Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Harvey Harrison | 3c9a320 | 2008-02-29 11:59:26 +0100 | [diff] [blame] | 33 | #include "hda_patch.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 63 | #ifdef CONFIG_SND_DEBUG |
| 64 | ALC880_TEST, |
| 65 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 66 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 67 | ALC880_MODEL_LAST /* last tag */ |
| 68 | }; |
| 69 | |
| 70 | /* ALC260 models */ |
| 71 | enum { |
| 72 | ALC260_BASIC, |
| 73 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 74 | ALC260_HP_3013, |
| 75 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 76 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 77 | ALC260_WILL, |
| 78 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 79 | #ifdef CONFIG_SND_DEBUG |
| 80 | ALC260_TEST, |
| 81 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 82 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 83 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | }; |
| 85 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | /* ALC262 models */ |
| 87 | enum { |
| 88 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 89 | ALC262_HIPPO, |
| 90 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 91 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 92 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 93 | ALC262_HP_BPC_D7000_WL, |
| 94 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 95 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 96 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 97 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 98 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 99 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 100 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame^] | 101 | ALC262_LENOVO_3000, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 102 | ALC262_AUTO, |
| 103 | ALC262_MODEL_LAST /* last tag */ |
| 104 | }; |
| 105 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 106 | /* ALC268 models */ |
| 107 | enum { |
| 108 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 109 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 110 | ALC268_ACER, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 111 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 112 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 113 | #ifdef CONFIG_SND_DEBUG |
| 114 | ALC268_TEST, |
| 115 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_AUTO, |
| 117 | ALC268_MODEL_LAST /* last tag */ |
| 118 | }; |
| 119 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 120 | /* ALC269 models */ |
| 121 | enum { |
| 122 | ALC269_BASIC, |
| 123 | ALC269_AUTO, |
| 124 | ALC269_MODEL_LAST /* last tag */ |
| 125 | }; |
| 126 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 127 | /* ALC861 models */ |
| 128 | enum { |
| 129 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 130 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 131 | ALC861_3ST_DIG, |
| 132 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 133 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 134 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 135 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 136 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 137 | ALC861_AUTO, |
| 138 | ALC861_MODEL_LAST, |
| 139 | }; |
| 140 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 141 | /* ALC861-VD models */ |
| 142 | enum { |
| 143 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 144 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 145 | ALC861VD_3ST, |
| 146 | ALC861VD_3ST_DIG, |
| 147 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 148 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 149 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 150 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 151 | ALC861VD_AUTO, |
| 152 | ALC861VD_MODEL_LAST, |
| 153 | }; |
| 154 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 155 | /* ALC662 models */ |
| 156 | enum { |
| 157 | ALC662_3ST_2ch_DIG, |
| 158 | ALC662_3ST_6ch_DIG, |
| 159 | ALC662_3ST_6ch, |
| 160 | ALC662_5ST_DIG, |
| 161 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 162 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 163 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 164 | ALC662_AUTO, |
| 165 | ALC662_MODEL_LAST, |
| 166 | }; |
| 167 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 168 | /* ALC882 models */ |
| 169 | enum { |
| 170 | ALC882_3ST_DIG, |
| 171 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 172 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 173 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 174 | ALC882_TARGA, |
| 175 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 176 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 177 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 178 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 179 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 180 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 181 | ALC882_MODEL_LAST, |
| 182 | }; |
| 183 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 184 | /* ALC883 models */ |
| 185 | enum { |
| 186 | ALC883_3ST_2ch_DIG, |
| 187 | ALC883_3ST_6ch_DIG, |
| 188 | ALC883_3ST_6ch, |
| 189 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 190 | ALC883_TARGA_DIG, |
| 191 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 192 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 193 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 194 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 195 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 196 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 197 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 198 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 199 | ALC888_LENOVO_MS7195_DIG, |
| 200 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 201 | ALC888_6ST_HP, |
| 202 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 203 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 204 | ALC883_MITAC, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 205 | ALC883_CLEVO_M720R, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 206 | ALC883_FUJITSU_PI2515, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 207 | ALC883_AUTO, |
| 208 | ALC883_MODEL_LAST, |
| 209 | }; |
| 210 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 211 | /* for GPIO Poll */ |
| 212 | #define GPIO_MASK 0x03 |
| 213 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | struct alc_spec { |
| 215 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 216 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | unsigned int num_mixers; |
| 218 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 219 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 220 | * don't forget NULL |
| 221 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 222 | */ |
| 223 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 225 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | struct hda_pcm_stream *stream_analog_playback; |
| 227 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 228 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 229 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 231 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | struct hda_pcm_stream *stream_digital_playback; |
| 233 | struct hda_pcm_stream *stream_digital_capture; |
| 234 | |
| 235 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 236 | struct hda_multi_out multiout; /* playback set-up |
| 237 | * max_channels, dacs must be set |
| 238 | * dig_out_nid and hp_nid are optional |
| 239 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 240 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | |
| 242 | /* capture */ |
| 243 | unsigned int num_adc_nids; |
| 244 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 245 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 246 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | |
| 248 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 249 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | const struct hda_input_mux *input_mux; |
| 251 | unsigned int cur_mux[3]; |
| 252 | |
| 253 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 254 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 256 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | |
| 258 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 259 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 260 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 261 | /* dynamic controls, init_verbs and input_mux */ |
| 262 | struct auto_pin_cfg autocfg; |
| 263 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 264 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 265 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 266 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 267 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 268 | /* hooks */ |
| 269 | void (*init_hook)(struct hda_codec *codec); |
| 270 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 271 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 272 | /* for pin sensing */ |
| 273 | unsigned int sense_updated: 1; |
| 274 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 275 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 276 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 277 | /* for virtual master */ |
| 278 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 279 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 280 | struct hda_loopback_check loopback; |
| 281 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 282 | }; |
| 283 | |
| 284 | /* |
| 285 | * configuration template - to be copied to the spec instance |
| 286 | */ |
| 287 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 288 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 289 | * with spec |
| 290 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 291 | const struct hda_verb *init_verbs[5]; |
| 292 | unsigned int num_dacs; |
| 293 | hda_nid_t *dac_nids; |
| 294 | hda_nid_t dig_out_nid; /* optional */ |
| 295 | hda_nid_t hp_nid; /* optional */ |
| 296 | unsigned int num_adc_nids; |
| 297 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 298 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 299 | hda_nid_t dig_in_nid; |
| 300 | unsigned int num_channel_mode; |
| 301 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 302 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 303 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 304 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 305 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 306 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 307 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 308 | struct hda_amp_list *loopbacks; |
| 309 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | }; |
| 311 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | |
| 313 | /* |
| 314 | * input MUX handling |
| 315 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 316 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 317 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | { |
| 319 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 320 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 321 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 322 | if (mux_idx >= spec->num_mux_defs) |
| 323 | mux_idx = 0; |
| 324 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | } |
| 326 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 327 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 328 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | { |
| 330 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 331 | struct alc_spec *spec = codec->spec; |
| 332 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 333 | |
| 334 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 335 | return 0; |
| 336 | } |
| 337 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 338 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 339 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | { |
| 341 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 342 | struct alc_spec *spec = codec->spec; |
| 343 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 344 | 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] | 345 | hda_nid_t nid = spec->capsrc_nids ? |
| 346 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 347 | 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] | 348 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | } |
| 350 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 351 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | /* |
| 353 | * channel mode setting |
| 354 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 355 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 356 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | { |
| 358 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 359 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 360 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 361 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | } |
| 363 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 364 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 365 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | { |
| 367 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 368 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 369 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 370 | spec->num_channel_mode, |
| 371 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | } |
| 373 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 374 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 375 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | { |
| 377 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 378 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 379 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 380 | spec->num_channel_mode, |
| 381 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 382 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 383 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 384 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | } |
| 386 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 388 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 389 | * instead of "%" to avoid consequences of accidently treating the % as |
| 390 | * being part of a format specifier. Maximum allowed length of a value is |
| 391 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 392 | * |
| 393 | * Note: some retasking pin complexes seem to ignore requests for input |
| 394 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 395 | * are requested. Therefore order this list so that this behaviour will not |
| 396 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 397 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 398 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 399 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 400 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 401 | "Mic 50pc bias", "Mic 80pc bias", |
| 402 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 403 | }; |
| 404 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 405 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 406 | }; |
| 407 | /* 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] | 408 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 409 | * addition, "input" pins may or may not process the mic bias option |
| 410 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 411 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 412 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 413 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 414 | #define ALC_PIN_DIR_IN 0x00 |
| 415 | #define ALC_PIN_DIR_OUT 0x01 |
| 416 | #define ALC_PIN_DIR_INOUT 0x02 |
| 417 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 418 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 419 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 420 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 421 | * For each direction the minimum and maximum values are given. |
| 422 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 423 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 424 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 425 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 426 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 427 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 428 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 429 | }; |
| 430 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 431 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 432 | #define alc_pin_mode_n_items(_dir) \ |
| 433 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 434 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 435 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 436 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 437 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 438 | unsigned int item_num = uinfo->value.enumerated.item; |
| 439 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 440 | |
| 441 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 442 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 443 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 444 | |
| 445 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 446 | item_num = alc_pin_mode_min(dir); |
| 447 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 448 | return 0; |
| 449 | } |
| 450 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 451 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 452 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 453 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 454 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 455 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 456 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 457 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 458 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 459 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 460 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 461 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 462 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 463 | /* Find enumerated value for current pinctl setting */ |
| 464 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 465 | 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] | 466 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 467 | *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] | 468 | return 0; |
| 469 | } |
| 470 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 471 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 472 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 473 | { |
| 474 | signed int change; |
| 475 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 476 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 477 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 478 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 479 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 480 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 481 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 482 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 483 | 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] | 484 | val = alc_pin_mode_min(dir); |
| 485 | |
| 486 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 487 | if (change) { |
| 488 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 489 | snd_hda_codec_write_cache(codec, nid, 0, |
| 490 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 491 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 492 | |
| 493 | /* Also enable the retasking pin's input/output as required |
| 494 | * for the requested pin mode. Enum values of 2 or less are |
| 495 | * input modes. |
| 496 | * |
| 497 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 498 | * reduces noise slightly (particularly on input) so we'll |
| 499 | * do it. However, having both input and output buffers |
| 500 | * enabled simultaneously doesn't seem to be problematic if |
| 501 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 502 | */ |
| 503 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 504 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 505 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 506 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 507 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 508 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 509 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 510 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 511 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 512 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 513 | } |
| 514 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 515 | return change; |
| 516 | } |
| 517 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 518 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 519 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 520 | .info = alc_pin_mode_info, \ |
| 521 | .get = alc_pin_mode_get, \ |
| 522 | .put = alc_pin_mode_put, \ |
| 523 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 524 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 525 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 526 | * together using a mask with more than one bit set. This control is |
| 527 | * currently used only by the ALC260 test model. At this stage they are not |
| 528 | * needed for any "production" models. |
| 529 | */ |
| 530 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 531 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 532 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 533 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 534 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 535 | { |
| 536 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 537 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 538 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 539 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 540 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 541 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 542 | |
| 543 | *valp = (val & mask) != 0; |
| 544 | return 0; |
| 545 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 546 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 547 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 548 | { |
| 549 | signed int change; |
| 550 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 551 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 552 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 553 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 554 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 555 | AC_VERB_GET_GPIO_DATA, |
| 556 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 557 | |
| 558 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 559 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 560 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 561 | gpio_data &= ~mask; |
| 562 | else |
| 563 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 564 | snd_hda_codec_write_cache(codec, nid, 0, |
| 565 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 566 | |
| 567 | return change; |
| 568 | } |
| 569 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 570 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 571 | .info = alc_gpio_data_info, \ |
| 572 | .get = alc_gpio_data_get, \ |
| 573 | .put = alc_gpio_data_put, \ |
| 574 | .private_value = nid | (mask<<16) } |
| 575 | #endif /* CONFIG_SND_DEBUG */ |
| 576 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 577 | /* A switch control to allow the enabling of the digital IO pins on the |
| 578 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 579 | * to provide something in the test model allowing digital outputs to be |
| 580 | * identified if present. If models are found which can utilise these |
| 581 | * outputs a more complete mixer control can be devised for those models if |
| 582 | * necessary. |
| 583 | */ |
| 584 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 585 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 586 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 587 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 588 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 589 | { |
| 590 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 591 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 592 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 593 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 594 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 595 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 596 | |
| 597 | *valp = (val & mask) != 0; |
| 598 | return 0; |
| 599 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 600 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 601 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 602 | { |
| 603 | signed int change; |
| 604 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 605 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 606 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 607 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 608 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 609 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 610 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 611 | |
| 612 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 613 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 614 | if (val==0) |
| 615 | ctrl_data &= ~mask; |
| 616 | else |
| 617 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 618 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 619 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 620 | |
| 621 | return change; |
| 622 | } |
| 623 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 624 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 625 | .info = alc_spdif_ctrl_info, \ |
| 626 | .get = alc_spdif_ctrl_get, \ |
| 627 | .put = alc_spdif_ctrl_put, \ |
| 628 | .private_value = nid | (mask<<16) } |
| 629 | #endif /* CONFIG_SND_DEBUG */ |
| 630 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 631 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 632 | * Again, this is only used in the ALC26x test models to help identify when |
| 633 | * the EAPD line must be asserted for features to work. |
| 634 | */ |
| 635 | #ifdef CONFIG_SND_DEBUG |
| 636 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 637 | |
| 638 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 639 | struct snd_ctl_elem_value *ucontrol) |
| 640 | { |
| 641 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 642 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 643 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 644 | long *valp = ucontrol->value.integer.value; |
| 645 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 646 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 647 | |
| 648 | *valp = (val & mask) != 0; |
| 649 | return 0; |
| 650 | } |
| 651 | |
| 652 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 653 | struct snd_ctl_elem_value *ucontrol) |
| 654 | { |
| 655 | int change; |
| 656 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 657 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 658 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 659 | long val = *ucontrol->value.integer.value; |
| 660 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 661 | AC_VERB_GET_EAPD_BTLENABLE, |
| 662 | 0x00); |
| 663 | |
| 664 | /* Set/unset the masked control bit(s) as needed */ |
| 665 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 666 | if (!val) |
| 667 | ctrl_data &= ~mask; |
| 668 | else |
| 669 | ctrl_data |= mask; |
| 670 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 671 | ctrl_data); |
| 672 | |
| 673 | return change; |
| 674 | } |
| 675 | |
| 676 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 677 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 678 | .info = alc_eapd_ctrl_info, \ |
| 679 | .get = alc_eapd_ctrl_get, \ |
| 680 | .put = alc_eapd_ctrl_put, \ |
| 681 | .private_value = nid | (mask<<16) } |
| 682 | #endif /* CONFIG_SND_DEBUG */ |
| 683 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 684 | /* |
| 685 | * set up from the preset table |
| 686 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 687 | static void setup_preset(struct alc_spec *spec, |
| 688 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 689 | { |
| 690 | int i; |
| 691 | |
| 692 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 693 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 694 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 695 | i++) |
| 696 | spec->init_verbs[spec->num_init_verbs++] = |
| 697 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 698 | |
| 699 | spec->channel_mode = preset->channel_mode; |
| 700 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 701 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 702 | |
| 703 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 704 | |
| 705 | spec->multiout.num_dacs = preset->num_dacs; |
| 706 | spec->multiout.dac_nids = preset->dac_nids; |
| 707 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 708 | spec->multiout.hp_nid = preset->hp_nid; |
| 709 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 710 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 711 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 712 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 713 | spec->input_mux = preset->input_mux; |
| 714 | |
| 715 | spec->num_adc_nids = preset->num_adc_nids; |
| 716 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 717 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 718 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 719 | |
| 720 | spec->unsol_event = preset->unsol_event; |
| 721 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 722 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 723 | spec->loopback.amplist = preset->loopbacks; |
| 724 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 725 | } |
| 726 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 727 | /* Enable GPIO mask and set output */ |
| 728 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 729 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 730 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 731 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 732 | { } |
| 733 | }; |
| 734 | |
| 735 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 736 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 737 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 738 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 739 | { } |
| 740 | }; |
| 741 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 742 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 743 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 744 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 745 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 746 | { } |
| 747 | }; |
| 748 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 749 | static void alc_sku_automute(struct hda_codec *codec) |
| 750 | { |
| 751 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 752 | unsigned int present; |
| 753 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 754 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 755 | |
| 756 | /* need to execute and sync at first */ |
| 757 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 758 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 759 | AC_VERB_GET_PIN_SENSE, 0); |
| 760 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 761 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 762 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 763 | } |
| 764 | |
| 765 | /* unsolicited event for HP jack sensing */ |
| 766 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 767 | { |
| 768 | if (codec->vendor_id == 0x10ec0880) |
| 769 | res >>= 28; |
| 770 | else |
| 771 | res >>= 26; |
| 772 | if (res != ALC880_HP_EVENT) |
| 773 | return; |
| 774 | |
| 775 | alc_sku_automute(codec); |
| 776 | } |
| 777 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 778 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 779 | * 31 ~ 16 : Manufacture ID |
| 780 | * 15 ~ 8 : SKU ID |
| 781 | * 7 ~ 0 : Assembly ID |
| 782 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 783 | */ |
| 784 | static void alc_subsystem_id(struct hda_codec *codec, |
| 785 | unsigned int porta, unsigned int porte, |
| 786 | unsigned int portd) |
| 787 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 788 | unsigned int ass, tmp, i; |
| 789 | unsigned nid; |
| 790 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 791 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 792 | ass = codec->subsystem_id & 0xffff; |
| 793 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 794 | goto do_sku; |
| 795 | |
| 796 | /* |
| 797 | * 31~30 : port conetcivity |
| 798 | * 29~21 : reserve |
| 799 | * 20 : PCBEEP input |
| 800 | * 19~16 : Check sum (15:1) |
| 801 | * 15~1 : Custom |
| 802 | * 0 : override |
| 803 | */ |
| 804 | nid = 0x1d; |
| 805 | if (codec->vendor_id == 0x10ec0260) |
| 806 | nid = 0x17; |
| 807 | ass = snd_hda_codec_read(codec, nid, 0, |
| 808 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 809 | if (!(ass & 1) && !(ass & 0x100000)) |
| 810 | return; |
| 811 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 812 | return; |
| 813 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 814 | /* check sum */ |
| 815 | tmp = 0; |
| 816 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 817 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 818 | tmp++; |
| 819 | } |
| 820 | if (((ass >> 16) & 0xf) != tmp) |
| 821 | return; |
| 822 | do_sku: |
| 823 | /* |
| 824 | * 0 : override |
| 825 | * 1 : Swap Jack |
| 826 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 827 | * 3~5 : External Amplifier control |
| 828 | * 7~6 : Reserved |
| 829 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 830 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 831 | switch (tmp) { |
| 832 | case 1: |
| 833 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 834 | break; |
| 835 | case 3: |
| 836 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 837 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 838 | case 7: |
| 839 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 840 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 841 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 842 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 843 | case 0x10ec0260: |
| 844 | snd_hda_codec_write(codec, 0x0f, 0, |
| 845 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 846 | snd_hda_codec_write(codec, 0x10, 0, |
| 847 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 848 | break; |
| 849 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 850 | case 0x10ec0267: |
| 851 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 852 | case 0x10ec0269: |
| 853 | case 0x10ec0862: |
| 854 | case 0x10ec0662: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 855 | snd_hda_codec_write(codec, 0x14, 0, |
| 856 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 857 | snd_hda_codec_write(codec, 0x15, 0, |
| 858 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 859 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 860 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 861 | switch (codec->vendor_id) { |
| 862 | case 0x10ec0260: |
| 863 | snd_hda_codec_write(codec, 0x1a, 0, |
| 864 | AC_VERB_SET_COEF_INDEX, 7); |
| 865 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 866 | AC_VERB_GET_PROC_COEF, 0); |
| 867 | snd_hda_codec_write(codec, 0x1a, 0, |
| 868 | AC_VERB_SET_COEF_INDEX, 7); |
| 869 | snd_hda_codec_write(codec, 0x1a, 0, |
| 870 | AC_VERB_SET_PROC_COEF, |
| 871 | tmp | 0x2010); |
| 872 | break; |
| 873 | case 0x10ec0262: |
| 874 | case 0x10ec0880: |
| 875 | case 0x10ec0882: |
| 876 | case 0x10ec0883: |
| 877 | case 0x10ec0885: |
| 878 | case 0x10ec0888: |
| 879 | snd_hda_codec_write(codec, 0x20, 0, |
| 880 | AC_VERB_SET_COEF_INDEX, 7); |
| 881 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 882 | AC_VERB_GET_PROC_COEF, 0); |
| 883 | snd_hda_codec_write(codec, 0x20, 0, |
| 884 | AC_VERB_SET_COEF_INDEX, 7); |
| 885 | snd_hda_codec_write(codec, 0x20, 0, |
| 886 | AC_VERB_SET_PROC_COEF, |
| 887 | tmp | 0x2010); |
| 888 | break; |
| 889 | case 0x10ec0267: |
| 890 | case 0x10ec0268: |
| 891 | snd_hda_codec_write(codec, 0x20, 0, |
| 892 | AC_VERB_SET_COEF_INDEX, 7); |
| 893 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 894 | AC_VERB_GET_PROC_COEF, 0); |
| 895 | snd_hda_codec_write(codec, 0x20, 0, |
| 896 | AC_VERB_SET_COEF_INDEX, 7); |
| 897 | snd_hda_codec_write(codec, 0x20, 0, |
| 898 | AC_VERB_SET_PROC_COEF, |
| 899 | tmp | 0x3000); |
| 900 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 901 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 902 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 903 | break; |
| 904 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 905 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 906 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 907 | * when the external headphone out jack is plugged" |
| 908 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 909 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 910 | return; |
| 911 | /* |
| 912 | * 10~8 : Jack location |
| 913 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 914 | * 14~13: Resvered |
| 915 | * 15 : 1 --> enable the function "Mute internal speaker |
| 916 | * when the external headphone out jack is plugged" |
| 917 | */ |
| 918 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 919 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 920 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 921 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 922 | else |
| 923 | return; |
| 924 | } |
| 925 | |
| 926 | if (!spec->autocfg.hp_pins[0]) { |
| 927 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 928 | if (tmp == 0) |
| 929 | spec->autocfg.hp_pins[0] = porta; |
| 930 | else if (tmp == 1) |
| 931 | spec->autocfg.hp_pins[0] = porte; |
| 932 | else if (tmp == 2) |
| 933 | spec->autocfg.hp_pins[0] = portd; |
| 934 | else |
| 935 | return; |
| 936 | } |
| 937 | |
| 938 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 939 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 940 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 941 | spec->unsol_event = alc_sku_unsol_event; |
| 942 | spec->init_hook = alc_sku_automute; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 943 | } |
| 944 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 945 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 946 | * Fix-up pin default configurations |
| 947 | */ |
| 948 | |
| 949 | struct alc_pincfg { |
| 950 | hda_nid_t nid; |
| 951 | u32 val; |
| 952 | }; |
| 953 | |
| 954 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 955 | const struct snd_pci_quirk *quirk, |
| 956 | const struct alc_pincfg **pinfix) |
| 957 | { |
| 958 | const struct alc_pincfg *cfg; |
| 959 | |
| 960 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 961 | if (!quirk) |
| 962 | return; |
| 963 | |
| 964 | cfg = pinfix[quirk->value]; |
| 965 | for (; cfg->nid; cfg++) { |
| 966 | int i; |
| 967 | u32 val = cfg->val; |
| 968 | for (i = 0; i < 4; i++) { |
| 969 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 970 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 971 | val & 0xff); |
| 972 | val >>= 8; |
| 973 | } |
| 974 | } |
| 975 | } |
| 976 | |
| 977 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 978 | * ALC880 3-stack model |
| 979 | * |
| 980 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 981 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 982 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 983 | */ |
| 984 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 985 | static hda_nid_t alc880_dac_nids[4] = { |
| 986 | /* front, rear, clfe, rear_surr */ |
| 987 | 0x02, 0x05, 0x04, 0x03 |
| 988 | }; |
| 989 | |
| 990 | static hda_nid_t alc880_adc_nids[3] = { |
| 991 | /* ADC0-2 */ |
| 992 | 0x07, 0x08, 0x09, |
| 993 | }; |
| 994 | |
| 995 | /* The datasheet says the node 0x07 is connected from inputs, |
| 996 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 997 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 998 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 999 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1000 | /* ADC1-2 */ |
| 1001 | 0x08, 0x09, |
| 1002 | }; |
| 1003 | |
| 1004 | #define ALC880_DIGOUT_NID 0x06 |
| 1005 | #define ALC880_DIGIN_NID 0x0a |
| 1006 | |
| 1007 | static struct hda_input_mux alc880_capture_source = { |
| 1008 | .num_items = 4, |
| 1009 | .items = { |
| 1010 | { "Mic", 0x0 }, |
| 1011 | { "Front Mic", 0x3 }, |
| 1012 | { "Line", 0x2 }, |
| 1013 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1014 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1015 | }; |
| 1016 | |
| 1017 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1018 | /* 2ch mode */ |
| 1019 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1020 | /* set line-in to input, mute it */ |
| 1021 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1022 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1023 | /* set mic-in to input vref 80%, mute it */ |
| 1024 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1025 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1026 | { } /* end */ |
| 1027 | }; |
| 1028 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1029 | /* 6ch mode */ |
| 1030 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1031 | /* set line-in to output, unmute it */ |
| 1032 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1033 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1034 | /* set mic-in to output, unmute it */ |
| 1035 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1036 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1037 | { } /* end */ |
| 1038 | }; |
| 1039 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1040 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1041 | { 2, alc880_threestack_ch2_init }, |
| 1042 | { 6, alc880_threestack_ch6_init }, |
| 1043 | }; |
| 1044 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1045 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1046 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1047 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1048 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1049 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1050 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1051 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1052 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1053 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1054 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1055 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1056 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1057 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1058 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1059 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1060 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1061 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1062 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1063 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1064 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1065 | { |
| 1066 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1067 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1068 | .info = alc_ch_mode_info, |
| 1069 | .get = alc_ch_mode_get, |
| 1070 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1071 | }, |
| 1072 | { } /* end */ |
| 1073 | }; |
| 1074 | |
| 1075 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1076 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1077 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1078 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1079 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1080 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1081 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1082 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1083 | { |
| 1084 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1085 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1086 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1087 | */ |
| 1088 | /* .name = "Capture Source", */ |
| 1089 | .name = "Input Source", |
| 1090 | .count = 3, |
| 1091 | .info = alc_mux_enum_info, |
| 1092 | .get = alc_mux_enum_get, |
| 1093 | .put = alc_mux_enum_put, |
| 1094 | }, |
| 1095 | { } /* end */ |
| 1096 | }; |
| 1097 | |
| 1098 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1099 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1100 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1101 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1102 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1103 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1104 | { |
| 1105 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1106 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1107 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1108 | */ |
| 1109 | /* .name = "Capture Source", */ |
| 1110 | .name = "Input Source", |
| 1111 | .count = 2, |
| 1112 | .info = alc_mux_enum_info, |
| 1113 | .get = alc_mux_enum_get, |
| 1114 | .put = alc_mux_enum_put, |
| 1115 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1116 | { } /* end */ |
| 1117 | }; |
| 1118 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1119 | |
| 1120 | |
| 1121 | /* |
| 1122 | * ALC880 5-stack model |
| 1123 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1124 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1125 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1126 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1127 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1128 | */ |
| 1129 | |
| 1130 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1131 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1132 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1133 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1134 | { } /* end */ |
| 1135 | }; |
| 1136 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1137 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1138 | /* 6ch mode */ |
| 1139 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1140 | /* set line-in to input, mute it */ |
| 1141 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1142 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1143 | { } /* end */ |
| 1144 | }; |
| 1145 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1146 | /* 8ch mode */ |
| 1147 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1148 | /* set line-in to output, unmute it */ |
| 1149 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1150 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1151 | { } /* end */ |
| 1152 | }; |
| 1153 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1154 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1155 | { 6, alc880_fivestack_ch6_init }, |
| 1156 | { 8, alc880_fivestack_ch8_init }, |
| 1157 | }; |
| 1158 | |
| 1159 | |
| 1160 | /* |
| 1161 | * ALC880 6-stack model |
| 1162 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1163 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1164 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1165 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1166 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1167 | */ |
| 1168 | |
| 1169 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1170 | /* front, rear, clfe, rear_surr */ |
| 1171 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1172 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1173 | |
| 1174 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1175 | .num_items = 4, |
| 1176 | .items = { |
| 1177 | { "Mic", 0x0 }, |
| 1178 | { "Front Mic", 0x1 }, |
| 1179 | { "Line", 0x2 }, |
| 1180 | { "CD", 0x4 }, |
| 1181 | }, |
| 1182 | }; |
| 1183 | |
| 1184 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1185 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1186 | { 8, NULL }, |
| 1187 | }; |
| 1188 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1189 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1190 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1191 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1192 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1193 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1194 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1195 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1196 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1197 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1198 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1199 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1200 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1201 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1202 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1203 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1204 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1205 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1206 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1207 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1208 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1209 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1210 | { |
| 1211 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1212 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1213 | .info = alc_ch_mode_info, |
| 1214 | .get = alc_ch_mode_get, |
| 1215 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1216 | }, |
| 1217 | { } /* end */ |
| 1218 | }; |
| 1219 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1220 | |
| 1221 | /* |
| 1222 | * ALC880 W810 model |
| 1223 | * |
| 1224 | * W810 has rear IO for: |
| 1225 | * Front (DAC 02) |
| 1226 | * Surround (DAC 03) |
| 1227 | * Center/LFE (DAC 04) |
| 1228 | * Digital out (06) |
| 1229 | * |
| 1230 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1231 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1232 | * |
| 1233 | * There is a variable resistor to control the speaker or headphone |
| 1234 | * volume. This is a hardware-only device without a software API. |
| 1235 | * |
| 1236 | * Plugging headphones in will disable the internal speakers. This is |
| 1237 | * implemented in hardware, not via the driver using jack sense. In |
| 1238 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1239 | * disable both the speakers and headphones. |
| 1240 | * |
| 1241 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1242 | * These may not do anything useful with this driver yet, because I |
| 1243 | * haven't setup any initialization verbs for these yet... |
| 1244 | */ |
| 1245 | |
| 1246 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1247 | /* front, rear/surround, clfe */ |
| 1248 | 0x02, 0x03, 0x04 |
| 1249 | }; |
| 1250 | |
| 1251 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1252 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1253 | { 6, NULL } |
| 1254 | }; |
| 1255 | |
| 1256 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1257 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1258 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1259 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1260 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1261 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1262 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1263 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1264 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1265 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1266 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1267 | { } /* end */ |
| 1268 | }; |
| 1269 | |
| 1270 | |
| 1271 | /* |
| 1272 | * Z710V model |
| 1273 | * |
| 1274 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1275 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1276 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1277 | */ |
| 1278 | |
| 1279 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1280 | 0x02 |
| 1281 | }; |
| 1282 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1283 | |
| 1284 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1285 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1286 | { 2, NULL } |
| 1287 | }; |
| 1288 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1289 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1290 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1291 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1292 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1293 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1294 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1295 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1296 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1297 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1298 | { } /* end */ |
| 1299 | }; |
| 1300 | |
| 1301 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1302 | /* |
| 1303 | * ALC880 F1734 model |
| 1304 | * |
| 1305 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1306 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1307 | */ |
| 1308 | |
| 1309 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1310 | 0x03 |
| 1311 | }; |
| 1312 | #define ALC880_F1734_HP_DAC 0x02 |
| 1313 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1314 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1315 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1316 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1317 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1318 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1319 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1320 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1321 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1322 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1323 | { } /* end */ |
| 1324 | }; |
| 1325 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1326 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1327 | .num_items = 2, |
| 1328 | .items = { |
| 1329 | { "Mic", 0x1 }, |
| 1330 | { "CD", 0x4 }, |
| 1331 | }, |
| 1332 | }; |
| 1333 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1334 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1335 | /* |
| 1336 | * ALC880 ASUS model |
| 1337 | * |
| 1338 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1339 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1340 | * Mic = 0x18, Line = 0x1a |
| 1341 | */ |
| 1342 | |
| 1343 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1344 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1345 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1346 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1347 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1348 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1349 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1350 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1351 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1352 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1353 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1354 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1355 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1356 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1357 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1358 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1359 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1360 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1361 | { |
| 1362 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1363 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1364 | .info = alc_ch_mode_info, |
| 1365 | .get = alc_ch_mode_get, |
| 1366 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1367 | }, |
| 1368 | { } /* end */ |
| 1369 | }; |
| 1370 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1371 | /* |
| 1372 | * ALC880 ASUS W1V model |
| 1373 | * |
| 1374 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1375 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1376 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1377 | */ |
| 1378 | |
| 1379 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1380 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1381 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1382 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1383 | { } /* end */ |
| 1384 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1385 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1386 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1387 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1388 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1389 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1390 | { } /* end */ |
| 1391 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1392 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1393 | /* TCL S700 */ |
| 1394 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1395 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1396 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1397 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1398 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1399 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1400 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1401 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1402 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1403 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1404 | { |
| 1405 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1406 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1407 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1408 | */ |
| 1409 | /* .name = "Capture Source", */ |
| 1410 | .name = "Input Source", |
| 1411 | .count = 1, |
| 1412 | .info = alc_mux_enum_info, |
| 1413 | .get = alc_mux_enum_get, |
| 1414 | .put = alc_mux_enum_put, |
| 1415 | }, |
| 1416 | { } /* end */ |
| 1417 | }; |
| 1418 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1419 | /* Uniwill */ |
| 1420 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1421 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1422 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1423 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1424 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1425 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1426 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1427 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1428 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1429 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1430 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1431 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1432 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1433 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1434 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1435 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1436 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1437 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1438 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1439 | { |
| 1440 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1441 | .name = "Channel Mode", |
| 1442 | .info = alc_ch_mode_info, |
| 1443 | .get = alc_ch_mode_get, |
| 1444 | .put = alc_ch_mode_put, |
| 1445 | }, |
| 1446 | { } /* end */ |
| 1447 | }; |
| 1448 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1449 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1450 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1451 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1452 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1453 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1454 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1455 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1456 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1457 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1458 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1459 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1460 | { } /* end */ |
| 1461 | }; |
| 1462 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1463 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1464 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1465 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1466 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1467 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1468 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1470 | { } /* end */ |
| 1471 | }; |
| 1472 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1473 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1474 | * virtual master controls |
| 1475 | */ |
| 1476 | |
| 1477 | /* |
| 1478 | * slave controls for virtual master |
| 1479 | */ |
| 1480 | static const char *alc_slave_vols[] = { |
| 1481 | "Front Playback Volume", |
| 1482 | "Surround Playback Volume", |
| 1483 | "Center Playback Volume", |
| 1484 | "LFE Playback Volume", |
| 1485 | "Side Playback Volume", |
| 1486 | "Headphone Playback Volume", |
| 1487 | "Speaker Playback Volume", |
| 1488 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1489 | "Line-Out Playback Volume", |
| 1490 | NULL, |
| 1491 | }; |
| 1492 | |
| 1493 | static const char *alc_slave_sws[] = { |
| 1494 | "Front Playback Switch", |
| 1495 | "Surround Playback Switch", |
| 1496 | "Center Playback Switch", |
| 1497 | "LFE Playback Switch", |
| 1498 | "Side Playback Switch", |
| 1499 | "Headphone Playback Switch", |
| 1500 | "Speaker Playback Switch", |
| 1501 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1502 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1503 | NULL, |
| 1504 | }; |
| 1505 | |
| 1506 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1507 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1508 | */ |
| 1509 | static int alc_build_controls(struct hda_codec *codec) |
| 1510 | { |
| 1511 | struct alc_spec *spec = codec->spec; |
| 1512 | int err; |
| 1513 | int i; |
| 1514 | |
| 1515 | for (i = 0; i < spec->num_mixers; i++) { |
| 1516 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1517 | if (err < 0) |
| 1518 | return err; |
| 1519 | } |
| 1520 | |
| 1521 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1522 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1523 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1524 | if (err < 0) |
| 1525 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1526 | err = snd_hda_create_spdif_share_sw(codec, |
| 1527 | &spec->multiout); |
| 1528 | if (err < 0) |
| 1529 | return err; |
| 1530 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1531 | } |
| 1532 | if (spec->dig_in_nid) { |
| 1533 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1534 | if (err < 0) |
| 1535 | return err; |
| 1536 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1537 | |
| 1538 | /* if we have no master control, let's create it */ |
| 1539 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1540 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1541 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1542 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1543 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1544 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1545 | if (err < 0) |
| 1546 | return err; |
| 1547 | } |
| 1548 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1549 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1550 | NULL, alc_slave_sws); |
| 1551 | if (err < 0) |
| 1552 | return err; |
| 1553 | } |
| 1554 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1555 | return 0; |
| 1556 | } |
| 1557 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1558 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1559 | /* |
| 1560 | * initialize the codec volumes, etc |
| 1561 | */ |
| 1562 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1563 | /* |
| 1564 | * generic initialization of ADC, input mixers and output mixers |
| 1565 | */ |
| 1566 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1567 | /* |
| 1568 | * Unmute ADC0-2 and set the default input to mic-in |
| 1569 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1570 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1571 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1572 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1573 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1574 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1575 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1576 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1577 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1578 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1579 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1580 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1581 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1582 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1583 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1584 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1585 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1586 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1587 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1588 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1589 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1590 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1591 | /* |
| 1592 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1593 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1594 | /* set vol=0 to output mixers */ |
| 1595 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1596 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1597 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1598 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1599 | /* set up input amps for analog loopback */ |
| 1600 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1601 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1602 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1603 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1604 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1605 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1606 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1607 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1608 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1609 | |
| 1610 | { } |
| 1611 | }; |
| 1612 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1613 | /* |
| 1614 | * 3-stack pin configuration: |
| 1615 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1616 | */ |
| 1617 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1618 | /* |
| 1619 | * preset connection lists of input pins |
| 1620 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1621 | */ |
| 1622 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1623 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1624 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1625 | |
| 1626 | /* |
| 1627 | * Set pin mode and muting |
| 1628 | */ |
| 1629 | /* set front pin widgets 0x14 for output */ |
| 1630 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1631 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1632 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1633 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1634 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1635 | /* Mic2 (as headphone out) for HP output */ |
| 1636 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1637 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1638 | /* Line In pin widget for input */ |
| 1639 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1640 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1641 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1642 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1643 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1644 | /* CD pin widget for input */ |
| 1645 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1646 | |
| 1647 | { } |
| 1648 | }; |
| 1649 | |
| 1650 | /* |
| 1651 | * 5-stack pin configuration: |
| 1652 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1653 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1654 | */ |
| 1655 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1656 | /* |
| 1657 | * preset connection lists of input pins |
| 1658 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1659 | */ |
| 1660 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1661 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1662 | |
| 1663 | /* |
| 1664 | * Set pin mode and muting |
| 1665 | */ |
| 1666 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1667 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1668 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1669 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1670 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1671 | /* unmute pins for output (no gain on this amp) */ |
| 1672 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1673 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1674 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1675 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1676 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1677 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1678 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1679 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1680 | /* Mic2 (as headphone out) for HP output */ |
| 1681 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1682 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1683 | /* Line In pin widget for input */ |
| 1684 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1685 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1686 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1687 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1688 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1689 | /* CD pin widget for input */ |
| 1690 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1691 | |
| 1692 | { } |
| 1693 | }; |
| 1694 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1695 | /* |
| 1696 | * W810 pin configuration: |
| 1697 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1698 | */ |
| 1699 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1700 | /* hphone/speaker input selector: front DAC */ |
| 1701 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1702 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1703 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1704 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1705 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1706 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1707 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1708 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1709 | |
| 1710 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1711 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1712 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1713 | { } |
| 1714 | }; |
| 1715 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1716 | /* |
| 1717 | * Z71V pin configuration: |
| 1718 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1719 | */ |
| 1720 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1721 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1722 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1723 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1724 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1725 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1726 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1727 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1728 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1729 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1730 | |
| 1731 | { } |
| 1732 | }; |
| 1733 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1734 | /* |
| 1735 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1736 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1737 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1738 | */ |
| 1739 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1740 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1741 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1742 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1743 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1744 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1745 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1746 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1747 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1748 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1749 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1750 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1751 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1752 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1753 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1754 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1755 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1756 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1757 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1758 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1759 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1760 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1761 | { } |
| 1762 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1763 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1764 | /* |
| 1765 | * Uniwill pin configuration: |
| 1766 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1767 | * line = 0x1a |
| 1768 | */ |
| 1769 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1770 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1771 | |
| 1772 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1773 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1774 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1775 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1776 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1777 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1778 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1779 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1780 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1781 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1782 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1783 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1784 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1785 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1786 | |
| 1787 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1788 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1789 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1790 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1791 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1792 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1793 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1794 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1795 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1796 | |
| 1797 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1798 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1799 | |
| 1800 | { } |
| 1801 | }; |
| 1802 | |
| 1803 | /* |
| 1804 | * Uniwill P53 |
| 1805 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1806 | */ |
| 1807 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1808 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1809 | |
| 1810 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1811 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1812 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1813 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1814 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1815 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1816 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1818 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1819 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1820 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1821 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1822 | |
| 1823 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1824 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1825 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1826 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1827 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1828 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1829 | |
| 1830 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1831 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1832 | |
| 1833 | { } |
| 1834 | }; |
| 1835 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1836 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1837 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1838 | { } |
| 1839 | }; |
| 1840 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1841 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1842 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1843 | { |
| 1844 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1845 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1846 | |
| 1847 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1848 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1849 | bits = present ? HDA_AMP_MUTE : 0; |
| 1850 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1851 | HDA_AMP_MUTE, bits); |
| 1852 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1853 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1854 | } |
| 1855 | |
| 1856 | /* auto-toggle front mic */ |
| 1857 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1858 | { |
| 1859 | unsigned int present; |
| 1860 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1861 | |
| 1862 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1863 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1864 | bits = present ? HDA_AMP_MUTE : 0; |
| 1865 | 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] | 1866 | } |
| 1867 | |
| 1868 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1869 | { |
| 1870 | alc880_uniwill_hp_automute(codec); |
| 1871 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1872 | } |
| 1873 | |
| 1874 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1875 | unsigned int res) |
| 1876 | { |
| 1877 | /* Looks like the unsol event is incompatible with the standard |
| 1878 | * definition. 4bit tag is placed at 28 bit! |
| 1879 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1880 | switch (res >> 28) { |
| 1881 | case ALC880_HP_EVENT: |
| 1882 | alc880_uniwill_hp_automute(codec); |
| 1883 | break; |
| 1884 | case ALC880_MIC_EVENT: |
| 1885 | alc880_uniwill_mic_automute(codec); |
| 1886 | break; |
| 1887 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1888 | } |
| 1889 | |
| 1890 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1891 | { |
| 1892 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1893 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1894 | |
| 1895 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1896 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1897 | bits = present ? HDA_AMP_MUTE : 0; |
| 1898 | 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] | 1899 | } |
| 1900 | |
| 1901 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1902 | { |
| 1903 | unsigned int present; |
| 1904 | |
| 1905 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1906 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1907 | present &= HDA_AMP_VOLMASK; |
| 1908 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1909 | HDA_AMP_VOLMASK, present); |
| 1910 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1911 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1912 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1913 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1914 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1915 | unsigned int res) |
| 1916 | { |
| 1917 | /* Looks like the unsol event is incompatible with the standard |
| 1918 | * definition. 4bit tag is placed at 28 bit! |
| 1919 | */ |
| 1920 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1921 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1922 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1923 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1924 | } |
| 1925 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1926 | /* |
| 1927 | * F1734 pin configuration: |
| 1928 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1929 | */ |
| 1930 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1931 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1932 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1933 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1934 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1935 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1936 | |
| 1937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1938 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1939 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1940 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1941 | |
| 1942 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1943 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1944 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1945 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1946 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1947 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1948 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1949 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1950 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1951 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1952 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 1953 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 1954 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1955 | { } |
| 1956 | }; |
| 1957 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1958 | /* |
| 1959 | * ASUS pin configuration: |
| 1960 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1961 | */ |
| 1962 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1963 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1964 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1965 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1966 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1967 | |
| 1968 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1969 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1970 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1971 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1972 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1973 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1974 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1975 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1976 | |
| 1977 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1978 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1979 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1980 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1981 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1982 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1983 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1984 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1985 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1986 | |
| 1987 | { } |
| 1988 | }; |
| 1989 | |
| 1990 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1991 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1992 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1993 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1994 | /* Clevo m520g init */ |
| 1995 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1996 | /* headphone output */ |
| 1997 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1998 | /* line-out */ |
| 1999 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2000 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2001 | /* Line-in */ |
| 2002 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2003 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2004 | /* CD */ |
| 2005 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2006 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2007 | /* Mic1 (rear panel) */ |
| 2008 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2009 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2010 | /* Mic2 (front panel) */ |
| 2011 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2012 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2013 | /* headphone */ |
| 2014 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2015 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2016 | /* change to EAPD mode */ |
| 2017 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2018 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2019 | |
| 2020 | { } |
| 2021 | }; |
| 2022 | |
| 2023 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2024 | /* change to EAPD mode */ |
| 2025 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2026 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2027 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2028 | /* Headphone output */ |
| 2029 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2030 | /* Front output*/ |
| 2031 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2032 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2033 | |
| 2034 | /* Line In pin widget for input */ |
| 2035 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2036 | /* CD pin widget for input */ |
| 2037 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2038 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2039 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2040 | |
| 2041 | /* change to EAPD mode */ |
| 2042 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2043 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2044 | |
| 2045 | { } |
| 2046 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2047 | |
| 2048 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2049 | * LG m1 express dual |
| 2050 | * |
| 2051 | * Pin assignment: |
| 2052 | * Rear Line-In/Out (blue): 0x14 |
| 2053 | * Build-in Mic-In: 0x15 |
| 2054 | * Speaker-out: 0x17 |
| 2055 | * HP-Out (green): 0x1b |
| 2056 | * Mic-In/Out (red): 0x19 |
| 2057 | * SPDIF-Out: 0x1e |
| 2058 | */ |
| 2059 | |
| 2060 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2061 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2062 | 0x05, 0x02, 0x03 |
| 2063 | }; |
| 2064 | |
| 2065 | /* seems analog CD is not working */ |
| 2066 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2067 | .num_items = 3, |
| 2068 | .items = { |
| 2069 | { "Mic", 0x1 }, |
| 2070 | { "Line", 0x5 }, |
| 2071 | { "Internal Mic", 0x6 }, |
| 2072 | }, |
| 2073 | }; |
| 2074 | |
| 2075 | /* 2,4,6 channel modes */ |
| 2076 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2077 | /* set line-in and mic-in to input */ |
| 2078 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2079 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2080 | { } |
| 2081 | }; |
| 2082 | |
| 2083 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2084 | /* set line-in to out and mic-in to input */ |
| 2085 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2086 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2087 | { } |
| 2088 | }; |
| 2089 | |
| 2090 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2091 | /* set line-in and mic-in to output */ |
| 2092 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2093 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2094 | { } |
| 2095 | }; |
| 2096 | |
| 2097 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2098 | { 2, alc880_lg_ch2_init }, |
| 2099 | { 4, alc880_lg_ch4_init }, |
| 2100 | { 6, alc880_lg_ch6_init }, |
| 2101 | }; |
| 2102 | |
| 2103 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2104 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2105 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2106 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2107 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2108 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2109 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2110 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2111 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2112 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2113 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2114 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2115 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2116 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2117 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2118 | { |
| 2119 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2120 | .name = "Channel Mode", |
| 2121 | .info = alc_ch_mode_info, |
| 2122 | .get = alc_ch_mode_get, |
| 2123 | .put = alc_ch_mode_put, |
| 2124 | }, |
| 2125 | { } /* end */ |
| 2126 | }; |
| 2127 | |
| 2128 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2129 | /* set capture source to mic-in */ |
| 2130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2131 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2132 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2133 | /* mute all amp mixer inputs */ |
| 2134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2136 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2137 | /* line-in to input */ |
| 2138 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2139 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2140 | /* built-in mic */ |
| 2141 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2142 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2143 | /* speaker-out */ |
| 2144 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2145 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2146 | /* mic-in to input */ |
| 2147 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2148 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2149 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2150 | /* HP-out */ |
| 2151 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2152 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2153 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2154 | /* jack sense */ |
| 2155 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2156 | { } |
| 2157 | }; |
| 2158 | |
| 2159 | /* toggle speaker-output according to the hp-jack state */ |
| 2160 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2161 | { |
| 2162 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2163 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2164 | |
| 2165 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2166 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2167 | bits = present ? HDA_AMP_MUTE : 0; |
| 2168 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2169 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2170 | } |
| 2171 | |
| 2172 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2173 | { |
| 2174 | /* Looks like the unsol event is incompatible with the standard |
| 2175 | * definition. 4bit tag is placed at 28 bit! |
| 2176 | */ |
| 2177 | if ((res >> 28) == 0x01) |
| 2178 | alc880_lg_automute(codec); |
| 2179 | } |
| 2180 | |
| 2181 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2182 | * LG LW20 |
| 2183 | * |
| 2184 | * Pin assignment: |
| 2185 | * Speaker-out: 0x14 |
| 2186 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2187 | * Built-in Mic-In: 0x19 |
| 2188 | * Line-In: 0x1b |
| 2189 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2190 | * SPDIF-Out: 0x1e |
| 2191 | */ |
| 2192 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2193 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2194 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2195 | .items = { |
| 2196 | { "Mic", 0x0 }, |
| 2197 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2198 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2199 | }, |
| 2200 | }; |
| 2201 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2202 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2203 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2204 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2205 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2206 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2207 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2208 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2209 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2210 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2211 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2212 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2213 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2214 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2217 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2218 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2219 | { |
| 2220 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2221 | .name = "Channel Mode", |
| 2222 | .info = alc_ch_mode_info, |
| 2223 | .get = alc_ch_mode_get, |
| 2224 | .put = alc_ch_mode_put, |
| 2225 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2226 | { } /* end */ |
| 2227 | }; |
| 2228 | |
| 2229 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2230 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2231 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2232 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2233 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2234 | /* set capture source to mic-in */ |
| 2235 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2236 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2237 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2238 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2239 | /* speaker-out */ |
| 2240 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2241 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2242 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2243 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2244 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2245 | /* mic-in to input */ |
| 2246 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2247 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2248 | /* built-in mic */ |
| 2249 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2250 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2251 | /* jack sense */ |
| 2252 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2253 | { } |
| 2254 | }; |
| 2255 | |
| 2256 | /* toggle speaker-output according to the hp-jack state */ |
| 2257 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2258 | { |
| 2259 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2260 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2261 | |
| 2262 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2263 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2264 | bits = present ? HDA_AMP_MUTE : 0; |
| 2265 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2266 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2267 | } |
| 2268 | |
| 2269 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2270 | { |
| 2271 | /* Looks like the unsol event is incompatible with the standard |
| 2272 | * definition. 4bit tag is placed at 28 bit! |
| 2273 | */ |
| 2274 | if ((res >> 28) == 0x01) |
| 2275 | alc880_lg_lw_automute(codec); |
| 2276 | } |
| 2277 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2278 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2279 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2280 | { 0x0b, HDA_INPUT, 0 }, |
| 2281 | { 0x0b, HDA_INPUT, 1 }, |
| 2282 | { 0x0b, HDA_INPUT, 2 }, |
| 2283 | { 0x0b, HDA_INPUT, 3 }, |
| 2284 | { 0x0b, HDA_INPUT, 4 }, |
| 2285 | { } /* end */ |
| 2286 | }; |
| 2287 | |
| 2288 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2289 | { 0x0b, HDA_INPUT, 1 }, |
| 2290 | { 0x0b, HDA_INPUT, 6 }, |
| 2291 | { 0x0b, HDA_INPUT, 7 }, |
| 2292 | { } /* end */ |
| 2293 | }; |
| 2294 | #endif |
| 2295 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2296 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2297 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2298 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2299 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2300 | static int alc_init(struct hda_codec *codec) |
| 2301 | { |
| 2302 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2303 | unsigned int i; |
| 2304 | |
| 2305 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2306 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2307 | |
| 2308 | if (spec->init_hook) |
| 2309 | spec->init_hook(codec); |
| 2310 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2311 | return 0; |
| 2312 | } |
| 2313 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2314 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2315 | { |
| 2316 | struct alc_spec *spec = codec->spec; |
| 2317 | |
| 2318 | if (spec->unsol_event) |
| 2319 | spec->unsol_event(codec, res); |
| 2320 | } |
| 2321 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2322 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2323 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2324 | { |
| 2325 | struct alc_spec *spec = codec->spec; |
| 2326 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2327 | } |
| 2328 | #endif |
| 2329 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2330 | /* |
| 2331 | * Analog playback callbacks |
| 2332 | */ |
| 2333 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2334 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2335 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2336 | { |
| 2337 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2338 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2339 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2340 | } |
| 2341 | |
| 2342 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2343 | struct hda_codec *codec, |
| 2344 | unsigned int stream_tag, |
| 2345 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2346 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2347 | { |
| 2348 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2349 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2350 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2351 | } |
| 2352 | |
| 2353 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2354 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2355 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2356 | { |
| 2357 | struct alc_spec *spec = codec->spec; |
| 2358 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2359 | } |
| 2360 | |
| 2361 | /* |
| 2362 | * Digital out |
| 2363 | */ |
| 2364 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2365 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2366 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2367 | { |
| 2368 | struct alc_spec *spec = codec->spec; |
| 2369 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2370 | } |
| 2371 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2372 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2373 | struct hda_codec *codec, |
| 2374 | unsigned int stream_tag, |
| 2375 | unsigned int format, |
| 2376 | struct snd_pcm_substream *substream) |
| 2377 | { |
| 2378 | struct alc_spec *spec = codec->spec; |
| 2379 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2380 | stream_tag, format, substream); |
| 2381 | } |
| 2382 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2383 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2384 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2385 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2386 | { |
| 2387 | struct alc_spec *spec = codec->spec; |
| 2388 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2389 | } |
| 2390 | |
| 2391 | /* |
| 2392 | * Analog capture |
| 2393 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2394 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2395 | struct hda_codec *codec, |
| 2396 | unsigned int stream_tag, |
| 2397 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2398 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2399 | { |
| 2400 | struct alc_spec *spec = codec->spec; |
| 2401 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2402 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2403 | stream_tag, 0, format); |
| 2404 | return 0; |
| 2405 | } |
| 2406 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2407 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2408 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2409 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2410 | { |
| 2411 | struct alc_spec *spec = codec->spec; |
| 2412 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2413 | snd_hda_codec_cleanup_stream(codec, |
| 2414 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2415 | return 0; |
| 2416 | } |
| 2417 | |
| 2418 | |
| 2419 | /* |
| 2420 | */ |
| 2421 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2422 | .substreams = 1, |
| 2423 | .channels_min = 2, |
| 2424 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2425 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2426 | .ops = { |
| 2427 | .open = alc880_playback_pcm_open, |
| 2428 | .prepare = alc880_playback_pcm_prepare, |
| 2429 | .cleanup = alc880_playback_pcm_cleanup |
| 2430 | }, |
| 2431 | }; |
| 2432 | |
| 2433 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2434 | .substreams = 1, |
| 2435 | .channels_min = 2, |
| 2436 | .channels_max = 2, |
| 2437 | /* NID is set in alc_build_pcms */ |
| 2438 | }; |
| 2439 | |
| 2440 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2441 | .substreams = 1, |
| 2442 | .channels_min = 2, |
| 2443 | .channels_max = 2, |
| 2444 | /* NID is set in alc_build_pcms */ |
| 2445 | }; |
| 2446 | |
| 2447 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2448 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2449 | .channels_min = 2, |
| 2450 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2451 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2452 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2453 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2454 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2455 | }, |
| 2456 | }; |
| 2457 | |
| 2458 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2459 | .substreams = 1, |
| 2460 | .channels_min = 2, |
| 2461 | .channels_max = 2, |
| 2462 | /* NID is set in alc_build_pcms */ |
| 2463 | .ops = { |
| 2464 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2465 | .close = alc880_dig_playback_pcm_close, |
| 2466 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2467 | }, |
| 2468 | }; |
| 2469 | |
| 2470 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2471 | .substreams = 1, |
| 2472 | .channels_min = 2, |
| 2473 | .channels_max = 2, |
| 2474 | /* NID is set in alc_build_pcms */ |
| 2475 | }; |
| 2476 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2477 | /* 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] | 2478 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2479 | .substreams = 0, |
| 2480 | .channels_min = 0, |
| 2481 | .channels_max = 0, |
| 2482 | }; |
| 2483 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2484 | static int alc_build_pcms(struct hda_codec *codec) |
| 2485 | { |
| 2486 | struct alc_spec *spec = codec->spec; |
| 2487 | struct hda_pcm *info = spec->pcm_rec; |
| 2488 | int i; |
| 2489 | |
| 2490 | codec->num_pcms = 1; |
| 2491 | codec->pcm_info = info; |
| 2492 | |
| 2493 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2494 | if (spec->stream_analog_playback) { |
| 2495 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2496 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2497 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2498 | } |
| 2499 | if (spec->stream_analog_capture) { |
| 2500 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2501 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2502 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2503 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2504 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2505 | if (spec->channel_mode) { |
| 2506 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2507 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2508 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2509 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2510 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2511 | } |
| 2512 | } |
| 2513 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2514 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2515 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2516 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2517 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2518 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2519 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2520 | if (spec->multiout.dig_out_nid && |
| 2521 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2522 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2523 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2524 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2525 | if (spec->dig_in_nid && |
| 2526 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2527 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2528 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2529 | } |
| 2530 | } |
| 2531 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2532 | /* If the use of more than one ADC is requested for the current |
| 2533 | * model, configure a second analog capture-only PCM. |
| 2534 | */ |
| 2535 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2536 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2537 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2538 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2539 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2540 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2541 | if (spec->alt_dac_nid) { |
| 2542 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2543 | *spec->stream_analog_alt_playback; |
| 2544 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2545 | spec->alt_dac_nid; |
| 2546 | } else { |
| 2547 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2548 | alc_pcm_null_stream; |
| 2549 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2550 | } |
| 2551 | if (spec->num_adc_nids > 1) { |
| 2552 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2553 | *spec->stream_analog_alt_capture; |
| 2554 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2555 | spec->adc_nids[1]; |
| 2556 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2557 | spec->num_adc_nids - 1; |
| 2558 | } else { |
| 2559 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2560 | alc_pcm_null_stream; |
| 2561 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2562 | } |
| 2563 | } |
| 2564 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2565 | return 0; |
| 2566 | } |
| 2567 | |
| 2568 | static void alc_free(struct hda_codec *codec) |
| 2569 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2570 | struct alc_spec *spec = codec->spec; |
| 2571 | unsigned int i; |
| 2572 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2573 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2574 | return; |
| 2575 | |
| 2576 | if (spec->kctl_alloc) { |
| 2577 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2578 | kfree(spec->kctl_alloc[i].name); |
| 2579 | kfree(spec->kctl_alloc); |
| 2580 | } |
| 2581 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2582 | } |
| 2583 | |
| 2584 | /* |
| 2585 | */ |
| 2586 | static struct hda_codec_ops alc_patch_ops = { |
| 2587 | .build_controls = alc_build_controls, |
| 2588 | .build_pcms = alc_build_pcms, |
| 2589 | .init = alc_init, |
| 2590 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2591 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2592 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2593 | .check_power_status = alc_check_power_status, |
| 2594 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2595 | }; |
| 2596 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2597 | |
| 2598 | /* |
| 2599 | * Test configuration for debugging |
| 2600 | * |
| 2601 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2602 | * enum controls. |
| 2603 | */ |
| 2604 | #ifdef CONFIG_SND_DEBUG |
| 2605 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2606 | 0x02, 0x03, 0x04, 0x05 |
| 2607 | }; |
| 2608 | |
| 2609 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2610 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2611 | .items = { |
| 2612 | { "In-1", 0x0 }, |
| 2613 | { "In-2", 0x1 }, |
| 2614 | { "In-3", 0x2 }, |
| 2615 | { "In-4", 0x3 }, |
| 2616 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2617 | { "Front", 0x5 }, |
| 2618 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2619 | }, |
| 2620 | }; |
| 2621 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2622 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2623 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2624 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2625 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2626 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2627 | }; |
| 2628 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2629 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2630 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2631 | { |
| 2632 | static char *texts[] = { |
| 2633 | "N/A", "Line Out", "HP Out", |
| 2634 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2635 | }; |
| 2636 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2637 | uinfo->count = 1; |
| 2638 | uinfo->value.enumerated.items = 8; |
| 2639 | if (uinfo->value.enumerated.item >= 8) |
| 2640 | uinfo->value.enumerated.item = 7; |
| 2641 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2642 | return 0; |
| 2643 | } |
| 2644 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2645 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2646 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2647 | { |
| 2648 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2649 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2650 | unsigned int pin_ctl, item = 0; |
| 2651 | |
| 2652 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2653 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2654 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2655 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2656 | item = 2; |
| 2657 | else |
| 2658 | item = 1; |
| 2659 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2660 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2661 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2662 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2663 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2664 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2665 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2666 | } |
| 2667 | } |
| 2668 | ucontrol->value.enumerated.item[0] = item; |
| 2669 | return 0; |
| 2670 | } |
| 2671 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2672 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2673 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2674 | { |
| 2675 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2676 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2677 | static unsigned int ctls[] = { |
| 2678 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2679 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2680 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2681 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2682 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2683 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2684 | }; |
| 2685 | unsigned int old_ctl, new_ctl; |
| 2686 | |
| 2687 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2688 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2689 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2690 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2691 | int val; |
| 2692 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2693 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2694 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2695 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2696 | HDA_AMP_MUTE : 0; |
| 2697 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2698 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2699 | return 1; |
| 2700 | } |
| 2701 | return 0; |
| 2702 | } |
| 2703 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2704 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2705 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2706 | { |
| 2707 | static char *texts[] = { |
| 2708 | "Front", "Surround", "CLFE", "Side" |
| 2709 | }; |
| 2710 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2711 | uinfo->count = 1; |
| 2712 | uinfo->value.enumerated.items = 4; |
| 2713 | if (uinfo->value.enumerated.item >= 4) |
| 2714 | uinfo->value.enumerated.item = 3; |
| 2715 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2716 | return 0; |
| 2717 | } |
| 2718 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2719 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2720 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2721 | { |
| 2722 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2723 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2724 | unsigned int sel; |
| 2725 | |
| 2726 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2727 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2728 | return 0; |
| 2729 | } |
| 2730 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2731 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2732 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2733 | { |
| 2734 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2735 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2736 | unsigned int sel; |
| 2737 | |
| 2738 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2739 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2740 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2741 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2742 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2743 | return 1; |
| 2744 | } |
| 2745 | return 0; |
| 2746 | } |
| 2747 | |
| 2748 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2749 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2750 | .name = xname, \ |
| 2751 | .info = alc_test_pin_ctl_info, \ |
| 2752 | .get = alc_test_pin_ctl_get, \ |
| 2753 | .put = alc_test_pin_ctl_put, \ |
| 2754 | .private_value = nid \ |
| 2755 | } |
| 2756 | |
| 2757 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2758 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2759 | .name = xname, \ |
| 2760 | .info = alc_test_pin_src_info, \ |
| 2761 | .get = alc_test_pin_src_get, \ |
| 2762 | .put = alc_test_pin_src_put, \ |
| 2763 | .private_value = nid \ |
| 2764 | } |
| 2765 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2766 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2767 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2768 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2769 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2770 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2771 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2772 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2773 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2774 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2775 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2776 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2777 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2778 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2779 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2780 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2781 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2782 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2783 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2784 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2785 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2786 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2787 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2788 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2789 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2790 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2791 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2792 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2793 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2794 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2795 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2796 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2797 | { |
| 2798 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2799 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2800 | .info = alc_ch_mode_info, |
| 2801 | .get = alc_ch_mode_get, |
| 2802 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2803 | }, |
| 2804 | { } /* end */ |
| 2805 | }; |
| 2806 | |
| 2807 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2808 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2809 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2810 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2811 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2812 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2813 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2814 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2815 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2816 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2817 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2818 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2819 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2820 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2821 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2822 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2824 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2825 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2826 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2827 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2828 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2829 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2830 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2831 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2832 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2833 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2834 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2835 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2836 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2837 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2838 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2839 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2840 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2841 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2842 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2843 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2844 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2845 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2846 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2847 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2848 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2849 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2850 | /* Analog input/passthru */ |
| 2851 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2852 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2853 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2854 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2855 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2856 | { } |
| 2857 | }; |
| 2858 | #endif |
| 2859 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2860 | /* |
| 2861 | */ |
| 2862 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2863 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2864 | [ALC880_3ST] = "3stack", |
| 2865 | [ALC880_TCL_S700] = "tcl", |
| 2866 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2867 | [ALC880_CLEVO] = "clevo", |
| 2868 | [ALC880_5ST] = "5stack", |
| 2869 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2870 | [ALC880_W810] = "w810", |
| 2871 | [ALC880_Z71V] = "z71v", |
| 2872 | [ALC880_6ST] = "6stack", |
| 2873 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2874 | [ALC880_ASUS] = "asus", |
| 2875 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2876 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2877 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2878 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2879 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2880 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2881 | [ALC880_F1734] = "F1734", |
| 2882 | [ALC880_LG] = "lg", |
| 2883 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2884 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2885 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2886 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2887 | [ALC880_AUTO] = "auto", |
| 2888 | }; |
| 2889 | |
| 2890 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2891 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2892 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2893 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2894 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2895 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2896 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2897 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2898 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2899 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2900 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2901 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2902 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2903 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2904 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2905 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2906 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2907 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2908 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2909 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2910 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2911 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2912 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2913 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2914 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2915 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2916 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2917 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2918 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2919 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2920 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2921 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2922 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2923 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2924 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2925 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2926 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2927 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2928 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2929 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2930 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2931 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2932 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2933 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2934 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2935 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2936 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2937 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2938 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2939 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2940 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2941 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2942 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2943 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2944 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2945 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 2946 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2947 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2948 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2949 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2950 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2951 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2952 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2953 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2954 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2955 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2956 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2957 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 2958 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2959 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2960 | {} |
| 2961 | }; |
| 2962 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2963 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2964 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2965 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2966 | static struct alc_config_preset alc880_presets[] = { |
| 2967 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2968 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2969 | .init_verbs = { alc880_volume_init_verbs, |
| 2970 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2971 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2972 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2973 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2974 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2975 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2976 | .input_mux = &alc880_capture_source, |
| 2977 | }, |
| 2978 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2979 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2980 | .init_verbs = { alc880_volume_init_verbs, |
| 2981 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2982 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2983 | .dac_nids = alc880_dac_nids, |
| 2984 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2985 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2986 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2987 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2988 | .input_mux = &alc880_capture_source, |
| 2989 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2990 | [ALC880_TCL_S700] = { |
| 2991 | .mixers = { alc880_tcl_s700_mixer }, |
| 2992 | .init_verbs = { alc880_volume_init_verbs, |
| 2993 | alc880_pin_tcl_S700_init_verbs, |
| 2994 | alc880_gpio2_init_verbs }, |
| 2995 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2996 | .dac_nids = alc880_dac_nids, |
| 2997 | .hp_nid = 0x03, |
| 2998 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2999 | .channel_mode = alc880_2_jack_modes, |
| 3000 | .input_mux = &alc880_capture_source, |
| 3001 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3002 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3003 | .mixers = { alc880_three_stack_mixer, |
| 3004 | alc880_five_stack_mixer}, |
| 3005 | .init_verbs = { alc880_volume_init_verbs, |
| 3006 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3007 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3008 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3009 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3010 | .channel_mode = alc880_fivestack_modes, |
| 3011 | .input_mux = &alc880_capture_source, |
| 3012 | }, |
| 3013 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3014 | .mixers = { alc880_three_stack_mixer, |
| 3015 | alc880_five_stack_mixer }, |
| 3016 | .init_verbs = { alc880_volume_init_verbs, |
| 3017 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3018 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3019 | .dac_nids = alc880_dac_nids, |
| 3020 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3021 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3022 | .channel_mode = alc880_fivestack_modes, |
| 3023 | .input_mux = &alc880_capture_source, |
| 3024 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3025 | [ALC880_6ST] = { |
| 3026 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3027 | .init_verbs = { alc880_volume_init_verbs, |
| 3028 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3029 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3030 | .dac_nids = alc880_6st_dac_nids, |
| 3031 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3032 | .channel_mode = alc880_sixstack_modes, |
| 3033 | .input_mux = &alc880_6stack_capture_source, |
| 3034 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3035 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3036 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3037 | .init_verbs = { alc880_volume_init_verbs, |
| 3038 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3039 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3040 | .dac_nids = alc880_6st_dac_nids, |
| 3041 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3042 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3043 | .channel_mode = alc880_sixstack_modes, |
| 3044 | .input_mux = &alc880_6stack_capture_source, |
| 3045 | }, |
| 3046 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3047 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3048 | .init_verbs = { alc880_volume_init_verbs, |
| 3049 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3050 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3051 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3052 | .dac_nids = alc880_w810_dac_nids, |
| 3053 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3054 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3055 | .channel_mode = alc880_w810_modes, |
| 3056 | .input_mux = &alc880_capture_source, |
| 3057 | }, |
| 3058 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3059 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3060 | .init_verbs = { alc880_volume_init_verbs, |
| 3061 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3062 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3063 | .dac_nids = alc880_z71v_dac_nids, |
| 3064 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3065 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3066 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3067 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3068 | .input_mux = &alc880_capture_source, |
| 3069 | }, |
| 3070 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3071 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3072 | .init_verbs = { alc880_volume_init_verbs, |
| 3073 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3074 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3075 | .dac_nids = alc880_f1734_dac_nids, |
| 3076 | .hp_nid = 0x02, |
| 3077 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3078 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3079 | .input_mux = &alc880_f1734_capture_source, |
| 3080 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3081 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3082 | }, |
| 3083 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3084 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3085 | .init_verbs = { alc880_volume_init_verbs, |
| 3086 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3087 | alc880_gpio1_init_verbs }, |
| 3088 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3089 | .dac_nids = alc880_asus_dac_nids, |
| 3090 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3091 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3092 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3093 | .input_mux = &alc880_capture_source, |
| 3094 | }, |
| 3095 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3096 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3097 | .init_verbs = { alc880_volume_init_verbs, |
| 3098 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3099 | alc880_gpio1_init_verbs }, |
| 3100 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3101 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3102 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3103 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3104 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3105 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3106 | .input_mux = &alc880_capture_source, |
| 3107 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3108 | [ALC880_ASUS_DIG2] = { |
| 3109 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3110 | .init_verbs = { alc880_volume_init_verbs, |
| 3111 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3112 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3113 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3114 | .dac_nids = alc880_asus_dac_nids, |
| 3115 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3116 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3117 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3118 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3119 | .input_mux = &alc880_capture_source, |
| 3120 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3121 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3122 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3123 | .init_verbs = { alc880_volume_init_verbs, |
| 3124 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3125 | alc880_gpio1_init_verbs }, |
| 3126 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3127 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3128 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3129 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3130 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3131 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3132 | .input_mux = &alc880_capture_source, |
| 3133 | }, |
| 3134 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3135 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3136 | .init_verbs = { alc880_volume_init_verbs, |
| 3137 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3138 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3139 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3140 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3141 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3142 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3143 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3144 | .input_mux = &alc880_capture_source, |
| 3145 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3146 | [ALC880_UNIWILL] = { |
| 3147 | .mixers = { alc880_uniwill_mixer }, |
| 3148 | .init_verbs = { alc880_volume_init_verbs, |
| 3149 | alc880_uniwill_init_verbs }, |
| 3150 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3151 | .dac_nids = alc880_asus_dac_nids, |
| 3152 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3153 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3154 | .channel_mode = alc880_threestack_modes, |
| 3155 | .need_dac_fix = 1, |
| 3156 | .input_mux = &alc880_capture_source, |
| 3157 | .unsol_event = alc880_uniwill_unsol_event, |
| 3158 | .init_hook = alc880_uniwill_automute, |
| 3159 | }, |
| 3160 | [ALC880_UNIWILL_P53] = { |
| 3161 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3162 | .init_verbs = { alc880_volume_init_verbs, |
| 3163 | alc880_uniwill_p53_init_verbs }, |
| 3164 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3165 | .dac_nids = alc880_asus_dac_nids, |
| 3166 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3167 | .channel_mode = alc880_threestack_modes, |
| 3168 | .input_mux = &alc880_capture_source, |
| 3169 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3170 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3171 | }, |
| 3172 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3173 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3174 | alc880_pcbeep_mixer, }, |
| 3175 | .init_verbs = { alc880_volume_init_verbs, |
| 3176 | alc880_uniwill_p53_init_verbs, |
| 3177 | alc880_beep_init_verbs }, |
| 3178 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3179 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3180 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3181 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3182 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3183 | .input_mux = &alc880_capture_source, |
| 3184 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3185 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3186 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3187 | [ALC880_CLEVO] = { |
| 3188 | .mixers = { alc880_three_stack_mixer }, |
| 3189 | .init_verbs = { alc880_volume_init_verbs, |
| 3190 | alc880_pin_clevo_init_verbs }, |
| 3191 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3192 | .dac_nids = alc880_dac_nids, |
| 3193 | .hp_nid = 0x03, |
| 3194 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3195 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3196 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3197 | .input_mux = &alc880_capture_source, |
| 3198 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3199 | [ALC880_LG] = { |
| 3200 | .mixers = { alc880_lg_mixer }, |
| 3201 | .init_verbs = { alc880_volume_init_verbs, |
| 3202 | alc880_lg_init_verbs }, |
| 3203 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3204 | .dac_nids = alc880_lg_dac_nids, |
| 3205 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3206 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3207 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3208 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3209 | .input_mux = &alc880_lg_capture_source, |
| 3210 | .unsol_event = alc880_lg_unsol_event, |
| 3211 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3212 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3213 | .loopbacks = alc880_lg_loopbacks, |
| 3214 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3215 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3216 | [ALC880_LG_LW] = { |
| 3217 | .mixers = { alc880_lg_lw_mixer }, |
| 3218 | .init_verbs = { alc880_volume_init_verbs, |
| 3219 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3220 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3221 | .dac_nids = alc880_dac_nids, |
| 3222 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3223 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3224 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3225 | .input_mux = &alc880_lg_lw_capture_source, |
| 3226 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3227 | .init_hook = alc880_lg_lw_automute, |
| 3228 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3229 | #ifdef CONFIG_SND_DEBUG |
| 3230 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3231 | .mixers = { alc880_test_mixer }, |
| 3232 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3233 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3234 | .dac_nids = alc880_test_dac_nids, |
| 3235 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3236 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3237 | .channel_mode = alc880_test_modes, |
| 3238 | .input_mux = &alc880_test_capture_source, |
| 3239 | }, |
| 3240 | #endif |
| 3241 | }; |
| 3242 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3243 | /* |
| 3244 | * Automatic parse of I/O pins from the BIOS configuration |
| 3245 | */ |
| 3246 | |
| 3247 | #define NUM_CONTROL_ALLOC 32 |
| 3248 | #define NUM_VERB_ALLOC 32 |
| 3249 | |
| 3250 | enum { |
| 3251 | ALC_CTL_WIDGET_VOL, |
| 3252 | ALC_CTL_WIDGET_MUTE, |
| 3253 | ALC_CTL_BIND_MUTE, |
| 3254 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3255 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3256 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3257 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3258 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3259 | }; |
| 3260 | |
| 3261 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3262 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3263 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3264 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3265 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3266 | |
| 3267 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3268 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3269 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3270 | /* array + terminator */ |
| 3271 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3272 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3273 | return -ENOMEM; |
| 3274 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3275 | memcpy(knew, spec->kctl_alloc, |
| 3276 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3277 | kfree(spec->kctl_alloc); |
| 3278 | } |
| 3279 | spec->kctl_alloc = knew; |
| 3280 | spec->num_kctl_alloc = num; |
| 3281 | } |
| 3282 | |
| 3283 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3284 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3285 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3286 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3287 | return -ENOMEM; |
| 3288 | knew->private_value = val; |
| 3289 | spec->num_kctl_used++; |
| 3290 | return 0; |
| 3291 | } |
| 3292 | |
| 3293 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3294 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3295 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3296 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3297 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3298 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3299 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3300 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3301 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3302 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3303 | #define ALC880_PIN_CD_NID 0x1c |
| 3304 | |
| 3305 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3306 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3307 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3308 | { |
| 3309 | hda_nid_t nid; |
| 3310 | int assigned[4]; |
| 3311 | int i, j; |
| 3312 | |
| 3313 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3314 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3315 | |
| 3316 | /* check the pins hardwired to audio widget */ |
| 3317 | for (i = 0; i < cfg->line_outs; i++) { |
| 3318 | nid = cfg->line_out_pins[i]; |
| 3319 | if (alc880_is_fixed_pin(nid)) { |
| 3320 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3321 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3322 | assigned[idx] = 1; |
| 3323 | } |
| 3324 | } |
| 3325 | /* left pins can be connect to any audio widget */ |
| 3326 | for (i = 0; i < cfg->line_outs; i++) { |
| 3327 | nid = cfg->line_out_pins[i]; |
| 3328 | if (alc880_is_fixed_pin(nid)) |
| 3329 | continue; |
| 3330 | /* search for an empty channel */ |
| 3331 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3332 | if (!assigned[j]) { |
| 3333 | spec->multiout.dac_nids[i] = |
| 3334 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3335 | assigned[j] = 1; |
| 3336 | break; |
| 3337 | } |
| 3338 | } |
| 3339 | } |
| 3340 | spec->multiout.num_dacs = cfg->line_outs; |
| 3341 | return 0; |
| 3342 | } |
| 3343 | |
| 3344 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3345 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3346 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3347 | { |
| 3348 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3349 | static const char *chname[4] = { |
| 3350 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3351 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3352 | hda_nid_t nid; |
| 3353 | int i, err; |
| 3354 | |
| 3355 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3356 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3357 | continue; |
| 3358 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3359 | if (i == 2) { |
| 3360 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3361 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3362 | "Center Playback Volume", |
| 3363 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3364 | HDA_OUTPUT)); |
| 3365 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3366 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3367 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3368 | "LFE Playback Volume", |
| 3369 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3370 | HDA_OUTPUT)); |
| 3371 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3372 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3373 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3374 | "Center Playback Switch", |
| 3375 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3376 | HDA_INPUT)); |
| 3377 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3378 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3379 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3380 | "LFE Playback Switch", |
| 3381 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3382 | HDA_INPUT)); |
| 3383 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3384 | return err; |
| 3385 | } else { |
| 3386 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3387 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3388 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3389 | HDA_OUTPUT)); |
| 3390 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3391 | return err; |
| 3392 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3393 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3394 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3395 | HDA_INPUT)); |
| 3396 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3397 | return err; |
| 3398 | } |
| 3399 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3400 | return 0; |
| 3401 | } |
| 3402 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3403 | /* add playback controls for speaker and HP outputs */ |
| 3404 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3405 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3406 | { |
| 3407 | hda_nid_t nid; |
| 3408 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3409 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3410 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3411 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3412 | return 0; |
| 3413 | |
| 3414 | if (alc880_is_fixed_pin(pin)) { |
| 3415 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3416 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3417 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3418 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3419 | else |
| 3420 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3421 | /* control HP volume/switch on the output mixer amp */ |
| 3422 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3423 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3424 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3425 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3426 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3427 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3428 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3429 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3430 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3431 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3432 | return err; |
| 3433 | } else if (alc880_is_multi_pin(pin)) { |
| 3434 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3435 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3436 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3437 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3438 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3439 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3440 | return err; |
| 3441 | } |
| 3442 | return 0; |
| 3443 | } |
| 3444 | |
| 3445 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3446 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3447 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3448 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3449 | { |
| 3450 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3451 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3452 | |
| 3453 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3454 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3455 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3456 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3457 | return err; |
| 3458 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3459 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3460 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3461 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3462 | return err; |
| 3463 | return 0; |
| 3464 | } |
| 3465 | |
| 3466 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3467 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3468 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3469 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3470 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3471 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3472 | |
| 3473 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3474 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3475 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3476 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3477 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3478 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3479 | if (err < 0) |
| 3480 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3481 | imux->items[imux->num_items].label = |
| 3482 | auto_pin_cfg_labels[i]; |
| 3483 | imux->items[imux->num_items].index = |
| 3484 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3485 | imux->num_items++; |
| 3486 | } |
| 3487 | } |
| 3488 | return 0; |
| 3489 | } |
| 3490 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3491 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3492 | unsigned int pin_type) |
| 3493 | { |
| 3494 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3495 | pin_type); |
| 3496 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3497 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3498 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3499 | } |
| 3500 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3501 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3502 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3503 | int dac_idx) |
| 3504 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3505 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3506 | /* need the manual connection? */ |
| 3507 | if (alc880_is_multi_pin(nid)) { |
| 3508 | struct alc_spec *spec = codec->spec; |
| 3509 | int idx = alc880_multi_pin_idx(nid); |
| 3510 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3511 | AC_VERB_SET_CONNECT_SEL, |
| 3512 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3513 | } |
| 3514 | } |
| 3515 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3516 | static int get_pin_type(int line_out_type) |
| 3517 | { |
| 3518 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3519 | return PIN_HP; |
| 3520 | else |
| 3521 | return PIN_OUT; |
| 3522 | } |
| 3523 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3524 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3525 | { |
| 3526 | struct alc_spec *spec = codec->spec; |
| 3527 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3528 | |
| 3529 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3530 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3531 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3532 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3533 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3534 | } |
| 3535 | } |
| 3536 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3537 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3538 | { |
| 3539 | struct alc_spec *spec = codec->spec; |
| 3540 | hda_nid_t pin; |
| 3541 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3542 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3543 | if (pin) /* connect to front */ |
| 3544 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3545 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3546 | if (pin) /* connect to front */ |
| 3547 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3548 | } |
| 3549 | |
| 3550 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3551 | { |
| 3552 | struct alc_spec *spec = codec->spec; |
| 3553 | int i; |
| 3554 | |
| 3555 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3556 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3557 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3558 | snd_hda_codec_write(codec, nid, 0, |
| 3559 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3560 | i <= AUTO_PIN_FRONT_MIC ? |
| 3561 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3562 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3563 | snd_hda_codec_write(codec, nid, 0, |
| 3564 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3565 | AMP_OUT_MUTE); |
| 3566 | } |
| 3567 | } |
| 3568 | } |
| 3569 | |
| 3570 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3571 | /* return 1 if successful, 0 if the proper config is not found, |
| 3572 | * or a negative error code |
| 3573 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3574 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3575 | { |
| 3576 | struct alc_spec *spec = codec->spec; |
| 3577 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3578 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3579 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3580 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3581 | alc880_ignore); |
| 3582 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3583 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3584 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3585 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3586 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3587 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3588 | if (err < 0) |
| 3589 | return err; |
| 3590 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3591 | if (err < 0) |
| 3592 | return err; |
| 3593 | err = alc880_auto_create_extra_out(spec, |
| 3594 | spec->autocfg.speaker_pins[0], |
| 3595 | "Speaker"); |
| 3596 | if (err < 0) |
| 3597 | return err; |
| 3598 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3599 | "Headphone"); |
| 3600 | if (err < 0) |
| 3601 | return err; |
| 3602 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3603 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3604 | return err; |
| 3605 | |
| 3606 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3607 | |
| 3608 | if (spec->autocfg.dig_out_pin) |
| 3609 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3610 | if (spec->autocfg.dig_in_pin) |
| 3611 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3612 | |
| 3613 | if (spec->kctl_alloc) |
| 3614 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3615 | |
| 3616 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3617 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3618 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3619 | spec->input_mux = &spec->private_imux; |
| 3620 | |
| 3621 | return 1; |
| 3622 | } |
| 3623 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3624 | /* additional initialization for auto-configuration model */ |
| 3625 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3626 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3627 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3628 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3629 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3630 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3631 | if (spec->unsol_event) |
| 3632 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3633 | } |
| 3634 | |
| 3635 | /* |
| 3636 | * OK, here we have finally the patch for ALC880 |
| 3637 | */ |
| 3638 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3639 | static int patch_alc880(struct hda_codec *codec) |
| 3640 | { |
| 3641 | struct alc_spec *spec; |
| 3642 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3643 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3644 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3645 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3646 | if (spec == NULL) |
| 3647 | return -ENOMEM; |
| 3648 | |
| 3649 | codec->spec = spec; |
| 3650 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3651 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3652 | alc880_models, |
| 3653 | alc880_cfg_tbl); |
| 3654 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3655 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3656 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3657 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3658 | } |
| 3659 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3660 | if (board_config == ALC880_AUTO) { |
| 3661 | /* automatic parse from the BIOS config */ |
| 3662 | err = alc880_parse_auto_config(codec); |
| 3663 | if (err < 0) { |
| 3664 | alc_free(codec); |
| 3665 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3666 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3667 | printk(KERN_INFO |
| 3668 | "hda_codec: Cannot set up configuration " |
| 3669 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3670 | board_config = ALC880_3ST; |
| 3671 | } |
| 3672 | } |
| 3673 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3674 | if (board_config != ALC880_AUTO) |
| 3675 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3676 | |
| 3677 | spec->stream_name_analog = "ALC880 Analog"; |
| 3678 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3679 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3680 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3681 | |
| 3682 | spec->stream_name_digital = "ALC880 Digital"; |
| 3683 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3684 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3685 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3686 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3687 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3688 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3689 | /* get type */ |
| 3690 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3691 | if (wcap != AC_WID_AUD_IN) { |
| 3692 | spec->adc_nids = alc880_adc_nids_alt; |
| 3693 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3694 | spec->mixers[spec->num_mixers] = |
| 3695 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3696 | spec->num_mixers++; |
| 3697 | } else { |
| 3698 | spec->adc_nids = alc880_adc_nids; |
| 3699 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3700 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3701 | spec->num_mixers++; |
| 3702 | } |
| 3703 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3704 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3705 | spec->vmaster_nid = 0x0c; |
| 3706 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3707 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3708 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3709 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3710 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3711 | if (!spec->loopback.amplist) |
| 3712 | spec->loopback.amplist = alc880_loopbacks; |
| 3713 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3714 | |
| 3715 | return 0; |
| 3716 | } |
| 3717 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3718 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3719 | /* |
| 3720 | * ALC260 support |
| 3721 | */ |
| 3722 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3723 | static hda_nid_t alc260_dac_nids[1] = { |
| 3724 | /* front */ |
| 3725 | 0x02, |
| 3726 | }; |
| 3727 | |
| 3728 | static hda_nid_t alc260_adc_nids[1] = { |
| 3729 | /* ADC0 */ |
| 3730 | 0x04, |
| 3731 | }; |
| 3732 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3733 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3734 | /* ADC1 */ |
| 3735 | 0x05, |
| 3736 | }; |
| 3737 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3738 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3739 | /* ADC1, 0 */ |
| 3740 | 0x05, 0x04 |
| 3741 | }; |
| 3742 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3743 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3744 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3745 | */ |
| 3746 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3747 | /* ADC0, ADC1 */ |
| 3748 | 0x04, 0x05 |
| 3749 | }; |
| 3750 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3751 | #define ALC260_DIGOUT_NID 0x03 |
| 3752 | #define ALC260_DIGIN_NID 0x06 |
| 3753 | |
| 3754 | static struct hda_input_mux alc260_capture_source = { |
| 3755 | .num_items = 4, |
| 3756 | .items = { |
| 3757 | { "Mic", 0x0 }, |
| 3758 | { "Front Mic", 0x1 }, |
| 3759 | { "Line", 0x2 }, |
| 3760 | { "CD", 0x4 }, |
| 3761 | }, |
| 3762 | }; |
| 3763 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3764 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3765 | * headphone jack and the internal CD lines since these are the only pins at |
| 3766 | * which audio can appear. For flexibility, also allow the option of |
| 3767 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3768 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3769 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3770 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3771 | { |
| 3772 | .num_items = 3, |
| 3773 | .items = { |
| 3774 | { "Mic/Line", 0x0 }, |
| 3775 | { "CD", 0x4 }, |
| 3776 | { "Headphone", 0x2 }, |
| 3777 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3778 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3779 | { |
| 3780 | .num_items = 4, |
| 3781 | .items = { |
| 3782 | { "Mic/Line", 0x0 }, |
| 3783 | { "CD", 0x4 }, |
| 3784 | { "Headphone", 0x2 }, |
| 3785 | { "Mixer", 0x5 }, |
| 3786 | }, |
| 3787 | }, |
| 3788 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3789 | }; |
| 3790 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3791 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3792 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3793 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3794 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3795 | { |
| 3796 | .num_items = 4, |
| 3797 | .items = { |
| 3798 | { "Mic", 0x0 }, |
| 3799 | { "Line", 0x2 }, |
| 3800 | { "CD", 0x4 }, |
| 3801 | { "Headphone", 0x5 }, |
| 3802 | }, |
| 3803 | }, |
| 3804 | { |
| 3805 | .num_items = 5, |
| 3806 | .items = { |
| 3807 | { "Mic", 0x0 }, |
| 3808 | { "Line", 0x2 }, |
| 3809 | { "CD", 0x4 }, |
| 3810 | { "Headphone", 0x6 }, |
| 3811 | { "Mixer", 0x5 }, |
| 3812 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3813 | }, |
| 3814 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3815 | /* |
| 3816 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3817 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3818 | * element which allows changing the channel mode, so the verb list is |
| 3819 | * never used. |
| 3820 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3821 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3822 | { 2, NULL }, |
| 3823 | }; |
| 3824 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3825 | |
| 3826 | /* Mixer combinations |
| 3827 | * |
| 3828 | * basic: base_output + input + pc_beep + capture |
| 3829 | * HP: base_output + input + capture_alt |
| 3830 | * HP_3013: hp_3013 + input + capture |
| 3831 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3832 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3833 | */ |
| 3834 | |
| 3835 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3836 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3837 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3838 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3839 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3840 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3841 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3842 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3843 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3844 | |
| 3845 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3846 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3847 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3848 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3849 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3851 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3852 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3853 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3854 | { } /* end */ |
| 3855 | }; |
| 3856 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3857 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3858 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3859 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3860 | { } /* end */ |
| 3861 | }; |
| 3862 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3863 | /* update HP, line and mono out pins according to the master switch */ |
| 3864 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 3865 | hda_nid_t hp, hda_nid_t line, |
| 3866 | hda_nid_t mono) |
| 3867 | { |
| 3868 | struct alc_spec *spec = codec->spec; |
| 3869 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 3870 | /* change HP and line-out pins */ |
| 3871 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3872 | val); |
| 3873 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3874 | val); |
| 3875 | /* mono (speaker) depending on the HP jack sense */ |
| 3876 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 3877 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3878 | val); |
| 3879 | } |
| 3880 | |
| 3881 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 3882 | struct snd_ctl_elem_value *ucontrol) |
| 3883 | { |
| 3884 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3885 | struct alc_spec *spec = codec->spec; |
| 3886 | *ucontrol->value.integer.value = spec->master_sw; |
| 3887 | return 0; |
| 3888 | } |
| 3889 | |
| 3890 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 3891 | struct snd_ctl_elem_value *ucontrol) |
| 3892 | { |
| 3893 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3894 | struct alc_spec *spec = codec->spec; |
| 3895 | int val = !!*ucontrol->value.integer.value; |
| 3896 | hda_nid_t hp, line, mono; |
| 3897 | |
| 3898 | if (val == spec->master_sw) |
| 3899 | return 0; |
| 3900 | spec->master_sw = val; |
| 3901 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 3902 | line = (kcontrol->private_value >> 8) & 0xff; |
| 3903 | mono = kcontrol->private_value & 0xff; |
| 3904 | alc260_hp_master_update(codec, hp, line, mono); |
| 3905 | return 1; |
| 3906 | } |
| 3907 | |
| 3908 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 3909 | { |
| 3910 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3911 | .name = "Master Playback Switch", |
| 3912 | .info = snd_ctl_boolean_mono_info, |
| 3913 | .get = alc260_hp_master_sw_get, |
| 3914 | .put = alc260_hp_master_sw_put, |
| 3915 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 3916 | }, |
| 3917 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3918 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 3919 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3920 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3921 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3922 | HDA_OUTPUT), |
| 3923 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3924 | { } /* end */ |
| 3925 | }; |
| 3926 | |
| 3927 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 3928 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3929 | {}, |
| 3930 | }; |
| 3931 | |
| 3932 | static void alc260_hp_automute(struct hda_codec *codec) |
| 3933 | { |
| 3934 | struct alc_spec *spec = codec->spec; |
| 3935 | unsigned int present; |
| 3936 | |
| 3937 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 3938 | AC_VERB_GET_PIN_SENSE, 0); |
| 3939 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3940 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 3941 | } |
| 3942 | |
| 3943 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3944 | { |
| 3945 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3946 | alc260_hp_automute(codec); |
| 3947 | } |
| 3948 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3949 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3950 | { |
| 3951 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3952 | .name = "Master Playback Switch", |
| 3953 | .info = snd_ctl_boolean_mono_info, |
| 3954 | .get = alc260_hp_master_sw_get, |
| 3955 | .put = alc260_hp_master_sw_put, |
| 3956 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 3957 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3958 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3959 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3960 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3961 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3962 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3963 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 3964 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3965 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3966 | { } /* end */ |
| 3967 | }; |
| 3968 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3969 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 3970 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3971 | {}, |
| 3972 | }; |
| 3973 | |
| 3974 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 3975 | { |
| 3976 | struct alc_spec *spec = codec->spec; |
| 3977 | unsigned int present; |
| 3978 | |
| 3979 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 3980 | AC_VERB_GET_PIN_SENSE, 0); |
| 3981 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3982 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 3983 | } |
| 3984 | |
| 3985 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 3986 | unsigned int res) |
| 3987 | { |
| 3988 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3989 | alc260_hp_3013_automute(codec); |
| 3990 | } |
| 3991 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3992 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3993 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3994 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3995 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3996 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3997 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3998 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3999 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4000 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4001 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4002 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4003 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4004 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4005 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4006 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4007 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4008 | { } /* end */ |
| 4009 | }; |
| 4010 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4011 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4012 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4013 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4014 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4015 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4016 | * revisions available in early 2006. Therefore for now allow the |
| 4017 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4018 | * that the lack of mic bias for this NID is intentional we could change the |
| 4019 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4020 | * |
| 4021 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4022 | * don't appear to make the mic bias available from the "line" jack, even |
| 4023 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4024 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4025 | * and the output jack. If this turns out to be the case for all such |
| 4026 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4027 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4028 | * |
| 4029 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4030 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4031 | * controls for such models. On models without a "mono speaker" the control |
| 4032 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4033 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4034 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4035 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4036 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4037 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4038 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4039 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4040 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4041 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4042 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4043 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4044 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4045 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4046 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4047 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4048 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4049 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4050 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4051 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4052 | { } /* end */ |
| 4053 | }; |
| 4054 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4055 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4056 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4057 | */ |
| 4058 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4059 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4060 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4061 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4062 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4063 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4064 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4065 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4066 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4067 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4068 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4069 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4070 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4071 | { } /* end */ |
| 4072 | }; |
| 4073 | |
| 4074 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4075 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4076 | */ |
| 4077 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4078 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4079 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4080 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4081 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4082 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4083 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4084 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4085 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4086 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4087 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4088 | { } /* end */ |
| 4089 | }; |
| 4090 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4091 | /* capture mixer elements */ |
| 4092 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4093 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4094 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4095 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4096 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4097 | { |
| 4098 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4099 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4100 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4101 | */ |
| 4102 | /* .name = "Capture Source", */ |
| 4103 | .name = "Input Source", |
| 4104 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4105 | .info = alc_mux_enum_info, |
| 4106 | .get = alc_mux_enum_get, |
| 4107 | .put = alc_mux_enum_put, |
| 4108 | }, |
| 4109 | { } /* end */ |
| 4110 | }; |
| 4111 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4112 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4113 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4114 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4115 | { |
| 4116 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4117 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4118 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4119 | */ |
| 4120 | /* .name = "Capture Source", */ |
| 4121 | .name = "Input Source", |
| 4122 | .count = 1, |
| 4123 | .info = alc_mux_enum_info, |
| 4124 | .get = alc_mux_enum_get, |
| 4125 | .put = alc_mux_enum_put, |
| 4126 | }, |
| 4127 | { } /* end */ |
| 4128 | }; |
| 4129 | |
| 4130 | /* |
| 4131 | * initialization verbs |
| 4132 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4133 | static struct hda_verb alc260_init_verbs[] = { |
| 4134 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4135 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4136 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4137 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4138 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4139 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4140 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4141 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4142 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4143 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4144 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4145 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4146 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4147 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4148 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4149 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4150 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4151 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4152 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4153 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4154 | /* set connection select to line in (default select for this ADC) */ |
| 4155 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4156 | /* mute capture amp left and right */ |
| 4157 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4158 | /* set connection select to line in (default select for this ADC) */ |
| 4159 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4160 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4161 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4162 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4163 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4164 | /* set vol=0 HP mixer amp left and right */ |
| 4165 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4166 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4167 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4168 | /* set vol=0 Mono mixer amp left and right */ |
| 4169 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4170 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4171 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4172 | /* unmute LINE-2 out pin */ |
| 4173 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4174 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4175 | * Line In 2 = 0x03 |
| 4176 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4177 | /* mute analog inputs */ |
| 4178 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4179 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4180 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4181 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4182 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4183 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4184 | /* mute Front out path */ |
| 4185 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4186 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4187 | /* mute Headphone out path */ |
| 4188 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4189 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4190 | /* mute Mono out path */ |
| 4191 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4192 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4193 | { } |
| 4194 | }; |
| 4195 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4196 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4197 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4198 | /* Headphone and output */ |
| 4199 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4200 | /* mono output */ |
| 4201 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4202 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4203 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4204 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4205 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4206 | /* Line In pin widget for input */ |
| 4207 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4208 | /* Line-2 pin widget for output */ |
| 4209 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4210 | /* CD pin widget for input */ |
| 4211 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4212 | /* unmute amp left and right */ |
| 4213 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4214 | /* set connection select to line in (default select for this ADC) */ |
| 4215 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4216 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4217 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4218 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4219 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4220 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4221 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4222 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4223 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4224 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4225 | * Line In 2 = 0x03 |
| 4226 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4227 | /* mute analog inputs */ |
| 4228 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4231 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4232 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4233 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4234 | /* Unmute Front out path */ |
| 4235 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4236 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4237 | /* Unmute Headphone out path */ |
| 4238 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4239 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4240 | /* Unmute Mono out path */ |
| 4241 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4242 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4243 | { } |
| 4244 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4245 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4246 | |
| 4247 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4248 | /* Line out and output */ |
| 4249 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4250 | /* mono output */ |
| 4251 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4252 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4253 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4254 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4255 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4256 | /* Line In pin widget for input */ |
| 4257 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4258 | /* Headphone pin widget for output */ |
| 4259 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4260 | /* CD pin widget for input */ |
| 4261 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4262 | /* unmute amp left and right */ |
| 4263 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4264 | /* set connection select to line in (default select for this ADC) */ |
| 4265 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4266 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4267 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4268 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4269 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4270 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4271 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4272 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4273 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4274 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4275 | * Line In 2 = 0x03 |
| 4276 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4277 | /* mute analog inputs */ |
| 4278 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4279 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4280 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4281 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4282 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4283 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4284 | /* Unmute Front out path */ |
| 4285 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4286 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4287 | /* Unmute Headphone out path */ |
| 4288 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4289 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4290 | /* Unmute Mono out path */ |
| 4291 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4292 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4293 | { } |
| 4294 | }; |
| 4295 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4296 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4297 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4298 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4299 | */ |
| 4300 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4301 | /* Disable all GPIOs */ |
| 4302 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4303 | /* Internal speaker is connected to headphone pin */ |
| 4304 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4305 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4306 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4307 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4308 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4309 | /* Ensure all other unused pins are disabled and muted. */ |
| 4310 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4311 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4312 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4313 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4314 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4315 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4316 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4317 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4318 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4319 | /* Disable digital (SPDIF) pins */ |
| 4320 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4321 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4322 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4323 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4324 | * when acting as an output. |
| 4325 | */ |
| 4326 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4327 | |
| 4328 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4329 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4330 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4331 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4332 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4333 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4334 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4335 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4336 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4337 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4338 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4339 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4340 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4341 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4342 | * If the pin mode is changed by the user the pin mode control will |
| 4343 | * take care of enabling the pin's input/output buffers as needed. |
| 4344 | * Therefore there's no need to enable the input buffer at this |
| 4345 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4346 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4347 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4348 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4349 | * mixer ctrl) |
| 4350 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4351 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4352 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4353 | /* Mute capture amp left and right */ |
| 4354 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4355 | /* Set ADC connection select to match default mixer setting - line |
| 4356 | * in (on mic1 pin) |
| 4357 | */ |
| 4358 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4359 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4360 | /* Do the same for the second ADC: mute capture input amp and |
| 4361 | * set ADC connection to line in (on mic1 pin) |
| 4362 | */ |
| 4363 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4364 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4365 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4366 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4367 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4368 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4369 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4370 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4371 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4372 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4373 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4374 | {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] | 4375 | |
| 4376 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4377 | }; |
| 4378 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4379 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4380 | * similar laptops (adapted from Fujitsu init verbs). |
| 4381 | */ |
| 4382 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4383 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4384 | * the headphone jack. Turn this on and rely on the standard mute |
| 4385 | * methods whenever the user wants to turn these outputs off. |
| 4386 | */ |
| 4387 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4388 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4389 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4390 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4391 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4392 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4393 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4394 | /* Line In jack is connected to Line1 pin */ |
| 4395 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4396 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4397 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4398 | /* Ensure all other unused pins are disabled and muted. */ |
| 4399 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4400 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4401 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4402 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4403 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4404 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4405 | /* Disable digital (SPDIF) pins */ |
| 4406 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4407 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4408 | |
| 4409 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4410 | * bus when acting as outputs. |
| 4411 | */ |
| 4412 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4413 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4414 | |
| 4415 | /* Start with output sum widgets muted and their output gains at min */ |
| 4416 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4417 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4418 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4420 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4421 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4422 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4423 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4424 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4425 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4426 | /* Unmute Line-out pin widget amp left and right |
| 4427 | * (no equiv mixer ctrl) |
| 4428 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4429 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4430 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4431 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4432 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4433 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4434 | * will take care of enabling the pin's input/output buffers as needed. |
| 4435 | * Therefore there's no need to enable the input buffer at this |
| 4436 | * stage. |
| 4437 | */ |
| 4438 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4439 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4440 | |
| 4441 | /* Mute capture amp left and right */ |
| 4442 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4443 | /* Set ADC connection select to match default mixer setting - mic |
| 4444 | * (on mic1 pin) |
| 4445 | */ |
| 4446 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4447 | |
| 4448 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4449 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4450 | */ |
| 4451 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4452 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4453 | |
| 4454 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4455 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4456 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4457 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4462 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4463 | |
| 4464 | { } |
| 4465 | }; |
| 4466 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4467 | static struct hda_verb alc260_will_verbs[] = { |
| 4468 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4469 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4470 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4471 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4472 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4473 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4474 | {} |
| 4475 | }; |
| 4476 | |
| 4477 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4478 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4479 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4480 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4481 | |
| 4482 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4483 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4484 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4485 | |
| 4486 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4487 | {} |
| 4488 | }; |
| 4489 | |
| 4490 | /* toggle speaker-output according to the hp-jack state */ |
| 4491 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4492 | { |
| 4493 | unsigned int present; |
| 4494 | |
| 4495 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4496 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4497 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4498 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4499 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4500 | AC_VERB_SET_GPIO_DATA, 1); |
| 4501 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4502 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4503 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4504 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4505 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4506 | AC_VERB_SET_GPIO_DATA, 0); |
| 4507 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4508 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4509 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4510 | } |
| 4511 | } |
| 4512 | |
| 4513 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4514 | unsigned int res) |
| 4515 | { |
| 4516 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4517 | alc260_replacer_672v_automute(codec); |
| 4518 | } |
| 4519 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4520 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4521 | * configuration. |
| 4522 | */ |
| 4523 | #ifdef CONFIG_SND_DEBUG |
| 4524 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4525 | 0x02, |
| 4526 | }; |
| 4527 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4528 | 0x04, 0x05, |
| 4529 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4530 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4531 | * the signal assignments are different. This assumes that the first ADC |
| 4532 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4533 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4534 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4535 | { |
| 4536 | .num_items = 7, |
| 4537 | .items = { |
| 4538 | { "MIC1 pin", 0x0 }, |
| 4539 | { "MIC2 pin", 0x1 }, |
| 4540 | { "LINE1 pin", 0x2 }, |
| 4541 | { "LINE2 pin", 0x3 }, |
| 4542 | { "CD pin", 0x4 }, |
| 4543 | { "LINE-OUT pin", 0x5 }, |
| 4544 | { "HP-OUT pin", 0x6 }, |
| 4545 | }, |
| 4546 | }, |
| 4547 | { |
| 4548 | .num_items = 8, |
| 4549 | .items = { |
| 4550 | { "MIC1 pin", 0x0 }, |
| 4551 | { "MIC2 pin", 0x1 }, |
| 4552 | { "LINE1 pin", 0x2 }, |
| 4553 | { "LINE2 pin", 0x3 }, |
| 4554 | { "CD pin", 0x4 }, |
| 4555 | { "Mixer", 0x5 }, |
| 4556 | { "LINE-OUT pin", 0x6 }, |
| 4557 | { "HP-OUT pin", 0x7 }, |
| 4558 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4559 | }, |
| 4560 | }; |
| 4561 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4562 | /* Output driver widgets */ |
| 4563 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4564 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4565 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4566 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4567 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4568 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4569 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4570 | /* Modes for retasking pin widgets |
| 4571 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4572 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4573 | * mention this restriction. At this stage it's not clear whether |
| 4574 | * this behaviour is intentional or is a hardware bug in chip |
| 4575 | * revisions available at least up until early 2006. Therefore for |
| 4576 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4577 | * choices, but if it turns out that the lack of mic bias for these |
| 4578 | * NIDs is intentional we could change their modes from |
| 4579 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4580 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4581 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4582 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4583 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4584 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4585 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4586 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4587 | |
| 4588 | /* Loopback mixer controls */ |
| 4589 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4590 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4591 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4592 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4593 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4594 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4595 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4596 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4597 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4598 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4599 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4600 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4601 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4602 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4603 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4604 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4605 | |
| 4606 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4607 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4608 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4609 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4610 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4611 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4612 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4613 | * is ambigious as to which NID is which; testing on laptops which |
| 4614 | * make this output available should provide clarification. |
| 4615 | */ |
| 4616 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4617 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4618 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4619 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4620 | * this output to turn on an external amplifier. |
| 4621 | */ |
| 4622 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4623 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4624 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4625 | { } /* end */ |
| 4626 | }; |
| 4627 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4628 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4629 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4630 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4631 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4632 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4633 | /* Enable retasking pins as output, initially without power amp */ |
| 4634 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4635 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4636 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4638 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4639 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4640 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4641 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4642 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4643 | * payload also sets the generation to 0, output to be in "consumer" |
| 4644 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4645 | * control. |
| 4646 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4647 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4648 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4649 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4650 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4651 | * OUT1 sum bus when acting as an output. |
| 4652 | */ |
| 4653 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4654 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4655 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4656 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4657 | |
| 4658 | /* Start with output sum widgets muted and their output gains at min */ |
| 4659 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4660 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4661 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4662 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4663 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4664 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4665 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4666 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4667 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4668 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4669 | /* Unmute retasking pin widget output buffers since the default |
| 4670 | * state appears to be output. As the pin mode is changed by the |
| 4671 | * user the pin mode control will take care of enabling the pin's |
| 4672 | * input/output buffers as needed. |
| 4673 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4674 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4675 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4676 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4677 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4678 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4679 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4680 | /* Also unmute the mono-out pin widget */ |
| 4681 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4682 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4683 | /* Mute capture amp left and right */ |
| 4684 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4685 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4686 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4687 | */ |
| 4688 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4689 | |
| 4690 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4691 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4692 | */ |
| 4693 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4694 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4695 | |
| 4696 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4698 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4700 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4701 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4702 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4703 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4704 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4705 | |
| 4706 | { } |
| 4707 | }; |
| 4708 | #endif |
| 4709 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4710 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4711 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4712 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4713 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4714 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4715 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4716 | /* |
| 4717 | * for BIOS auto-configuration |
| 4718 | */ |
| 4719 | |
| 4720 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4721 | const char *pfx) |
| 4722 | { |
| 4723 | hda_nid_t nid_vol; |
| 4724 | unsigned long vol_val, sw_val; |
| 4725 | char name[32]; |
| 4726 | int err; |
| 4727 | |
| 4728 | if (nid >= 0x0f && nid < 0x11) { |
| 4729 | nid_vol = nid - 0x7; |
| 4730 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4731 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4732 | } else if (nid == 0x11) { |
| 4733 | nid_vol = nid - 0x7; |
| 4734 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4735 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4736 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4737 | nid_vol = 0x08; |
| 4738 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4739 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4740 | } else |
| 4741 | return 0; /* N/A */ |
| 4742 | |
| 4743 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4744 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4745 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4746 | return err; |
| 4747 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4748 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4749 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4750 | return err; |
| 4751 | return 1; |
| 4752 | } |
| 4753 | |
| 4754 | /* add playback controls from the parsed DAC table */ |
| 4755 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4756 | const struct auto_pin_cfg *cfg) |
| 4757 | { |
| 4758 | hda_nid_t nid; |
| 4759 | int err; |
| 4760 | |
| 4761 | spec->multiout.num_dacs = 1; |
| 4762 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4763 | spec->multiout.dac_nids[0] = 0x02; |
| 4764 | |
| 4765 | nid = cfg->line_out_pins[0]; |
| 4766 | if (nid) { |
| 4767 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4768 | if (err < 0) |
| 4769 | return err; |
| 4770 | } |
| 4771 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4772 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4773 | if (nid) { |
| 4774 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4775 | if (err < 0) |
| 4776 | return err; |
| 4777 | } |
| 4778 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4779 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4780 | if (nid) { |
| 4781 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4782 | if (err < 0) |
| 4783 | return err; |
| 4784 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4785 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4786 | } |
| 4787 | |
| 4788 | /* create playback/capture controls for input pins */ |
| 4789 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4790 | const struct auto_pin_cfg *cfg) |
| 4791 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4792 | struct hda_input_mux *imux = &spec->private_imux; |
| 4793 | int i, err, idx; |
| 4794 | |
| 4795 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4796 | if (cfg->input_pins[i] >= 0x12) { |
| 4797 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4798 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4799 | auto_pin_cfg_labels[i], idx, |
| 4800 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4801 | if (err < 0) |
| 4802 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4803 | imux->items[imux->num_items].label = |
| 4804 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4805 | imux->items[imux->num_items].index = idx; |
| 4806 | imux->num_items++; |
| 4807 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4808 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4809 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4810 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4811 | auto_pin_cfg_labels[i], idx, |
| 4812 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4813 | if (err < 0) |
| 4814 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4815 | imux->items[imux->num_items].label = |
| 4816 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4817 | imux->items[imux->num_items].index = idx; |
| 4818 | imux->num_items++; |
| 4819 | } |
| 4820 | } |
| 4821 | return 0; |
| 4822 | } |
| 4823 | |
| 4824 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4825 | hda_nid_t nid, int pin_type, |
| 4826 | int sel_idx) |
| 4827 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4828 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4829 | /* need the manual connection? */ |
| 4830 | if (nid >= 0x12) { |
| 4831 | int idx = nid - 0x12; |
| 4832 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4833 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4834 | } |
| 4835 | } |
| 4836 | |
| 4837 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4838 | { |
| 4839 | struct alc_spec *spec = codec->spec; |
| 4840 | hda_nid_t nid; |
| 4841 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4842 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4843 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4844 | if (nid) { |
| 4845 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4846 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4847 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4848 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4849 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4850 | if (nid) |
| 4851 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4852 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4853 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4854 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4855 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4856 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4857 | |
| 4858 | #define ALC260_PIN_CD_NID 0x16 |
| 4859 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4860 | { |
| 4861 | struct alc_spec *spec = codec->spec; |
| 4862 | int i; |
| 4863 | |
| 4864 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4865 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4866 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4867 | snd_hda_codec_write(codec, nid, 0, |
| 4868 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4869 | i <= AUTO_PIN_FRONT_MIC ? |
| 4870 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4871 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4872 | snd_hda_codec_write(codec, nid, 0, |
| 4873 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4874 | AMP_OUT_MUTE); |
| 4875 | } |
| 4876 | } |
| 4877 | } |
| 4878 | |
| 4879 | /* |
| 4880 | * generic initialization of ADC, input mixers and output mixers |
| 4881 | */ |
| 4882 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4883 | /* |
| 4884 | * Unmute ADC0-1 and set the default input to mic-in |
| 4885 | */ |
| 4886 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4887 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4888 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4889 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4890 | |
| 4891 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4892 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4893 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4894 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4895 | */ |
| 4896 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4897 | /* mute analog inputs */ |
| 4898 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4900 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4901 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4902 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4903 | |
| 4904 | /* |
| 4905 | * Set up output mixers (0x08 - 0x0a) |
| 4906 | */ |
| 4907 | /* set vol=0 to output mixers */ |
| 4908 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4909 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4910 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4911 | /* set up input amps for analog loopback */ |
| 4912 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4913 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4914 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4915 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4916 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4917 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4918 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4919 | |
| 4920 | { } |
| 4921 | }; |
| 4922 | |
| 4923 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4924 | { |
| 4925 | struct alc_spec *spec = codec->spec; |
| 4926 | unsigned int wcap; |
| 4927 | int err; |
| 4928 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4929 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4930 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4931 | alc260_ignore); |
| 4932 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4933 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4934 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4935 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4936 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4937 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4938 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4939 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4940 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4941 | return err; |
| 4942 | |
| 4943 | spec->multiout.max_channels = 2; |
| 4944 | |
| 4945 | if (spec->autocfg.dig_out_pin) |
| 4946 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4947 | if (spec->kctl_alloc) |
| 4948 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4949 | |
| 4950 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4951 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4952 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4953 | spec->input_mux = &spec->private_imux; |
| 4954 | |
| 4955 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4956 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4957 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 4958 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4959 | spec->adc_nids = alc260_adc_nids_alt; |
| 4960 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4961 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4962 | } else { |
| 4963 | spec->adc_nids = alc260_adc_nids; |
| 4964 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4965 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4966 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4967 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4968 | |
| 4969 | return 1; |
| 4970 | } |
| 4971 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4972 | /* additional initialization for auto-configuration model */ |
| 4973 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4974 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4975 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4976 | alc260_auto_init_multi_out(codec); |
| 4977 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4978 | if (spec->unsol_event) |
| 4979 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4980 | } |
| 4981 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4982 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4983 | static struct hda_amp_list alc260_loopbacks[] = { |
| 4984 | { 0x07, HDA_INPUT, 0 }, |
| 4985 | { 0x07, HDA_INPUT, 1 }, |
| 4986 | { 0x07, HDA_INPUT, 2 }, |
| 4987 | { 0x07, HDA_INPUT, 3 }, |
| 4988 | { 0x07, HDA_INPUT, 4 }, |
| 4989 | { } /* end */ |
| 4990 | }; |
| 4991 | #endif |
| 4992 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4993 | /* |
| 4994 | * ALC260 configurations |
| 4995 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4996 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4997 | [ALC260_BASIC] = "basic", |
| 4998 | [ALC260_HP] = "hp", |
| 4999 | [ALC260_HP_3013] = "hp-3013", |
| 5000 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5001 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5002 | [ALC260_WILL] = "will", |
| 5003 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5004 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5005 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5006 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5007 | [ALC260_AUTO] = "auto", |
| 5008 | }; |
| 5009 | |
| 5010 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5011 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5012 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5013 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5014 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5015 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 5016 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 5017 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 5018 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5019 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5020 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5021 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5022 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5023 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5024 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5025 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5026 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5027 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5028 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5029 | {} |
| 5030 | }; |
| 5031 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5032 | static struct alc_config_preset alc260_presets[] = { |
| 5033 | [ALC260_BASIC] = { |
| 5034 | .mixers = { alc260_base_output_mixer, |
| 5035 | alc260_input_mixer, |
| 5036 | alc260_pc_beep_mixer, |
| 5037 | alc260_capture_mixer }, |
| 5038 | .init_verbs = { alc260_init_verbs }, |
| 5039 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5040 | .dac_nids = alc260_dac_nids, |
| 5041 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5042 | .adc_nids = alc260_adc_nids, |
| 5043 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5044 | .channel_mode = alc260_modes, |
| 5045 | .input_mux = &alc260_capture_source, |
| 5046 | }, |
| 5047 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5048 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5049 | alc260_input_mixer, |
| 5050 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5051 | .init_verbs = { alc260_init_verbs, |
| 5052 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5053 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5054 | .dac_nids = alc260_dac_nids, |
| 5055 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5056 | .adc_nids = alc260_hp_adc_nids, |
| 5057 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5058 | .channel_mode = alc260_modes, |
| 5059 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5060 | .unsol_event = alc260_hp_unsol_event, |
| 5061 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5062 | }, |
| 5063 | [ALC260_HP_3013] = { |
| 5064 | .mixers = { alc260_hp_3013_mixer, |
| 5065 | alc260_input_mixer, |
| 5066 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5067 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5068 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5069 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5070 | .dac_nids = alc260_dac_nids, |
| 5071 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5072 | .adc_nids = alc260_hp_adc_nids, |
| 5073 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5074 | .channel_mode = alc260_modes, |
| 5075 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5076 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5077 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5078 | }, |
| 5079 | [ALC260_FUJITSU_S702X] = { |
| 5080 | .mixers = { alc260_fujitsu_mixer, |
| 5081 | alc260_capture_mixer }, |
| 5082 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5083 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5084 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5085 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5086 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5087 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5088 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5089 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5090 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5091 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5092 | [ALC260_ACER] = { |
| 5093 | .mixers = { alc260_acer_mixer, |
| 5094 | alc260_capture_mixer }, |
| 5095 | .init_verbs = { alc260_acer_init_verbs }, |
| 5096 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5097 | .dac_nids = alc260_dac_nids, |
| 5098 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5099 | .adc_nids = alc260_dual_adc_nids, |
| 5100 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5101 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5102 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5103 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5104 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5105 | [ALC260_WILL] = { |
| 5106 | .mixers = { alc260_will_mixer, |
| 5107 | alc260_capture_mixer }, |
| 5108 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5109 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5110 | .dac_nids = alc260_dac_nids, |
| 5111 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5112 | .adc_nids = alc260_adc_nids, |
| 5113 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5114 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5115 | .channel_mode = alc260_modes, |
| 5116 | .input_mux = &alc260_capture_source, |
| 5117 | }, |
| 5118 | [ALC260_REPLACER_672V] = { |
| 5119 | .mixers = { alc260_replacer_672v_mixer, |
| 5120 | alc260_capture_mixer }, |
| 5121 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5122 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5123 | .dac_nids = alc260_dac_nids, |
| 5124 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5125 | .adc_nids = alc260_adc_nids, |
| 5126 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5127 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5128 | .channel_mode = alc260_modes, |
| 5129 | .input_mux = &alc260_capture_source, |
| 5130 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5131 | .init_hook = alc260_replacer_672v_automute, |
| 5132 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5133 | #ifdef CONFIG_SND_DEBUG |
| 5134 | [ALC260_TEST] = { |
| 5135 | .mixers = { alc260_test_mixer, |
| 5136 | alc260_capture_mixer }, |
| 5137 | .init_verbs = { alc260_test_init_verbs }, |
| 5138 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5139 | .dac_nids = alc260_test_dac_nids, |
| 5140 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5141 | .adc_nids = alc260_test_adc_nids, |
| 5142 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5143 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5144 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5145 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5146 | }, |
| 5147 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5148 | }; |
| 5149 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5150 | static int patch_alc260(struct hda_codec *codec) |
| 5151 | { |
| 5152 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5153 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5154 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5155 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5156 | if (spec == NULL) |
| 5157 | return -ENOMEM; |
| 5158 | |
| 5159 | codec->spec = spec; |
| 5160 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5161 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5162 | alc260_models, |
| 5163 | alc260_cfg_tbl); |
| 5164 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5165 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5166 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5167 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5168 | } |
| 5169 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5170 | if (board_config == ALC260_AUTO) { |
| 5171 | /* automatic parse from the BIOS config */ |
| 5172 | err = alc260_parse_auto_config(codec); |
| 5173 | if (err < 0) { |
| 5174 | alc_free(codec); |
| 5175 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5176 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5177 | printk(KERN_INFO |
| 5178 | "hda_codec: Cannot set up configuration " |
| 5179 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5180 | board_config = ALC260_BASIC; |
| 5181 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5182 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5183 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5184 | if (board_config != ALC260_AUTO) |
| 5185 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5186 | |
| 5187 | spec->stream_name_analog = "ALC260 Analog"; |
| 5188 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5189 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5190 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5191 | spec->stream_name_digital = "ALC260 Digital"; |
| 5192 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5193 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5194 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5195 | spec->vmaster_nid = 0x08; |
| 5196 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5197 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5198 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5199 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5200 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5201 | if (!spec->loopback.amplist) |
| 5202 | spec->loopback.amplist = alc260_loopbacks; |
| 5203 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5204 | |
| 5205 | return 0; |
| 5206 | } |
| 5207 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5208 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5209 | /* |
| 5210 | * ALC882 support |
| 5211 | * |
| 5212 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5213 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5214 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5215 | * 6-channel independent captures. |
| 5216 | * |
| 5217 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5218 | * driver yet). |
| 5219 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5220 | #define ALC882_DIGOUT_NID 0x06 |
| 5221 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5222 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5223 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5224 | { 8, NULL } |
| 5225 | }; |
| 5226 | |
| 5227 | static hda_nid_t alc882_dac_nids[4] = { |
| 5228 | /* front, rear, clfe, rear_surr */ |
| 5229 | 0x02, 0x03, 0x04, 0x05 |
| 5230 | }; |
| 5231 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5232 | /* identical with ALC880 */ |
| 5233 | #define alc882_adc_nids alc880_adc_nids |
| 5234 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5235 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5236 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5237 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5238 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5239 | /* input MUX */ |
| 5240 | /* FIXME: should be a matrix-type input source selection */ |
| 5241 | |
| 5242 | static struct hda_input_mux alc882_capture_source = { |
| 5243 | .num_items = 4, |
| 5244 | .items = { |
| 5245 | { "Mic", 0x0 }, |
| 5246 | { "Front Mic", 0x1 }, |
| 5247 | { "Line", 0x2 }, |
| 5248 | { "CD", 0x4 }, |
| 5249 | }, |
| 5250 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5251 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5252 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5253 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5254 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5255 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5256 | { |
| 5257 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5258 | struct alc_spec *spec = codec->spec; |
| 5259 | const struct hda_input_mux *imux = spec->input_mux; |
| 5260 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5261 | hda_nid_t nid = spec->capsrc_nids ? |
| 5262 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5263 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5264 | unsigned int i, idx; |
| 5265 | |
| 5266 | idx = ucontrol->value.enumerated.item[0]; |
| 5267 | if (idx >= imux->num_items) |
| 5268 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5269 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5270 | return 0; |
| 5271 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5272 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5273 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5274 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5275 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5276 | } |
| 5277 | *cur_val = idx; |
| 5278 | return 1; |
| 5279 | } |
| 5280 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5281 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5282 | * 2ch mode |
| 5283 | */ |
| 5284 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5285 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5286 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5287 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5288 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5289 | { } /* end */ |
| 5290 | }; |
| 5291 | |
| 5292 | /* |
| 5293 | * 6ch mode |
| 5294 | */ |
| 5295 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5296 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5297 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5298 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5299 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5300 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5301 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5302 | { } /* end */ |
| 5303 | }; |
| 5304 | |
| 5305 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5306 | { 2, alc882_3ST_ch2_init }, |
| 5307 | { 6, alc882_3ST_ch6_init }, |
| 5308 | }; |
| 5309 | |
| 5310 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5311 | * 6ch mode |
| 5312 | */ |
| 5313 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5314 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5315 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5316 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5317 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5318 | { } /* end */ |
| 5319 | }; |
| 5320 | |
| 5321 | /* |
| 5322 | * 8ch mode |
| 5323 | */ |
| 5324 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5325 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5326 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5327 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5328 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5329 | { } /* end */ |
| 5330 | }; |
| 5331 | |
| 5332 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5333 | { 6, alc882_sixstack_ch6_init }, |
| 5334 | { 8, alc882_sixstack_ch8_init }, |
| 5335 | }; |
| 5336 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5337 | /* |
| 5338 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5339 | */ |
| 5340 | |
| 5341 | /* |
| 5342 | * 2ch mode |
| 5343 | */ |
| 5344 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5345 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5346 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5347 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5348 | { } /* end */ |
| 5349 | }; |
| 5350 | |
| 5351 | /* |
| 5352 | * 6ch mode |
| 5353 | */ |
| 5354 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5355 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5356 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5357 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5358 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5359 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5360 | { } /* end */ |
| 5361 | }; |
| 5362 | |
| 5363 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5364 | { 2, alc885_mbp_ch2_init }, |
| 5365 | { 6, alc885_mbp_ch6_init }, |
| 5366 | }; |
| 5367 | |
| 5368 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5369 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5370 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5371 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5372 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5373 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5374 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5375 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5376 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5377 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5378 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5379 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5380 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5381 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5382 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5383 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5384 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5385 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5386 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5387 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5388 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5389 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5390 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5391 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5392 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5393 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5394 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5395 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5396 | { } /* end */ |
| 5397 | }; |
| 5398 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5399 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5400 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5401 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5402 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5403 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5404 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5405 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5406 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5407 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5408 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5409 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5410 | { } /* end */ |
| 5411 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5412 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5413 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5414 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5415 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5416 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5417 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5418 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5419 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5420 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5421 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5422 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5423 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5424 | { } /* end */ |
| 5425 | }; |
| 5426 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5427 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5428 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5429 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5430 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5431 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5432 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5433 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5434 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5435 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5436 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5437 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5438 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5439 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5440 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5441 | { } /* end */ |
| 5442 | }; |
| 5443 | |
| 5444 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5445 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5446 | */ |
| 5447 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5448 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5449 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5450 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5451 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5452 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5453 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5454 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5455 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5456 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5457 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5458 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5459 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5460 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5461 | { } /* end */ |
| 5462 | }; |
| 5463 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5464 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5465 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5466 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5467 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5468 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5469 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5470 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5471 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5472 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5473 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5474 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5475 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5476 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5477 | { } /* end */ |
| 5478 | }; |
| 5479 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5480 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5481 | { |
| 5482 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5483 | .name = "Channel Mode", |
| 5484 | .info = alc_ch_mode_info, |
| 5485 | .get = alc_ch_mode_get, |
| 5486 | .put = alc_ch_mode_put, |
| 5487 | }, |
| 5488 | { } /* end */ |
| 5489 | }; |
| 5490 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5491 | static struct hda_verb alc882_init_verbs[] = { |
| 5492 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5493 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5494 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5495 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5496 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5497 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5498 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5499 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5500 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5501 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5502 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5503 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5504 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5505 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5506 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5507 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5508 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5509 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5510 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5511 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5512 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5513 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5514 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5515 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5516 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5517 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5518 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5519 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5520 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5521 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5522 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5523 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5524 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5525 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5526 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5527 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5528 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5529 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5530 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5531 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5532 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5533 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5534 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5535 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5536 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5537 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5538 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5539 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5540 | |
| 5541 | /* FIXME: use matrix-type input source selection */ |
| 5542 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5543 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5544 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5545 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5546 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5547 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5548 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5549 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5550 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5551 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5552 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5553 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5554 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5555 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5556 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5557 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5558 | /* ADC1: mute amp left and right */ |
| 5559 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5560 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5561 | /* ADC2: mute amp left and right */ |
| 5562 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5563 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5564 | /* ADC3: mute amp left and right */ |
| 5565 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5566 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5567 | |
| 5568 | { } |
| 5569 | }; |
| 5570 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5571 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5572 | /* change to EAPD mode */ |
| 5573 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5574 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5575 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5576 | }; |
| 5577 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5578 | /* Mac Pro test */ |
| 5579 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5580 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5581 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5582 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5583 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5584 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5585 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5586 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5587 | { } /* end */ |
| 5588 | }; |
| 5589 | |
| 5590 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5591 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5593 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5594 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5595 | /* Front Pin: output 0 (0x0c) */ |
| 5596 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5597 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5598 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5599 | /* Front Mic pin: input vref at 80% */ |
| 5600 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5601 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5602 | /* Speaker: output */ |
| 5603 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5604 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5605 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5606 | /* Headphone output (output 0 - 0x0c) */ |
| 5607 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5608 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5609 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5610 | |
| 5611 | /* FIXME: use matrix-type input source selection */ |
| 5612 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5613 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5614 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5615 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5616 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5617 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5618 | /* Input mixer2 */ |
| 5619 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5620 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5621 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5622 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5623 | /* Input mixer3 */ |
| 5624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5625 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5626 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5627 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5628 | /* ADC1: mute amp left and right */ |
| 5629 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5630 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5631 | /* ADC2: mute amp left and right */ |
| 5632 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5633 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5634 | /* ADC3: mute amp left and right */ |
| 5635 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5636 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5637 | |
| 5638 | { } |
| 5639 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5640 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5641 | /* Macbook Pro rev3 */ |
| 5642 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5643 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5644 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5645 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5646 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5647 | /* Rear mixer */ |
| 5648 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5649 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5650 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5651 | /* Front Pin: output 0 (0x0c) */ |
| 5652 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5653 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5654 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5655 | /* HP Pin: output 0 (0x0d) */ |
| 5656 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5657 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5658 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5659 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5660 | /* Mic (rear) pin: input vref at 80% */ |
| 5661 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5662 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5663 | /* Front Mic pin: input vref at 80% */ |
| 5664 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5665 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5666 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5667 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5668 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5669 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5670 | |
| 5671 | /* FIXME: use matrix-type input source selection */ |
| 5672 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5673 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5674 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5675 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5676 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5677 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5678 | /* Input mixer2 */ |
| 5679 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5680 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5681 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5682 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5683 | /* Input mixer3 */ |
| 5684 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5685 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5686 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5687 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5688 | /* ADC1: mute amp left and right */ |
| 5689 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5690 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5691 | /* ADC2: mute amp left and right */ |
| 5692 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5693 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5694 | /* ADC3: mute amp left and right */ |
| 5695 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5696 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5697 | |
| 5698 | { } |
| 5699 | }; |
| 5700 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5701 | /* iMac 24 mixer. */ |
| 5702 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5703 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5704 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5705 | { } /* end */ |
| 5706 | }; |
| 5707 | |
| 5708 | /* iMac 24 init verbs. */ |
| 5709 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5710 | /* Internal speakers: output 0 (0x0c) */ |
| 5711 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5712 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5713 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5714 | /* Internal speakers: output 0 (0x0c) */ |
| 5715 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5716 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5717 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5718 | /* Headphone: output 0 (0x0c) */ |
| 5719 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5720 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5721 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5722 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5723 | /* Front Mic: input vref at 80% */ |
| 5724 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5725 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5726 | { } |
| 5727 | }; |
| 5728 | |
| 5729 | /* Toggle speaker-output according to the hp-jack state */ |
| 5730 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5731 | { |
| 5732 | unsigned int present; |
| 5733 | |
| 5734 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5735 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5736 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5737 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5738 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5739 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5740 | } |
| 5741 | |
| 5742 | /* Processes unsolicited events. */ |
| 5743 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5744 | unsigned int res) |
| 5745 | { |
| 5746 | /* Headphone insertion or removal. */ |
| 5747 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5748 | alc885_imac24_automute(codec); |
| 5749 | } |
| 5750 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5751 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5752 | { |
| 5753 | unsigned int present; |
| 5754 | |
| 5755 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5756 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5757 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5758 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5759 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5760 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5761 | |
| 5762 | } |
| 5763 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5764 | unsigned int res) |
| 5765 | { |
| 5766 | /* Headphone insertion or removal. */ |
| 5767 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5768 | alc885_mbp3_automute(codec); |
| 5769 | } |
| 5770 | |
| 5771 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5772 | static struct hda_verb alc882_targa_verbs[] = { |
| 5773 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5774 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5775 | |
| 5776 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5777 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5778 | |
| 5779 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5780 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5781 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5782 | |
| 5783 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5784 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5785 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5786 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5787 | { } /* end */ |
| 5788 | }; |
| 5789 | |
| 5790 | /* toggle speaker-output according to the hp-jack state */ |
| 5791 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5792 | { |
| 5793 | unsigned int present; |
| 5794 | |
| 5795 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5796 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5797 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5798 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5799 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5800 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5801 | } |
| 5802 | |
| 5803 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5804 | { |
| 5805 | /* Looks like the unsol event is incompatible with the standard |
| 5806 | * definition. 4bit tag is placed at 26 bit! |
| 5807 | */ |
| 5808 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5809 | alc882_targa_automute(codec); |
| 5810 | } |
| 5811 | } |
| 5812 | |
| 5813 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5814 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5815 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5816 | |
| 5817 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5818 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5819 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5820 | |
| 5821 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5822 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5823 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5824 | |
| 5825 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5826 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5827 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5828 | { } /* end */ |
| 5829 | }; |
| 5830 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5831 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5832 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5833 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5834 | |
| 5835 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5836 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5837 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5838 | |
| 5839 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5840 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5841 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5842 | |
| 5843 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5844 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5845 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5846 | { } /* end */ |
| 5847 | }; |
| 5848 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5849 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5850 | { |
| 5851 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5852 | |
| 5853 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5854 | AC_VERB_GET_GPIO_DATA, 0); |
| 5855 | |
| 5856 | if (!muted) |
| 5857 | gpiostate |= (1 << pin); |
| 5858 | else |
| 5859 | gpiostate &= ~(1 << pin); |
| 5860 | |
| 5861 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5862 | AC_VERB_GET_GPIO_MASK, 0); |
| 5863 | gpiomask |= (1 << pin); |
| 5864 | |
| 5865 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5866 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5867 | gpiodir |= (1 << pin); |
| 5868 | |
| 5869 | |
| 5870 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5871 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5872 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5873 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5874 | |
| 5875 | msleep(1); |
| 5876 | |
| 5877 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5878 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5879 | } |
| 5880 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5881 | /* set up GPIO at initialization */ |
| 5882 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5883 | { |
| 5884 | alc882_gpio_mute(codec, 0, 0); |
| 5885 | alc882_gpio_mute(codec, 1, 0); |
| 5886 | } |
| 5887 | |
| 5888 | /* set up GPIO and update auto-muting at initialization */ |
| 5889 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5890 | { |
| 5891 | alc885_macpro_init_hook(codec); |
| 5892 | alc885_imac24_automute(codec); |
| 5893 | } |
| 5894 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5895 | /* |
| 5896 | * generic initialization of ADC, input mixers and output mixers |
| 5897 | */ |
| 5898 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5899 | /* |
| 5900 | * Unmute ADC0-2 and set the default input to mic-in |
| 5901 | */ |
| 5902 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5903 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5904 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5905 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5906 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5907 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5908 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5909 | /* 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] | 5910 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5911 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5912 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5913 | */ |
| 5914 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5915 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5916 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5917 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5918 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5919 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5920 | |
| 5921 | /* |
| 5922 | * Set up output mixers (0x0c - 0x0f) |
| 5923 | */ |
| 5924 | /* set vol=0 to output mixers */ |
| 5925 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5926 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5927 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5928 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5929 | /* set up input amps for analog loopback */ |
| 5930 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5931 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5932 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5933 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5934 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5935 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5936 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5937 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5938 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5939 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5940 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5941 | |
| 5942 | /* FIXME: use matrix-type input source selection */ |
| 5943 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5944 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5945 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5946 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5947 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5948 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5949 | /* Input mixer2 */ |
| 5950 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5951 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5952 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5953 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5954 | /* Input mixer3 */ |
| 5955 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5956 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5957 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5958 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5959 | |
| 5960 | { } |
| 5961 | }; |
| 5962 | |
| 5963 | /* capture mixer elements */ |
| 5964 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5965 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5966 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5967 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5968 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5969 | { |
| 5970 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5971 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5972 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5973 | */ |
| 5974 | /* .name = "Capture Source", */ |
| 5975 | .name = "Input Source", |
| 5976 | .count = 2, |
| 5977 | .info = alc882_mux_enum_info, |
| 5978 | .get = alc882_mux_enum_get, |
| 5979 | .put = alc882_mux_enum_put, |
| 5980 | }, |
| 5981 | { } /* end */ |
| 5982 | }; |
| 5983 | |
| 5984 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5985 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5986 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5987 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5988 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5989 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5990 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5991 | { |
| 5992 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5993 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5994 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5995 | */ |
| 5996 | /* .name = "Capture Source", */ |
| 5997 | .name = "Input Source", |
| 5998 | .count = 3, |
| 5999 | .info = alc882_mux_enum_info, |
| 6000 | .get = alc882_mux_enum_get, |
| 6001 | .put = alc882_mux_enum_put, |
| 6002 | }, |
| 6003 | { } /* end */ |
| 6004 | }; |
| 6005 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6006 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6007 | #define alc882_loopbacks alc880_loopbacks |
| 6008 | #endif |
| 6009 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6010 | /* pcm configuration: identiacal with ALC880 */ |
| 6011 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6012 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6013 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6014 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6015 | |
| 6016 | /* |
| 6017 | * configuration and preset |
| 6018 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6019 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6020 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6021 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6022 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6023 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6024 | [ALC882_TARGA] = "targa", |
| 6025 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6026 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6027 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6028 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6029 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6030 | [ALC882_AUTO] = "auto", |
| 6031 | }; |
| 6032 | |
| 6033 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6034 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6035 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6036 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6037 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6038 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6039 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6040 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6041 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6042 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6043 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6044 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6045 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6046 | {} |
| 6047 | }; |
| 6048 | |
| 6049 | static struct alc_config_preset alc882_presets[] = { |
| 6050 | [ALC882_3ST_DIG] = { |
| 6051 | .mixers = { alc882_base_mixer }, |
| 6052 | .init_verbs = { alc882_init_verbs }, |
| 6053 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6054 | .dac_nids = alc882_dac_nids, |
| 6055 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6056 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6057 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6058 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6059 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6060 | .input_mux = &alc882_capture_source, |
| 6061 | }, |
| 6062 | [ALC882_6ST_DIG] = { |
| 6063 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6064 | .init_verbs = { alc882_init_verbs }, |
| 6065 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6066 | .dac_nids = alc882_dac_nids, |
| 6067 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6068 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6069 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6070 | .channel_mode = alc882_sixstack_modes, |
| 6071 | .input_mux = &alc882_capture_source, |
| 6072 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6073 | [ALC882_ARIMA] = { |
| 6074 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6075 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6076 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6077 | .dac_nids = alc882_dac_nids, |
| 6078 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6079 | .channel_mode = alc882_sixstack_modes, |
| 6080 | .input_mux = &alc882_capture_source, |
| 6081 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6082 | [ALC882_W2JC] = { |
| 6083 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6084 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6085 | alc880_gpio1_init_verbs }, |
| 6086 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6087 | .dac_nids = alc882_dac_nids, |
| 6088 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6089 | .channel_mode = alc880_threestack_modes, |
| 6090 | .need_dac_fix = 1, |
| 6091 | .input_mux = &alc882_capture_source, |
| 6092 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6093 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6094 | [ALC885_MBP3] = { |
| 6095 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6096 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6097 | alc880_gpio1_init_verbs }, |
| 6098 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6099 | .dac_nids = alc882_dac_nids, |
| 6100 | .channel_mode = alc885_mbp_6ch_modes, |
| 6101 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6102 | .input_mux = &alc882_capture_source, |
| 6103 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6104 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6105 | .unsol_event = alc885_mbp3_unsol_event, |
| 6106 | .init_hook = alc885_mbp3_automute, |
| 6107 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6108 | [ALC885_MACPRO] = { |
| 6109 | .mixers = { alc882_macpro_mixer }, |
| 6110 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6111 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6112 | .dac_nids = alc882_dac_nids, |
| 6113 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6114 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6115 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6116 | .channel_mode = alc882_ch_modes, |
| 6117 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6118 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6119 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6120 | [ALC885_IMAC24] = { |
| 6121 | .mixers = { alc885_imac24_mixer }, |
| 6122 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6123 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6124 | .dac_nids = alc882_dac_nids, |
| 6125 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6126 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6127 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6128 | .channel_mode = alc882_ch_modes, |
| 6129 | .input_mux = &alc882_capture_source, |
| 6130 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6131 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6132 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6133 | [ALC882_TARGA] = { |
| 6134 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6135 | alc882_capture_mixer }, |
| 6136 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6137 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6138 | .dac_nids = alc882_dac_nids, |
| 6139 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6140 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6141 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6142 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6143 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6144 | .channel_mode = alc882_3ST_6ch_modes, |
| 6145 | .need_dac_fix = 1, |
| 6146 | .input_mux = &alc882_capture_source, |
| 6147 | .unsol_event = alc882_targa_unsol_event, |
| 6148 | .init_hook = alc882_targa_automute, |
| 6149 | }, |
| 6150 | [ALC882_ASUS_A7J] = { |
| 6151 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6152 | alc882_capture_mixer }, |
| 6153 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6154 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6155 | .dac_nids = alc882_dac_nids, |
| 6156 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6157 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6158 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6159 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6160 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6161 | .channel_mode = alc882_3ST_6ch_modes, |
| 6162 | .need_dac_fix = 1, |
| 6163 | .input_mux = &alc882_capture_source, |
| 6164 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6165 | [ALC882_ASUS_A7M] = { |
| 6166 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6167 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6168 | alc880_gpio1_init_verbs, |
| 6169 | alc882_asus_a7m_verbs }, |
| 6170 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6171 | .dac_nids = alc882_dac_nids, |
| 6172 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6173 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6174 | .channel_mode = alc880_threestack_modes, |
| 6175 | .need_dac_fix = 1, |
| 6176 | .input_mux = &alc882_capture_source, |
| 6177 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6178 | }; |
| 6179 | |
| 6180 | |
| 6181 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6182 | * Pin config fixes |
| 6183 | */ |
| 6184 | enum { |
| 6185 | PINFIX_ABIT_AW9D_MAX |
| 6186 | }; |
| 6187 | |
| 6188 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6189 | { 0x15, 0x01080104 }, /* side */ |
| 6190 | { 0x16, 0x01011012 }, /* rear */ |
| 6191 | { 0x17, 0x01016011 }, /* clfe */ |
| 6192 | { } |
| 6193 | }; |
| 6194 | |
| 6195 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6196 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6197 | }; |
| 6198 | |
| 6199 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6200 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6201 | {} |
| 6202 | }; |
| 6203 | |
| 6204 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6205 | * BIOS auto configuration |
| 6206 | */ |
| 6207 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6208 | hda_nid_t nid, int pin_type, |
| 6209 | int dac_idx) |
| 6210 | { |
| 6211 | /* set as output */ |
| 6212 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6213 | int idx; |
| 6214 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6215 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6216 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6217 | idx = 4; |
| 6218 | else |
| 6219 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6220 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6221 | |
| 6222 | } |
| 6223 | |
| 6224 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6225 | { |
| 6226 | struct alc_spec *spec = codec->spec; |
| 6227 | int i; |
| 6228 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6229 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6230 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6231 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6232 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6233 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6234 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6235 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6236 | } |
| 6237 | } |
| 6238 | |
| 6239 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6240 | { |
| 6241 | struct alc_spec *spec = codec->spec; |
| 6242 | hda_nid_t pin; |
| 6243 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6244 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6245 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6246 | /* use dac 0 */ |
| 6247 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6248 | pin = spec->autocfg.speaker_pins[0]; |
| 6249 | if (pin) |
| 6250 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6251 | } |
| 6252 | |
| 6253 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6254 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6255 | |
| 6256 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6257 | { |
| 6258 | struct alc_spec *spec = codec->spec; |
| 6259 | int i; |
| 6260 | |
| 6261 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6262 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6263 | unsigned int vref; |
| 6264 | if (!nid) |
| 6265 | continue; |
| 6266 | vref = PIN_IN; |
| 6267 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
| 6268 | if (snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) & |
| 6269 | AC_PINCAP_VREF_80) |
| 6270 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6271 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6272 | snd_hda_codec_write(codec, nid, 0, |
| 6273 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6274 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6275 | snd_hda_codec_write(codec, nid, 0, |
| 6276 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6277 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6278 | } |
| 6279 | } |
| 6280 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6281 | /* add mic boosts if needed */ |
| 6282 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6283 | { |
| 6284 | struct alc_spec *spec = codec->spec; |
| 6285 | int err; |
| 6286 | hda_nid_t nid; |
| 6287 | |
| 6288 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6289 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6290 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6291 | "Mic Boost", |
| 6292 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6293 | if (err < 0) |
| 6294 | return err; |
| 6295 | } |
| 6296 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6297 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6298 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6299 | "Front Mic Boost", |
| 6300 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6301 | if (err < 0) |
| 6302 | return err; |
| 6303 | } |
| 6304 | return 0; |
| 6305 | } |
| 6306 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6307 | /* almost identical with ALC880 parser... */ |
| 6308 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6309 | { |
| 6310 | struct alc_spec *spec = codec->spec; |
| 6311 | int err = alc880_parse_auto_config(codec); |
| 6312 | |
| 6313 | if (err < 0) |
| 6314 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6315 | else if (!err) |
| 6316 | return 0; /* no config found */ |
| 6317 | |
| 6318 | err = alc_auto_add_mic_boost(codec); |
| 6319 | if (err < 0) |
| 6320 | return err; |
| 6321 | |
| 6322 | /* hack - override the init verbs */ |
| 6323 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6324 | |
| 6325 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6326 | } |
| 6327 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6328 | /* additional initialization for auto-configuration model */ |
| 6329 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6330 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6331 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6332 | alc882_auto_init_multi_out(codec); |
| 6333 | alc882_auto_init_hp_out(codec); |
| 6334 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6335 | if (spec->unsol_event) |
| 6336 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6337 | } |
| 6338 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6339 | static int patch_alc882(struct hda_codec *codec) |
| 6340 | { |
| 6341 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6342 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6343 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6344 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6345 | if (spec == NULL) |
| 6346 | return -ENOMEM; |
| 6347 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6348 | codec->spec = spec; |
| 6349 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6350 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6351 | alc882_models, |
| 6352 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6353 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6354 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6355 | /* Pick up systems that don't supply PCI SSID */ |
| 6356 | switch (codec->subsystem_id) { |
| 6357 | case 0x106b0c00: /* Mac Pro */ |
| 6358 | board_config = ALC885_MACPRO; |
| 6359 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6360 | case 0x106b1000: /* iMac 24 */ |
| 6361 | board_config = ALC885_IMAC24; |
| 6362 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame] | 6363 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6364 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6365 | board_config = ALC885_MBP3; |
| 6366 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6367 | default: |
| 6368 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6369 | "trying auto-probe from BIOS...\n"); |
| 6370 | board_config = ALC882_AUTO; |
| 6371 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6372 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6373 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6374 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6375 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6376 | if (board_config == ALC882_AUTO) { |
| 6377 | /* automatic parse from the BIOS config */ |
| 6378 | err = alc882_parse_auto_config(codec); |
| 6379 | if (err < 0) { |
| 6380 | alc_free(codec); |
| 6381 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6382 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6383 | printk(KERN_INFO |
| 6384 | "hda_codec: Cannot set up configuration " |
| 6385 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6386 | board_config = ALC882_3ST_DIG; |
| 6387 | } |
| 6388 | } |
| 6389 | |
| 6390 | if (board_config != ALC882_AUTO) |
| 6391 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6392 | |
| 6393 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6394 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6395 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6396 | /* FIXME: setup DAC5 */ |
| 6397 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6398 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6399 | |
| 6400 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6401 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6402 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6403 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6404 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6405 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6406 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6407 | /* get type */ |
| 6408 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6409 | if (wcap != AC_WID_AUD_IN) { |
| 6410 | spec->adc_nids = alc882_adc_nids_alt; |
| 6411 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6412 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6413 | spec->mixers[spec->num_mixers] = |
| 6414 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6415 | spec->num_mixers++; |
| 6416 | } else { |
| 6417 | spec->adc_nids = alc882_adc_nids; |
| 6418 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6419 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6420 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6421 | spec->num_mixers++; |
| 6422 | } |
| 6423 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6424 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6425 | spec->vmaster_nid = 0x0c; |
| 6426 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6427 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6428 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6429 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6430 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6431 | if (!spec->loopback.amplist) |
| 6432 | spec->loopback.amplist = alc882_loopbacks; |
| 6433 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6434 | |
| 6435 | return 0; |
| 6436 | } |
| 6437 | |
| 6438 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6439 | * ALC883 support |
| 6440 | * |
| 6441 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6442 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6443 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6444 | * 6-channel independent captures. |
| 6445 | * |
| 6446 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6447 | * driver yet). |
| 6448 | */ |
| 6449 | #define ALC883_DIGOUT_NID 0x06 |
| 6450 | #define ALC883_DIGIN_NID 0x0a |
| 6451 | |
| 6452 | static hda_nid_t alc883_dac_nids[4] = { |
| 6453 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6454 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6455 | }; |
| 6456 | |
| 6457 | static hda_nid_t alc883_adc_nids[2] = { |
| 6458 | /* ADC1-2 */ |
| 6459 | 0x08, 0x09, |
| 6460 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6461 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6462 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6463 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6464 | /* input MUX */ |
| 6465 | /* FIXME: should be a matrix-type input source selection */ |
| 6466 | |
| 6467 | static struct hda_input_mux alc883_capture_source = { |
| 6468 | .num_items = 4, |
| 6469 | .items = { |
| 6470 | { "Mic", 0x0 }, |
| 6471 | { "Front Mic", 0x1 }, |
| 6472 | { "Line", 0x2 }, |
| 6473 | { "CD", 0x4 }, |
| 6474 | }, |
| 6475 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6476 | |
| 6477 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6478 | .num_items = 2, |
| 6479 | .items = { |
| 6480 | { "Mic", 0x1 }, |
| 6481 | { "Line", 0x2 }, |
| 6482 | }, |
| 6483 | }; |
| 6484 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6485 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6486 | .num_items = 4, |
| 6487 | .items = { |
| 6488 | { "Mic", 0x0 }, |
| 6489 | { "iMic", 0x1 }, |
| 6490 | { "Line", 0x2 }, |
| 6491 | { "CD", 0x4 }, |
| 6492 | }, |
| 6493 | }; |
| 6494 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6495 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6496 | .num_items = 2, |
| 6497 | .items = { |
| 6498 | { "Mic", 0x0 }, |
| 6499 | { "Int Mic", 0x1 }, |
| 6500 | }, |
| 6501 | }; |
| 6502 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6503 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6504 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6505 | /* ALC883 has the ALC882-type input selection */ |
| 6506 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6507 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6508 | /* |
| 6509 | * 2ch mode |
| 6510 | */ |
| 6511 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6512 | { 2, NULL } |
| 6513 | }; |
| 6514 | |
| 6515 | /* |
| 6516 | * 2ch mode |
| 6517 | */ |
| 6518 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6519 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6520 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6521 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6522 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6523 | { } /* end */ |
| 6524 | }; |
| 6525 | |
| 6526 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6527 | * 4ch mode |
| 6528 | */ |
| 6529 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6530 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6531 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6532 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6533 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6534 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6535 | { } /* end */ |
| 6536 | }; |
| 6537 | |
| 6538 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6539 | * 6ch mode |
| 6540 | */ |
| 6541 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6542 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6543 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6544 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6545 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6546 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6547 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6548 | { } /* end */ |
| 6549 | }; |
| 6550 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6551 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6552 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6553 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6554 | { 6, alc883_3ST_ch6_init }, |
| 6555 | }; |
| 6556 | |
| 6557 | /* |
| 6558 | * 6ch mode |
| 6559 | */ |
| 6560 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6561 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6562 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6563 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6564 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6565 | { } /* end */ |
| 6566 | }; |
| 6567 | |
| 6568 | /* |
| 6569 | * 8ch mode |
| 6570 | */ |
| 6571 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6572 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6573 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6574 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6575 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6576 | { } /* end */ |
| 6577 | }; |
| 6578 | |
| 6579 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6580 | { 6, alc883_sixstack_ch6_init }, |
| 6581 | { 8, alc883_sixstack_ch8_init }, |
| 6582 | }; |
| 6583 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6584 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6585 | /* eanable EAPD on medion laptop */ |
| 6586 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6587 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6588 | { } |
| 6589 | }; |
| 6590 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6591 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6592 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6593 | */ |
| 6594 | |
| 6595 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6596 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6597 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6598 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6599 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6600 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6601 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6602 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6603 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6604 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6605 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6606 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6607 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6608 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6609 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6610 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6611 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6612 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6613 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6614 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6615 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6616 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6617 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6618 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6619 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6620 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6621 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6622 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6623 | { |
| 6624 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6625 | /* .name = "Capture Source", */ |
| 6626 | .name = "Input Source", |
| 6627 | .count = 2, |
| 6628 | .info = alc883_mux_enum_info, |
| 6629 | .get = alc883_mux_enum_get, |
| 6630 | .put = alc883_mux_enum_put, |
| 6631 | }, |
| 6632 | { } /* end */ |
| 6633 | }; |
| 6634 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6635 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6636 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6637 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6638 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6639 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6640 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6641 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6642 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6643 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6644 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6645 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6646 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6647 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6648 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6649 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6650 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6651 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6652 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6653 | { |
| 6654 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6655 | /* .name = "Capture Source", */ |
| 6656 | .name = "Input Source", |
| 6657 | .count = 2, |
| 6658 | .info = alc883_mux_enum_info, |
| 6659 | .get = alc883_mux_enum_get, |
| 6660 | .put = alc883_mux_enum_put, |
| 6661 | }, |
| 6662 | { } /* end */ |
| 6663 | }; |
| 6664 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 6665 | static struct snd_kcontrol_new alc883_clevo_m720r_mixer[] = { |
| 6666 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6667 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6668 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6669 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6670 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6671 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6672 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6673 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6674 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6675 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6676 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6677 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6678 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6679 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6680 | { |
| 6681 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6682 | /* .name = "Capture Source", */ |
| 6683 | .name = "Input Source", |
| 6684 | .count = 2, |
| 6685 | .info = alc883_mux_enum_info, |
| 6686 | .get = alc883_mux_enum_get, |
| 6687 | .put = alc883_mux_enum_put, |
| 6688 | }, |
| 6689 | { } /* end */ |
| 6690 | }; |
| 6691 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6692 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 6693 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6694 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6695 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6696 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6697 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6698 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6699 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6700 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6701 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6702 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6703 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6704 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6705 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6706 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6707 | { |
| 6708 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6709 | /* .name = "Capture Source", */ |
| 6710 | .name = "Input Source", |
| 6711 | .count = 2, |
| 6712 | .info = alc883_mux_enum_info, |
| 6713 | .get = alc883_mux_enum_get, |
| 6714 | .put = alc883_mux_enum_put, |
| 6715 | }, |
| 6716 | { } /* end */ |
| 6717 | }; |
| 6718 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6719 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6720 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6721 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6722 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6723 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6724 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6725 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6726 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6727 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6728 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6729 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6730 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6731 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6732 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6733 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6734 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6735 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6736 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6737 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6738 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6739 | { |
| 6740 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6741 | /* .name = "Capture Source", */ |
| 6742 | .name = "Input Source", |
| 6743 | .count = 2, |
| 6744 | .info = alc883_mux_enum_info, |
| 6745 | .get = alc883_mux_enum_get, |
| 6746 | .put = alc883_mux_enum_put, |
| 6747 | }, |
| 6748 | { } /* end */ |
| 6749 | }; |
| 6750 | |
| 6751 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6752 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6753 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6754 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6755 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6756 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6757 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6758 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6759 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6760 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6761 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6762 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6763 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6764 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6765 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6766 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6767 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6768 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6769 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6770 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6771 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6772 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6773 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6774 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6775 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6776 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6777 | { |
| 6778 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6779 | /* .name = "Capture Source", */ |
| 6780 | .name = "Input Source", |
| 6781 | .count = 2, |
| 6782 | .info = alc883_mux_enum_info, |
| 6783 | .get = alc883_mux_enum_get, |
| 6784 | .put = alc883_mux_enum_put, |
| 6785 | }, |
| 6786 | { } /* end */ |
| 6787 | }; |
| 6788 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6789 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6790 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6791 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6792 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6793 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6794 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6795 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6796 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6797 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6798 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6799 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6800 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6801 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6802 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6803 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6804 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6805 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6806 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6807 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6808 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6809 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6810 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6811 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6812 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6813 | |
| 6814 | { |
| 6815 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6816 | /* .name = "Capture Source", */ |
| 6817 | .name = "Input Source", |
| 6818 | .count = 1, |
| 6819 | .info = alc883_mux_enum_info, |
| 6820 | .get = alc883_mux_enum_get, |
| 6821 | .put = alc883_mux_enum_put, |
| 6822 | }, |
| 6823 | { } /* end */ |
| 6824 | }; |
| 6825 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6826 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6827 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6828 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6829 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6830 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6831 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6832 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6833 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6834 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6835 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6836 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6837 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6838 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6839 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6840 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6841 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6843 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6844 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6845 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6846 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6847 | { |
| 6848 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6849 | /* .name = "Capture Source", */ |
| 6850 | .name = "Input Source", |
| 6851 | .count = 2, |
| 6852 | .info = alc883_mux_enum_info, |
| 6853 | .get = alc883_mux_enum_get, |
| 6854 | .put = alc883_mux_enum_put, |
| 6855 | }, |
| 6856 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6857 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6858 | |
| 6859 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6861 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6862 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6863 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6864 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6865 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6866 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6867 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6868 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6869 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6870 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6871 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6872 | { |
| 6873 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6874 | /* .name = "Capture Source", */ |
| 6875 | .name = "Input Source", |
| 6876 | .count = 2, |
| 6877 | .info = alc883_mux_enum_info, |
| 6878 | .get = alc883_mux_enum_get, |
| 6879 | .put = alc883_mux_enum_put, |
| 6880 | }, |
| 6881 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6882 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6883 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6884 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6885 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6886 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6887 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6888 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6889 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6890 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6891 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6892 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6893 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6894 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6895 | { |
| 6896 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6897 | /* .name = "Capture Source", */ |
| 6898 | .name = "Input Source", |
| 6899 | .count = 1, |
| 6900 | .info = alc883_mux_enum_info, |
| 6901 | .get = alc883_mux_enum_get, |
| 6902 | .put = alc883_mux_enum_put, |
| 6903 | }, |
| 6904 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6905 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6906 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6907 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6908 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6909 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6910 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6911 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6912 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6913 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6914 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6915 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6916 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6917 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6918 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6919 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6920 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6921 | { |
| 6922 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6923 | /* .name = "Capture Source", */ |
| 6924 | .name = "Input Source", |
| 6925 | .count = 2, |
| 6926 | .info = alc883_mux_enum_info, |
| 6927 | .get = alc883_mux_enum_get, |
| 6928 | .put = alc883_mux_enum_put, |
| 6929 | }, |
| 6930 | { } /* end */ |
| 6931 | }; |
| 6932 | |
| 6933 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6934 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6935 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6936 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6937 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6938 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6939 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6940 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6941 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6942 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6943 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6944 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6945 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6946 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6947 | { |
| 6948 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6949 | /* .name = "Capture Source", */ |
| 6950 | .name = "Input Source", |
| 6951 | .count = 2, |
| 6952 | .info = alc883_mux_enum_info, |
| 6953 | .get = alc883_mux_enum_get, |
| 6954 | .put = alc883_mux_enum_put, |
| 6955 | }, |
| 6956 | { } /* end */ |
| 6957 | }; |
| 6958 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6959 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6960 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6961 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6962 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6963 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6964 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6965 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6966 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6967 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6968 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6969 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6970 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6971 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6972 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6973 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6974 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6975 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6976 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6977 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6978 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6979 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6980 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6981 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6982 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6983 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6984 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6985 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6986 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6987 | { |
| 6988 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6989 | /* .name = "Capture Source", */ |
| 6990 | .name = "Input Source", |
| 6991 | .count = 2, |
| 6992 | .info = alc883_mux_enum_info, |
| 6993 | .get = alc883_mux_enum_get, |
| 6994 | .put = alc883_mux_enum_put, |
| 6995 | }, |
| 6996 | { } /* end */ |
| 6997 | }; |
| 6998 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6999 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7000 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7001 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7002 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7003 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7004 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7005 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7006 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7007 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7008 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7009 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7010 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7011 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7012 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7013 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7014 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7015 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7016 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7017 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7018 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7019 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7020 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7021 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7022 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7023 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7024 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7025 | { |
| 7026 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7027 | /* .name = "Capture Source", */ |
| 7028 | .name = "Input Source", |
| 7029 | .count = 2, |
| 7030 | .info = alc883_mux_enum_info, |
| 7031 | .get = alc883_mux_enum_get, |
| 7032 | .put = alc883_mux_enum_put, |
| 7033 | }, |
| 7034 | { } /* end */ |
| 7035 | }; |
| 7036 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7037 | static struct snd_kcontrol_new alc888_6st_dell_mixer[] = { |
| 7038 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7039 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7040 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7041 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7042 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7043 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7044 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7045 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7046 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7047 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7048 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7049 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7050 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7051 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7052 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7053 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7054 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7055 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7056 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7057 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7058 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7059 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7060 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7061 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7062 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7063 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7064 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7065 | { |
| 7066 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7067 | /* .name = "Capture Source", */ |
| 7068 | .name = "Input Source", |
| 7069 | .count = 2, |
| 7070 | .info = alc883_mux_enum_info, |
| 7071 | .get = alc883_mux_enum_get, |
| 7072 | .put = alc883_mux_enum_put, |
| 7073 | }, |
| 7074 | { } /* end */ |
| 7075 | }; |
| 7076 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7077 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7078 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7079 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7080 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7081 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7082 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7083 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7084 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7085 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7086 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7087 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7088 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7089 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7090 | { |
| 7091 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7092 | /* .name = "Capture Source", */ |
| 7093 | .name = "Input Source", |
| 7094 | .count = 2, |
| 7095 | .info = alc883_mux_enum_info, |
| 7096 | .get = alc883_mux_enum_get, |
| 7097 | .put = alc883_mux_enum_put, |
| 7098 | }, |
| 7099 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7100 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7101 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7102 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7103 | { |
| 7104 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7105 | .name = "Channel Mode", |
| 7106 | .info = alc_ch_mode_info, |
| 7107 | .get = alc_ch_mode_get, |
| 7108 | .put = alc_ch_mode_put, |
| 7109 | }, |
| 7110 | { } /* end */ |
| 7111 | }; |
| 7112 | |
| 7113 | static struct hda_verb alc883_init_verbs[] = { |
| 7114 | /* ADC1: mute amp left and right */ |
| 7115 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7116 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7117 | /* ADC2: mute amp left and right */ |
| 7118 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7119 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7120 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7121 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7122 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7123 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7124 | /* Rear mixer */ |
| 7125 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7126 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7127 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7128 | /* CLFE mixer */ |
| 7129 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7130 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7131 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7132 | /* Side mixer */ |
| 7133 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7134 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7135 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7136 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7137 | /* mute analog input loopbacks */ |
| 7138 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7139 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7140 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7141 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7142 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7143 | |
| 7144 | /* Front Pin: output 0 (0x0c) */ |
| 7145 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7146 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7147 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7148 | /* Rear Pin: output 1 (0x0d) */ |
| 7149 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7150 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7151 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7152 | /* CLFE Pin: output 2 (0x0e) */ |
| 7153 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7154 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7155 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7156 | /* Side Pin: output 3 (0x0f) */ |
| 7157 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7158 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7159 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7160 | /* Mic (rear) pin: input vref at 80% */ |
| 7161 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7162 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7163 | /* Front Mic pin: input vref at 80% */ |
| 7164 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7165 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7166 | /* Line In pin: input */ |
| 7167 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7168 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7169 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7170 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7171 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7172 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7173 | /* CD pin widget for input */ |
| 7174 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7175 | |
| 7176 | /* FIXME: use matrix-type input source selection */ |
| 7177 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7178 | /* Input mixer2 */ |
| 7179 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7180 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7181 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7182 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7183 | /* Input mixer3 */ |
| 7184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7186 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7187 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7188 | { } |
| 7189 | }; |
| 7190 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7191 | /* toggle speaker-output according to the hp-jack state */ |
| 7192 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7193 | { |
| 7194 | unsigned int present; |
| 7195 | |
| 7196 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7197 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7198 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7199 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7200 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7201 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7202 | } |
| 7203 | |
| 7204 | /* auto-toggle front mic */ |
| 7205 | /* |
| 7206 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7207 | { |
| 7208 | unsigned int present; |
| 7209 | unsigned char bits; |
| 7210 | |
| 7211 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7212 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7213 | bits = present ? HDA_AMP_MUTE : 0; |
| 7214 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7215 | } |
| 7216 | */ |
| 7217 | |
| 7218 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7219 | { |
| 7220 | alc883_mitac_hp_automute(codec); |
| 7221 | /* alc883_mitac_mic_automute(codec); */ |
| 7222 | } |
| 7223 | |
| 7224 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7225 | unsigned int res) |
| 7226 | { |
| 7227 | switch (res >> 26) { |
| 7228 | case ALC880_HP_EVENT: |
| 7229 | alc883_mitac_hp_automute(codec); |
| 7230 | break; |
| 7231 | case ALC880_MIC_EVENT: |
| 7232 | /* alc883_mitac_mic_automute(codec); */ |
| 7233 | break; |
| 7234 | } |
| 7235 | } |
| 7236 | |
| 7237 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7238 | /* HP */ |
| 7239 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7240 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7241 | /* Subwoofer */ |
| 7242 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7243 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7244 | |
| 7245 | /* enable unsolicited event */ |
| 7246 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7247 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7248 | |
| 7249 | { } /* end */ |
| 7250 | }; |
| 7251 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7252 | static struct hda_verb alc883_clevo_m720r_verbs[] = { |
| 7253 | /* HP */ |
| 7254 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7255 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7256 | /* Int speaker */ |
| 7257 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7258 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7259 | |
| 7260 | /* enable unsolicited event */ |
| 7261 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7262 | |
| 7263 | { } /* end */ |
| 7264 | }; |
| 7265 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7266 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7267 | /* HP */ |
| 7268 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7269 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7270 | /* Subwoofer */ |
| 7271 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7272 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7273 | |
| 7274 | /* enable unsolicited event */ |
| 7275 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7276 | |
| 7277 | { } /* end */ |
| 7278 | }; |
| 7279 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7280 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7281 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7282 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7283 | |
| 7284 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7285 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7286 | |
| 7287 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7288 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7289 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7290 | |
| 7291 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7292 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7293 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7294 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7295 | |
| 7296 | { } /* end */ |
| 7297 | }; |
| 7298 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7299 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7300 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7301 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7302 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7303 | { } /* end */ |
| 7304 | }; |
| 7305 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7306 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7307 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7308 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7309 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7310 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7311 | { } /* end */ |
| 7312 | }; |
| 7313 | |
| 7314 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7315 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7316 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7317 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7318 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7319 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7320 | { } /* end */ |
| 7321 | }; |
| 7322 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7323 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7325 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7326 | |
| 7327 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7328 | |
| 7329 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7330 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7331 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7332 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7333 | { } /* end */ |
| 7334 | }; |
| 7335 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7336 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7337 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7338 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7339 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7340 | { } |
| 7341 | }; |
| 7342 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7343 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7344 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7345 | { } |
| 7346 | }; |
| 7347 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7348 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7349 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7350 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7351 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7352 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7353 | { } |
| 7354 | }; |
| 7355 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7356 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7357 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7358 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7359 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7360 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7361 | { } |
| 7362 | }; |
| 7363 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7364 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7365 | { 2, alc888_3st_hp_2ch_init }, |
| 7366 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7367 | }; |
| 7368 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7369 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7370 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7371 | { |
| 7372 | unsigned int present; |
| 7373 | |
| 7374 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7375 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7376 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7377 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7378 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7379 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7380 | } |
| 7381 | |
| 7382 | /* toggle RCA according to the front-jack state */ |
| 7383 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7384 | { |
| 7385 | unsigned int present; |
| 7386 | |
| 7387 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7388 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7389 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7390 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7391 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7392 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7393 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7394 | unsigned int res) |
| 7395 | { |
| 7396 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7397 | alc888_lenovo_ms7195_front_automute(codec); |
| 7398 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7399 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7400 | } |
| 7401 | |
| 7402 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7403 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7404 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7405 | |
| 7406 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7407 | |
| 7408 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7409 | { } /* end */ |
| 7410 | }; |
| 7411 | |
| 7412 | /* toggle speaker-output according to the hp-jack state */ |
| 7413 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7414 | { |
| 7415 | unsigned int present; |
| 7416 | |
| 7417 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7418 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7419 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7420 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7421 | } |
| 7422 | |
| 7423 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7424 | unsigned int res) |
| 7425 | { |
| 7426 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7427 | alc883_medion_md2_automute(codec); |
| 7428 | } |
| 7429 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7430 | /* toggle speaker-output according to the hp-jack state */ |
| 7431 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7432 | { |
| 7433 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7434 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7435 | |
| 7436 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7437 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7438 | bits = present ? HDA_AMP_MUTE : 0; |
| 7439 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7440 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7441 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7442 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7443 | } |
| 7444 | |
| 7445 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7446 | { |
| 7447 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7448 | alc883_tagra_automute(codec); |
| 7449 | } |
| 7450 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7451 | /* toggle speaker-output according to the hp-jack state */ |
| 7452 | static void alc883_clevo_m720r_automute(struct hda_codec *codec) |
| 7453 | { |
| 7454 | unsigned int present; |
| 7455 | unsigned char bits; |
| 7456 | |
| 7457 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7458 | & AC_PINSENSE_PRESENCE; |
| 7459 | bits = present ? HDA_AMP_MUTE : 0; |
| 7460 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7461 | HDA_AMP_MUTE, bits); |
| 7462 | } |
| 7463 | |
| 7464 | static void alc883_clevo_m720r_unsol_event(struct hda_codec *codec, |
| 7465 | unsigned int res) |
| 7466 | { |
| 7467 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7468 | alc883_clevo_m720r_automute(codec); |
| 7469 | } |
| 7470 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7471 | /* toggle speaker-output according to the hp-jack state */ |
| 7472 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7473 | { |
| 7474 | unsigned int present; |
| 7475 | unsigned char bits; |
| 7476 | |
| 7477 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7478 | & AC_PINSENSE_PRESENCE; |
| 7479 | bits = present ? HDA_AMP_MUTE : 0; |
| 7480 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7481 | HDA_AMP_MUTE, bits); |
| 7482 | } |
| 7483 | |
| 7484 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7485 | unsigned int res) |
| 7486 | { |
| 7487 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7488 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7489 | } |
| 7490 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7491 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7492 | { |
| 7493 | unsigned int present; |
| 7494 | unsigned char bits; |
| 7495 | |
| 7496 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7497 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7498 | bits = present ? 0x80 : 0; |
| 7499 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7500 | 0x80, bits); |
| 7501 | } |
| 7502 | |
| 7503 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7504 | unsigned int res) |
| 7505 | { |
| 7506 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7507 | alc883_haier_w66_automute(codec); |
| 7508 | } |
| 7509 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7510 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7511 | { |
| 7512 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7513 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7514 | |
| 7515 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7516 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7517 | bits = present ? HDA_AMP_MUTE : 0; |
| 7518 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7519 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7520 | } |
| 7521 | |
| 7522 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7523 | { |
| 7524 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7525 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7526 | |
| 7527 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7528 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7529 | bits = present ? HDA_AMP_MUTE : 0; |
| 7530 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7531 | HDA_AMP_MUTE, bits); |
| 7532 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7533 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7534 | } |
| 7535 | |
| 7536 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7537 | unsigned int res) |
| 7538 | { |
| 7539 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7540 | alc883_lenovo_101e_all_automute(codec); |
| 7541 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7542 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7543 | } |
| 7544 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7545 | /* toggle speaker-output according to the hp-jack state */ |
| 7546 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7547 | { |
| 7548 | unsigned int present; |
| 7549 | |
| 7550 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7551 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7552 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7553 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7554 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7555 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7556 | } |
| 7557 | |
| 7558 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7559 | unsigned int res) |
| 7560 | { |
| 7561 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7562 | alc883_acer_aspire_automute(codec); |
| 7563 | } |
| 7564 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7565 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7566 | /* HP Pin: output 0 (0x0c) */ |
| 7567 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7568 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7569 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7570 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7571 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7572 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7573 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7574 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7575 | /* eanable EAPD on medion laptop */ |
| 7576 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7577 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7578 | /* enable unsolicited event */ |
| 7579 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7580 | { } |
| 7581 | }; |
| 7582 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7583 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7584 | { |
| 7585 | unsigned int present; |
| 7586 | |
| 7587 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7588 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7589 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7590 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7591 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7592 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7593 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7594 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7595 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7596 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7597 | } |
| 7598 | |
| 7599 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7600 | unsigned int res) |
| 7601 | { |
| 7602 | switch (res >> 26) { |
| 7603 | case ALC880_HP_EVENT: |
| 7604 | printk("hp_event\n"); |
| 7605 | alc888_6st_dell_front_automute(codec); |
| 7606 | break; |
| 7607 | } |
| 7608 | } |
| 7609 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7610 | /* |
| 7611 | * generic initialization of ADC, input mixers and output mixers |
| 7612 | */ |
| 7613 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7614 | /* |
| 7615 | * Unmute ADC0-2 and set the default input to mic-in |
| 7616 | */ |
| 7617 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7618 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7619 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7620 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7621 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7622 | /* 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] | 7623 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7624 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7625 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7626 | */ |
| 7627 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7628 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7629 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7630 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7631 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7632 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7633 | |
| 7634 | /* |
| 7635 | * Set up output mixers (0x0c - 0x0f) |
| 7636 | */ |
| 7637 | /* set vol=0 to output mixers */ |
| 7638 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7639 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7640 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7641 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7642 | /* set up input amps for analog loopback */ |
| 7643 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7644 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7645 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7646 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7647 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7648 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7649 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7650 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7651 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7652 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7653 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7654 | |
| 7655 | /* FIXME: use matrix-type input source selection */ |
| 7656 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7657 | /* Input mixer1 */ |
| 7658 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7659 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7660 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7661 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7662 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7663 | /* Input mixer2 */ |
| 7664 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7665 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7666 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7667 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7668 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7669 | |
| 7670 | { } |
| 7671 | }; |
| 7672 | |
| 7673 | /* capture mixer elements */ |
| 7674 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7675 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7676 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7677 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7678 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7679 | { |
| 7680 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7681 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7682 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7683 | */ |
| 7684 | /* .name = "Capture Source", */ |
| 7685 | .name = "Input Source", |
| 7686 | .count = 2, |
| 7687 | .info = alc882_mux_enum_info, |
| 7688 | .get = alc882_mux_enum_get, |
| 7689 | .put = alc882_mux_enum_put, |
| 7690 | }, |
| 7691 | { } /* end */ |
| 7692 | }; |
| 7693 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7694 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7695 | #define alc883_loopbacks alc880_loopbacks |
| 7696 | #endif |
| 7697 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7698 | /* pcm configuration: identiacal with ALC880 */ |
| 7699 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7700 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7701 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7702 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7703 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7704 | |
| 7705 | /* |
| 7706 | * configuration and preset |
| 7707 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7708 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7709 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7710 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7711 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7712 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7713 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7714 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7715 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7716 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7717 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7718 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7719 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7720 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7721 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7722 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7723 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7724 | [ALC888_6ST_HP] = "6stack-hp", |
| 7725 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7726 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7727 | [ALC883_MITAC] = "mitac", |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7728 | [ALC883_CLEVO_M720R] = "clevo-m720r", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7729 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7730 | [ALC883_AUTO] = "auto", |
| 7731 | }; |
| 7732 | |
| 7733 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7734 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7735 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7736 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7737 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7738 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7739 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7740 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7741 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7742 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 7743 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 7744 | 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] | 7745 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7746 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7747 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7748 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7749 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7750 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7751 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7752 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
| 7753 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 7754 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7755 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7756 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7757 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7758 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7759 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7760 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7761 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7762 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7763 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7764 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7765 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7766 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 7767 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7768 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7769 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7770 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7771 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7772 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720R), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7773 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7774 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7775 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7776 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7777 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7778 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7779 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7780 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7781 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 7782 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7783 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7784 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7785 | {} |
| 7786 | }; |
| 7787 | |
| 7788 | static struct alc_config_preset alc883_presets[] = { |
| 7789 | [ALC883_3ST_2ch_DIG] = { |
| 7790 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7791 | .init_verbs = { alc883_init_verbs }, |
| 7792 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7793 | .dac_nids = alc883_dac_nids, |
| 7794 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7795 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7796 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7797 | .channel_mode = alc883_3ST_2ch_modes, |
| 7798 | .input_mux = &alc883_capture_source, |
| 7799 | }, |
| 7800 | [ALC883_3ST_6ch_DIG] = { |
| 7801 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7802 | .init_verbs = { alc883_init_verbs }, |
| 7803 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7804 | .dac_nids = alc883_dac_nids, |
| 7805 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7806 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7807 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7808 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7809 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7810 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7811 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7812 | [ALC883_3ST_6ch] = { |
| 7813 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7814 | .init_verbs = { alc883_init_verbs }, |
| 7815 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7816 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7817 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7818 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7819 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7820 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7821 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7822 | [ALC883_6ST_DIG] = { |
| 7823 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7824 | .init_verbs = { alc883_init_verbs }, |
| 7825 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7826 | .dac_nids = alc883_dac_nids, |
| 7827 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7828 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7829 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7830 | .channel_mode = alc883_sixstack_modes, |
| 7831 | .input_mux = &alc883_capture_source, |
| 7832 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7833 | [ALC883_TARGA_DIG] = { |
| 7834 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7835 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7836 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7837 | .dac_nids = alc883_dac_nids, |
| 7838 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7839 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7840 | .channel_mode = alc883_3ST_6ch_modes, |
| 7841 | .need_dac_fix = 1, |
| 7842 | .input_mux = &alc883_capture_source, |
| 7843 | .unsol_event = alc883_tagra_unsol_event, |
| 7844 | .init_hook = alc883_tagra_automute, |
| 7845 | }, |
| 7846 | [ALC883_TARGA_2ch_DIG] = { |
| 7847 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7848 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7849 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7850 | .dac_nids = alc883_dac_nids, |
| 7851 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7852 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7853 | .channel_mode = alc883_3ST_2ch_modes, |
| 7854 | .input_mux = &alc883_capture_source, |
| 7855 | .unsol_event = alc883_tagra_unsol_event, |
| 7856 | .init_hook = alc883_tagra_automute, |
| 7857 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7858 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7859 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7860 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7861 | * and the headphone jack. Turn this on and rely on the |
| 7862 | * standard mute methods whenever the user wants to turn |
| 7863 | * these outputs off. |
| 7864 | */ |
| 7865 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7866 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7867 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7868 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7869 | .channel_mode = alc883_3ST_2ch_modes, |
| 7870 | .input_mux = &alc883_capture_source, |
| 7871 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7872 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7873 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7874 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7875 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7876 | .dac_nids = alc883_dac_nids, |
| 7877 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7878 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7879 | .channel_mode = alc883_3ST_2ch_modes, |
| 7880 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7881 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7882 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7883 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7884 | [ALC883_MEDION] = { |
| 7885 | .mixers = { alc883_fivestack_mixer, |
| 7886 | alc883_chmode_mixer }, |
| 7887 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7888 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7889 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7890 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7891 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7892 | .channel_mode = alc883_sixstack_modes, |
| 7893 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7894 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7895 | [ALC883_MEDION_MD2] = { |
| 7896 | .mixers = { alc883_medion_md2_mixer}, |
| 7897 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7898 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7899 | .dac_nids = alc883_dac_nids, |
| 7900 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7901 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7902 | .channel_mode = alc883_3ST_2ch_modes, |
| 7903 | .input_mux = &alc883_capture_source, |
| 7904 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7905 | .init_hook = alc883_medion_md2_automute, |
| 7906 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7907 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7908 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7909 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7910 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7911 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7912 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7913 | .channel_mode = alc883_3ST_2ch_modes, |
| 7914 | .input_mux = &alc883_capture_source, |
| 7915 | }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7916 | [ALC883_CLEVO_M720R] = { |
| 7917 | .mixers = { alc883_clevo_m720r_mixer }, |
| 7918 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720r_verbs }, |
| 7919 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7920 | .dac_nids = alc883_dac_nids, |
| 7921 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7922 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7923 | .channel_mode = alc883_3ST_2ch_modes, |
| 7924 | .input_mux = &alc883_capture_source, |
| 7925 | .unsol_event = alc883_clevo_m720r_unsol_event, |
| 7926 | .init_hook = alc883_clevo_m720r_automute, |
| 7927 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7928 | [ALC883_LENOVO_101E_2ch] = { |
| 7929 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7930 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7931 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7932 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7933 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7934 | .channel_mode = alc883_3ST_2ch_modes, |
| 7935 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7936 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7937 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7938 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7939 | [ALC883_LENOVO_NB0763] = { |
| 7940 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7941 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7942 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7943 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7944 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7945 | .channel_mode = alc883_3ST_2ch_modes, |
| 7946 | .need_dac_fix = 1, |
| 7947 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7948 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7949 | .init_hook = alc883_medion_md2_automute, |
| 7950 | }, |
| 7951 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7952 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7953 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7954 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7955 | .dac_nids = alc883_dac_nids, |
| 7956 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7957 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7958 | .channel_mode = alc883_3ST_6ch_modes, |
| 7959 | .need_dac_fix = 1, |
| 7960 | .input_mux = &alc883_capture_source, |
| 7961 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7962 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7963 | }, |
| 7964 | [ALC883_HAIER_W66] = { |
| 7965 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7966 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7967 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7968 | .dac_nids = alc883_dac_nids, |
| 7969 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7970 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7971 | .channel_mode = alc883_3ST_2ch_modes, |
| 7972 | .input_mux = &alc883_capture_source, |
| 7973 | .unsol_event = alc883_haier_w66_unsol_event, |
| 7974 | .init_hook = alc883_haier_w66_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7975 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7976 | [ALC888_6ST_HP] = { |
| 7977 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7978 | .init_verbs = { alc883_init_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7979 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7980 | .dac_nids = alc883_dac_nids, |
| 7981 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7982 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7983 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7984 | .channel_mode = alc883_sixstack_modes, |
| 7985 | .input_mux = &alc883_capture_source, |
| 7986 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7987 | [ALC888_3ST_HP] = { |
| 7988 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 7989 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7990 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7991 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7992 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 7993 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7994 | .need_dac_fix = 1, |
| 7995 | .input_mux = &alc883_capture_source, |
| 7996 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7997 | [ALC888_6ST_DELL] = { |
| 7998 | .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer }, |
| 7999 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8000 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8001 | .dac_nids = alc883_dac_nids, |
| 8002 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8003 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8004 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8005 | .channel_mode = alc883_sixstack_modes, |
| 8006 | .input_mux = &alc883_capture_source, |
| 8007 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8008 | .init_hook = alc888_6st_dell_front_automute, |
| 8009 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8010 | [ALC883_MITAC] = { |
| 8011 | .mixers = { alc883_mitac_mixer }, |
| 8012 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8013 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8014 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8015 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8016 | .channel_mode = alc883_3ST_2ch_modes, |
| 8017 | .input_mux = &alc883_capture_source, |
| 8018 | .unsol_event = alc883_mitac_unsol_event, |
| 8019 | .init_hook = alc883_mitac_automute, |
| 8020 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8021 | [ALC883_FUJITSU_PI2515] = { |
| 8022 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8023 | .init_verbs = { alc883_init_verbs, |
| 8024 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8025 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8026 | .dac_nids = alc883_dac_nids, |
| 8027 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8028 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8029 | .channel_mode = alc883_3ST_2ch_modes, |
| 8030 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8031 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8032 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8033 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8034 | }; |
| 8035 | |
| 8036 | |
| 8037 | /* |
| 8038 | * BIOS auto configuration |
| 8039 | */ |
| 8040 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8041 | hda_nid_t nid, int pin_type, |
| 8042 | int dac_idx) |
| 8043 | { |
| 8044 | /* set as output */ |
| 8045 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8046 | int idx; |
| 8047 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8048 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8049 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8050 | idx = 4; |
| 8051 | else |
| 8052 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8053 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8054 | |
| 8055 | } |
| 8056 | |
| 8057 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8058 | { |
| 8059 | struct alc_spec *spec = codec->spec; |
| 8060 | int i; |
| 8061 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8062 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8063 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8064 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8065 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8066 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8067 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8068 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8069 | } |
| 8070 | } |
| 8071 | |
| 8072 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8073 | { |
| 8074 | struct alc_spec *spec = codec->spec; |
| 8075 | hda_nid_t pin; |
| 8076 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8077 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8078 | if (pin) /* connect to front */ |
| 8079 | /* use dac 0 */ |
| 8080 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8081 | pin = spec->autocfg.speaker_pins[0]; |
| 8082 | if (pin) |
| 8083 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8084 | } |
| 8085 | |
| 8086 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8087 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8088 | |
| 8089 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8090 | { |
| 8091 | struct alc_spec *spec = codec->spec; |
| 8092 | int i; |
| 8093 | |
| 8094 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8095 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8096 | if (alc883_is_input_pin(nid)) { |
| 8097 | snd_hda_codec_write(codec, nid, 0, |
| 8098 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8099 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8100 | PIN_VREF80 : PIN_IN)); |
| 8101 | if (nid != ALC883_PIN_CD_NID) |
| 8102 | snd_hda_codec_write(codec, nid, 0, |
| 8103 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8104 | AMP_OUT_MUTE); |
| 8105 | } |
| 8106 | } |
| 8107 | } |
| 8108 | |
| 8109 | /* almost identical with ALC880 parser... */ |
| 8110 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8111 | { |
| 8112 | struct alc_spec *spec = codec->spec; |
| 8113 | int err = alc880_parse_auto_config(codec); |
| 8114 | |
| 8115 | if (err < 0) |
| 8116 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8117 | else if (!err) |
| 8118 | return 0; /* no config found */ |
| 8119 | |
| 8120 | err = alc_auto_add_mic_boost(codec); |
| 8121 | if (err < 0) |
| 8122 | return err; |
| 8123 | |
| 8124 | /* hack - override the init verbs */ |
| 8125 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8126 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8127 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8128 | |
| 8129 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8130 | } |
| 8131 | |
| 8132 | /* additional initialization for auto-configuration model */ |
| 8133 | static void alc883_auto_init(struct hda_codec *codec) |
| 8134 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8135 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8136 | alc883_auto_init_multi_out(codec); |
| 8137 | alc883_auto_init_hp_out(codec); |
| 8138 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8139 | if (spec->unsol_event) |
| 8140 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8141 | } |
| 8142 | |
| 8143 | static int patch_alc883(struct hda_codec *codec) |
| 8144 | { |
| 8145 | struct alc_spec *spec; |
| 8146 | int err, board_config; |
| 8147 | |
| 8148 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8149 | if (spec == NULL) |
| 8150 | return -ENOMEM; |
| 8151 | |
| 8152 | codec->spec = spec; |
| 8153 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8154 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8155 | alc883_models, |
| 8156 | alc883_cfg_tbl); |
| 8157 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8158 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8159 | "trying auto-probe from BIOS...\n"); |
| 8160 | board_config = ALC883_AUTO; |
| 8161 | } |
| 8162 | |
| 8163 | if (board_config == ALC883_AUTO) { |
| 8164 | /* automatic parse from the BIOS config */ |
| 8165 | err = alc883_parse_auto_config(codec); |
| 8166 | if (err < 0) { |
| 8167 | alc_free(codec); |
| 8168 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8169 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8170 | printk(KERN_INFO |
| 8171 | "hda_codec: Cannot set up configuration " |
| 8172 | "from BIOS. Using base mode...\n"); |
| 8173 | board_config = ALC883_3ST_2ch_DIG; |
| 8174 | } |
| 8175 | } |
| 8176 | |
| 8177 | if (board_config != ALC883_AUTO) |
| 8178 | setup_preset(spec, &alc883_presets[board_config]); |
| 8179 | |
| 8180 | spec->stream_name_analog = "ALC883 Analog"; |
| 8181 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8182 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8183 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8184 | |
| 8185 | spec->stream_name_digital = "ALC883 Digital"; |
| 8186 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8187 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8188 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8189 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8190 | spec->adc_nids = alc883_adc_nids; |
| 8191 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8192 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8193 | spec->vmaster_nid = 0x0c; |
| 8194 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8195 | codec->patch_ops = alc_patch_ops; |
| 8196 | if (board_config == ALC883_AUTO) |
| 8197 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8198 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8199 | if (!spec->loopback.amplist) |
| 8200 | spec->loopback.amplist = alc883_loopbacks; |
| 8201 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8202 | |
| 8203 | return 0; |
| 8204 | } |
| 8205 | |
| 8206 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8207 | * ALC262 support |
| 8208 | */ |
| 8209 | |
| 8210 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8211 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8212 | |
| 8213 | #define alc262_dac_nids alc260_dac_nids |
| 8214 | #define alc262_adc_nids alc882_adc_nids |
| 8215 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8216 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8217 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8218 | |
| 8219 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8220 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8221 | |
| 8222 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8223 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8224 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8225 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8226 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8227 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8228 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8229 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8230 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8231 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8232 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8233 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8234 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8235 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8236 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8237 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8238 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8239 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8240 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8241 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8242 | }; |
| 8243 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8244 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8245 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8246 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8247 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8248 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8249 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8250 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8251 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8252 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8253 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8254 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8255 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8256 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8257 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8258 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8259 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8260 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8261 | { } /* end */ |
| 8262 | }; |
| 8263 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8264 | /* update HP, line and mono-out pins according to the master switch */ |
| 8265 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8266 | { |
| 8267 | struct alc_spec *spec = codec->spec; |
| 8268 | int val = spec->master_sw; |
| 8269 | |
| 8270 | /* HP & line-out */ |
| 8271 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8272 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8273 | val ? PIN_HP : 0); |
| 8274 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8275 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8276 | val ? PIN_HP : 0); |
| 8277 | /* mono (speaker) depending on the HP jack sense */ |
| 8278 | val = val && !spec->jack_present; |
| 8279 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8280 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8281 | val ? PIN_OUT : 0); |
| 8282 | } |
| 8283 | |
| 8284 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8285 | { |
| 8286 | struct alc_spec *spec = codec->spec; |
| 8287 | unsigned int presence; |
| 8288 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8289 | AC_VERB_GET_PIN_SENSE, 0); |
| 8290 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8291 | alc262_hp_master_update(codec); |
| 8292 | } |
| 8293 | |
| 8294 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8295 | { |
| 8296 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8297 | return; |
| 8298 | alc262_hp_bpc_automute(codec); |
| 8299 | } |
| 8300 | |
| 8301 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8302 | { |
| 8303 | struct alc_spec *spec = codec->spec; |
| 8304 | unsigned int presence; |
| 8305 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8306 | AC_VERB_GET_PIN_SENSE, 0); |
| 8307 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8308 | alc262_hp_master_update(codec); |
| 8309 | } |
| 8310 | |
| 8311 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8312 | unsigned int res) |
| 8313 | { |
| 8314 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8315 | return; |
| 8316 | alc262_hp_wildwest_automute(codec); |
| 8317 | } |
| 8318 | |
| 8319 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8320 | struct snd_ctl_elem_value *ucontrol) |
| 8321 | { |
| 8322 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8323 | struct alc_spec *spec = codec->spec; |
| 8324 | *ucontrol->value.integer.value = spec->master_sw; |
| 8325 | return 0; |
| 8326 | } |
| 8327 | |
| 8328 | static int alc262_hp_master_sw_put(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 | int val = !!*ucontrol->value.integer.value; |
| 8334 | |
| 8335 | if (val == spec->master_sw) |
| 8336 | return 0; |
| 8337 | spec->master_sw = val; |
| 8338 | alc262_hp_master_update(codec); |
| 8339 | return 1; |
| 8340 | } |
| 8341 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8342 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8343 | { |
| 8344 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8345 | .name = "Master Playback Switch", |
| 8346 | .info = snd_ctl_boolean_mono_info, |
| 8347 | .get = alc262_hp_master_sw_get, |
| 8348 | .put = alc262_hp_master_sw_put, |
| 8349 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8350 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8351 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8352 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8353 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8354 | HDA_OUTPUT), |
| 8355 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8356 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8357 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8358 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8359 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8360 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8361 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8362 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8363 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8364 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8365 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8366 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8367 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8368 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8369 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8370 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8371 | { } /* end */ |
| 8372 | }; |
| 8373 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8374 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8375 | { |
| 8376 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8377 | .name = "Master Playback Switch", |
| 8378 | .info = snd_ctl_boolean_mono_info, |
| 8379 | .get = alc262_hp_master_sw_get, |
| 8380 | .put = alc262_hp_master_sw_put, |
| 8381 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8382 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8383 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8384 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8385 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8386 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8387 | HDA_OUTPUT), |
| 8388 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8389 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8390 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8391 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8392 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8393 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8394 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8395 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8396 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8397 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8398 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8399 | { } /* end */ |
| 8400 | }; |
| 8401 | |
| 8402 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8403 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8404 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8405 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8406 | { } /* end */ |
| 8407 | }; |
| 8408 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8409 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8410 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8411 | { |
| 8412 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8413 | |
| 8414 | if (force || !spec->sense_updated) { |
| 8415 | unsigned int present; |
| 8416 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8417 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8418 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8419 | spec->sense_updated = 1; |
| 8420 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8421 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8422 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8423 | } |
| 8424 | |
| 8425 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8426 | unsigned int res) |
| 8427 | { |
| 8428 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8429 | return; |
| 8430 | alc262_hp_t5735_automute(codec, 1); |
| 8431 | } |
| 8432 | |
| 8433 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8434 | { |
| 8435 | alc262_hp_t5735_automute(codec, 1); |
| 8436 | } |
| 8437 | |
| 8438 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8439 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8440 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8441 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8442 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8443 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8444 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8445 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8446 | { } /* end */ |
| 8447 | }; |
| 8448 | |
| 8449 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8450 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8451 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8452 | |
| 8453 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8454 | { } |
| 8455 | }; |
| 8456 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8457 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8458 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8459 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8460 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8461 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8462 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8463 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8464 | { } /* end */ |
| 8465 | }; |
| 8466 | |
| 8467 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8468 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8469 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8470 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8471 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8472 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8473 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8474 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8475 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8476 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8477 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8478 | {} |
| 8479 | }; |
| 8480 | |
| 8481 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8482 | .num_items = 1, |
| 8483 | .items = { |
| 8484 | { "Line", 0x1 }, |
| 8485 | }, |
| 8486 | }; |
| 8487 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8488 | /* bind hp and internal speaker mute (with plug check) */ |
| 8489 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8490 | struct snd_ctl_elem_value *ucontrol) |
| 8491 | { |
| 8492 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8493 | long *valp = ucontrol->value.integer.value; |
| 8494 | int change; |
| 8495 | |
| 8496 | /* change hp mute */ |
| 8497 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8498 | HDA_AMP_MUTE, |
| 8499 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8500 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8501 | HDA_AMP_MUTE, |
| 8502 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8503 | if (change) { |
| 8504 | /* change speaker according to HP jack state */ |
| 8505 | struct alc_spec *spec = codec->spec; |
| 8506 | unsigned int mute; |
| 8507 | if (spec->jack_present) |
| 8508 | mute = HDA_AMP_MUTE; |
| 8509 | else |
| 8510 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8511 | HDA_OUTPUT, 0); |
| 8512 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8513 | HDA_AMP_MUTE, mute); |
| 8514 | } |
| 8515 | return change; |
| 8516 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8517 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8518 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8519 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8520 | { |
| 8521 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8522 | .name = "Master Playback Switch", |
| 8523 | .info = snd_hda_mixer_amp_switch_info, |
| 8524 | .get = snd_hda_mixer_amp_switch_get, |
| 8525 | .put = alc262_sony_master_sw_put, |
| 8526 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8527 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8528 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8529 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8530 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8531 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8532 | { } /* end */ |
| 8533 | }; |
| 8534 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8535 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8536 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8537 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8538 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8539 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8540 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8541 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8542 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8543 | { } /* end */ |
| 8544 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8545 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8546 | #define alc262_capture_mixer alc882_capture_mixer |
| 8547 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8548 | |
| 8549 | /* |
| 8550 | * generic initialization of ADC, input mixers and output mixers |
| 8551 | */ |
| 8552 | static struct hda_verb alc262_init_verbs[] = { |
| 8553 | /* |
| 8554 | * Unmute ADC0-2 and set the default input to mic-in |
| 8555 | */ |
| 8556 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8557 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8558 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8559 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8560 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8561 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8562 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8563 | /* 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] | 8564 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8565 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8566 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8567 | */ |
| 8568 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8569 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8570 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8571 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8572 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8573 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8574 | |
| 8575 | /* |
| 8576 | * Set up output mixers (0x0c - 0x0e) |
| 8577 | */ |
| 8578 | /* set vol=0 to output mixers */ |
| 8579 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8580 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8581 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8582 | /* set up input amps for analog loopback */ |
| 8583 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8584 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8588 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8589 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8590 | |
| 8591 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8592 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8593 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8594 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8595 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8596 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8597 | |
| 8598 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8599 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8600 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8601 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8602 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8603 | |
| 8604 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8605 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8606 | |
| 8607 | /* FIXME: use matrix-type input source selection */ |
| 8608 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8609 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8610 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8611 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8612 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8613 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8614 | /* Input mixer2 */ |
| 8615 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8616 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8617 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8618 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8619 | /* Input mixer3 */ |
| 8620 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8621 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8622 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8624 | |
| 8625 | { } |
| 8626 | }; |
| 8627 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8628 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8629 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8630 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8631 | {} |
| 8632 | }; |
| 8633 | |
| 8634 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8635 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8636 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8637 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8638 | |
| 8639 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8640 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8641 | {} |
| 8642 | }; |
| 8643 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8644 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8645 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8646 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8647 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8648 | |
| 8649 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8650 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8651 | }; |
| 8652 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8653 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8654 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8655 | { |
| 8656 | struct alc_spec *spec = codec->spec; |
| 8657 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8658 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8659 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8660 | /* need to execute and sync at first */ |
| 8661 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8662 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8663 | AC_VERB_GET_PIN_SENSE, 0); |
| 8664 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8665 | if (spec->jack_present) { |
| 8666 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8667 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8668 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8669 | } else { |
| 8670 | /* unmute internal speaker if necessary */ |
| 8671 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8672 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8673 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8674 | } |
| 8675 | } |
| 8676 | |
| 8677 | /* unsolicited event for HP jack sensing */ |
| 8678 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8679 | unsigned int res) |
| 8680 | { |
| 8681 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8682 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8683 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8684 | } |
| 8685 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8686 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8687 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8688 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8689 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8690 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8691 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8692 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8693 | AC_VERB_GET_PIN_SENSE, 0); |
| 8694 | present = (present & 0x80000000) != 0; |
| 8695 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8696 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8697 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8698 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8699 | } else { |
| 8700 | /* unmute internal speaker if necessary */ |
| 8701 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8702 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8703 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8704 | } |
| 8705 | } |
| 8706 | |
| 8707 | /* unsolicited event for HP jack sensing */ |
| 8708 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8709 | unsigned int res) |
| 8710 | { |
| 8711 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8712 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8713 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8714 | } |
| 8715 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8716 | /* |
| 8717 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8718 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 8719 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8720 | */ |
| 8721 | |
| 8722 | #define ALC_HP_EVENT 0x37 |
| 8723 | |
| 8724 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8725 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8726 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8727 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8728 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8729 | {} |
| 8730 | }; |
| 8731 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame^] | 8732 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 8733 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8734 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8735 | {} |
| 8736 | }; |
| 8737 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 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) { |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8775 | unsigned int present_int_hp, present_dock_hp; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8776 | /* need to execute and sync at first */ |
| 8777 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8778 | present_int_hp = snd_hda_codec_read(codec, 0x14, 0, |
| 8779 | AC_VERB_GET_PIN_SENSE, 0); |
| 8780 | snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8781 | present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 8782 | AC_VERB_GET_PIN_SENSE, 0); |
| 8783 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 8784 | spec->jack_present |= (present_dock_hp & 0x80000000) != 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8785 | spec->sense_updated = 1; |
| 8786 | } |
| 8787 | if (spec->jack_present) { |
| 8788 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8789 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8790 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8791 | } else { |
| 8792 | /* unmute internal speaker if necessary */ |
| 8793 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8794 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8795 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8796 | } |
| 8797 | } |
| 8798 | |
| 8799 | /* unsolicited event for HP jack sensing */ |
| 8800 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8801 | unsigned int res) |
| 8802 | { |
| 8803 | if ((res >> 26) != ALC_HP_EVENT) |
| 8804 | return; |
| 8805 | alc262_fujitsu_automute(codec, 1); |
| 8806 | } |
| 8807 | |
| 8808 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8809 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8810 | .ops = &snd_hda_bind_vol, |
| 8811 | .values = { |
| 8812 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8813 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8814 | 0 |
| 8815 | }, |
| 8816 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8817 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame^] | 8818 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8819 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 8820 | { |
| 8821 | struct alc_spec *spec = codec->spec; |
| 8822 | unsigned int mute; |
| 8823 | |
| 8824 | if (force || !spec->sense_updated) { |
| 8825 | unsigned int present_int_hp; |
| 8826 | /* need to execute and sync at first */ |
| 8827 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8828 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 8829 | AC_VERB_GET_PIN_SENSE, 0); |
| 8830 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 8831 | spec->sense_updated = 1; |
| 8832 | } |
| 8833 | if (spec->jack_present) { |
| 8834 | /* mute internal speaker */ |
| 8835 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8836 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8837 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8838 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8839 | } else { |
| 8840 | /* unmute internal speaker if necessary */ |
| 8841 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8842 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8843 | HDA_AMP_MUTE, mute); |
| 8844 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8845 | HDA_AMP_MUTE, mute); |
| 8846 | } |
| 8847 | } |
| 8848 | |
| 8849 | /* unsolicited event for HP jack sensing */ |
| 8850 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 8851 | unsigned int res) |
| 8852 | { |
| 8853 | if ((res >> 26) != ALC_HP_EVENT) |
| 8854 | return; |
| 8855 | alc262_lenovo_3000_automute(codec, 1); |
| 8856 | } |
| 8857 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8858 | /* bind hp and internal speaker mute (with plug check) */ |
| 8859 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8860 | struct snd_ctl_elem_value *ucontrol) |
| 8861 | { |
| 8862 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8863 | long *valp = ucontrol->value.integer.value; |
| 8864 | int change; |
| 8865 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8866 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8867 | HDA_AMP_MUTE, |
| 8868 | valp ? 0 : HDA_AMP_MUTE); |
| 8869 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8870 | HDA_AMP_MUTE, |
| 8871 | valp ? 0 : HDA_AMP_MUTE); |
| 8872 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8873 | if (change) |
| 8874 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8875 | return change; |
| 8876 | } |
| 8877 | |
| 8878 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8879 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8880 | { |
| 8881 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8882 | .name = "Master Playback Switch", |
| 8883 | .info = snd_hda_mixer_amp_switch_info, |
| 8884 | .get = snd_hda_mixer_amp_switch_get, |
| 8885 | .put = alc262_fujitsu_master_sw_put, |
| 8886 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8887 | }, |
| 8888 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8889 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8890 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8891 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8892 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8893 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8894 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8895 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8896 | { } /* end */ |
| 8897 | }; |
| 8898 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame^] | 8899 | /* bind hp and internal speaker mute (with plug check) */ |
| 8900 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8901 | struct snd_ctl_elem_value *ucontrol) |
| 8902 | { |
| 8903 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8904 | long *valp = ucontrol->value.integer.value; |
| 8905 | int change; |
| 8906 | |
| 8907 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8908 | HDA_AMP_MUTE, |
| 8909 | valp ? 0 : HDA_AMP_MUTE); |
| 8910 | |
| 8911 | if (change) |
| 8912 | alc262_lenovo_3000_automute(codec, 0); |
| 8913 | return change; |
| 8914 | } |
| 8915 | |
| 8916 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 8917 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 8918 | { |
| 8919 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8920 | .name = "Master Playback Switch", |
| 8921 | .info = snd_hda_mixer_amp_switch_info, |
| 8922 | .get = snd_hda_mixer_amp_switch_get, |
| 8923 | .put = alc262_lenovo_3000_master_sw_put, |
| 8924 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 8925 | }, |
| 8926 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8927 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8928 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8929 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8930 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8931 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8932 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8933 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8934 | { } /* end */ |
| 8935 | }; |
| 8936 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8937 | /* additional init verbs for Benq laptops */ |
| 8938 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8939 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8940 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8941 | {} |
| 8942 | }; |
| 8943 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8944 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8945 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8946 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8947 | |
| 8948 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8949 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8950 | {} |
| 8951 | }; |
| 8952 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8953 | /* Samsung Q1 Ultra Vista model setup */ |
| 8954 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8955 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8956 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8957 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8958 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8959 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8960 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8961 | { } /* end */ |
| 8962 | }; |
| 8963 | |
| 8964 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8965 | /* output mixer */ |
| 8966 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8967 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8968 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8969 | /* speaker */ |
| 8970 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8971 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8972 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8973 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8974 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8975 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8976 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8977 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8978 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8979 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8980 | /* internal mic */ |
| 8981 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8982 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8983 | /* ADC, choose mic */ |
| 8984 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8985 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8986 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8987 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8988 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8989 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8991 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 8992 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 8993 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8994 | {} |
| 8995 | }; |
| 8996 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8997 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8998 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 8999 | { |
| 9000 | struct alc_spec *spec = codec->spec; |
| 9001 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9002 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9003 | mute = 0; |
| 9004 | /* auto-mute only when HP is used as HP */ |
| 9005 | if (!spec->cur_mux[0]) { |
| 9006 | unsigned int present; |
| 9007 | /* need to execute and sync at first */ |
| 9008 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9009 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9010 | AC_VERB_GET_PIN_SENSE, 0); |
| 9011 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9012 | if (spec->jack_present) |
| 9013 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9014 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9015 | /* mute/unmute internal speaker */ |
| 9016 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9017 | HDA_AMP_MUTE, mute); |
| 9018 | /* mute/unmute HP */ |
| 9019 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9020 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9021 | } |
| 9022 | |
| 9023 | /* unsolicited event for HP jack sensing */ |
| 9024 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9025 | unsigned int res) |
| 9026 | { |
| 9027 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9028 | return; |
| 9029 | alc262_ultra_automute(codec); |
| 9030 | } |
| 9031 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9032 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9033 | .num_items = 2, |
| 9034 | .items = { |
| 9035 | { "Mic", 0x1 }, |
| 9036 | { "Headphone", 0x7 }, |
| 9037 | }, |
| 9038 | }; |
| 9039 | |
| 9040 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9041 | struct snd_ctl_elem_value *ucontrol) |
| 9042 | { |
| 9043 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9044 | struct alc_spec *spec = codec->spec; |
| 9045 | int ret; |
| 9046 | |
| 9047 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 9048 | if (!ret) |
| 9049 | return 0; |
| 9050 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9051 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9052 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9053 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9054 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9055 | return ret; |
| 9056 | } |
| 9057 | |
| 9058 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9059 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9060 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9061 | { |
| 9062 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9063 | .name = "Capture Source", |
| 9064 | .info = alc882_mux_enum_info, |
| 9065 | .get = alc882_mux_enum_get, |
| 9066 | .put = alc262_ultra_mux_enum_put, |
| 9067 | }, |
| 9068 | { } /* end */ |
| 9069 | }; |
| 9070 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9071 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9072 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9073 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9074 | { |
| 9075 | hda_nid_t nid; |
| 9076 | int err; |
| 9077 | |
| 9078 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9079 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9080 | spec->multiout.dac_nids[0] = 2; |
| 9081 | |
| 9082 | nid = cfg->line_out_pins[0]; |
| 9083 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9084 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9085 | "Front Playback Volume", |
| 9086 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9087 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9088 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9089 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9090 | "Front Playback Switch", |
| 9091 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9092 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9093 | return err; |
| 9094 | } |
| 9095 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9096 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9097 | if (nid) { |
| 9098 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9099 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9100 | "Speaker Playback Volume", |
| 9101 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9102 | HDA_OUTPUT)); |
| 9103 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9104 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9105 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9106 | "Speaker Playback Switch", |
| 9107 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9108 | HDA_OUTPUT)); |
| 9109 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9110 | return err; |
| 9111 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9112 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9113 | "Speaker Playback Switch", |
| 9114 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9115 | HDA_OUTPUT)); |
| 9116 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9117 | return err; |
| 9118 | } |
| 9119 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9120 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9121 | if (nid) { |
| 9122 | /* spec->multiout.hp_nid = 2; */ |
| 9123 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9124 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9125 | "Headphone Playback Volume", |
| 9126 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9127 | HDA_OUTPUT)); |
| 9128 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9129 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9130 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9131 | "Headphone Playback Switch", |
| 9132 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9133 | HDA_OUTPUT)); |
| 9134 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9135 | return err; |
| 9136 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9137 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9138 | "Headphone Playback Switch", |
| 9139 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9140 | HDA_OUTPUT)); |
| 9141 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9142 | return err; |
| 9143 | } |
| 9144 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9145 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9146 | } |
| 9147 | |
| 9148 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9149 | #define alc262_auto_create_analog_input_ctls \ |
| 9150 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9151 | |
| 9152 | /* |
| 9153 | * generic initialization of ADC, input mixers and output mixers |
| 9154 | */ |
| 9155 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9156 | /* |
| 9157 | * Unmute ADC0-2 and set the default input to mic-in |
| 9158 | */ |
| 9159 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9160 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9161 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9162 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9163 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9164 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9165 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9166 | /* 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] | 9167 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9168 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9169 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9170 | */ |
| 9171 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9172 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9173 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9174 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9175 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9176 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9177 | |
| 9178 | /* |
| 9179 | * Set up output mixers (0x0c - 0x0f) |
| 9180 | */ |
| 9181 | /* set vol=0 to output mixers */ |
| 9182 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9183 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9184 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9185 | |
| 9186 | /* set up input amps for analog loopback */ |
| 9187 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9188 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9189 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9190 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9191 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9192 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9193 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9194 | |
| 9195 | /* FIXME: use matrix-type input source selection */ |
| 9196 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9197 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9198 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9199 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9200 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9201 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9202 | /* Input mixer2 */ |
| 9203 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9204 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9205 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9206 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9207 | /* Input mixer3 */ |
| 9208 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9209 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9210 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9211 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9212 | |
| 9213 | { } |
| 9214 | }; |
| 9215 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9216 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9217 | /* |
| 9218 | * Unmute ADC0-2 and set the default input to mic-in |
| 9219 | */ |
| 9220 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9221 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9222 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9223 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9224 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9225 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9226 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9227 | /* 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] | 9228 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9229 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9230 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9231 | */ |
| 9232 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9233 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9234 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9235 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9236 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9237 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9238 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9239 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9240 | |
| 9241 | /* |
| 9242 | * Set up output mixers (0x0c - 0x0e) |
| 9243 | */ |
| 9244 | /* set vol=0 to output mixers */ |
| 9245 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9246 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9247 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9248 | |
| 9249 | /* set up input amps for analog loopback */ |
| 9250 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9251 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9253 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9254 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9255 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9256 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9257 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9258 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9259 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9260 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9261 | |
| 9262 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9263 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9264 | |
| 9265 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9266 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9267 | |
| 9268 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9269 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9270 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9271 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9272 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9273 | |
| 9274 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9275 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9276 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9277 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9278 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9279 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9280 | |
| 9281 | |
| 9282 | /* FIXME: use matrix-type input source selection */ |
| 9283 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9284 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9285 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9286 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9287 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9288 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9289 | /* Input mixer2 */ |
| 9290 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9291 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9292 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9293 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9294 | /* Input mixer3 */ |
| 9295 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9296 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9297 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9298 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9299 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9300 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9301 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9302 | { } |
| 9303 | }; |
| 9304 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9305 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9306 | /* |
| 9307 | * Unmute ADC0-2 and set the default input to mic-in |
| 9308 | */ |
| 9309 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9310 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9311 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9312 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9313 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9314 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9315 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9316 | /* 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] | 9317 | * mixer widget |
| 9318 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9319 | * panel mic (mic 2) |
| 9320 | */ |
| 9321 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9322 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9323 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9324 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9326 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9329 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9330 | /* |
| 9331 | * Set up output mixers (0x0c - 0x0e) |
| 9332 | */ |
| 9333 | /* set vol=0 to output mixers */ |
| 9334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9335 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9336 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9337 | |
| 9338 | /* set up input amps for analog loopback */ |
| 9339 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9340 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9341 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9342 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9343 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9344 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9345 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9346 | |
| 9347 | |
| 9348 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9349 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9350 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9351 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9352 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9353 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9354 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9355 | |
| 9356 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9357 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9358 | |
| 9359 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9360 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9361 | |
| 9362 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9363 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9364 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9365 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9366 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9367 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9368 | |
| 9369 | /* FIXME: use matrix-type input source selection */ |
| 9370 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9371 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9372 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9373 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9374 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9375 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9376 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9377 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9378 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9379 | /* Input mixer2 */ |
| 9380 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9381 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9382 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9383 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9384 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9385 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9386 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9387 | /* Input mixer3 */ |
| 9388 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9389 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9390 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9391 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9392 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9393 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9394 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9395 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9396 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9397 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9398 | { } |
| 9399 | }; |
| 9400 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9401 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9402 | #define alc262_loopbacks alc880_loopbacks |
| 9403 | #endif |
| 9404 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9405 | /* pcm configuration: identiacal with ALC880 */ |
| 9406 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9407 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9408 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9409 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9410 | |
| 9411 | /* |
| 9412 | * BIOS auto configuration |
| 9413 | */ |
| 9414 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9415 | { |
| 9416 | struct alc_spec *spec = codec->spec; |
| 9417 | int err; |
| 9418 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9419 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9420 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9421 | alc262_ignore); |
| 9422 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9423 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9424 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9425 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9426 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9427 | if (err < 0) |
| 9428 | return err; |
| 9429 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9430 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9431 | return err; |
| 9432 | |
| 9433 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9434 | |
| 9435 | if (spec->autocfg.dig_out_pin) |
| 9436 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9437 | if (spec->autocfg.dig_in_pin) |
| 9438 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9439 | |
| 9440 | if (spec->kctl_alloc) |
| 9441 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9442 | |
| 9443 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9444 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9445 | spec->input_mux = &spec->private_imux; |
| 9446 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9447 | err = alc_auto_add_mic_boost(codec); |
| 9448 | if (err < 0) |
| 9449 | return err; |
| 9450 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9451 | return 1; |
| 9452 | } |
| 9453 | |
| 9454 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9455 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9456 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 9457 | |
| 9458 | |
| 9459 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9460 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9461 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9462 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9463 | alc262_auto_init_multi_out(codec); |
| 9464 | alc262_auto_init_hp_out(codec); |
| 9465 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9466 | if (spec->unsol_event) |
| 9467 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9468 | } |
| 9469 | |
| 9470 | /* |
| 9471 | * configuration and preset |
| 9472 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9473 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9474 | [ALC262_BASIC] = "basic", |
| 9475 | [ALC262_HIPPO] = "hippo", |
| 9476 | [ALC262_HIPPO_1] = "hippo_1", |
| 9477 | [ALC262_FUJITSU] = "fujitsu", |
| 9478 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9479 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9480 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9481 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9482 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9483 | [ALC262_BENQ_T31] = "benq-t31", |
| 9484 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9485 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame^] | 9486 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9487 | [ALC262_AUTO] = "auto", |
| 9488 | }; |
| 9489 | |
| 9490 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9491 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 9492 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9493 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9494 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9495 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9496 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9497 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9498 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9499 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9500 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9501 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9502 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9503 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9504 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9505 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9506 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9507 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9508 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9509 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9510 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9511 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9512 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9513 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9514 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9515 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9516 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9517 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9518 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9519 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9520 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9521 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9522 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame^] | 9523 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9524 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9525 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9526 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9527 | {} |
| 9528 | }; |
| 9529 | |
| 9530 | static struct alc_config_preset alc262_presets[] = { |
| 9531 | [ALC262_BASIC] = { |
| 9532 | .mixers = { alc262_base_mixer }, |
| 9533 | .init_verbs = { alc262_init_verbs }, |
| 9534 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9535 | .dac_nids = alc262_dac_nids, |
| 9536 | .hp_nid = 0x03, |
| 9537 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9538 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9539 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9540 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9541 | [ALC262_HIPPO] = { |
| 9542 | .mixers = { alc262_base_mixer }, |
| 9543 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9544 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9545 | .dac_nids = alc262_dac_nids, |
| 9546 | .hp_nid = 0x03, |
| 9547 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9548 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9549 | .channel_mode = alc262_modes, |
| 9550 | .input_mux = &alc262_capture_source, |
| 9551 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9552 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9553 | }, |
| 9554 | [ALC262_HIPPO_1] = { |
| 9555 | .mixers = { alc262_hippo1_mixer }, |
| 9556 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9557 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9558 | .dac_nids = alc262_dac_nids, |
| 9559 | .hp_nid = 0x02, |
| 9560 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9561 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9562 | .channel_mode = alc262_modes, |
| 9563 | .input_mux = &alc262_capture_source, |
| 9564 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9565 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9566 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9567 | [ALC262_FUJITSU] = { |
| 9568 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9569 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9570 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9571 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9572 | .dac_nids = alc262_dac_nids, |
| 9573 | .hp_nid = 0x03, |
| 9574 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9575 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9576 | .channel_mode = alc262_modes, |
| 9577 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9578 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9579 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9580 | [ALC262_HP_BPC] = { |
| 9581 | .mixers = { alc262_HP_BPC_mixer }, |
| 9582 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9583 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9584 | .dac_nids = alc262_dac_nids, |
| 9585 | .hp_nid = 0x03, |
| 9586 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9587 | .channel_mode = alc262_modes, |
| 9588 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9589 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 9590 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9591 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9592 | [ALC262_HP_BPC_D7000_WF] = { |
| 9593 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9594 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9595 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9596 | .dac_nids = alc262_dac_nids, |
| 9597 | .hp_nid = 0x03, |
| 9598 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9599 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9600 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9601 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9602 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9603 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9604 | [ALC262_HP_BPC_D7000_WL] = { |
| 9605 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9606 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9607 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9608 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9609 | .dac_nids = alc262_dac_nids, |
| 9610 | .hp_nid = 0x03, |
| 9611 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9612 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9613 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9614 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9615 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9616 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9617 | [ALC262_HP_TC_T5735] = { |
| 9618 | .mixers = { alc262_hp_t5735_mixer }, |
| 9619 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9620 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9621 | .dac_nids = alc262_dac_nids, |
| 9622 | .hp_nid = 0x03, |
| 9623 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9624 | .channel_mode = alc262_modes, |
| 9625 | .input_mux = &alc262_capture_source, |
| 9626 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9627 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9628 | }, |
| 9629 | [ALC262_HP_RP5700] = { |
| 9630 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9631 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9632 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9633 | .dac_nids = alc262_dac_nids, |
| 9634 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9635 | .channel_mode = alc262_modes, |
| 9636 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9637 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9638 | [ALC262_BENQ_ED8] = { |
| 9639 | .mixers = { alc262_base_mixer }, |
| 9640 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9641 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9642 | .dac_nids = alc262_dac_nids, |
| 9643 | .hp_nid = 0x03, |
| 9644 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9645 | .channel_mode = alc262_modes, |
| 9646 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9647 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9648 | [ALC262_SONY_ASSAMD] = { |
| 9649 | .mixers = { alc262_sony_mixer }, |
| 9650 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9651 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9652 | .dac_nids = alc262_dac_nids, |
| 9653 | .hp_nid = 0x02, |
| 9654 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9655 | .channel_mode = alc262_modes, |
| 9656 | .input_mux = &alc262_capture_source, |
| 9657 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9658 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9659 | }, |
| 9660 | [ALC262_BENQ_T31] = { |
| 9661 | .mixers = { alc262_benq_t31_mixer }, |
| 9662 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9663 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9664 | .dac_nids = alc262_dac_nids, |
| 9665 | .hp_nid = 0x03, |
| 9666 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9667 | .channel_mode = alc262_modes, |
| 9668 | .input_mux = &alc262_capture_source, |
| 9669 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9670 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9671 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9672 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9673 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 9674 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9675 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9676 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9677 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9678 | .channel_mode = alc262_modes, |
| 9679 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9680 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 9681 | .capsrc_nids = alc262_capsrc_nids, |
| 9682 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9683 | .unsol_event = alc262_ultra_unsol_event, |
| 9684 | .init_hook = alc262_ultra_automute, |
| 9685 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame^] | 9686 | [ALC262_LENOVO_3000] = { |
| 9687 | .mixers = { alc262_lenovo_3000_mixer }, |
| 9688 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9689 | alc262_lenovo_3000_unsol_verbs }, |
| 9690 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9691 | .dac_nids = alc262_dac_nids, |
| 9692 | .hp_nid = 0x03, |
| 9693 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9694 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9695 | .channel_mode = alc262_modes, |
| 9696 | .input_mux = &alc262_fujitsu_capture_source, |
| 9697 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 9698 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9699 | }; |
| 9700 | |
| 9701 | static int patch_alc262(struct hda_codec *codec) |
| 9702 | { |
| 9703 | struct alc_spec *spec; |
| 9704 | int board_config; |
| 9705 | int err; |
| 9706 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9707 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9708 | if (spec == NULL) |
| 9709 | return -ENOMEM; |
| 9710 | |
| 9711 | codec->spec = spec; |
| 9712 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9713 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9714 | * under-run |
| 9715 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9716 | { |
| 9717 | int tmp; |
| 9718 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9719 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9720 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9721 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9722 | } |
| 9723 | #endif |
| 9724 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9725 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9726 | alc262_models, |
| 9727 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9728 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9729 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9730 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9731 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9732 | board_config = ALC262_AUTO; |
| 9733 | } |
| 9734 | |
| 9735 | if (board_config == ALC262_AUTO) { |
| 9736 | /* automatic parse from the BIOS config */ |
| 9737 | err = alc262_parse_auto_config(codec); |
| 9738 | if (err < 0) { |
| 9739 | alc_free(codec); |
| 9740 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9741 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9742 | printk(KERN_INFO |
| 9743 | "hda_codec: Cannot set up configuration " |
| 9744 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9745 | board_config = ALC262_BASIC; |
| 9746 | } |
| 9747 | } |
| 9748 | |
| 9749 | if (board_config != ALC262_AUTO) |
| 9750 | setup_preset(spec, &alc262_presets[board_config]); |
| 9751 | |
| 9752 | spec->stream_name_analog = "ALC262 Analog"; |
| 9753 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9754 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9755 | |
| 9756 | spec->stream_name_digital = "ALC262 Digital"; |
| 9757 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9758 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9759 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9760 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9761 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9762 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9763 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9764 | /* get type */ |
| 9765 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9766 | if (wcap != AC_WID_AUD_IN) { |
| 9767 | spec->adc_nids = alc262_adc_nids_alt; |
| 9768 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9769 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9770 | spec->mixers[spec->num_mixers] = |
| 9771 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9772 | spec->num_mixers++; |
| 9773 | } else { |
| 9774 | spec->adc_nids = alc262_adc_nids; |
| 9775 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9776 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9777 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9778 | spec->num_mixers++; |
| 9779 | } |
| 9780 | } |
| 9781 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9782 | spec->vmaster_nid = 0x0c; |
| 9783 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9784 | codec->patch_ops = alc_patch_ops; |
| 9785 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9786 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9787 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9788 | if (!spec->loopback.amplist) |
| 9789 | spec->loopback.amplist = alc262_loopbacks; |
| 9790 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9791 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9792 | return 0; |
| 9793 | } |
| 9794 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9795 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9796 | * ALC268 channel source setting (2 channel) |
| 9797 | */ |
| 9798 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9799 | #define alc268_modes alc260_modes |
| 9800 | |
| 9801 | static hda_nid_t alc268_dac_nids[2] = { |
| 9802 | /* front, hp */ |
| 9803 | 0x02, 0x03 |
| 9804 | }; |
| 9805 | |
| 9806 | static hda_nid_t alc268_adc_nids[2] = { |
| 9807 | /* ADC0-1 */ |
| 9808 | 0x08, 0x07 |
| 9809 | }; |
| 9810 | |
| 9811 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9812 | /* ADC0 */ |
| 9813 | 0x08 |
| 9814 | }; |
| 9815 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 9816 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 9817 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9818 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9819 | /* output mixer control */ |
| 9820 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9821 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9822 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9823 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9824 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9825 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9826 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9827 | { } |
| 9828 | }; |
| 9829 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 9830 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 9831 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 9832 | .ops = &snd_hda_bind_sw, |
| 9833 | .values = { |
| 9834 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 9835 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 9836 | 0 |
| 9837 | }, |
| 9838 | }; |
| 9839 | |
| 9840 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 9841 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 9842 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 9843 | { } |
| 9844 | }; |
| 9845 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9846 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9847 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9848 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9849 | { } |
| 9850 | }; |
| 9851 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9852 | /* Toshiba specific */ |
| 9853 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9854 | |
| 9855 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9856 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9857 | { } /* end */ |
| 9858 | }; |
| 9859 | |
| 9860 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9861 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9862 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9863 | .ops = &snd_hda_bind_vol, |
| 9864 | .values = { |
| 9865 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9866 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9867 | 0 |
| 9868 | }, |
| 9869 | }; |
| 9870 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9871 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9872 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9873 | { |
| 9874 | struct alc_spec *spec = codec->spec; |
| 9875 | unsigned int mute; |
| 9876 | |
| 9877 | if (force || !spec->sense_updated) { |
| 9878 | unsigned int present; |
| 9879 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9880 | AC_VERB_GET_PIN_SENSE, 0); |
| 9881 | spec->jack_present = (present & 0x80000000) != 0; |
| 9882 | spec->sense_updated = 1; |
| 9883 | } |
| 9884 | if (spec->jack_present) |
| 9885 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9886 | else /* unmute internal speaker if necessary */ |
| 9887 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9888 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9889 | HDA_AMP_MUTE, mute); |
| 9890 | } |
| 9891 | |
| 9892 | |
| 9893 | /* bind hp and internal speaker mute (with plug check) */ |
| 9894 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9895 | struct snd_ctl_elem_value *ucontrol) |
| 9896 | { |
| 9897 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9898 | long *valp = ucontrol->value.integer.value; |
| 9899 | int change; |
| 9900 | |
| 9901 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9902 | HDA_AMP_MUTE, |
| 9903 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9904 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9905 | HDA_AMP_MUTE, |
| 9906 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9907 | if (change) |
| 9908 | alc268_acer_automute(codec, 0); |
| 9909 | return change; |
| 9910 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9911 | |
| 9912 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9913 | /* output mixer control */ |
| 9914 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9915 | { |
| 9916 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9917 | .name = "Master Playback Switch", |
| 9918 | .info = snd_hda_mixer_amp_switch_info, |
| 9919 | .get = snd_hda_mixer_amp_switch_get, |
| 9920 | .put = alc268_acer_master_sw_put, |
| 9921 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9922 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9923 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9924 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9925 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9926 | { } |
| 9927 | }; |
| 9928 | |
| 9929 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 9930 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 9931 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9932 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9933 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 9934 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9935 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9936 | |
| 9937 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9938 | { } |
| 9939 | }; |
| 9940 | |
| 9941 | /* unsolicited event for HP jack sensing */ |
| 9942 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9943 | unsigned int res) |
| 9944 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9945 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9946 | return; |
| 9947 | alc268_toshiba_automute(codec); |
| 9948 | } |
| 9949 | |
| 9950 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9951 | unsigned int res) |
| 9952 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9953 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9954 | return; |
| 9955 | alc268_acer_automute(codec, 1); |
| 9956 | } |
| 9957 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9958 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9959 | { |
| 9960 | alc268_acer_automute(codec, 1); |
| 9961 | } |
| 9962 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9963 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 9964 | /* output mixer control */ |
| 9965 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9966 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9967 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9968 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9969 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9970 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9971 | { } |
| 9972 | }; |
| 9973 | |
| 9974 | static struct hda_verb alc268_dell_verbs[] = { |
| 9975 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9976 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9977 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9978 | { } |
| 9979 | }; |
| 9980 | |
| 9981 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9982 | static void alc268_dell_automute(struct hda_codec *codec) |
| 9983 | { |
| 9984 | unsigned int present; |
| 9985 | unsigned int mute; |
| 9986 | |
| 9987 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 9988 | if (present & 0x80000000) |
| 9989 | mute = HDA_AMP_MUTE; |
| 9990 | else |
| 9991 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 9992 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9993 | HDA_AMP_MUTE, mute); |
| 9994 | } |
| 9995 | |
| 9996 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 9997 | unsigned int res) |
| 9998 | { |
| 9999 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10000 | return; |
| 10001 | alc268_dell_automute(codec); |
| 10002 | } |
| 10003 | |
| 10004 | #define alc268_dell_init_hook alc268_dell_automute |
| 10005 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10006 | /* |
| 10007 | * generic initialization of ADC, input mixers and output mixers |
| 10008 | */ |
| 10009 | static struct hda_verb alc268_base_init_verbs[] = { |
| 10010 | /* Unmute DAC0-1 and set vol = 0 */ |
| 10011 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10012 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10013 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10014 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10015 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10016 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10017 | |
| 10018 | /* |
| 10019 | * Set up output mixers (0x0c - 0x0e) |
| 10020 | */ |
| 10021 | /* set vol=0 to output mixers */ |
| 10022 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10023 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10024 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10025 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10026 | |
| 10027 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10028 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10029 | |
| 10030 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10031 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10032 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10033 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10034 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10035 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10036 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10037 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10038 | |
| 10039 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10040 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10041 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10042 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10043 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10044 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10045 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10046 | |
| 10047 | /* set PCBEEP vol = 0, mute connections */ |
| 10048 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10049 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10050 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10051 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10052 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 10053 | |
| 10054 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10055 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10056 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10057 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10058 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10059 | { } |
| 10060 | }; |
| 10061 | |
| 10062 | /* |
| 10063 | * generic initialization of ADC, input mixers and output mixers |
| 10064 | */ |
| 10065 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 10066 | /* set output DAC */ |
| 10067 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10068 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10069 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10070 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10071 | |
| 10072 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10073 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10074 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10075 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10076 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10077 | |
| 10078 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10079 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10080 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10081 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10082 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10083 | |
| 10084 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10085 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10086 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10087 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10088 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10089 | /* set PCBEEP vol = 0, mute connections */ |
| 10090 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10091 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10092 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10093 | |
| 10094 | { } |
| 10095 | }; |
| 10096 | |
| 10097 | #define alc268_mux_enum_info alc_mux_enum_info |
| 10098 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10099 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10100 | |
| 10101 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 10102 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10103 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10104 | { |
| 10105 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10106 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10107 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10108 | */ |
| 10109 | /* .name = "Capture Source", */ |
| 10110 | .name = "Input Source", |
| 10111 | .count = 1, |
| 10112 | .info = alc268_mux_enum_info, |
| 10113 | .get = alc268_mux_enum_get, |
| 10114 | .put = alc268_mux_enum_put, |
| 10115 | }, |
| 10116 | { } /* end */ |
| 10117 | }; |
| 10118 | |
| 10119 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 10120 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10121 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10122 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10123 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10124 | { |
| 10125 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10126 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10127 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10128 | */ |
| 10129 | /* .name = "Capture Source", */ |
| 10130 | .name = "Input Source", |
| 10131 | .count = 2, |
| 10132 | .info = alc268_mux_enum_info, |
| 10133 | .get = alc268_mux_enum_get, |
| 10134 | .put = alc268_mux_enum_put, |
| 10135 | }, |
| 10136 | { } /* end */ |
| 10137 | }; |
| 10138 | |
| 10139 | static struct hda_input_mux alc268_capture_source = { |
| 10140 | .num_items = 4, |
| 10141 | .items = { |
| 10142 | { "Mic", 0x0 }, |
| 10143 | { "Front Mic", 0x1 }, |
| 10144 | { "Line", 0x2 }, |
| 10145 | { "CD", 0x3 }, |
| 10146 | }, |
| 10147 | }; |
| 10148 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10149 | static struct hda_input_mux alc268_acer_capture_source = { |
| 10150 | .num_items = 3, |
| 10151 | .items = { |
| 10152 | { "Mic", 0x0 }, |
| 10153 | { "Internal Mic", 0x6 }, |
| 10154 | { "Line", 0x2 }, |
| 10155 | }, |
| 10156 | }; |
| 10157 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10158 | #ifdef CONFIG_SND_DEBUG |
| 10159 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10160 | /* Volume widgets */ |
| 10161 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10162 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10163 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10164 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10165 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 10166 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 10167 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 10168 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 10169 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 10170 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 10171 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 10172 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 10173 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 10174 | /* The below appears problematic on some hardwares */ |
| 10175 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10176 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10177 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10178 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 10179 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 10180 | |
| 10181 | /* Modes for retasking pin widgets */ |
| 10182 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 10183 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 10184 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 10185 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 10186 | |
| 10187 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 10188 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 10189 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 10190 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 10191 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 10192 | |
| 10193 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 10194 | * The ALC268 does not have an SPDIF input. |
| 10195 | */ |
| 10196 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 10197 | |
| 10198 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 10199 | * this output to turn on an external amplifier. |
| 10200 | */ |
| 10201 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 10202 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 10203 | |
| 10204 | { } /* end */ |
| 10205 | }; |
| 10206 | #endif |
| 10207 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10208 | /* create input playback/capture controls for the given pin */ |
| 10209 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 10210 | const char *ctlname, int idx) |
| 10211 | { |
| 10212 | char name[32]; |
| 10213 | int err; |
| 10214 | |
| 10215 | sprintf(name, "%s Playback Volume", ctlname); |
| 10216 | if (nid == 0x14) { |
| 10217 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10218 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 10219 | HDA_OUTPUT)); |
| 10220 | if (err < 0) |
| 10221 | return err; |
| 10222 | } else if (nid == 0x15) { |
| 10223 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10224 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 10225 | HDA_OUTPUT)); |
| 10226 | if (err < 0) |
| 10227 | return err; |
| 10228 | } else |
| 10229 | return -1; |
| 10230 | sprintf(name, "%s Playback Switch", ctlname); |
| 10231 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10232 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 10233 | if (err < 0) |
| 10234 | return err; |
| 10235 | return 0; |
| 10236 | } |
| 10237 | |
| 10238 | /* add playback controls from the parsed DAC table */ |
| 10239 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10240 | const struct auto_pin_cfg *cfg) |
| 10241 | { |
| 10242 | hda_nid_t nid; |
| 10243 | int err; |
| 10244 | |
| 10245 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 10246 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10247 | spec->multiout.dac_nids[0] = 2; |
| 10248 | spec->multiout.dac_nids[1] = 3; |
| 10249 | |
| 10250 | nid = cfg->line_out_pins[0]; |
| 10251 | if (nid) |
| 10252 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 10253 | |
| 10254 | nid = cfg->speaker_pins[0]; |
| 10255 | if (nid == 0x1d) { |
| 10256 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10257 | "Speaker Playback Volume", |
| 10258 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10259 | if (err < 0) |
| 10260 | return err; |
| 10261 | } |
| 10262 | nid = cfg->hp_pins[0]; |
| 10263 | if (nid) |
| 10264 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 10265 | |
| 10266 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 10267 | if (nid == 0x16) { |
| 10268 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10269 | "Mono Playback Switch", |
| 10270 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 10271 | if (err < 0) |
| 10272 | return err; |
| 10273 | } |
| 10274 | return 0; |
| 10275 | } |
| 10276 | |
| 10277 | /* create playback/capture controls for input pins */ |
| 10278 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10279 | const struct auto_pin_cfg *cfg) |
| 10280 | { |
| 10281 | struct hda_input_mux *imux = &spec->private_imux; |
| 10282 | int i, idx1; |
| 10283 | |
| 10284 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10285 | switch(cfg->input_pins[i]) { |
| 10286 | case 0x18: |
| 10287 | idx1 = 0; /* Mic 1 */ |
| 10288 | break; |
| 10289 | case 0x19: |
| 10290 | idx1 = 1; /* Mic 2 */ |
| 10291 | break; |
| 10292 | case 0x1a: |
| 10293 | idx1 = 2; /* Line In */ |
| 10294 | break; |
| 10295 | case 0x1c: |
| 10296 | idx1 = 3; /* CD */ |
| 10297 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 10298 | case 0x12: |
| 10299 | case 0x13: |
| 10300 | idx1 = 6; /* digital mics */ |
| 10301 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10302 | default: |
| 10303 | continue; |
| 10304 | } |
| 10305 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 10306 | imux->items[imux->num_items].index = idx1; |
| 10307 | imux->num_items++; |
| 10308 | } |
| 10309 | return 0; |
| 10310 | } |
| 10311 | |
| 10312 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 10313 | { |
| 10314 | struct alc_spec *spec = codec->spec; |
| 10315 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10316 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10317 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10318 | unsigned int dac_vol1, dac_vol2; |
| 10319 | |
| 10320 | if (speaker_nid) { |
| 10321 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 10322 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 10323 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10324 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10325 | AMP_IN_UNMUTE(1)); |
| 10326 | snd_hda_codec_write(codec, 0x10, 0, |
| 10327 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10328 | AMP_IN_UNMUTE(1)); |
| 10329 | } else { |
| 10330 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10331 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10332 | snd_hda_codec_write(codec, 0x10, 0, |
| 10333 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10334 | } |
| 10335 | |
| 10336 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 10337 | if (line_nid == 0x14) |
| 10338 | dac_vol2 = AMP_OUT_ZERO; |
| 10339 | else if (line_nid == 0x15) |
| 10340 | dac_vol1 = AMP_OUT_ZERO; |
| 10341 | if (hp_nid == 0x14) |
| 10342 | dac_vol2 = AMP_OUT_ZERO; |
| 10343 | else if (hp_nid == 0x15) |
| 10344 | dac_vol1 = AMP_OUT_ZERO; |
| 10345 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10346 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10347 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10348 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10349 | |
| 10350 | snd_hda_codec_write(codec, 0x02, 0, |
| 10351 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10352 | snd_hda_codec_write(codec, 0x03, 0, |
| 10353 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10354 | } |
| 10355 | |
| 10356 | /* pcm configuration: identiacal with ALC880 */ |
| 10357 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10358 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10359 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10360 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10361 | |
| 10362 | /* |
| 10363 | * BIOS auto configuration |
| 10364 | */ |
| 10365 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10366 | { |
| 10367 | struct alc_spec *spec = codec->spec; |
| 10368 | int err; |
| 10369 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10370 | |
| 10371 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10372 | alc268_ignore); |
| 10373 | if (err < 0) |
| 10374 | return err; |
| 10375 | if (!spec->autocfg.line_outs) |
| 10376 | return 0; /* can't find valid BIOS pin config */ |
| 10377 | |
| 10378 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10379 | if (err < 0) |
| 10380 | return err; |
| 10381 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10382 | if (err < 0) |
| 10383 | return err; |
| 10384 | |
| 10385 | spec->multiout.max_channels = 2; |
| 10386 | |
| 10387 | /* digital only support output */ |
| 10388 | if (spec->autocfg.dig_out_pin) |
| 10389 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10390 | |
| 10391 | if (spec->kctl_alloc) |
| 10392 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10393 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10394 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 10395 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 10396 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10397 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10398 | spec->num_mux_defs = 1; |
| 10399 | spec->input_mux = &spec->private_imux; |
| 10400 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10401 | err = alc_auto_add_mic_boost(codec); |
| 10402 | if (err < 0) |
| 10403 | return err; |
| 10404 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10405 | return 1; |
| 10406 | } |
| 10407 | |
| 10408 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10409 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10410 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10411 | |
| 10412 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10413 | static void alc268_auto_init(struct hda_codec *codec) |
| 10414 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10415 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10416 | alc268_auto_init_multi_out(codec); |
| 10417 | alc268_auto_init_hp_out(codec); |
| 10418 | alc268_auto_init_mono_speaker_out(codec); |
| 10419 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10420 | if (spec->unsol_event) |
| 10421 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10422 | } |
| 10423 | |
| 10424 | /* |
| 10425 | * configuration and preset |
| 10426 | */ |
| 10427 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 10428 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10429 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10430 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10431 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10432 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10433 | #ifdef CONFIG_SND_DEBUG |
| 10434 | [ALC268_TEST] = "test", |
| 10435 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10436 | [ALC268_AUTO] = "auto", |
| 10437 | }; |
| 10438 | |
| 10439 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10440 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10441 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10442 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10443 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10444 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10445 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10446 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10447 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10448 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10449 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10450 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10451 | {} |
| 10452 | }; |
| 10453 | |
| 10454 | static struct alc_config_preset alc268_presets[] = { |
| 10455 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10456 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10457 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10458 | .init_verbs = { alc268_base_init_verbs }, |
| 10459 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10460 | .dac_nids = alc268_dac_nids, |
| 10461 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10462 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10463 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10464 | .hp_nid = 0x03, |
| 10465 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10466 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10467 | .channel_mode = alc268_modes, |
| 10468 | .input_mux = &alc268_capture_source, |
| 10469 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10470 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10471 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10472 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10473 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10474 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10475 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10476 | .dac_nids = alc268_dac_nids, |
| 10477 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10478 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10479 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10480 | .hp_nid = 0x03, |
| 10481 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10482 | .channel_mode = alc268_modes, |
| 10483 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10484 | .unsol_event = alc268_toshiba_unsol_event, |
| 10485 | .init_hook = alc268_toshiba_automute, |
| 10486 | }, |
| 10487 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10488 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 10489 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10490 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10491 | alc268_acer_verbs }, |
| 10492 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10493 | .dac_nids = alc268_dac_nids, |
| 10494 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10495 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10496 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10497 | .hp_nid = 0x02, |
| 10498 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10499 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10500 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10501 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10502 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10503 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10504 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10505 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10506 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10507 | alc268_dell_verbs }, |
| 10508 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10509 | .dac_nids = alc268_dac_nids, |
| 10510 | .hp_nid = 0x02, |
| 10511 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10512 | .channel_mode = alc268_modes, |
| 10513 | .unsol_event = alc268_dell_unsol_event, |
| 10514 | .init_hook = alc268_dell_init_hook, |
| 10515 | .input_mux = &alc268_capture_source, |
| 10516 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10517 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10518 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10519 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10520 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10521 | alc268_toshiba_verbs }, |
| 10522 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10523 | .dac_nids = alc268_dac_nids, |
| 10524 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10525 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10526 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10527 | .hp_nid = 0x03, |
| 10528 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10529 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10530 | .channel_mode = alc268_modes, |
| 10531 | .input_mux = &alc268_capture_source, |
| 10532 | .unsol_event = alc268_toshiba_unsol_event, |
| 10533 | .init_hook = alc268_toshiba_automute |
| 10534 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10535 | #ifdef CONFIG_SND_DEBUG |
| 10536 | [ALC268_TEST] = { |
| 10537 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10538 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10539 | alc268_volume_init_verbs }, |
| 10540 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10541 | .dac_nids = alc268_dac_nids, |
| 10542 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10543 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10544 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10545 | .hp_nid = 0x03, |
| 10546 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10547 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10548 | .channel_mode = alc268_modes, |
| 10549 | .input_mux = &alc268_capture_source, |
| 10550 | }, |
| 10551 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10552 | }; |
| 10553 | |
| 10554 | static int patch_alc268(struct hda_codec *codec) |
| 10555 | { |
| 10556 | struct alc_spec *spec; |
| 10557 | int board_config; |
| 10558 | int err; |
| 10559 | |
| 10560 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10561 | if (spec == NULL) |
| 10562 | return -ENOMEM; |
| 10563 | |
| 10564 | codec->spec = spec; |
| 10565 | |
| 10566 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10567 | alc268_models, |
| 10568 | alc268_cfg_tbl); |
| 10569 | |
| 10570 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10571 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10572 | "trying auto-probe from BIOS...\n"); |
| 10573 | board_config = ALC268_AUTO; |
| 10574 | } |
| 10575 | |
| 10576 | if (board_config == ALC268_AUTO) { |
| 10577 | /* automatic parse from the BIOS config */ |
| 10578 | err = alc268_parse_auto_config(codec); |
| 10579 | if (err < 0) { |
| 10580 | alc_free(codec); |
| 10581 | return err; |
| 10582 | } else if (!err) { |
| 10583 | printk(KERN_INFO |
| 10584 | "hda_codec: Cannot set up configuration " |
| 10585 | "from BIOS. Using base mode...\n"); |
| 10586 | board_config = ALC268_3ST; |
| 10587 | } |
| 10588 | } |
| 10589 | |
| 10590 | if (board_config != ALC268_AUTO) |
| 10591 | setup_preset(spec, &alc268_presets[board_config]); |
| 10592 | |
| 10593 | spec->stream_name_analog = "ALC268 Analog"; |
| 10594 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10595 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10596 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10597 | |
| 10598 | spec->stream_name_digital = "ALC268 Digital"; |
| 10599 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10600 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10601 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 10602 | /* override the amp caps for beep generator */ |
| 10603 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 10604 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 10605 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 10606 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 10607 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 10608 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10609 | if (!spec->adc_nids && spec->input_mux) { |
| 10610 | /* check whether NID 0x07 is valid */ |
| 10611 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10612 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10613 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10614 | /* get type */ |
| 10615 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 10616 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10617 | spec->adc_nids = alc268_adc_nids_alt; |
| 10618 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10619 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10620 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10621 | spec->num_mixers++; |
| 10622 | } else { |
| 10623 | spec->adc_nids = alc268_adc_nids; |
| 10624 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10625 | spec->mixers[spec->num_mixers] = |
| 10626 | alc268_capture_mixer; |
| 10627 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10628 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10629 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10630 | /* set default input source */ |
| 10631 | for (i = 0; i < spec->num_adc_nids; i++) |
| 10632 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 10633 | 0, AC_VERB_SET_CONNECT_SEL, |
| 10634 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10635 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10636 | |
| 10637 | spec->vmaster_nid = 0x02; |
| 10638 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10639 | codec->patch_ops = alc_patch_ops; |
| 10640 | if (board_config == ALC268_AUTO) |
| 10641 | spec->init_hook = alc268_auto_init; |
| 10642 | |
| 10643 | return 0; |
| 10644 | } |
| 10645 | |
| 10646 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10647 | * ALC269 channel source setting (2 channel) |
| 10648 | */ |
| 10649 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10650 | |
| 10651 | #define alc269_dac_nids alc260_dac_nids |
| 10652 | |
| 10653 | static hda_nid_t alc269_adc_nids[1] = { |
| 10654 | /* ADC1 */ |
| 10655 | 0x07, |
| 10656 | }; |
| 10657 | |
| 10658 | #define alc269_modes alc260_modes |
| 10659 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10660 | |
| 10661 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10662 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10663 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10664 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10665 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10666 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10667 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10668 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10669 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10670 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10671 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10672 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10673 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10674 | { } /* end */ |
| 10675 | }; |
| 10676 | |
| 10677 | /* capture mixer elements */ |
| 10678 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10679 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10680 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10681 | { |
| 10682 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10683 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10684 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10685 | */ |
| 10686 | /* .name = "Capture Source", */ |
| 10687 | .name = "Input Source", |
| 10688 | .count = 1, |
| 10689 | .info = alc_mux_enum_info, |
| 10690 | .get = alc_mux_enum_get, |
| 10691 | .put = alc_mux_enum_put, |
| 10692 | }, |
| 10693 | { } /* end */ |
| 10694 | }; |
| 10695 | |
| 10696 | /* |
| 10697 | * generic initialization of ADC, input mixers and output mixers |
| 10698 | */ |
| 10699 | static struct hda_verb alc269_init_verbs[] = { |
| 10700 | /* |
| 10701 | * Unmute ADC0 and set the default input to mic-in |
| 10702 | */ |
| 10703 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10704 | |
| 10705 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 10706 | * analog-loopback mixer widget |
| 10707 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10708 | * front panel mic (mic 2) |
| 10709 | */ |
| 10710 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10711 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10712 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10713 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10714 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10715 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10716 | |
| 10717 | /* |
| 10718 | * Set up output mixers (0x0c - 0x0e) |
| 10719 | */ |
| 10720 | /* set vol=0 to output mixers */ |
| 10721 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10722 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10723 | |
| 10724 | /* set up input amps for analog loopback */ |
| 10725 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10726 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10727 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10728 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10729 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10730 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10731 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10732 | |
| 10733 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10734 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10735 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10736 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10737 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10738 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10739 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10740 | |
| 10741 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10742 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10743 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10744 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10745 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10746 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10747 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10748 | |
| 10749 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10750 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10751 | |
| 10752 | /* FIXME: use matrix-type input source selection */ |
| 10753 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10754 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10755 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10756 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10757 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10758 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10759 | |
| 10760 | /* set EAPD */ |
| 10761 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10762 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10763 | { } |
| 10764 | }; |
| 10765 | |
| 10766 | /* add playback controls from the parsed DAC table */ |
| 10767 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10768 | const struct auto_pin_cfg *cfg) |
| 10769 | { |
| 10770 | hda_nid_t nid; |
| 10771 | int err; |
| 10772 | |
| 10773 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10774 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10775 | spec->multiout.dac_nids[0] = 2; |
| 10776 | |
| 10777 | nid = cfg->line_out_pins[0]; |
| 10778 | if (nid) { |
| 10779 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10780 | "Front Playback Volume", |
| 10781 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10782 | if (err < 0) |
| 10783 | return err; |
| 10784 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10785 | "Front Playback Switch", |
| 10786 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10787 | if (err < 0) |
| 10788 | return err; |
| 10789 | } |
| 10790 | |
| 10791 | nid = cfg->speaker_pins[0]; |
| 10792 | if (nid) { |
| 10793 | if (!cfg->line_out_pins[0]) { |
| 10794 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10795 | "Speaker Playback Volume", |
| 10796 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10797 | HDA_OUTPUT)); |
| 10798 | if (err < 0) |
| 10799 | return err; |
| 10800 | } |
| 10801 | if (nid == 0x16) { |
| 10802 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10803 | "Speaker Playback Switch", |
| 10804 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10805 | HDA_OUTPUT)); |
| 10806 | if (err < 0) |
| 10807 | return err; |
| 10808 | } else { |
| 10809 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10810 | "Speaker Playback Switch", |
| 10811 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10812 | HDA_OUTPUT)); |
| 10813 | if (err < 0) |
| 10814 | return err; |
| 10815 | } |
| 10816 | } |
| 10817 | nid = cfg->hp_pins[0]; |
| 10818 | if (nid) { |
| 10819 | /* spec->multiout.hp_nid = 2; */ |
| 10820 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10821 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10822 | "Headphone Playback Volume", |
| 10823 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10824 | HDA_OUTPUT)); |
| 10825 | if (err < 0) |
| 10826 | return err; |
| 10827 | } |
| 10828 | if (nid == 0x16) { |
| 10829 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10830 | "Headphone Playback Switch", |
| 10831 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10832 | HDA_OUTPUT)); |
| 10833 | if (err < 0) |
| 10834 | return err; |
| 10835 | } else { |
| 10836 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10837 | "Headphone Playback Switch", |
| 10838 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10839 | HDA_OUTPUT)); |
| 10840 | if (err < 0) |
| 10841 | return err; |
| 10842 | } |
| 10843 | } |
| 10844 | return 0; |
| 10845 | } |
| 10846 | |
| 10847 | #define alc269_auto_create_analog_input_ctls \ |
| 10848 | alc880_auto_create_analog_input_ctls |
| 10849 | |
| 10850 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10851 | #define alc269_loopbacks alc880_loopbacks |
| 10852 | #endif |
| 10853 | |
| 10854 | /* pcm configuration: identiacal with ALC880 */ |
| 10855 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10856 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10857 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10858 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10859 | |
| 10860 | /* |
| 10861 | * BIOS auto configuration |
| 10862 | */ |
| 10863 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10864 | { |
| 10865 | struct alc_spec *spec = codec->spec; |
| 10866 | int err; |
| 10867 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10868 | |
| 10869 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10870 | alc269_ignore); |
| 10871 | if (err < 0) |
| 10872 | return err; |
| 10873 | |
| 10874 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10875 | if (err < 0) |
| 10876 | return err; |
| 10877 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10878 | if (err < 0) |
| 10879 | return err; |
| 10880 | |
| 10881 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10882 | |
| 10883 | if (spec->autocfg.dig_out_pin) |
| 10884 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10885 | |
| 10886 | if (spec->kctl_alloc) |
| 10887 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10888 | |
| 10889 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10890 | spec->num_mux_defs = 1; |
| 10891 | spec->input_mux = &spec->private_imux; |
| 10892 | |
| 10893 | err = alc_auto_add_mic_boost(codec); |
| 10894 | if (err < 0) |
| 10895 | return err; |
| 10896 | |
| 10897 | return 1; |
| 10898 | } |
| 10899 | |
| 10900 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10901 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10902 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10903 | |
| 10904 | |
| 10905 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10906 | static void alc269_auto_init(struct hda_codec *codec) |
| 10907 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10908 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10909 | alc269_auto_init_multi_out(codec); |
| 10910 | alc269_auto_init_hp_out(codec); |
| 10911 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10912 | if (spec->unsol_event) |
| 10913 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10914 | } |
| 10915 | |
| 10916 | /* |
| 10917 | * configuration and preset |
| 10918 | */ |
| 10919 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 10920 | [ALC269_BASIC] = "basic", |
| 10921 | }; |
| 10922 | |
| 10923 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 10924 | {} |
| 10925 | }; |
| 10926 | |
| 10927 | static struct alc_config_preset alc269_presets[] = { |
| 10928 | [ALC269_BASIC] = { |
| 10929 | .mixers = { alc269_base_mixer }, |
| 10930 | .init_verbs = { alc269_init_verbs }, |
| 10931 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 10932 | .dac_nids = alc269_dac_nids, |
| 10933 | .hp_nid = 0x03, |
| 10934 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 10935 | .channel_mode = alc269_modes, |
| 10936 | .input_mux = &alc269_capture_source, |
| 10937 | }, |
| 10938 | }; |
| 10939 | |
| 10940 | static int patch_alc269(struct hda_codec *codec) |
| 10941 | { |
| 10942 | struct alc_spec *spec; |
| 10943 | int board_config; |
| 10944 | int err; |
| 10945 | |
| 10946 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10947 | if (spec == NULL) |
| 10948 | return -ENOMEM; |
| 10949 | |
| 10950 | codec->spec = spec; |
| 10951 | |
| 10952 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 10953 | alc269_models, |
| 10954 | alc269_cfg_tbl); |
| 10955 | |
| 10956 | if (board_config < 0) { |
| 10957 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 10958 | "trying auto-probe from BIOS...\n"); |
| 10959 | board_config = ALC269_AUTO; |
| 10960 | } |
| 10961 | |
| 10962 | if (board_config == ALC269_AUTO) { |
| 10963 | /* automatic parse from the BIOS config */ |
| 10964 | err = alc269_parse_auto_config(codec); |
| 10965 | if (err < 0) { |
| 10966 | alc_free(codec); |
| 10967 | return err; |
| 10968 | } else if (!err) { |
| 10969 | printk(KERN_INFO |
| 10970 | "hda_codec: Cannot set up configuration " |
| 10971 | "from BIOS. Using base mode...\n"); |
| 10972 | board_config = ALC269_BASIC; |
| 10973 | } |
| 10974 | } |
| 10975 | |
| 10976 | if (board_config != ALC269_AUTO) |
| 10977 | setup_preset(spec, &alc269_presets[board_config]); |
| 10978 | |
| 10979 | spec->stream_name_analog = "ALC269 Analog"; |
| 10980 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 10981 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 10982 | |
| 10983 | spec->stream_name_digital = "ALC269 Digital"; |
| 10984 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 10985 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 10986 | |
| 10987 | spec->adc_nids = alc269_adc_nids; |
| 10988 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 10989 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 10990 | spec->num_mixers++; |
| 10991 | |
| 10992 | codec->patch_ops = alc_patch_ops; |
| 10993 | if (board_config == ALC269_AUTO) |
| 10994 | spec->init_hook = alc269_auto_init; |
| 10995 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10996 | if (!spec->loopback.amplist) |
| 10997 | spec->loopback.amplist = alc269_loopbacks; |
| 10998 | #endif |
| 10999 | |
| 11000 | return 0; |
| 11001 | } |
| 11002 | |
| 11003 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11004 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 11005 | */ |
| 11006 | |
| 11007 | /* |
| 11008 | * set the path ways for 2 channel output |
| 11009 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 11010 | */ |
| 11011 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 11012 | /* set pin widget 1Ah (line in) for input */ |
| 11013 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11014 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11015 | * the vref |
| 11016 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11017 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11018 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11019 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11020 | #if 0 |
| 11021 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11022 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11023 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11024 | { } /* end */ |
| 11025 | }; |
| 11026 | /* |
| 11027 | * 6ch mode |
| 11028 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 11029 | */ |
| 11030 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 11031 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11032 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11033 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11034 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11035 | |
| 11036 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11037 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11038 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11039 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11040 | #if 0 |
| 11041 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11042 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11043 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11044 | { } /* end */ |
| 11045 | }; |
| 11046 | |
| 11047 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 11048 | { 2, alc861_threestack_ch2_init }, |
| 11049 | { 6, alc861_threestack_ch6_init }, |
| 11050 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11051 | /* Set mic1 as input and unmute the mixer */ |
| 11052 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 11053 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11054 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11055 | { } /* end */ |
| 11056 | }; |
| 11057 | /* Set mic1 as output and mute mixer */ |
| 11058 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 11059 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11060 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11061 | { } /* end */ |
| 11062 | }; |
| 11063 | |
| 11064 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 11065 | { 2, alc861_uniwill_m31_ch2_init }, |
| 11066 | { 4, alc861_uniwill_m31_ch4_init }, |
| 11067 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11068 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11069 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 11070 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 11071 | /* set pin widget 1Ah (line in) for input */ |
| 11072 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11073 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11074 | * the vref |
| 11075 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11076 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11077 | |
| 11078 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11079 | #if 0 |
| 11080 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11081 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11082 | #endif |
| 11083 | { } /* end */ |
| 11084 | }; |
| 11085 | /* Set mic1 nad line-in as output and mute mixer */ |
| 11086 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 11087 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11088 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11089 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11090 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11091 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11092 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11093 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11094 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11095 | |
| 11096 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11097 | #if 0 |
| 11098 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11099 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11100 | #endif |
| 11101 | { } /* end */ |
| 11102 | }; |
| 11103 | |
| 11104 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 11105 | { 2, alc861_asus_ch2_init }, |
| 11106 | { 6, alc861_asus_ch6_init }, |
| 11107 | }; |
| 11108 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11109 | /* patch-ALC861 */ |
| 11110 | |
| 11111 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 11112 | /* output mixer control */ |
| 11113 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11114 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11115 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11116 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11117 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11118 | |
| 11119 | /*Input mixer control */ |
| 11120 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11121 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11122 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11123 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11124 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11125 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11126 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11127 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11128 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11129 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11130 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11131 | /* Capture mixer control */ |
| 11132 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11133 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11134 | { |
| 11135 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11136 | .name = "Capture Source", |
| 11137 | .count = 1, |
| 11138 | .info = alc_mux_enum_info, |
| 11139 | .get = alc_mux_enum_get, |
| 11140 | .put = alc_mux_enum_put, |
| 11141 | }, |
| 11142 | { } /* end */ |
| 11143 | }; |
| 11144 | |
| 11145 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 11146 | /* output mixer control */ |
| 11147 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11148 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11149 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11150 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11151 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11152 | |
| 11153 | /* Input mixer control */ |
| 11154 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11155 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11156 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11157 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11158 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11159 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11160 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11161 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11162 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11163 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11164 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11165 | /* Capture mixer control */ |
| 11166 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11167 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11168 | { |
| 11169 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11170 | .name = "Capture Source", |
| 11171 | .count = 1, |
| 11172 | .info = alc_mux_enum_info, |
| 11173 | .get = alc_mux_enum_get, |
| 11174 | .put = alc_mux_enum_put, |
| 11175 | }, |
| 11176 | { |
| 11177 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11178 | .name = "Channel Mode", |
| 11179 | .info = alc_ch_mode_info, |
| 11180 | .get = alc_ch_mode_get, |
| 11181 | .put = alc_ch_mode_put, |
| 11182 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 11183 | }, |
| 11184 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11185 | }; |
| 11186 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11187 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11188 | /* output mixer control */ |
| 11189 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11190 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11191 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11192 | |
| 11193 | /*Capture mixer control */ |
| 11194 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11195 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11196 | { |
| 11197 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11198 | .name = "Capture Source", |
| 11199 | .count = 1, |
| 11200 | .info = alc_mux_enum_info, |
| 11201 | .get = alc_mux_enum_get, |
| 11202 | .put = alc_mux_enum_put, |
| 11203 | }, |
| 11204 | |
| 11205 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11206 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11207 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11208 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 11209 | /* output mixer control */ |
| 11210 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11211 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11212 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11213 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11214 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11215 | |
| 11216 | /* Input mixer control */ |
| 11217 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11218 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11219 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11220 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11221 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11222 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11225 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11227 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11228 | /* Capture mixer control */ |
| 11229 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11230 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11231 | { |
| 11232 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11233 | .name = "Capture Source", |
| 11234 | .count = 1, |
| 11235 | .info = alc_mux_enum_info, |
| 11236 | .get = alc_mux_enum_get, |
| 11237 | .put = alc_mux_enum_put, |
| 11238 | }, |
| 11239 | { |
| 11240 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11241 | .name = "Channel Mode", |
| 11242 | .info = alc_ch_mode_info, |
| 11243 | .get = alc_ch_mode_get, |
| 11244 | .put = alc_ch_mode_put, |
| 11245 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11246 | }, |
| 11247 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11248 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11249 | |
| 11250 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 11251 | /* output mixer control */ |
| 11252 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11253 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11254 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11255 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11256 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11257 | |
| 11258 | /* Input mixer control */ |
| 11259 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11260 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11261 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11262 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11263 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11264 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11265 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11266 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11267 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11268 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 11269 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11270 | /* Capture mixer control */ |
| 11271 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11272 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11273 | { |
| 11274 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11275 | .name = "Capture Source", |
| 11276 | .count = 1, |
| 11277 | .info = alc_mux_enum_info, |
| 11278 | .get = alc_mux_enum_get, |
| 11279 | .put = alc_mux_enum_put, |
| 11280 | }, |
| 11281 | { |
| 11282 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11283 | .name = "Channel Mode", |
| 11284 | .info = alc_ch_mode_info, |
| 11285 | .get = alc_ch_mode_get, |
| 11286 | .put = alc_ch_mode_put, |
| 11287 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 11288 | }, |
| 11289 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11290 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11291 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11292 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11293 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11294 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11295 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11296 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11297 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11298 | { } |
| 11299 | }; |
| 11300 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11301 | /* |
| 11302 | * generic initialization of ADC, input mixers and output mixers |
| 11303 | */ |
| 11304 | static struct hda_verb alc861_base_init_verbs[] = { |
| 11305 | /* |
| 11306 | * Unmute ADC0 and set the default input to mic-in |
| 11307 | */ |
| 11308 | /* port-A for surround (rear panel) */ |
| 11309 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11310 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11311 | /* port-B for mic-in (rear panel) with vref */ |
| 11312 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11313 | /* port-C for line-in (rear panel) */ |
| 11314 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11315 | /* port-D for Front */ |
| 11316 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11317 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11318 | /* port-E for HP out (front panel) */ |
| 11319 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11320 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11321 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11322 | /* port-F for mic-in (front panel) with vref */ |
| 11323 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11324 | /* port-G for CLFE (rear panel) */ |
| 11325 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11326 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11327 | /* port-H for side (rear panel) */ |
| 11328 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11329 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11330 | /* CD-in */ |
| 11331 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11332 | /* route front mic to ADC1*/ |
| 11333 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11334 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11335 | |
| 11336 | /* Unmute DAC0~3 & spdif out*/ |
| 11337 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11338 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11339 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11340 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11341 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11342 | |
| 11343 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11344 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11345 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11346 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11347 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11348 | |
| 11349 | /* Unmute Stereo Mixer 15 */ |
| 11350 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11351 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11352 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11353 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11354 | |
| 11355 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11356 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11357 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11358 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11359 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11360 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11361 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11362 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11363 | /* hp used DAC 3 (Front) */ |
| 11364 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11365 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11366 | |
| 11367 | { } |
| 11368 | }; |
| 11369 | |
| 11370 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 11371 | /* |
| 11372 | * Unmute ADC0 and set the default input to mic-in |
| 11373 | */ |
| 11374 | /* port-A for surround (rear panel) */ |
| 11375 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11376 | /* port-B for mic-in (rear panel) with vref */ |
| 11377 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11378 | /* port-C for line-in (rear panel) */ |
| 11379 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11380 | /* port-D for Front */ |
| 11381 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11382 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11383 | /* port-E for HP out (front panel) */ |
| 11384 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11385 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11386 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11387 | /* port-F for mic-in (front panel) with vref */ |
| 11388 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11389 | /* port-G for CLFE (rear panel) */ |
| 11390 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11391 | /* port-H for side (rear panel) */ |
| 11392 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11393 | /* CD-in */ |
| 11394 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11395 | /* route front mic to ADC1*/ |
| 11396 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11397 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11398 | /* Unmute DAC0~3 & spdif out*/ |
| 11399 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11400 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11401 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11402 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11403 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11404 | |
| 11405 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11406 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11407 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11408 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11409 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11410 | |
| 11411 | /* Unmute Stereo Mixer 15 */ |
| 11412 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11413 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11414 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11415 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11416 | |
| 11417 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11418 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11419 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11420 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11421 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11422 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11423 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11424 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11425 | /* hp used DAC 3 (Front) */ |
| 11426 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11427 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11428 | { } |
| 11429 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11430 | |
| 11431 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11432 | /* |
| 11433 | * Unmute ADC0 and set the default input to mic-in |
| 11434 | */ |
| 11435 | /* port-A for surround (rear panel) */ |
| 11436 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11437 | /* port-B for mic-in (rear panel) with vref */ |
| 11438 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11439 | /* port-C for line-in (rear panel) */ |
| 11440 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11441 | /* port-D for Front */ |
| 11442 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11443 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11444 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11445 | /* this has to be set to VREF80 */ |
| 11446 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11447 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11448 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11449 | /* port-F for mic-in (front panel) with vref */ |
| 11450 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11451 | /* port-G for CLFE (rear panel) */ |
| 11452 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11453 | /* port-H for side (rear panel) */ |
| 11454 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11455 | /* CD-in */ |
| 11456 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11457 | /* route front mic to ADC1*/ |
| 11458 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11459 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11460 | /* Unmute DAC0~3 & spdif out*/ |
| 11461 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11462 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11463 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11464 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11465 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11466 | |
| 11467 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11468 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11469 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11470 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11471 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11472 | |
| 11473 | /* Unmute Stereo Mixer 15 */ |
| 11474 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11475 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11476 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11477 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11478 | |
| 11479 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11480 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11481 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11482 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11483 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11484 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11485 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11486 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11487 | /* hp used DAC 3 (Front) */ |
| 11488 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11489 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11490 | { } |
| 11491 | }; |
| 11492 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11493 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 11494 | /* |
| 11495 | * Unmute ADC0 and set the default input to mic-in |
| 11496 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11497 | /* port-A for surround (rear panel) |
| 11498 | * according to codec#0 this is the HP jack |
| 11499 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11500 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 11501 | /* route front PCM to HP */ |
| 11502 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11503 | /* port-B for mic-in (rear panel) with vref */ |
| 11504 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11505 | /* port-C for line-in (rear panel) */ |
| 11506 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11507 | /* port-D for Front */ |
| 11508 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11509 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11510 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11511 | /* this has to be set to VREF80 */ |
| 11512 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11513 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11514 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11515 | /* port-F for mic-in (front panel) with vref */ |
| 11516 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11517 | /* port-G for CLFE (rear panel) */ |
| 11518 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11519 | /* port-H for side (rear panel) */ |
| 11520 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11521 | /* CD-in */ |
| 11522 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11523 | /* route front mic to ADC1*/ |
| 11524 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11525 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11526 | /* Unmute DAC0~3 & spdif out*/ |
| 11527 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11528 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11529 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11530 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11531 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11532 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11533 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11534 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11535 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11536 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11537 | |
| 11538 | /* Unmute Stereo Mixer 15 */ |
| 11539 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11540 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11541 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11542 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11543 | |
| 11544 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11545 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11546 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11547 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11548 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11549 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11550 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11551 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11552 | /* hp used DAC 3 (Front) */ |
| 11553 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11554 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11555 | { } |
| 11556 | }; |
| 11557 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11558 | /* additional init verbs for ASUS laptops */ |
| 11559 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 11560 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 11561 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 11562 | { } |
| 11563 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11564 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11565 | /* |
| 11566 | * generic initialization of ADC, input mixers and output mixers |
| 11567 | */ |
| 11568 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 11569 | /* |
| 11570 | * Unmute ADC0 and set the default input to mic-in |
| 11571 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11572 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11573 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11574 | |
| 11575 | /* Unmute DAC0~3 & spdif out*/ |
| 11576 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11577 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11578 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11579 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11580 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11581 | |
| 11582 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11583 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11584 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11585 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11586 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11587 | |
| 11588 | /* Unmute Stereo Mixer 15 */ |
| 11589 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11590 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11591 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11592 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 11593 | |
| 11594 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11595 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11596 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11597 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11598 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11599 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11600 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11601 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11602 | |
| 11603 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11604 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11605 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11606 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11607 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11608 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11609 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11610 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11611 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11612 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11613 | |
| 11614 | { } |
| 11615 | }; |
| 11616 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11617 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11618 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11619 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11620 | { } |
| 11621 | }; |
| 11622 | |
| 11623 | /* toggle speaker-output according to the hp-jack state */ |
| 11624 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11625 | { |
| 11626 | unsigned int present; |
| 11627 | |
| 11628 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11629 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11630 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11631 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11632 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11633 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11634 | } |
| 11635 | |
| 11636 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11637 | unsigned int res) |
| 11638 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11639 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11640 | alc861_toshiba_automute(codec); |
| 11641 | } |
| 11642 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11643 | /* pcm configuration: identiacal with ALC880 */ |
| 11644 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11645 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11646 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11647 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11648 | |
| 11649 | |
| 11650 | #define ALC861_DIGOUT_NID 0x07 |
| 11651 | |
| 11652 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11653 | { 8, NULL } |
| 11654 | }; |
| 11655 | |
| 11656 | static hda_nid_t alc861_dac_nids[4] = { |
| 11657 | /* front, surround, clfe, side */ |
| 11658 | 0x03, 0x06, 0x05, 0x04 |
| 11659 | }; |
| 11660 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11661 | static hda_nid_t alc660_dac_nids[3] = { |
| 11662 | /* front, clfe, surround */ |
| 11663 | 0x03, 0x05, 0x06 |
| 11664 | }; |
| 11665 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11666 | static hda_nid_t alc861_adc_nids[1] = { |
| 11667 | /* ADC0-2 */ |
| 11668 | 0x08, |
| 11669 | }; |
| 11670 | |
| 11671 | static struct hda_input_mux alc861_capture_source = { |
| 11672 | .num_items = 5, |
| 11673 | .items = { |
| 11674 | { "Mic", 0x0 }, |
| 11675 | { "Front Mic", 0x3 }, |
| 11676 | { "Line", 0x1 }, |
| 11677 | { "CD", 0x4 }, |
| 11678 | { "Mixer", 0x5 }, |
| 11679 | }, |
| 11680 | }; |
| 11681 | |
| 11682 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11683 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11684 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11685 | { |
| 11686 | int i; |
| 11687 | hda_nid_t nid; |
| 11688 | |
| 11689 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11690 | for (i = 0; i < cfg->line_outs; i++) { |
| 11691 | nid = cfg->line_out_pins[i]; |
| 11692 | if (nid) { |
| 11693 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11694 | continue; |
| 11695 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11696 | } |
| 11697 | } |
| 11698 | spec->multiout.num_dacs = cfg->line_outs; |
| 11699 | return 0; |
| 11700 | } |
| 11701 | |
| 11702 | /* add playback controls from the parsed DAC table */ |
| 11703 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11704 | const struct auto_pin_cfg *cfg) |
| 11705 | { |
| 11706 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11707 | static const char *chname[4] = { |
| 11708 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11709 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11710 | hda_nid_t nid; |
| 11711 | int i, idx, err; |
| 11712 | |
| 11713 | for (i = 0; i < cfg->line_outs; i++) { |
| 11714 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11715 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11716 | continue; |
| 11717 | if (nid == 0x05) { |
| 11718 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11719 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11720 | "Center Playback Switch", |
| 11721 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11722 | HDA_OUTPUT)); |
| 11723 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11724 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11725 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11726 | "LFE Playback Switch", |
| 11727 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11728 | HDA_OUTPUT)); |
| 11729 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11730 | return err; |
| 11731 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11732 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11733 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11734 | if (nid == alc861_dac_nids[idx]) |
| 11735 | break; |
| 11736 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11737 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11738 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11739 | HDA_OUTPUT)); |
| 11740 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11741 | return err; |
| 11742 | } |
| 11743 | } |
| 11744 | return 0; |
| 11745 | } |
| 11746 | |
| 11747 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11748 | { |
| 11749 | int err; |
| 11750 | hda_nid_t nid; |
| 11751 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11752 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11753 | return 0; |
| 11754 | |
| 11755 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11756 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11757 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11758 | "Headphone Playback Switch", |
| 11759 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11760 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11761 | return err; |
| 11762 | spec->multiout.hp_nid = nid; |
| 11763 | } |
| 11764 | return 0; |
| 11765 | } |
| 11766 | |
| 11767 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11768 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11769 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11770 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11771 | struct hda_input_mux *imux = &spec->private_imux; |
| 11772 | int i, err, idx, idx1; |
| 11773 | |
| 11774 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11775 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11776 | case 0x0c: |
| 11777 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11778 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11779 | break; |
| 11780 | case 0x0f: |
| 11781 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11782 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11783 | break; |
| 11784 | case 0x0d: |
| 11785 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11786 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11787 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11788 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11789 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11790 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11791 | break; |
| 11792 | case 0x11: |
| 11793 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11794 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11795 | break; |
| 11796 | default: |
| 11797 | continue; |
| 11798 | } |
| 11799 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11800 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11801 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11802 | if (err < 0) |
| 11803 | return err; |
| 11804 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11805 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11806 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11807 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11808 | } |
| 11809 | return 0; |
| 11810 | } |
| 11811 | |
| 11812 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11813 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11814 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11815 | |
| 11816 | { |
| 11817 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11818 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11819 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11820 | */ |
| 11821 | /* .name = "Capture Source", */ |
| 11822 | .name = "Input Source", |
| 11823 | .count = 1, |
| 11824 | .info = alc_mux_enum_info, |
| 11825 | .get = alc_mux_enum_get, |
| 11826 | .put = alc_mux_enum_put, |
| 11827 | }, |
| 11828 | { } /* end */ |
| 11829 | }; |
| 11830 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11831 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11832 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11833 | int pin_type, int dac_idx) |
| 11834 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11835 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11836 | } |
| 11837 | |
| 11838 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11839 | { |
| 11840 | struct alc_spec *spec = codec->spec; |
| 11841 | int i; |
| 11842 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11843 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11844 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11845 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11846 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11847 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11848 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11849 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11850 | } |
| 11851 | } |
| 11852 | |
| 11853 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11854 | { |
| 11855 | struct alc_spec *spec = codec->spec; |
| 11856 | hda_nid_t pin; |
| 11857 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11858 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11859 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11860 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11861 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11862 | pin = spec->autocfg.speaker_pins[0]; |
| 11863 | if (pin) |
| 11864 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11865 | } |
| 11866 | |
| 11867 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11868 | { |
| 11869 | struct alc_spec *spec = codec->spec; |
| 11870 | int i; |
| 11871 | |
| 11872 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11873 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11874 | if (nid >= 0x0c && nid <= 0x11) { |
| 11875 | snd_hda_codec_write(codec, nid, 0, |
| 11876 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11877 | i <= AUTO_PIN_FRONT_MIC ? |
| 11878 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11879 | } |
| 11880 | } |
| 11881 | } |
| 11882 | |
| 11883 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11884 | /* return 1 if successful, 0 if the proper config is not found, |
| 11885 | * or a negative error code |
| 11886 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11887 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11888 | { |
| 11889 | struct alc_spec *spec = codec->spec; |
| 11890 | int err; |
| 11891 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11892 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11893 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11894 | alc861_ignore); |
| 11895 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11896 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11897 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11898 | return 0; /* can't find valid BIOS pin config */ |
| 11899 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11900 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11901 | if (err < 0) |
| 11902 | return err; |
| 11903 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11904 | if (err < 0) |
| 11905 | return err; |
| 11906 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11907 | if (err < 0) |
| 11908 | return err; |
| 11909 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11910 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11911 | return err; |
| 11912 | |
| 11913 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11914 | |
| 11915 | if (spec->autocfg.dig_out_pin) |
| 11916 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 11917 | |
| 11918 | if (spec->kctl_alloc) |
| 11919 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11920 | |
| 11921 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 11922 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11923 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11924 | spec->input_mux = &spec->private_imux; |
| 11925 | |
| 11926 | spec->adc_nids = alc861_adc_nids; |
| 11927 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 11928 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 11929 | spec->num_mixers++; |
| 11930 | |
| 11931 | return 1; |
| 11932 | } |
| 11933 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11934 | /* additional initialization for auto-configuration model */ |
| 11935 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11936 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11937 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11938 | alc861_auto_init_multi_out(codec); |
| 11939 | alc861_auto_init_hp_out(codec); |
| 11940 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11941 | if (spec->unsol_event) |
| 11942 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11943 | } |
| 11944 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11945 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11946 | static struct hda_amp_list alc861_loopbacks[] = { |
| 11947 | { 0x15, HDA_INPUT, 0 }, |
| 11948 | { 0x15, HDA_INPUT, 1 }, |
| 11949 | { 0x15, HDA_INPUT, 2 }, |
| 11950 | { 0x15, HDA_INPUT, 3 }, |
| 11951 | { } /* end */ |
| 11952 | }; |
| 11953 | #endif |
| 11954 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11955 | |
| 11956 | /* |
| 11957 | * configuration and preset |
| 11958 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11959 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 11960 | [ALC861_3ST] = "3stack", |
| 11961 | [ALC660_3ST] = "3stack-660", |
| 11962 | [ALC861_3ST_DIG] = "3stack-dig", |
| 11963 | [ALC861_6ST_DIG] = "6stack-dig", |
| 11964 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 11965 | [ALC861_TOSHIBA] = "toshiba", |
| 11966 | [ALC861_ASUS] = "asus", |
| 11967 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 11968 | [ALC861_AUTO] = "auto", |
| 11969 | }; |
| 11970 | |
| 11971 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 11972 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11973 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11974 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11975 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11976 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11977 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 11978 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 11979 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 11980 | * Any other models that need this preset? |
| 11981 | */ |
| 11982 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 11983 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 11984 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11985 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 11986 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 11987 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 11988 | /* FIXME: the below seems conflict */ |
| 11989 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 11990 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 11991 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11992 | {} |
| 11993 | }; |
| 11994 | |
| 11995 | static struct alc_config_preset alc861_presets[] = { |
| 11996 | [ALC861_3ST] = { |
| 11997 | .mixers = { alc861_3ST_mixer }, |
| 11998 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11999 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12000 | .dac_nids = alc861_dac_nids, |
| 12001 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12002 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12003 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12004 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12005 | .adc_nids = alc861_adc_nids, |
| 12006 | .input_mux = &alc861_capture_source, |
| 12007 | }, |
| 12008 | [ALC861_3ST_DIG] = { |
| 12009 | .mixers = { alc861_base_mixer }, |
| 12010 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12011 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12012 | .dac_nids = alc861_dac_nids, |
| 12013 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12014 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12015 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12016 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12017 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12018 | .adc_nids = alc861_adc_nids, |
| 12019 | .input_mux = &alc861_capture_source, |
| 12020 | }, |
| 12021 | [ALC861_6ST_DIG] = { |
| 12022 | .mixers = { alc861_base_mixer }, |
| 12023 | .init_verbs = { alc861_base_init_verbs }, |
| 12024 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12025 | .dac_nids = alc861_dac_nids, |
| 12026 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12027 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 12028 | .channel_mode = alc861_8ch_modes, |
| 12029 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12030 | .adc_nids = alc861_adc_nids, |
| 12031 | .input_mux = &alc861_capture_source, |
| 12032 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12033 | [ALC660_3ST] = { |
| 12034 | .mixers = { alc861_3ST_mixer }, |
| 12035 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12036 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 12037 | .dac_nids = alc660_dac_nids, |
| 12038 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12039 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12040 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12041 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12042 | .adc_nids = alc861_adc_nids, |
| 12043 | .input_mux = &alc861_capture_source, |
| 12044 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12045 | [ALC861_UNIWILL_M31] = { |
| 12046 | .mixers = { alc861_uniwill_m31_mixer }, |
| 12047 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 12048 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12049 | .dac_nids = alc861_dac_nids, |
| 12050 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12051 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12052 | .channel_mode = alc861_uniwill_m31_modes, |
| 12053 | .need_dac_fix = 1, |
| 12054 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12055 | .adc_nids = alc861_adc_nids, |
| 12056 | .input_mux = &alc861_capture_source, |
| 12057 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12058 | [ALC861_TOSHIBA] = { |
| 12059 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12060 | .init_verbs = { alc861_base_init_verbs, |
| 12061 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12062 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12063 | .dac_nids = alc861_dac_nids, |
| 12064 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12065 | .channel_mode = alc883_3ST_2ch_modes, |
| 12066 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12067 | .adc_nids = alc861_adc_nids, |
| 12068 | .input_mux = &alc861_capture_source, |
| 12069 | .unsol_event = alc861_toshiba_unsol_event, |
| 12070 | .init_hook = alc861_toshiba_automute, |
| 12071 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12072 | [ALC861_ASUS] = { |
| 12073 | .mixers = { alc861_asus_mixer }, |
| 12074 | .init_verbs = { alc861_asus_init_verbs }, |
| 12075 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12076 | .dac_nids = alc861_dac_nids, |
| 12077 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12078 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 12079 | .channel_mode = alc861_asus_modes, |
| 12080 | .need_dac_fix = 1, |
| 12081 | .hp_nid = 0x06, |
| 12082 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12083 | .adc_nids = alc861_adc_nids, |
| 12084 | .input_mux = &alc861_capture_source, |
| 12085 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12086 | [ALC861_ASUS_LAPTOP] = { |
| 12087 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 12088 | .init_verbs = { alc861_asus_init_verbs, |
| 12089 | alc861_asus_laptop_init_verbs }, |
| 12090 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12091 | .dac_nids = alc861_dac_nids, |
| 12092 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12093 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12094 | .channel_mode = alc883_3ST_2ch_modes, |
| 12095 | .need_dac_fix = 1, |
| 12096 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12097 | .adc_nids = alc861_adc_nids, |
| 12098 | .input_mux = &alc861_capture_source, |
| 12099 | }, |
| 12100 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12101 | |
| 12102 | |
| 12103 | static int patch_alc861(struct hda_codec *codec) |
| 12104 | { |
| 12105 | struct alc_spec *spec; |
| 12106 | int board_config; |
| 12107 | int err; |
| 12108 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12109 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12110 | if (spec == NULL) |
| 12111 | return -ENOMEM; |
| 12112 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12113 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12114 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12115 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 12116 | alc861_models, |
| 12117 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12118 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12119 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12120 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 12121 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12122 | board_config = ALC861_AUTO; |
| 12123 | } |
| 12124 | |
| 12125 | if (board_config == ALC861_AUTO) { |
| 12126 | /* automatic parse from the BIOS config */ |
| 12127 | err = alc861_parse_auto_config(codec); |
| 12128 | if (err < 0) { |
| 12129 | alc_free(codec); |
| 12130 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12131 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12132 | printk(KERN_INFO |
| 12133 | "hda_codec: Cannot set up configuration " |
| 12134 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12135 | board_config = ALC861_3ST_DIG; |
| 12136 | } |
| 12137 | } |
| 12138 | |
| 12139 | if (board_config != ALC861_AUTO) |
| 12140 | setup_preset(spec, &alc861_presets[board_config]); |
| 12141 | |
| 12142 | spec->stream_name_analog = "ALC861 Analog"; |
| 12143 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 12144 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 12145 | |
| 12146 | spec->stream_name_digital = "ALC861 Digital"; |
| 12147 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 12148 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 12149 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12150 | spec->vmaster_nid = 0x03; |
| 12151 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12152 | codec->patch_ops = alc_patch_ops; |
| 12153 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12154 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12155 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12156 | if (!spec->loopback.amplist) |
| 12157 | spec->loopback.amplist = alc861_loopbacks; |
| 12158 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12159 | |
| 12160 | return 0; |
| 12161 | } |
| 12162 | |
| 12163 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12164 | * ALC861-VD support |
| 12165 | * |
| 12166 | * Based on ALC882 |
| 12167 | * |
| 12168 | * In addition, an independent DAC |
| 12169 | */ |
| 12170 | #define ALC861VD_DIGOUT_NID 0x06 |
| 12171 | |
| 12172 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 12173 | /* front, surr, clfe, side surr */ |
| 12174 | 0x02, 0x03, 0x04, 0x05 |
| 12175 | }; |
| 12176 | |
| 12177 | /* dac_nids for ALC660vd are in a different order - according to |
| 12178 | * Realtek's driver. |
| 12179 | * This should probably tesult in a different mixer for 6stack models |
| 12180 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 12181 | * - and it is the same as in 861vd. |
| 12182 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 12183 | */ |
| 12184 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 12185 | /* front, rear, clfe, rear_surr */ |
| 12186 | 0x02, 0x04, 0x03 |
| 12187 | }; |
| 12188 | |
| 12189 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 12190 | /* ADC0 */ |
| 12191 | 0x09, |
| 12192 | }; |
| 12193 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12194 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 12195 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12196 | /* input MUX */ |
| 12197 | /* FIXME: should be a matrix-type input source selection */ |
| 12198 | static struct hda_input_mux alc861vd_capture_source = { |
| 12199 | .num_items = 4, |
| 12200 | .items = { |
| 12201 | { "Mic", 0x0 }, |
| 12202 | { "Front Mic", 0x1 }, |
| 12203 | { "Line", 0x2 }, |
| 12204 | { "CD", 0x4 }, |
| 12205 | }, |
| 12206 | }; |
| 12207 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12208 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12209 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12210 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12211 | { "Ext Mic", 0x0 }, |
| 12212 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12213 | }, |
| 12214 | }; |
| 12215 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12216 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 12217 | .num_items = 2, |
| 12218 | .items = { |
| 12219 | { "Front Mic", 0x0 }, |
| 12220 | { "ATAPI Mic", 0x1 }, |
| 12221 | }, |
| 12222 | }; |
| 12223 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12224 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 12225 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12226 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 12227 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12228 | |
| 12229 | /* |
| 12230 | * 2ch mode |
| 12231 | */ |
| 12232 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 12233 | { 2, NULL } |
| 12234 | }; |
| 12235 | |
| 12236 | /* |
| 12237 | * 6ch mode |
| 12238 | */ |
| 12239 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 12240 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12241 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12242 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12243 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12244 | { } /* end */ |
| 12245 | }; |
| 12246 | |
| 12247 | /* |
| 12248 | * 8ch mode |
| 12249 | */ |
| 12250 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 12251 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12252 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12253 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12254 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12255 | { } /* end */ |
| 12256 | }; |
| 12257 | |
| 12258 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 12259 | { 6, alc861vd_6stack_ch6_init }, |
| 12260 | { 8, alc861vd_6stack_ch8_init }, |
| 12261 | }; |
| 12262 | |
| 12263 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 12264 | { |
| 12265 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12266 | .name = "Channel Mode", |
| 12267 | .info = alc_ch_mode_info, |
| 12268 | .get = alc_ch_mode_get, |
| 12269 | .put = alc_ch_mode_put, |
| 12270 | }, |
| 12271 | { } /* end */ |
| 12272 | }; |
| 12273 | |
| 12274 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 12275 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 12276 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 12277 | |
| 12278 | { |
| 12279 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12280 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12281 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12282 | */ |
| 12283 | /* .name = "Capture Source", */ |
| 12284 | .name = "Input Source", |
| 12285 | .count = 1, |
| 12286 | .info = alc861vd_mux_enum_info, |
| 12287 | .get = alc861vd_mux_enum_get, |
| 12288 | .put = alc861vd_mux_enum_put, |
| 12289 | }, |
| 12290 | { } /* end */ |
| 12291 | }; |
| 12292 | |
| 12293 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12294 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12295 | */ |
| 12296 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 12297 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12298 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12299 | |
| 12300 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12301 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12302 | |
| 12303 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 12304 | HDA_OUTPUT), |
| 12305 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 12306 | HDA_OUTPUT), |
| 12307 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12308 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 12309 | |
| 12310 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 12311 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12312 | |
| 12313 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12314 | |
| 12315 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12316 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12317 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12318 | |
| 12319 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12320 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12321 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12322 | |
| 12323 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12324 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12325 | |
| 12326 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12327 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12328 | |
| 12329 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12330 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12331 | |
| 12332 | { } /* end */ |
| 12333 | }; |
| 12334 | |
| 12335 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 12336 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12337 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12338 | |
| 12339 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12340 | |
| 12341 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12342 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12343 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12344 | |
| 12345 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12346 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12347 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12348 | |
| 12349 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12350 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12351 | |
| 12352 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12353 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12354 | |
| 12355 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12356 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12357 | |
| 12358 | { } /* end */ |
| 12359 | }; |
| 12360 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12361 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 12362 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12363 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 12364 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12365 | |
| 12366 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12367 | |
| 12368 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12369 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12370 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12371 | |
| 12372 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12373 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12374 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12375 | |
| 12376 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12377 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12378 | |
| 12379 | { } /* end */ |
| 12380 | }; |
| 12381 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12382 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 12383 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12384 | */ |
| 12385 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12386 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12387 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12388 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12389 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12390 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12391 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12392 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12393 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12394 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12395 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12396 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 12397 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12398 | { } /* end */ |
| 12399 | }; |
| 12400 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12401 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12402 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12403 | */ |
| 12404 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12405 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12406 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12407 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12408 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12409 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12410 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12411 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12412 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12413 | |
| 12414 | { } /* end */ |
| 12415 | }; |
| 12416 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12417 | /* |
| 12418 | * generic initialization of ADC, input mixers and output mixers |
| 12419 | */ |
| 12420 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12421 | /* |
| 12422 | * Unmute ADC0 and set the default input to mic-in |
| 12423 | */ |
| 12424 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12425 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12426 | |
| 12427 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12428 | * the analog-loopback mixer widget |
| 12429 | */ |
| 12430 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12431 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12432 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12433 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12434 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12435 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12436 | |
| 12437 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12438 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12439 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12440 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12441 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12442 | |
| 12443 | /* |
| 12444 | * Set up output mixers (0x02 - 0x05) |
| 12445 | */ |
| 12446 | /* set vol=0 to output mixers */ |
| 12447 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12448 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12449 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12450 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12451 | |
| 12452 | /* set up input amps for analog loopback */ |
| 12453 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12454 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12455 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12456 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12457 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12458 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12459 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12460 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12461 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12462 | |
| 12463 | { } |
| 12464 | }; |
| 12465 | |
| 12466 | /* |
| 12467 | * 3-stack pin configuration: |
| 12468 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 12469 | */ |
| 12470 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 12471 | /* |
| 12472 | * Set pin mode and muting |
| 12473 | */ |
| 12474 | /* set front pin widgets 0x14 for output */ |
| 12475 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12476 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12477 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12478 | |
| 12479 | /* Mic (rear) pin: input vref at 80% */ |
| 12480 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12481 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12482 | /* Front Mic pin: input vref at 80% */ |
| 12483 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12484 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12485 | /* Line In pin: input */ |
| 12486 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12487 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12488 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12489 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12490 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12491 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12492 | /* CD pin widget for input */ |
| 12493 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12494 | |
| 12495 | { } |
| 12496 | }; |
| 12497 | |
| 12498 | /* |
| 12499 | * 6-stack pin configuration: |
| 12500 | */ |
| 12501 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 12502 | /* |
| 12503 | * Set pin mode and muting |
| 12504 | */ |
| 12505 | /* set front pin widgets 0x14 for output */ |
| 12506 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12507 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12508 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12509 | |
| 12510 | /* Rear Pin: output 1 (0x0d) */ |
| 12511 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12512 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12513 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12514 | /* CLFE Pin: output 2 (0x0e) */ |
| 12515 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12516 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12517 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 12518 | /* Side Pin: output 3 (0x0f) */ |
| 12519 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12520 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12521 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 12522 | |
| 12523 | /* Mic (rear) pin: input vref at 80% */ |
| 12524 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12525 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12526 | /* Front Mic pin: input vref at 80% */ |
| 12527 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12528 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12529 | /* Line In pin: input */ |
| 12530 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12531 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12532 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12533 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12534 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12535 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12536 | /* CD pin widget for input */ |
| 12537 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12538 | |
| 12539 | { } |
| 12540 | }; |
| 12541 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12542 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 12543 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12544 | { } |
| 12545 | }; |
| 12546 | |
| 12547 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 12548 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12549 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12550 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12551 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12552 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12553 | {} |
| 12554 | }; |
| 12555 | |
| 12556 | /* toggle speaker-output according to the hp-jack state */ |
| 12557 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 12558 | { |
| 12559 | unsigned int present; |
| 12560 | unsigned char bits; |
| 12561 | |
| 12562 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12563 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12564 | bits = present ? HDA_AMP_MUTE : 0; |
| 12565 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12566 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12567 | } |
| 12568 | |
| 12569 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 12570 | { |
| 12571 | unsigned int present; |
| 12572 | unsigned char bits; |
| 12573 | |
| 12574 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12575 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12576 | bits = present ? HDA_AMP_MUTE : 0; |
| 12577 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 12578 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12579 | } |
| 12580 | |
| 12581 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 12582 | { |
| 12583 | alc861vd_lenovo_hp_automute(codec); |
| 12584 | alc861vd_lenovo_mic_automute(codec); |
| 12585 | } |
| 12586 | |
| 12587 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12588 | unsigned int res) |
| 12589 | { |
| 12590 | switch (res >> 26) { |
| 12591 | case ALC880_HP_EVENT: |
| 12592 | alc861vd_lenovo_hp_automute(codec); |
| 12593 | break; |
| 12594 | case ALC880_MIC_EVENT: |
| 12595 | alc861vd_lenovo_mic_automute(codec); |
| 12596 | break; |
| 12597 | } |
| 12598 | } |
| 12599 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12600 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12601 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12602 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12603 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12604 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12605 | |
| 12606 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12607 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12608 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12609 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12610 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12611 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12612 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12613 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12614 | |
| 12615 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12616 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12617 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12618 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12619 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12620 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12621 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12622 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12623 | |
| 12624 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12625 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12626 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12627 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12628 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12629 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12630 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12631 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12632 | |
| 12633 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12634 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12635 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12636 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12637 | |
| 12638 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12639 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12640 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12641 | |
| 12642 | { } /* end */ |
| 12643 | }; |
| 12644 | |
| 12645 | /* toggle speaker-output according to the hp-jack state */ |
| 12646 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12647 | { |
| 12648 | unsigned int present; |
| 12649 | |
| 12650 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12651 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12652 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12653 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12654 | } |
| 12655 | |
| 12656 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12657 | { |
| 12658 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12659 | alc861vd_dallas_automute(codec); |
| 12660 | } |
| 12661 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12662 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12663 | #define alc861vd_loopbacks alc880_loopbacks |
| 12664 | #endif |
| 12665 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12666 | /* pcm configuration: identiacal with ALC880 */ |
| 12667 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12668 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12669 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12670 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12671 | |
| 12672 | /* |
| 12673 | * configuration and preset |
| 12674 | */ |
| 12675 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12676 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12677 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12678 | [ALC861VD_3ST] = "3stack", |
| 12679 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12680 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12681 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12682 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12683 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12684 | [ALC861VD_AUTO] = "auto", |
| 12685 | }; |
| 12686 | |
| 12687 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12688 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12689 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12690 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12691 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12692 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12693 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12694 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 12695 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12696 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 12697 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12698 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 12699 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12700 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12701 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12702 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12703 | {} |
| 12704 | }; |
| 12705 | |
| 12706 | static struct alc_config_preset alc861vd_presets[] = { |
| 12707 | [ALC660VD_3ST] = { |
| 12708 | .mixers = { alc861vd_3st_mixer }, |
| 12709 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12710 | alc861vd_3stack_init_verbs }, |
| 12711 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12712 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12713 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12714 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12715 | .input_mux = &alc861vd_capture_source, |
| 12716 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12717 | [ALC660VD_3ST_DIG] = { |
| 12718 | .mixers = { alc861vd_3st_mixer }, |
| 12719 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12720 | alc861vd_3stack_init_verbs }, |
| 12721 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12722 | .dac_nids = alc660vd_dac_nids, |
| 12723 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12724 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12725 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12726 | .input_mux = &alc861vd_capture_source, |
| 12727 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12728 | [ALC861VD_3ST] = { |
| 12729 | .mixers = { alc861vd_3st_mixer }, |
| 12730 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12731 | alc861vd_3stack_init_verbs }, |
| 12732 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12733 | .dac_nids = alc861vd_dac_nids, |
| 12734 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12735 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12736 | .input_mux = &alc861vd_capture_source, |
| 12737 | }, |
| 12738 | [ALC861VD_3ST_DIG] = { |
| 12739 | .mixers = { alc861vd_3st_mixer }, |
| 12740 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12741 | alc861vd_3stack_init_verbs }, |
| 12742 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12743 | .dac_nids = alc861vd_dac_nids, |
| 12744 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12745 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12746 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12747 | .input_mux = &alc861vd_capture_source, |
| 12748 | }, |
| 12749 | [ALC861VD_6ST_DIG] = { |
| 12750 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12751 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12752 | alc861vd_6stack_init_verbs }, |
| 12753 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12754 | .dac_nids = alc861vd_dac_nids, |
| 12755 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12756 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12757 | .channel_mode = alc861vd_6stack_modes, |
| 12758 | .input_mux = &alc861vd_capture_source, |
| 12759 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12760 | [ALC861VD_LENOVO] = { |
| 12761 | .mixers = { alc861vd_lenovo_mixer }, |
| 12762 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12763 | alc861vd_3stack_init_verbs, |
| 12764 | alc861vd_eapd_verbs, |
| 12765 | alc861vd_lenovo_unsol_verbs }, |
| 12766 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12767 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12768 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12769 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12770 | .input_mux = &alc861vd_capture_source, |
| 12771 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12772 | .init_hook = alc861vd_lenovo_automute, |
| 12773 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12774 | [ALC861VD_DALLAS] = { |
| 12775 | .mixers = { alc861vd_dallas_mixer }, |
| 12776 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12777 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12778 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12779 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12780 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12781 | .input_mux = &alc861vd_dallas_capture_source, |
| 12782 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12783 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12784 | }, |
| 12785 | [ALC861VD_HP] = { |
| 12786 | .mixers = { alc861vd_hp_mixer }, |
| 12787 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12788 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12789 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12790 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12791 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12792 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12793 | .input_mux = &alc861vd_hp_capture_source, |
| 12794 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12795 | .init_hook = alc861vd_dallas_automute, |
| 12796 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12797 | }; |
| 12798 | |
| 12799 | /* |
| 12800 | * BIOS auto configuration |
| 12801 | */ |
| 12802 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12803 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12804 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12805 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12806 | } |
| 12807 | |
| 12808 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12809 | { |
| 12810 | struct alc_spec *spec = codec->spec; |
| 12811 | int i; |
| 12812 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12813 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12814 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12815 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12816 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12817 | if (nid) |
| 12818 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12819 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12820 | } |
| 12821 | } |
| 12822 | |
| 12823 | |
| 12824 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12825 | { |
| 12826 | struct alc_spec *spec = codec->spec; |
| 12827 | hda_nid_t pin; |
| 12828 | |
| 12829 | pin = spec->autocfg.hp_pins[0]; |
| 12830 | if (pin) /* connect to front and use dac 0 */ |
| 12831 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12832 | pin = spec->autocfg.speaker_pins[0]; |
| 12833 | if (pin) |
| 12834 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12835 | } |
| 12836 | |
| 12837 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12838 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12839 | |
| 12840 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12841 | { |
| 12842 | struct alc_spec *spec = codec->spec; |
| 12843 | int i; |
| 12844 | |
| 12845 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12846 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12847 | if (alc861vd_is_input_pin(nid)) { |
| 12848 | snd_hda_codec_write(codec, nid, 0, |
| 12849 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12850 | i <= AUTO_PIN_FRONT_MIC ? |
| 12851 | PIN_VREF80 : PIN_IN); |
| 12852 | if (nid != ALC861VD_PIN_CD_NID) |
| 12853 | snd_hda_codec_write(codec, nid, 0, |
| 12854 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12855 | AMP_OUT_MUTE); |
| 12856 | } |
| 12857 | } |
| 12858 | } |
| 12859 | |
| 12860 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12861 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12862 | |
| 12863 | /* add playback controls from the parsed DAC table */ |
| 12864 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12865 | * different NIDs for mute/unmute switch and volume control */ |
| 12866 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12867 | const struct auto_pin_cfg *cfg) |
| 12868 | { |
| 12869 | char name[32]; |
| 12870 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12871 | hda_nid_t nid_v, nid_s; |
| 12872 | int i, err; |
| 12873 | |
| 12874 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12875 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12876 | continue; |
| 12877 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12878 | alc880_dac_to_idx( |
| 12879 | spec->multiout.dac_nids[i])); |
| 12880 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12881 | alc880_dac_to_idx( |
| 12882 | spec->multiout.dac_nids[i])); |
| 12883 | |
| 12884 | if (i == 2) { |
| 12885 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12886 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12887 | "Center Playback Volume", |
| 12888 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12889 | HDA_OUTPUT)); |
| 12890 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12891 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12892 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12893 | "LFE Playback Volume", |
| 12894 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12895 | HDA_OUTPUT)); |
| 12896 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12897 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12898 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12899 | "Center Playback Switch", |
| 12900 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12901 | HDA_INPUT)); |
| 12902 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12903 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12904 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12905 | "LFE Playback Switch", |
| 12906 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12907 | HDA_INPUT)); |
| 12908 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12909 | return err; |
| 12910 | } else { |
| 12911 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12912 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12913 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 12914 | HDA_OUTPUT)); |
| 12915 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12916 | return err; |
| 12917 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12918 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12919 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12920 | HDA_INPUT)); |
| 12921 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12922 | return err; |
| 12923 | } |
| 12924 | } |
| 12925 | return 0; |
| 12926 | } |
| 12927 | |
| 12928 | /* add playback controls for speaker and HP outputs */ |
| 12929 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12930 | * different NIDs for mute/unmute switch and volume control */ |
| 12931 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 12932 | hda_nid_t pin, const char *pfx) |
| 12933 | { |
| 12934 | hda_nid_t nid_v, nid_s; |
| 12935 | int err; |
| 12936 | char name[32]; |
| 12937 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12938 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12939 | return 0; |
| 12940 | |
| 12941 | if (alc880_is_fixed_pin(pin)) { |
| 12942 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 12943 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12944 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12945 | spec->multiout.hp_nid = nid_v; |
| 12946 | else |
| 12947 | spec->multiout.extra_out_nid[0] = nid_v; |
| 12948 | /* control HP volume/switch on the output mixer amp */ |
| 12949 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12950 | alc880_fixed_pin_idx(pin)); |
| 12951 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12952 | alc880_fixed_pin_idx(pin)); |
| 12953 | |
| 12954 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12955 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12956 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 12957 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12958 | return err; |
| 12959 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12960 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12961 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 12962 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12963 | return err; |
| 12964 | } else if (alc880_is_multi_pin(pin)) { |
| 12965 | /* set manual connection */ |
| 12966 | /* we have only a switch on HP-out PIN */ |
| 12967 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12968 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12969 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 12970 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12971 | return err; |
| 12972 | } |
| 12973 | return 0; |
| 12974 | } |
| 12975 | |
| 12976 | /* parse the BIOS configuration and set up the alc_spec |
| 12977 | * return 1 if successful, 0 if the proper config is not found, |
| 12978 | * or a negative error code |
| 12979 | * Based on ALC880 version - had to change it to override |
| 12980 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 12981 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 12982 | { |
| 12983 | struct alc_spec *spec = codec->spec; |
| 12984 | int err; |
| 12985 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 12986 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12987 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12988 | alc861vd_ignore); |
| 12989 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12990 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12991 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12992 | return 0; /* can't find valid BIOS pin config */ |
| 12993 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12994 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12995 | if (err < 0) |
| 12996 | return err; |
| 12997 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12998 | if (err < 0) |
| 12999 | return err; |
| 13000 | err = alc861vd_auto_create_extra_out(spec, |
| 13001 | spec->autocfg.speaker_pins[0], |
| 13002 | "Speaker"); |
| 13003 | if (err < 0) |
| 13004 | return err; |
| 13005 | err = alc861vd_auto_create_extra_out(spec, |
| 13006 | spec->autocfg.hp_pins[0], |
| 13007 | "Headphone"); |
| 13008 | if (err < 0) |
| 13009 | return err; |
| 13010 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13011 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13012 | return err; |
| 13013 | |
| 13014 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13015 | |
| 13016 | if (spec->autocfg.dig_out_pin) |
| 13017 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 13018 | |
| 13019 | if (spec->kctl_alloc) |
| 13020 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13021 | |
| 13022 | spec->init_verbs[spec->num_init_verbs++] |
| 13023 | = alc861vd_volume_init_verbs; |
| 13024 | |
| 13025 | spec->num_mux_defs = 1; |
| 13026 | spec->input_mux = &spec->private_imux; |
| 13027 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13028 | err = alc_auto_add_mic_boost(codec); |
| 13029 | if (err < 0) |
| 13030 | return err; |
| 13031 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13032 | return 1; |
| 13033 | } |
| 13034 | |
| 13035 | /* additional initialization for auto-configuration model */ |
| 13036 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 13037 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13038 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13039 | alc861vd_auto_init_multi_out(codec); |
| 13040 | alc861vd_auto_init_hp_out(codec); |
| 13041 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13042 | if (spec->unsol_event) |
| 13043 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13044 | } |
| 13045 | |
| 13046 | static int patch_alc861vd(struct hda_codec *codec) |
| 13047 | { |
| 13048 | struct alc_spec *spec; |
| 13049 | int err, board_config; |
| 13050 | |
| 13051 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13052 | if (spec == NULL) |
| 13053 | return -ENOMEM; |
| 13054 | |
| 13055 | codec->spec = spec; |
| 13056 | |
| 13057 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 13058 | alc861vd_models, |
| 13059 | alc861vd_cfg_tbl); |
| 13060 | |
| 13061 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 13062 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 13063 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 13064 | board_config = ALC861VD_AUTO; |
| 13065 | } |
| 13066 | |
| 13067 | if (board_config == ALC861VD_AUTO) { |
| 13068 | /* automatic parse from the BIOS config */ |
| 13069 | err = alc861vd_parse_auto_config(codec); |
| 13070 | if (err < 0) { |
| 13071 | alc_free(codec); |
| 13072 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13073 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13074 | printk(KERN_INFO |
| 13075 | "hda_codec: Cannot set up configuration " |
| 13076 | "from BIOS. Using base mode...\n"); |
| 13077 | board_config = ALC861VD_3ST; |
| 13078 | } |
| 13079 | } |
| 13080 | |
| 13081 | if (board_config != ALC861VD_AUTO) |
| 13082 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 13083 | |
| 13084 | spec->stream_name_analog = "ALC861VD Analog"; |
| 13085 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 13086 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 13087 | |
| 13088 | spec->stream_name_digital = "ALC861VD Digital"; |
| 13089 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 13090 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 13091 | |
| 13092 | spec->adc_nids = alc861vd_adc_nids; |
| 13093 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13094 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13095 | |
| 13096 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 13097 | spec->num_mixers++; |
| 13098 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13099 | spec->vmaster_nid = 0x02; |
| 13100 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13101 | codec->patch_ops = alc_patch_ops; |
| 13102 | |
| 13103 | if (board_config == ALC861VD_AUTO) |
| 13104 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13105 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13106 | if (!spec->loopback.amplist) |
| 13107 | spec->loopback.amplist = alc861vd_loopbacks; |
| 13108 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13109 | |
| 13110 | return 0; |
| 13111 | } |
| 13112 | |
| 13113 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13114 | * ALC662 support |
| 13115 | * |
| 13116 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 13117 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 13118 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 13119 | * 6-channel independent captures. |
| 13120 | * |
| 13121 | * In addition, an independent DAC for the multi-playback (not used in this |
| 13122 | * driver yet). |
| 13123 | */ |
| 13124 | #define ALC662_DIGOUT_NID 0x06 |
| 13125 | #define ALC662_DIGIN_NID 0x0a |
| 13126 | |
| 13127 | static hda_nid_t alc662_dac_nids[4] = { |
| 13128 | /* front, rear, clfe, rear_surr */ |
| 13129 | 0x02, 0x03, 0x04 |
| 13130 | }; |
| 13131 | |
| 13132 | static hda_nid_t alc662_adc_nids[1] = { |
| 13133 | /* ADC1-2 */ |
| 13134 | 0x09, |
| 13135 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13136 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 13137 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13138 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13139 | /* input MUX */ |
| 13140 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13141 | static struct hda_input_mux alc662_capture_source = { |
| 13142 | .num_items = 4, |
| 13143 | .items = { |
| 13144 | { "Mic", 0x0 }, |
| 13145 | { "Front Mic", 0x1 }, |
| 13146 | { "Line", 0x2 }, |
| 13147 | { "CD", 0x4 }, |
| 13148 | }, |
| 13149 | }; |
| 13150 | |
| 13151 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 13152 | .num_items = 2, |
| 13153 | .items = { |
| 13154 | { "Mic", 0x1 }, |
| 13155 | { "Line", 0x2 }, |
| 13156 | }, |
| 13157 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13158 | |
| 13159 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 13160 | .num_items = 2, |
| 13161 | .items = { |
| 13162 | { "i-Mic", 0x1 }, |
| 13163 | { "e-Mic", 0x0 }, |
| 13164 | }, |
| 13165 | }; |
| 13166 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13167 | #define alc662_mux_enum_info alc_mux_enum_info |
| 13168 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13169 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13170 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13171 | /* |
| 13172 | * 2ch mode |
| 13173 | */ |
| 13174 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 13175 | { 2, NULL } |
| 13176 | }; |
| 13177 | |
| 13178 | /* |
| 13179 | * 2ch mode |
| 13180 | */ |
| 13181 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 13182 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 13183 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13184 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 13185 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13186 | { } /* end */ |
| 13187 | }; |
| 13188 | |
| 13189 | /* |
| 13190 | * 6ch mode |
| 13191 | */ |
| 13192 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 13193 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13194 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13195 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 13196 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13197 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13198 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13199 | { } /* end */ |
| 13200 | }; |
| 13201 | |
| 13202 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 13203 | { 2, alc662_3ST_ch2_init }, |
| 13204 | { 6, alc662_3ST_ch6_init }, |
| 13205 | }; |
| 13206 | |
| 13207 | /* |
| 13208 | * 2ch mode |
| 13209 | */ |
| 13210 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 13211 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13212 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13213 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13214 | { } /* end */ |
| 13215 | }; |
| 13216 | |
| 13217 | /* |
| 13218 | * 6ch mode |
| 13219 | */ |
| 13220 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 13221 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13222 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13223 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13224 | { } /* end */ |
| 13225 | }; |
| 13226 | |
| 13227 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 13228 | { 2, alc662_sixstack_ch6_init }, |
| 13229 | { 6, alc662_sixstack_ch8_init }, |
| 13230 | }; |
| 13231 | |
| 13232 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13233 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13234 | */ |
| 13235 | |
| 13236 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 13237 | /* output mixer control */ |
| 13238 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13239 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13240 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13241 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13242 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13243 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13244 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13245 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13246 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13247 | |
| 13248 | /*Input mixer control */ |
| 13249 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 13250 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 13251 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 13252 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 13253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 13254 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 13255 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 13256 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13257 | { } /* end */ |
| 13258 | }; |
| 13259 | |
| 13260 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 13261 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13262 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13263 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13264 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13265 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13266 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13267 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13268 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13269 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13270 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13271 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13272 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13273 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13274 | { } /* end */ |
| 13275 | }; |
| 13276 | |
| 13277 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 13278 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13279 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13280 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13281 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13282 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13283 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13284 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13285 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13286 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13287 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13288 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13289 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13290 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13291 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13292 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13293 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13294 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13295 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13296 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13297 | { } /* end */ |
| 13298 | }; |
| 13299 | |
| 13300 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 13301 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13302 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13303 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13304 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13305 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13306 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13307 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13308 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13309 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13310 | { } /* end */ |
| 13311 | }; |
| 13312 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13313 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13314 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13315 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 13316 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13317 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13318 | |
| 13319 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 13320 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13321 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13322 | |
| 13323 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 13324 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13325 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13326 | { } /* end */ |
| 13327 | }; |
| 13328 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13329 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 13330 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13331 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13332 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13333 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 13334 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13335 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13336 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13337 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13338 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13339 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13340 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13341 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13342 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13343 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13344 | { } /* end */ |
| 13345 | }; |
| 13346 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13347 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 13348 | { |
| 13349 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13350 | .name = "Channel Mode", |
| 13351 | .info = alc_ch_mode_info, |
| 13352 | .get = alc_ch_mode_get, |
| 13353 | .put = alc_ch_mode_put, |
| 13354 | }, |
| 13355 | { } /* end */ |
| 13356 | }; |
| 13357 | |
| 13358 | static struct hda_verb alc662_init_verbs[] = { |
| 13359 | /* ADC: mute amp left and right */ |
| 13360 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13361 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13362 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 13363 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13364 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13365 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13366 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13367 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13368 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13369 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13370 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13371 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13372 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13373 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13374 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13375 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13376 | |
| 13377 | /* Front Pin: output 0 (0x0c) */ |
| 13378 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13379 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13380 | |
| 13381 | /* Rear Pin: output 1 (0x0d) */ |
| 13382 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13383 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13384 | |
| 13385 | /* CLFE Pin: output 2 (0x0e) */ |
| 13386 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13387 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13388 | |
| 13389 | /* Mic (rear) pin: input vref at 80% */ |
| 13390 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13391 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13392 | /* Front Mic pin: input vref at 80% */ |
| 13393 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13394 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13395 | /* Line In pin: input */ |
| 13396 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13397 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13398 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13399 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13400 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13401 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13402 | /* CD pin widget for input */ |
| 13403 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13404 | |
| 13405 | /* FIXME: use matrix-type input source selection */ |
| 13406 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13407 | /* Input mixer */ |
| 13408 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13409 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13410 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13411 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13412 | |
| 13413 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13414 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13415 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13416 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13417 | { } |
| 13418 | }; |
| 13419 | |
| 13420 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 13421 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13422 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13423 | {} |
| 13424 | }; |
| 13425 | |
| 13426 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 13427 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13428 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13429 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13430 | }; |
| 13431 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13432 | /* Set Unsolicited Event*/ |
| 13433 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 13434 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13435 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13436 | {} |
| 13437 | }; |
| 13438 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13439 | /* |
| 13440 | * generic initialization of ADC, input mixers and output mixers |
| 13441 | */ |
| 13442 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 13443 | /* |
| 13444 | * Unmute ADC and set the default input to mic-in |
| 13445 | */ |
| 13446 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13447 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13448 | |
| 13449 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 13450 | * mixer widget |
| 13451 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 13452 | * panel mic (mic 2) |
| 13453 | */ |
| 13454 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13455 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13456 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13457 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13458 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13459 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13460 | |
| 13461 | /* |
| 13462 | * Set up output mixers (0x0c - 0x0f) |
| 13463 | */ |
| 13464 | /* set vol=0 to output mixers */ |
| 13465 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13466 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13467 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13468 | |
| 13469 | /* set up input amps for analog loopback */ |
| 13470 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13471 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13473 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13474 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13475 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13476 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13477 | |
| 13478 | |
| 13479 | /* FIXME: use matrix-type input source selection */ |
| 13480 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13481 | /* Input mixer */ |
| 13482 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13483 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13484 | { } |
| 13485 | }; |
| 13486 | |
| 13487 | /* capture mixer elements */ |
| 13488 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 13489 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13490 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13491 | { |
| 13492 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13493 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13494 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13495 | */ |
| 13496 | /* .name = "Capture Source", */ |
| 13497 | .name = "Input Source", |
| 13498 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 13499 | .info = alc662_mux_enum_info, |
| 13500 | .get = alc662_mux_enum_get, |
| 13501 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13502 | }, |
| 13503 | { } /* end */ |
| 13504 | }; |
| 13505 | |
| 13506 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 13507 | { |
| 13508 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13509 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13510 | |
| 13511 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13512 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13513 | bits = present ? HDA_AMP_MUTE : 0; |
| 13514 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13515 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13516 | } |
| 13517 | |
| 13518 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 13519 | { |
| 13520 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13521 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13522 | |
| 13523 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13524 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13525 | bits = present ? HDA_AMP_MUTE : 0; |
| 13526 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13527 | HDA_AMP_MUTE, bits); |
| 13528 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13529 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13530 | } |
| 13531 | |
| 13532 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 13533 | unsigned int res) |
| 13534 | { |
| 13535 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13536 | alc662_lenovo_101e_all_automute(codec); |
| 13537 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 13538 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 13539 | } |
| 13540 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13541 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 13542 | { |
| 13543 | unsigned int present; |
| 13544 | |
| 13545 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13546 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13547 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13548 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13549 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13550 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13551 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13552 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13553 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13554 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13555 | } |
| 13556 | |
| 13557 | /* unsolicited event for HP jack sensing */ |
| 13558 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13559 | unsigned int res) |
| 13560 | { |
| 13561 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13562 | alc262_hippo1_automute( codec ); |
| 13563 | |
| 13564 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13565 | alc662_eeepc_mic_automute(codec); |
| 13566 | } |
| 13567 | |
| 13568 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13569 | { |
| 13570 | alc262_hippo1_automute( codec ); |
| 13571 | alc662_eeepc_mic_automute(codec); |
| 13572 | } |
| 13573 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13574 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13575 | { |
| 13576 | unsigned int mute; |
| 13577 | unsigned int present; |
| 13578 | |
| 13579 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13580 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13581 | AC_VERB_GET_PIN_SENSE, 0); |
| 13582 | present = (present & 0x80000000) != 0; |
| 13583 | if (present) { |
| 13584 | /* mute internal speaker */ |
| 13585 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13586 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13587 | } else { |
| 13588 | /* unmute internal speaker if necessary */ |
| 13589 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13590 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13591 | HDA_AMP_MUTE, mute); |
| 13592 | } |
| 13593 | } |
| 13594 | |
| 13595 | /* unsolicited event for HP jack sensing */ |
| 13596 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 13597 | unsigned int res) |
| 13598 | { |
| 13599 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13600 | alc662_eeepc_ep20_automute(codec); |
| 13601 | } |
| 13602 | |
| 13603 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 13604 | { |
| 13605 | alc662_eeepc_ep20_automute(codec); |
| 13606 | } |
| 13607 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13608 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13609 | #define alc662_loopbacks alc880_loopbacks |
| 13610 | #endif |
| 13611 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13612 | |
| 13613 | /* pcm configuration: identiacal with ALC880 */ |
| 13614 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 13615 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 13616 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 13617 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 13618 | |
| 13619 | /* |
| 13620 | * configuration and preset |
| 13621 | */ |
| 13622 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 13623 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 13624 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 13625 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 13626 | [ALC662_5ST_DIG] = "6stack-dig", |
| 13627 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 13628 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13629 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13630 | [ALC662_AUTO] = "auto", |
| 13631 | }; |
| 13632 | |
| 13633 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 13634 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13635 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13636 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13637 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13638 | {} |
| 13639 | }; |
| 13640 | |
| 13641 | static struct alc_config_preset alc662_presets[] = { |
| 13642 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13643 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13644 | .init_verbs = { alc662_init_verbs }, |
| 13645 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13646 | .dac_nids = alc662_dac_nids, |
| 13647 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13648 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13649 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13650 | .channel_mode = alc662_3ST_2ch_modes, |
| 13651 | .input_mux = &alc662_capture_source, |
| 13652 | }, |
| 13653 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13654 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13655 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13656 | .init_verbs = { alc662_init_verbs }, |
| 13657 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13658 | .dac_nids = alc662_dac_nids, |
| 13659 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13660 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13661 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13662 | .channel_mode = alc662_3ST_6ch_modes, |
| 13663 | .need_dac_fix = 1, |
| 13664 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13665 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13666 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13667 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13668 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13669 | .init_verbs = { alc662_init_verbs }, |
| 13670 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13671 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13672 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13673 | .channel_mode = alc662_3ST_6ch_modes, |
| 13674 | .need_dac_fix = 1, |
| 13675 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13676 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13677 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13678 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13679 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13680 | .init_verbs = { alc662_init_verbs }, |
| 13681 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13682 | .dac_nids = alc662_dac_nids, |
| 13683 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13684 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13685 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 13686 | .channel_mode = alc662_5stack_modes, |
| 13687 | .input_mux = &alc662_capture_source, |
| 13688 | }, |
| 13689 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13690 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13691 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 13692 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13693 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13694 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13695 | .channel_mode = alc662_3ST_2ch_modes, |
| 13696 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13697 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 13698 | .init_hook = alc662_lenovo_101e_all_automute, |
| 13699 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13700 | [ALC662_ASUS_EEEPC_P701] = { |
| 13701 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 13702 | .init_verbs = { alc662_init_verbs, |
| 13703 | alc662_eeepc_sue_init_verbs }, |
| 13704 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13705 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13706 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13707 | .channel_mode = alc662_3ST_2ch_modes, |
| 13708 | .input_mux = &alc662_eeepc_capture_source, |
| 13709 | .unsol_event = alc662_eeepc_unsol_event, |
| 13710 | .init_hook = alc662_eeepc_inithook, |
| 13711 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13712 | [ALC662_ASUS_EEEPC_EP20] = { |
| 13713 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 13714 | alc662_chmode_mixer }, |
| 13715 | .init_verbs = { alc662_init_verbs, |
| 13716 | alc662_eeepc_ep20_sue_init_verbs }, |
| 13717 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13718 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13719 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13720 | .channel_mode = alc662_3ST_6ch_modes, |
| 13721 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13722 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 13723 | .init_hook = alc662_eeepc_ep20_inithook, |
| 13724 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13725 | |
| 13726 | }; |
| 13727 | |
| 13728 | |
| 13729 | /* |
| 13730 | * BIOS auto configuration |
| 13731 | */ |
| 13732 | |
| 13733 | /* add playback controls from the parsed DAC table */ |
| 13734 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13735 | const struct auto_pin_cfg *cfg) |
| 13736 | { |
| 13737 | char name[32]; |
| 13738 | static const char *chname[4] = { |
| 13739 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13740 | }; |
| 13741 | hda_nid_t nid; |
| 13742 | int i, err; |
| 13743 | |
| 13744 | for (i = 0; i < cfg->line_outs; i++) { |
| 13745 | if (!spec->multiout.dac_nids[i]) |
| 13746 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13747 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13748 | if (i == 2) { |
| 13749 | /* Center/LFE */ |
| 13750 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13751 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13752 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13753 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13754 | if (err < 0) |
| 13755 | return err; |
| 13756 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13757 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13758 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13759 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13760 | if (err < 0) |
| 13761 | return err; |
| 13762 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13763 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13764 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13765 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13766 | if (err < 0) |
| 13767 | return err; |
| 13768 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13769 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13770 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13771 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13772 | if (err < 0) |
| 13773 | return err; |
| 13774 | } else { |
| 13775 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13776 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13777 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13778 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13779 | if (err < 0) |
| 13780 | return err; |
| 13781 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13782 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13783 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13784 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13785 | if (err < 0) |
| 13786 | return err; |
| 13787 | } |
| 13788 | } |
| 13789 | return 0; |
| 13790 | } |
| 13791 | |
| 13792 | /* add playback controls for speaker and HP outputs */ |
| 13793 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13794 | const char *pfx) |
| 13795 | { |
| 13796 | hda_nid_t nid; |
| 13797 | int err; |
| 13798 | char name[32]; |
| 13799 | |
| 13800 | if (!pin) |
| 13801 | return 0; |
| 13802 | |
| 13803 | if (alc880_is_fixed_pin(pin)) { |
| 13804 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13805 | /* printk("DAC nid=%x\n",nid); */ |
| 13806 | /* specify the DAC as the extra output */ |
| 13807 | if (!spec->multiout.hp_nid) |
| 13808 | spec->multiout.hp_nid = nid; |
| 13809 | else |
| 13810 | spec->multiout.extra_out_nid[0] = nid; |
| 13811 | /* control HP volume/switch on the output mixer amp */ |
| 13812 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13813 | sprintf(name, "%s Playback Volume", pfx); |
| 13814 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13815 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13816 | if (err < 0) |
| 13817 | return err; |
| 13818 | sprintf(name, "%s Playback Switch", pfx); |
| 13819 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13820 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13821 | if (err < 0) |
| 13822 | return err; |
| 13823 | } else if (alc880_is_multi_pin(pin)) { |
| 13824 | /* set manual connection */ |
| 13825 | /* we have only a switch on HP-out PIN */ |
| 13826 | sprintf(name, "%s Playback Switch", pfx); |
| 13827 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13828 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13829 | if (err < 0) |
| 13830 | return err; |
| 13831 | } |
| 13832 | return 0; |
| 13833 | } |
| 13834 | |
| 13835 | /* create playback/capture controls for input pins */ |
| 13836 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13837 | const struct auto_pin_cfg *cfg) |
| 13838 | { |
| 13839 | struct hda_input_mux *imux = &spec->private_imux; |
| 13840 | int i, err, idx; |
| 13841 | |
| 13842 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13843 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13844 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13845 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13846 | auto_pin_cfg_labels[i], |
| 13847 | idx, 0x0b); |
| 13848 | if (err < 0) |
| 13849 | return err; |
| 13850 | imux->items[imux->num_items].label = |
| 13851 | auto_pin_cfg_labels[i]; |
| 13852 | imux->items[imux->num_items].index = |
| 13853 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13854 | imux->num_items++; |
| 13855 | } |
| 13856 | } |
| 13857 | return 0; |
| 13858 | } |
| 13859 | |
| 13860 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13861 | hda_nid_t nid, int pin_type, |
| 13862 | int dac_idx) |
| 13863 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13864 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13865 | /* need the manual connection? */ |
| 13866 | if (alc880_is_multi_pin(nid)) { |
| 13867 | struct alc_spec *spec = codec->spec; |
| 13868 | int idx = alc880_multi_pin_idx(nid); |
| 13869 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13870 | AC_VERB_SET_CONNECT_SEL, |
| 13871 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13872 | } |
| 13873 | } |
| 13874 | |
| 13875 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13876 | { |
| 13877 | struct alc_spec *spec = codec->spec; |
| 13878 | int i; |
| 13879 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13880 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13881 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13882 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13883 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13884 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13885 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13886 | i); |
| 13887 | } |
| 13888 | } |
| 13889 | |
| 13890 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13891 | { |
| 13892 | struct alc_spec *spec = codec->spec; |
| 13893 | hda_nid_t pin; |
| 13894 | |
| 13895 | pin = spec->autocfg.hp_pins[0]; |
| 13896 | if (pin) /* connect to front */ |
| 13897 | /* use dac 0 */ |
| 13898 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13899 | pin = spec->autocfg.speaker_pins[0]; |
| 13900 | if (pin) |
| 13901 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13902 | } |
| 13903 | |
| 13904 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13905 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13906 | |
| 13907 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13908 | { |
| 13909 | struct alc_spec *spec = codec->spec; |
| 13910 | int i; |
| 13911 | |
| 13912 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13913 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13914 | if (alc662_is_input_pin(nid)) { |
| 13915 | snd_hda_codec_write(codec, nid, 0, |
| 13916 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13917 | (i <= AUTO_PIN_FRONT_MIC ? |
| 13918 | PIN_VREF80 : PIN_IN)); |
| 13919 | if (nid != ALC662_PIN_CD_NID) |
| 13920 | snd_hda_codec_write(codec, nid, 0, |
| 13921 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13922 | AMP_OUT_MUTE); |
| 13923 | } |
| 13924 | } |
| 13925 | } |
| 13926 | |
| 13927 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 13928 | { |
| 13929 | struct alc_spec *spec = codec->spec; |
| 13930 | int err; |
| 13931 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 13932 | |
| 13933 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13934 | alc662_ignore); |
| 13935 | if (err < 0) |
| 13936 | return err; |
| 13937 | if (!spec->autocfg.line_outs) |
| 13938 | return 0; /* can't find valid BIOS pin config */ |
| 13939 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13940 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13941 | if (err < 0) |
| 13942 | return err; |
| 13943 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13944 | if (err < 0) |
| 13945 | return err; |
| 13946 | err = alc662_auto_create_extra_out(spec, |
| 13947 | spec->autocfg.speaker_pins[0], |
| 13948 | "Speaker"); |
| 13949 | if (err < 0) |
| 13950 | return err; |
| 13951 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 13952 | "Headphone"); |
| 13953 | if (err < 0) |
| 13954 | return err; |
| 13955 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13956 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13957 | return err; |
| 13958 | |
| 13959 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13960 | |
| 13961 | if (spec->autocfg.dig_out_pin) |
| 13962 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 13963 | |
| 13964 | if (spec->kctl_alloc) |
| 13965 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13966 | |
| 13967 | spec->num_mux_defs = 1; |
| 13968 | spec->input_mux = &spec->private_imux; |
| 13969 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13970 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13971 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 13972 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13973 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13974 | } |
| 13975 | |
| 13976 | /* additional initialization for auto-configuration model */ |
| 13977 | static void alc662_auto_init(struct hda_codec *codec) |
| 13978 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13979 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13980 | alc662_auto_init_multi_out(codec); |
| 13981 | alc662_auto_init_hp_out(codec); |
| 13982 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13983 | if (spec->unsol_event) |
| 13984 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13985 | } |
| 13986 | |
| 13987 | static int patch_alc662(struct hda_codec *codec) |
| 13988 | { |
| 13989 | struct alc_spec *spec; |
| 13990 | int err, board_config; |
| 13991 | |
| 13992 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13993 | if (!spec) |
| 13994 | return -ENOMEM; |
| 13995 | |
| 13996 | codec->spec = spec; |
| 13997 | |
| 13998 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 13999 | alc662_models, |
| 14000 | alc662_cfg_tbl); |
| 14001 | if (board_config < 0) { |
| 14002 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 14003 | "trying auto-probe from BIOS...\n"); |
| 14004 | board_config = ALC662_AUTO; |
| 14005 | } |
| 14006 | |
| 14007 | if (board_config == ALC662_AUTO) { |
| 14008 | /* automatic parse from the BIOS config */ |
| 14009 | err = alc662_parse_auto_config(codec); |
| 14010 | if (err < 0) { |
| 14011 | alc_free(codec); |
| 14012 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14013 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14014 | printk(KERN_INFO |
| 14015 | "hda_codec: Cannot set up configuration " |
| 14016 | "from BIOS. Using base mode...\n"); |
| 14017 | board_config = ALC662_3ST_2ch_DIG; |
| 14018 | } |
| 14019 | } |
| 14020 | |
| 14021 | if (board_config != ALC662_AUTO) |
| 14022 | setup_preset(spec, &alc662_presets[board_config]); |
| 14023 | |
| 14024 | spec->stream_name_analog = "ALC662 Analog"; |
| 14025 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 14026 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 14027 | |
| 14028 | spec->stream_name_digital = "ALC662 Digital"; |
| 14029 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 14030 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 14031 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14032 | spec->adc_nids = alc662_adc_nids; |
| 14033 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 14034 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14035 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14036 | spec->vmaster_nid = 0x02; |
| 14037 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14038 | codec->patch_ops = alc_patch_ops; |
| 14039 | if (board_config == ALC662_AUTO) |
| 14040 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14041 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14042 | if (!spec->loopback.amplist) |
| 14043 | spec->loopback.amplist = alc662_loopbacks; |
| 14044 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14045 | |
| 14046 | return 0; |
| 14047 | } |
| 14048 | |
| 14049 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14050 | * patch entries |
| 14051 | */ |
| 14052 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 14053 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14054 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14055 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14056 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14057 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14058 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14059 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14060 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 14061 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 14062 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14063 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 14064 | .patch = patch_alc883 }, |
| 14065 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 14066 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14067 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14068 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14069 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14070 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14071 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14072 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14073 | {} /* terminator */ |
| 14074 | }; |