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 | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 75 | ALC260_HP_3013, |
| 76 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 77 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 78 | ALC260_WILL, |
| 79 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 80 | #ifdef CONFIG_SND_DEBUG |
| 81 | ALC260_TEST, |
| 82 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 83 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 84 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | }; |
| 86 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 87 | /* ALC262 models */ |
| 88 | enum { |
| 89 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 90 | ALC262_HIPPO, |
| 91 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 92 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 93 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 94 | ALC262_HP_BPC_D7000_WL, |
| 95 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 96 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 97 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 98 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 99 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 100 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 101 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 102 | ALC262_LENOVO_3000, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 103 | ALC262_AUTO, |
| 104 | ALC262_MODEL_LAST /* last tag */ |
| 105 | }; |
| 106 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 107 | /* ALC268 models */ |
| 108 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 109 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 110 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 111 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 112 | ALC268_ACER, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 113 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 114 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 115 | #ifdef CONFIG_SND_DEBUG |
| 116 | ALC268_TEST, |
| 117 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 118 | ALC268_AUTO, |
| 119 | ALC268_MODEL_LAST /* last tag */ |
| 120 | }; |
| 121 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 122 | /* ALC269 models */ |
| 123 | enum { |
| 124 | ALC269_BASIC, |
| 125 | ALC269_AUTO, |
| 126 | ALC269_MODEL_LAST /* last tag */ |
| 127 | }; |
| 128 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 129 | /* ALC861 models */ |
| 130 | enum { |
| 131 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 132 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 133 | ALC861_3ST_DIG, |
| 134 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 135 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 136 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 137 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 138 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 139 | ALC861_AUTO, |
| 140 | ALC861_MODEL_LAST, |
| 141 | }; |
| 142 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 143 | /* ALC861-VD models */ |
| 144 | enum { |
| 145 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 146 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 147 | ALC861VD_3ST, |
| 148 | ALC861VD_3ST_DIG, |
| 149 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 150 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 151 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 152 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 153 | ALC861VD_AUTO, |
| 154 | ALC861VD_MODEL_LAST, |
| 155 | }; |
| 156 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 157 | /* ALC662 models */ |
| 158 | enum { |
| 159 | ALC662_3ST_2ch_DIG, |
| 160 | ALC662_3ST_6ch_DIG, |
| 161 | ALC662_3ST_6ch, |
| 162 | ALC662_5ST_DIG, |
| 163 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 164 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 165 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 166 | ALC663_ASUS_M51VA, |
| 167 | ALC663_ASUS_G71V, |
| 168 | ALC663_ASUS_H13, |
| 169 | ALC663_ASUS_G50V, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 170 | ALC662_AUTO, |
| 171 | ALC662_MODEL_LAST, |
| 172 | }; |
| 173 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 174 | /* ALC882 models */ |
| 175 | enum { |
| 176 | ALC882_3ST_DIG, |
| 177 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 178 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 179 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 180 | ALC882_TARGA, |
| 181 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 182 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 183 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 184 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 185 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 186 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 187 | ALC882_MODEL_LAST, |
| 188 | }; |
| 189 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 190 | /* ALC883 models */ |
| 191 | enum { |
| 192 | ALC883_3ST_2ch_DIG, |
| 193 | ALC883_3ST_6ch_DIG, |
| 194 | ALC883_3ST_6ch, |
| 195 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 196 | ALC883_TARGA_DIG, |
| 197 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 198 | ALC883_ACER, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 199 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 200 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 201 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 202 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 203 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 204 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 205 | ALC888_LENOVO_MS7195_DIG, |
| 206 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 207 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 208 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 209 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 210 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 211 | ALC883_FUJITSU_PI2515, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 212 | ALC883_AUTO, |
| 213 | ALC883_MODEL_LAST, |
| 214 | }; |
| 215 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 216 | /* for GPIO Poll */ |
| 217 | #define GPIO_MASK 0x03 |
| 218 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | struct alc_spec { |
| 220 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 221 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | unsigned int num_mixers; |
| 223 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 224 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 225 | * don't forget NULL |
| 226 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 227 | */ |
| 228 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 230 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | struct hda_pcm_stream *stream_analog_playback; |
| 232 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 233 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 234 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 236 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | struct hda_pcm_stream *stream_digital_playback; |
| 238 | struct hda_pcm_stream *stream_digital_capture; |
| 239 | |
| 240 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 241 | struct hda_multi_out multiout; /* playback set-up |
| 242 | * max_channels, dacs must be set |
| 243 | * dig_out_nid and hp_nid are optional |
| 244 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 245 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | |
| 247 | /* capture */ |
| 248 | unsigned int num_adc_nids; |
| 249 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 250 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 251 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | |
| 253 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 254 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | const struct hda_input_mux *input_mux; |
| 256 | unsigned int cur_mux[3]; |
| 257 | |
| 258 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 259 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 261 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | |
| 263 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 264 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 265 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 266 | /* dynamic controls, init_verbs and input_mux */ |
| 267 | struct auto_pin_cfg autocfg; |
| 268 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 269 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 270 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 271 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 272 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 273 | /* hooks */ |
| 274 | void (*init_hook)(struct hda_codec *codec); |
| 275 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 276 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 277 | /* for pin sensing */ |
| 278 | unsigned int sense_updated: 1; |
| 279 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 280 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 281 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 282 | /* for virtual master */ |
| 283 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 284 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 285 | struct hda_loopback_check loopback; |
| 286 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 287 | }; |
| 288 | |
| 289 | /* |
| 290 | * configuration template - to be copied to the spec instance |
| 291 | */ |
| 292 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 293 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 294 | * with spec |
| 295 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 296 | const struct hda_verb *init_verbs[5]; |
| 297 | unsigned int num_dacs; |
| 298 | hda_nid_t *dac_nids; |
| 299 | hda_nid_t dig_out_nid; /* optional */ |
| 300 | hda_nid_t hp_nid; /* optional */ |
| 301 | unsigned int num_adc_nids; |
| 302 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 303 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 304 | hda_nid_t dig_in_nid; |
| 305 | unsigned int num_channel_mode; |
| 306 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 307 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 308 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 309 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 310 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 311 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 312 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 313 | struct hda_amp_list *loopbacks; |
| 314 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | }; |
| 316 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | |
| 318 | /* |
| 319 | * input MUX handling |
| 320 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 321 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 322 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | { |
| 324 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 325 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 326 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 327 | if (mux_idx >= spec->num_mux_defs) |
| 328 | mux_idx = 0; |
| 329 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | } |
| 331 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 332 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 333 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | { |
| 335 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 336 | struct alc_spec *spec = codec->spec; |
| 337 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 338 | |
| 339 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 340 | return 0; |
| 341 | } |
| 342 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 343 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 344 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | { |
| 346 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 347 | struct alc_spec *spec = codec->spec; |
| 348 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 349 | 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] | 350 | hda_nid_t nid = spec->capsrc_nids ? |
| 351 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 352 | 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] | 353 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | } |
| 355 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 356 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | /* |
| 358 | * channel mode setting |
| 359 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 360 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 361 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | { |
| 363 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 364 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 365 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 366 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | } |
| 368 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 369 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 370 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | { |
| 372 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 373 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 374 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 375 | spec->num_channel_mode, |
| 376 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | } |
| 378 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 379 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 380 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | { |
| 382 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 383 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 384 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 385 | spec->num_channel_mode, |
| 386 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 387 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 388 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 389 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | } |
| 391 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 393 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 394 | * instead of "%" to avoid consequences of accidently treating the % as |
| 395 | * being part of a format specifier. Maximum allowed length of a value is |
| 396 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 397 | * |
| 398 | * Note: some retasking pin complexes seem to ignore requests for input |
| 399 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 400 | * are requested. Therefore order this list so that this behaviour will not |
| 401 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 402 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 403 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 404 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 405 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 406 | "Mic 50pc bias", "Mic 80pc bias", |
| 407 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 408 | }; |
| 409 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 410 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 411 | }; |
| 412 | /* 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] | 413 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 414 | * addition, "input" pins may or may not process the mic bias option |
| 415 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 416 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 417 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 418 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 419 | #define ALC_PIN_DIR_IN 0x00 |
| 420 | #define ALC_PIN_DIR_OUT 0x01 |
| 421 | #define ALC_PIN_DIR_INOUT 0x02 |
| 422 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 423 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 424 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 425 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 426 | * For each direction the minimum and maximum values are given. |
| 427 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 428 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 429 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 430 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 431 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 432 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 433 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 434 | }; |
| 435 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 436 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 437 | #define alc_pin_mode_n_items(_dir) \ |
| 438 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 439 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 440 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 441 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 442 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 443 | unsigned int item_num = uinfo->value.enumerated.item; |
| 444 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 445 | |
| 446 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 447 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 448 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 449 | |
| 450 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 451 | item_num = alc_pin_mode_min(dir); |
| 452 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 453 | return 0; |
| 454 | } |
| 455 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 456 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 457 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 458 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 459 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 460 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 461 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 462 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 463 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 464 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 465 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 466 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 467 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 468 | /* Find enumerated value for current pinctl setting */ |
| 469 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 470 | 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] | 471 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 472 | *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] | 473 | return 0; |
| 474 | } |
| 475 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 476 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 477 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 478 | { |
| 479 | signed int change; |
| 480 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 481 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 482 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 483 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 484 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 485 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 486 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 487 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 488 | 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] | 489 | val = alc_pin_mode_min(dir); |
| 490 | |
| 491 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 492 | if (change) { |
| 493 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 494 | snd_hda_codec_write_cache(codec, nid, 0, |
| 495 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 496 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 497 | |
| 498 | /* Also enable the retasking pin's input/output as required |
| 499 | * for the requested pin mode. Enum values of 2 or less are |
| 500 | * input modes. |
| 501 | * |
| 502 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 503 | * reduces noise slightly (particularly on input) so we'll |
| 504 | * do it. However, having both input and output buffers |
| 505 | * enabled simultaneously doesn't seem to be problematic if |
| 506 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 507 | */ |
| 508 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 509 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 510 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 511 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 512 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 513 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 514 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 515 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 516 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 517 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 518 | } |
| 519 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 520 | return change; |
| 521 | } |
| 522 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 523 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 524 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 525 | .info = alc_pin_mode_info, \ |
| 526 | .get = alc_pin_mode_get, \ |
| 527 | .put = alc_pin_mode_put, \ |
| 528 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 529 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 530 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 531 | * together using a mask with more than one bit set. This control is |
| 532 | * currently used only by the ALC260 test model. At this stage they are not |
| 533 | * needed for any "production" models. |
| 534 | */ |
| 535 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 536 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 537 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 538 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 539 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 540 | { |
| 541 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 542 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 543 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 544 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 545 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 546 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 547 | |
| 548 | *valp = (val & mask) != 0; |
| 549 | return 0; |
| 550 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 551 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 552 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 553 | { |
| 554 | signed int change; |
| 555 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 556 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 557 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 558 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 559 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 560 | AC_VERB_GET_GPIO_DATA, |
| 561 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 562 | |
| 563 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 564 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 565 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 566 | gpio_data &= ~mask; |
| 567 | else |
| 568 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 569 | snd_hda_codec_write_cache(codec, nid, 0, |
| 570 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 571 | |
| 572 | return change; |
| 573 | } |
| 574 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 575 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 576 | .info = alc_gpio_data_info, \ |
| 577 | .get = alc_gpio_data_get, \ |
| 578 | .put = alc_gpio_data_put, \ |
| 579 | .private_value = nid | (mask<<16) } |
| 580 | #endif /* CONFIG_SND_DEBUG */ |
| 581 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 582 | /* A switch control to allow the enabling of the digital IO pins on the |
| 583 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 584 | * to provide something in the test model allowing digital outputs to be |
| 585 | * identified if present. If models are found which can utilise these |
| 586 | * outputs a more complete mixer control can be devised for those models if |
| 587 | * necessary. |
| 588 | */ |
| 589 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 590 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 591 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 592 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 593 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 594 | { |
| 595 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 596 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 597 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 598 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 599 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 600 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 601 | |
| 602 | *valp = (val & mask) != 0; |
| 603 | return 0; |
| 604 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 605 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 606 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 607 | { |
| 608 | signed int change; |
| 609 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 610 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 611 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 612 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 613 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 614 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 615 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 616 | |
| 617 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 618 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 619 | if (val==0) |
| 620 | ctrl_data &= ~mask; |
| 621 | else |
| 622 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 623 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 624 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 625 | |
| 626 | return change; |
| 627 | } |
| 628 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 629 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 630 | .info = alc_spdif_ctrl_info, \ |
| 631 | .get = alc_spdif_ctrl_get, \ |
| 632 | .put = alc_spdif_ctrl_put, \ |
| 633 | .private_value = nid | (mask<<16) } |
| 634 | #endif /* CONFIG_SND_DEBUG */ |
| 635 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 636 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 637 | * Again, this is only used in the ALC26x test models to help identify when |
| 638 | * the EAPD line must be asserted for features to work. |
| 639 | */ |
| 640 | #ifdef CONFIG_SND_DEBUG |
| 641 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 642 | |
| 643 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 644 | struct snd_ctl_elem_value *ucontrol) |
| 645 | { |
| 646 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 647 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 648 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 649 | long *valp = ucontrol->value.integer.value; |
| 650 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 651 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 652 | |
| 653 | *valp = (val & mask) != 0; |
| 654 | return 0; |
| 655 | } |
| 656 | |
| 657 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 658 | struct snd_ctl_elem_value *ucontrol) |
| 659 | { |
| 660 | int change; |
| 661 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 662 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 663 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 664 | long val = *ucontrol->value.integer.value; |
| 665 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 666 | AC_VERB_GET_EAPD_BTLENABLE, |
| 667 | 0x00); |
| 668 | |
| 669 | /* Set/unset the masked control bit(s) as needed */ |
| 670 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 671 | if (!val) |
| 672 | ctrl_data &= ~mask; |
| 673 | else |
| 674 | ctrl_data |= mask; |
| 675 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 676 | ctrl_data); |
| 677 | |
| 678 | return change; |
| 679 | } |
| 680 | |
| 681 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 682 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 683 | .info = alc_eapd_ctrl_info, \ |
| 684 | .get = alc_eapd_ctrl_get, \ |
| 685 | .put = alc_eapd_ctrl_put, \ |
| 686 | .private_value = nid | (mask<<16) } |
| 687 | #endif /* CONFIG_SND_DEBUG */ |
| 688 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 689 | /* |
| 690 | * set up from the preset table |
| 691 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 692 | static void setup_preset(struct alc_spec *spec, |
| 693 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 694 | { |
| 695 | int i; |
| 696 | |
| 697 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 698 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 699 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 700 | i++) |
| 701 | spec->init_verbs[spec->num_init_verbs++] = |
| 702 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 703 | |
| 704 | spec->channel_mode = preset->channel_mode; |
| 705 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 706 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 707 | |
| 708 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 709 | |
| 710 | spec->multiout.num_dacs = preset->num_dacs; |
| 711 | spec->multiout.dac_nids = preset->dac_nids; |
| 712 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 713 | spec->multiout.hp_nid = preset->hp_nid; |
| 714 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 715 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 716 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 717 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 718 | spec->input_mux = preset->input_mux; |
| 719 | |
| 720 | spec->num_adc_nids = preset->num_adc_nids; |
| 721 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 722 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 723 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 724 | |
| 725 | spec->unsol_event = preset->unsol_event; |
| 726 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 727 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 728 | spec->loopback.amplist = preset->loopbacks; |
| 729 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 730 | } |
| 731 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 732 | /* Enable GPIO mask and set output */ |
| 733 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 734 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 735 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 736 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 737 | { } |
| 738 | }; |
| 739 | |
| 740 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 741 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 742 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 743 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 744 | { } |
| 745 | }; |
| 746 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 747 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 748 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 749 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 750 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 751 | { } |
| 752 | }; |
| 753 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 754 | static void alc_sku_automute(struct hda_codec *codec) |
| 755 | { |
| 756 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 757 | unsigned int present; |
| 758 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 759 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 760 | |
| 761 | /* need to execute and sync at first */ |
| 762 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 763 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 764 | AC_VERB_GET_PIN_SENSE, 0); |
| 765 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 766 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 767 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 768 | } |
| 769 | |
| 770 | /* unsolicited event for HP jack sensing */ |
| 771 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 772 | { |
| 773 | if (codec->vendor_id == 0x10ec0880) |
| 774 | res >>= 28; |
| 775 | else |
| 776 | res >>= 26; |
| 777 | if (res != ALC880_HP_EVENT) |
| 778 | return; |
| 779 | |
| 780 | alc_sku_automute(codec); |
| 781 | } |
| 782 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 783 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 784 | * 31 ~ 16 : Manufacture ID |
| 785 | * 15 ~ 8 : SKU ID |
| 786 | * 7 ~ 0 : Assembly ID |
| 787 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 788 | */ |
| 789 | static void alc_subsystem_id(struct hda_codec *codec, |
| 790 | unsigned int porta, unsigned int porte, |
| 791 | unsigned int portd) |
| 792 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 793 | unsigned int ass, tmp, i; |
| 794 | unsigned nid; |
| 795 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 796 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 797 | ass = codec->subsystem_id & 0xffff; |
| 798 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 799 | goto do_sku; |
| 800 | |
| 801 | /* |
| 802 | * 31~30 : port conetcivity |
| 803 | * 29~21 : reserve |
| 804 | * 20 : PCBEEP input |
| 805 | * 19~16 : Check sum (15:1) |
| 806 | * 15~1 : Custom |
| 807 | * 0 : override |
| 808 | */ |
| 809 | nid = 0x1d; |
| 810 | if (codec->vendor_id == 0x10ec0260) |
| 811 | nid = 0x17; |
| 812 | ass = snd_hda_codec_read(codec, nid, 0, |
| 813 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 814 | if (!(ass & 1) && !(ass & 0x100000)) |
| 815 | return; |
| 816 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 817 | return; |
| 818 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 819 | /* check sum */ |
| 820 | tmp = 0; |
| 821 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 822 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 823 | tmp++; |
| 824 | } |
| 825 | if (((ass >> 16) & 0xf) != tmp) |
| 826 | return; |
| 827 | do_sku: |
| 828 | /* |
| 829 | * 0 : override |
| 830 | * 1 : Swap Jack |
| 831 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 832 | * 3~5 : External Amplifier control |
| 833 | * 7~6 : Reserved |
| 834 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 835 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 836 | switch (tmp) { |
| 837 | case 1: |
| 838 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 839 | break; |
| 840 | case 3: |
| 841 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 842 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 843 | case 7: |
| 844 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 845 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 846 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 847 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 848 | case 0x10ec0260: |
| 849 | snd_hda_codec_write(codec, 0x0f, 0, |
| 850 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 851 | snd_hda_codec_write(codec, 0x10, 0, |
| 852 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 853 | break; |
| 854 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 855 | case 0x10ec0267: |
| 856 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 857 | case 0x10ec0269: |
| 858 | case 0x10ec0862: |
| 859 | case 0x10ec0662: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 860 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 861 | snd_hda_codec_write(codec, 0x14, 0, |
| 862 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 863 | snd_hda_codec_write(codec, 0x15, 0, |
| 864 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 865 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 866 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 867 | switch (codec->vendor_id) { |
| 868 | case 0x10ec0260: |
| 869 | snd_hda_codec_write(codec, 0x1a, 0, |
| 870 | AC_VERB_SET_COEF_INDEX, 7); |
| 871 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 872 | AC_VERB_GET_PROC_COEF, 0); |
| 873 | snd_hda_codec_write(codec, 0x1a, 0, |
| 874 | AC_VERB_SET_COEF_INDEX, 7); |
| 875 | snd_hda_codec_write(codec, 0x1a, 0, |
| 876 | AC_VERB_SET_PROC_COEF, |
| 877 | tmp | 0x2010); |
| 878 | break; |
| 879 | case 0x10ec0262: |
| 880 | case 0x10ec0880: |
| 881 | case 0x10ec0882: |
| 882 | case 0x10ec0883: |
| 883 | case 0x10ec0885: |
| 884 | case 0x10ec0888: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 885 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 886 | snd_hda_codec_write(codec, 0x20, 0, |
| 887 | AC_VERB_SET_COEF_INDEX, 7); |
| 888 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 889 | AC_VERB_GET_PROC_COEF, 0); |
| 890 | snd_hda_codec_write(codec, 0x20, 0, |
| 891 | AC_VERB_SET_COEF_INDEX, 7); |
| 892 | snd_hda_codec_write(codec, 0x20, 0, |
| 893 | AC_VERB_SET_PROC_COEF, |
| 894 | tmp | 0x2010); |
| 895 | break; |
| 896 | case 0x10ec0267: |
| 897 | case 0x10ec0268: |
| 898 | snd_hda_codec_write(codec, 0x20, 0, |
| 899 | AC_VERB_SET_COEF_INDEX, 7); |
| 900 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 901 | AC_VERB_GET_PROC_COEF, 0); |
| 902 | snd_hda_codec_write(codec, 0x20, 0, |
| 903 | AC_VERB_SET_COEF_INDEX, 7); |
| 904 | snd_hda_codec_write(codec, 0x20, 0, |
| 905 | AC_VERB_SET_PROC_COEF, |
| 906 | tmp | 0x3000); |
| 907 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 908 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 909 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 910 | break; |
| 911 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 912 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 913 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 914 | * when the external headphone out jack is plugged" |
| 915 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 916 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 917 | return; |
| 918 | /* |
| 919 | * 10~8 : Jack location |
| 920 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 921 | * 14~13: Resvered |
| 922 | * 15 : 1 --> enable the function "Mute internal speaker |
| 923 | * when the external headphone out jack is plugged" |
| 924 | */ |
| 925 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 926 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 927 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 928 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 929 | else |
| 930 | return; |
| 931 | } |
| 932 | |
| 933 | if (!spec->autocfg.hp_pins[0]) { |
| 934 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 935 | if (tmp == 0) |
| 936 | spec->autocfg.hp_pins[0] = porta; |
| 937 | else if (tmp == 1) |
| 938 | spec->autocfg.hp_pins[0] = porte; |
| 939 | else if (tmp == 2) |
| 940 | spec->autocfg.hp_pins[0] = portd; |
| 941 | else |
| 942 | return; |
| 943 | } |
| 944 | |
| 945 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 946 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 947 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 948 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 949 | } |
| 950 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 951 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 952 | * Fix-up pin default configurations |
| 953 | */ |
| 954 | |
| 955 | struct alc_pincfg { |
| 956 | hda_nid_t nid; |
| 957 | u32 val; |
| 958 | }; |
| 959 | |
| 960 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 961 | const struct snd_pci_quirk *quirk, |
| 962 | const struct alc_pincfg **pinfix) |
| 963 | { |
| 964 | const struct alc_pincfg *cfg; |
| 965 | |
| 966 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 967 | if (!quirk) |
| 968 | return; |
| 969 | |
| 970 | cfg = pinfix[quirk->value]; |
| 971 | for (; cfg->nid; cfg++) { |
| 972 | int i; |
| 973 | u32 val = cfg->val; |
| 974 | for (i = 0; i < 4; i++) { |
| 975 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 976 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 977 | val & 0xff); |
| 978 | val >>= 8; |
| 979 | } |
| 980 | } |
| 981 | } |
| 982 | |
| 983 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 984 | * ALC880 3-stack model |
| 985 | * |
| 986 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 987 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 988 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 989 | */ |
| 990 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 991 | static hda_nid_t alc880_dac_nids[4] = { |
| 992 | /* front, rear, clfe, rear_surr */ |
| 993 | 0x02, 0x05, 0x04, 0x03 |
| 994 | }; |
| 995 | |
| 996 | static hda_nid_t alc880_adc_nids[3] = { |
| 997 | /* ADC0-2 */ |
| 998 | 0x07, 0x08, 0x09, |
| 999 | }; |
| 1000 | |
| 1001 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1002 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1003 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1004 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1005 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1006 | /* ADC1-2 */ |
| 1007 | 0x08, 0x09, |
| 1008 | }; |
| 1009 | |
| 1010 | #define ALC880_DIGOUT_NID 0x06 |
| 1011 | #define ALC880_DIGIN_NID 0x0a |
| 1012 | |
| 1013 | static struct hda_input_mux alc880_capture_source = { |
| 1014 | .num_items = 4, |
| 1015 | .items = { |
| 1016 | { "Mic", 0x0 }, |
| 1017 | { "Front Mic", 0x3 }, |
| 1018 | { "Line", 0x2 }, |
| 1019 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1020 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1021 | }; |
| 1022 | |
| 1023 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1024 | /* 2ch mode */ |
| 1025 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1026 | /* set line-in to input, mute it */ |
| 1027 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1028 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1029 | /* set mic-in to input vref 80%, mute it */ |
| 1030 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1031 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1032 | { } /* end */ |
| 1033 | }; |
| 1034 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1035 | /* 6ch mode */ |
| 1036 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1037 | /* set line-in to output, unmute it */ |
| 1038 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1039 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1040 | /* set mic-in to output, unmute it */ |
| 1041 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1042 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1043 | { } /* end */ |
| 1044 | }; |
| 1045 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1046 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1047 | { 2, alc880_threestack_ch2_init }, |
| 1048 | { 6, alc880_threestack_ch6_init }, |
| 1049 | }; |
| 1050 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1051 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1052 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1053 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1054 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1055 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1056 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1057 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1058 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1059 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1060 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1061 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1062 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1063 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1064 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1065 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1066 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1067 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1068 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1069 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1070 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1071 | { |
| 1072 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1073 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1074 | .info = alc_ch_mode_info, |
| 1075 | .get = alc_ch_mode_get, |
| 1076 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1077 | }, |
| 1078 | { } /* end */ |
| 1079 | }; |
| 1080 | |
| 1081 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1082 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1083 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1084 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1085 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1086 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1087 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1088 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1089 | { |
| 1090 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1091 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1092 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1093 | */ |
| 1094 | /* .name = "Capture Source", */ |
| 1095 | .name = "Input Source", |
| 1096 | .count = 3, |
| 1097 | .info = alc_mux_enum_info, |
| 1098 | .get = alc_mux_enum_get, |
| 1099 | .put = alc_mux_enum_put, |
| 1100 | }, |
| 1101 | { } /* end */ |
| 1102 | }; |
| 1103 | |
| 1104 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1105 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1106 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1107 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1108 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1109 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1110 | { |
| 1111 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1112 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1113 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1114 | */ |
| 1115 | /* .name = "Capture Source", */ |
| 1116 | .name = "Input Source", |
| 1117 | .count = 2, |
| 1118 | .info = alc_mux_enum_info, |
| 1119 | .get = alc_mux_enum_get, |
| 1120 | .put = alc_mux_enum_put, |
| 1121 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1122 | { } /* end */ |
| 1123 | }; |
| 1124 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1125 | |
| 1126 | |
| 1127 | /* |
| 1128 | * ALC880 5-stack model |
| 1129 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1130 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1131 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1132 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1133 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1134 | */ |
| 1135 | |
| 1136 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1137 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1138 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1139 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1140 | { } /* end */ |
| 1141 | }; |
| 1142 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1143 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1144 | /* 6ch mode */ |
| 1145 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1146 | /* set line-in to input, mute it */ |
| 1147 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1148 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1149 | { } /* end */ |
| 1150 | }; |
| 1151 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1152 | /* 8ch mode */ |
| 1153 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1154 | /* set line-in to output, unmute it */ |
| 1155 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1156 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1157 | { } /* end */ |
| 1158 | }; |
| 1159 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1160 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1161 | { 6, alc880_fivestack_ch6_init }, |
| 1162 | { 8, alc880_fivestack_ch8_init }, |
| 1163 | }; |
| 1164 | |
| 1165 | |
| 1166 | /* |
| 1167 | * ALC880 6-stack model |
| 1168 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1169 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1170 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1171 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1172 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1173 | */ |
| 1174 | |
| 1175 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1176 | /* front, rear, clfe, rear_surr */ |
| 1177 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1178 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1179 | |
| 1180 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1181 | .num_items = 4, |
| 1182 | .items = { |
| 1183 | { "Mic", 0x0 }, |
| 1184 | { "Front Mic", 0x1 }, |
| 1185 | { "Line", 0x2 }, |
| 1186 | { "CD", 0x4 }, |
| 1187 | }, |
| 1188 | }; |
| 1189 | |
| 1190 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1191 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1192 | { 8, NULL }, |
| 1193 | }; |
| 1194 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1195 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1196 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1197 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1198 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1199 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1200 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1201 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1202 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1203 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1204 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1205 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1206 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1207 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1208 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1209 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1210 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1211 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1212 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1213 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1214 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1215 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1216 | { |
| 1217 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1218 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1219 | .info = alc_ch_mode_info, |
| 1220 | .get = alc_ch_mode_get, |
| 1221 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1222 | }, |
| 1223 | { } /* end */ |
| 1224 | }; |
| 1225 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1226 | |
| 1227 | /* |
| 1228 | * ALC880 W810 model |
| 1229 | * |
| 1230 | * W810 has rear IO for: |
| 1231 | * Front (DAC 02) |
| 1232 | * Surround (DAC 03) |
| 1233 | * Center/LFE (DAC 04) |
| 1234 | * Digital out (06) |
| 1235 | * |
| 1236 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1237 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1238 | * |
| 1239 | * There is a variable resistor to control the speaker or headphone |
| 1240 | * volume. This is a hardware-only device without a software API. |
| 1241 | * |
| 1242 | * Plugging headphones in will disable the internal speakers. This is |
| 1243 | * implemented in hardware, not via the driver using jack sense. In |
| 1244 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1245 | * disable both the speakers and headphones. |
| 1246 | * |
| 1247 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1248 | * These may not do anything useful with this driver yet, because I |
| 1249 | * haven't setup any initialization verbs for these yet... |
| 1250 | */ |
| 1251 | |
| 1252 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1253 | /* front, rear/surround, clfe */ |
| 1254 | 0x02, 0x03, 0x04 |
| 1255 | }; |
| 1256 | |
| 1257 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1258 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1259 | { 6, NULL } |
| 1260 | }; |
| 1261 | |
| 1262 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1263 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1264 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1265 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1266 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1267 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1268 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1269 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1270 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1271 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1272 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1273 | { } /* end */ |
| 1274 | }; |
| 1275 | |
| 1276 | |
| 1277 | /* |
| 1278 | * Z710V model |
| 1279 | * |
| 1280 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1281 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1282 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1283 | */ |
| 1284 | |
| 1285 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1286 | 0x02 |
| 1287 | }; |
| 1288 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1289 | |
| 1290 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1291 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1292 | { 2, NULL } |
| 1293 | }; |
| 1294 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1295 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1296 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1297 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1298 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1299 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1300 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1301 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1302 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1303 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1304 | { } /* end */ |
| 1305 | }; |
| 1306 | |
| 1307 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1308 | /* |
| 1309 | * ALC880 F1734 model |
| 1310 | * |
| 1311 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1312 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1313 | */ |
| 1314 | |
| 1315 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1316 | 0x03 |
| 1317 | }; |
| 1318 | #define ALC880_F1734_HP_DAC 0x02 |
| 1319 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1320 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1321 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1322 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1323 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1324 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1325 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1326 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1327 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1328 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1329 | { } /* end */ |
| 1330 | }; |
| 1331 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1332 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1333 | .num_items = 2, |
| 1334 | .items = { |
| 1335 | { "Mic", 0x1 }, |
| 1336 | { "CD", 0x4 }, |
| 1337 | }, |
| 1338 | }; |
| 1339 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1340 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1341 | /* |
| 1342 | * ALC880 ASUS model |
| 1343 | * |
| 1344 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1345 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1346 | * Mic = 0x18, Line = 0x1a |
| 1347 | */ |
| 1348 | |
| 1349 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1350 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1351 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1352 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1353 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1354 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1355 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1356 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1357 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1358 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1359 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1360 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1361 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1362 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1363 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1364 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1365 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1366 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1367 | { |
| 1368 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1369 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1370 | .info = alc_ch_mode_info, |
| 1371 | .get = alc_ch_mode_get, |
| 1372 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1373 | }, |
| 1374 | { } /* end */ |
| 1375 | }; |
| 1376 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1377 | /* |
| 1378 | * ALC880 ASUS W1V model |
| 1379 | * |
| 1380 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1381 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1382 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1383 | */ |
| 1384 | |
| 1385 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1386 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1387 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1388 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1389 | { } /* end */ |
| 1390 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1391 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1392 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1393 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1394 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1395 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1396 | { } /* end */ |
| 1397 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1398 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1399 | /* TCL S700 */ |
| 1400 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1401 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1402 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1403 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1404 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1405 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1406 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1407 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1408 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1409 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1410 | { |
| 1411 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1412 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1413 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1414 | */ |
| 1415 | /* .name = "Capture Source", */ |
| 1416 | .name = "Input Source", |
| 1417 | .count = 1, |
| 1418 | .info = alc_mux_enum_info, |
| 1419 | .get = alc_mux_enum_get, |
| 1420 | .put = alc_mux_enum_put, |
| 1421 | }, |
| 1422 | { } /* end */ |
| 1423 | }; |
| 1424 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1425 | /* Uniwill */ |
| 1426 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1427 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1428 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1429 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1430 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1431 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1432 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1433 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1434 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1435 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1436 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1437 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1438 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1439 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1440 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1441 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1442 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1443 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1444 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1445 | { |
| 1446 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1447 | .name = "Channel Mode", |
| 1448 | .info = alc_ch_mode_info, |
| 1449 | .get = alc_ch_mode_get, |
| 1450 | .put = alc_ch_mode_put, |
| 1451 | }, |
| 1452 | { } /* end */ |
| 1453 | }; |
| 1454 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1455 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1456 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1457 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1458 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1459 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1460 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1461 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1462 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1463 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1464 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1465 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1466 | { } /* end */ |
| 1467 | }; |
| 1468 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1469 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1470 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1471 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1472 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1473 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1474 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1475 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1476 | { } /* end */ |
| 1477 | }; |
| 1478 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1479 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1480 | * virtual master controls |
| 1481 | */ |
| 1482 | |
| 1483 | /* |
| 1484 | * slave controls for virtual master |
| 1485 | */ |
| 1486 | static const char *alc_slave_vols[] = { |
| 1487 | "Front Playback Volume", |
| 1488 | "Surround Playback Volume", |
| 1489 | "Center Playback Volume", |
| 1490 | "LFE Playback Volume", |
| 1491 | "Side Playback Volume", |
| 1492 | "Headphone Playback Volume", |
| 1493 | "Speaker Playback Volume", |
| 1494 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1495 | "Line-Out Playback Volume", |
| 1496 | NULL, |
| 1497 | }; |
| 1498 | |
| 1499 | static const char *alc_slave_sws[] = { |
| 1500 | "Front Playback Switch", |
| 1501 | "Surround Playback Switch", |
| 1502 | "Center Playback Switch", |
| 1503 | "LFE Playback Switch", |
| 1504 | "Side Playback Switch", |
| 1505 | "Headphone Playback Switch", |
| 1506 | "Speaker Playback Switch", |
| 1507 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1508 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1509 | NULL, |
| 1510 | }; |
| 1511 | |
| 1512 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1513 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1514 | */ |
| 1515 | static int alc_build_controls(struct hda_codec *codec) |
| 1516 | { |
| 1517 | struct alc_spec *spec = codec->spec; |
| 1518 | int err; |
| 1519 | int i; |
| 1520 | |
| 1521 | for (i = 0; i < spec->num_mixers; i++) { |
| 1522 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1523 | if (err < 0) |
| 1524 | return err; |
| 1525 | } |
| 1526 | |
| 1527 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1528 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1529 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1530 | if (err < 0) |
| 1531 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1532 | err = snd_hda_create_spdif_share_sw(codec, |
| 1533 | &spec->multiout); |
| 1534 | if (err < 0) |
| 1535 | return err; |
| 1536 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1537 | } |
| 1538 | if (spec->dig_in_nid) { |
| 1539 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1540 | if (err < 0) |
| 1541 | return err; |
| 1542 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1543 | |
| 1544 | /* if we have no master control, let's create it */ |
| 1545 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1546 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1547 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1548 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1549 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1550 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1551 | if (err < 0) |
| 1552 | return err; |
| 1553 | } |
| 1554 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1555 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1556 | NULL, alc_slave_sws); |
| 1557 | if (err < 0) |
| 1558 | return err; |
| 1559 | } |
| 1560 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1561 | return 0; |
| 1562 | } |
| 1563 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1564 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1565 | /* |
| 1566 | * initialize the codec volumes, etc |
| 1567 | */ |
| 1568 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1569 | /* |
| 1570 | * generic initialization of ADC, input mixers and output mixers |
| 1571 | */ |
| 1572 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1573 | /* |
| 1574 | * Unmute ADC0-2 and set the default input to mic-in |
| 1575 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1576 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1577 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1578 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1579 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1580 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1581 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1582 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1583 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1584 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1585 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1586 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1587 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1588 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1589 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1590 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1591 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1592 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1593 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1594 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1595 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1596 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1597 | /* |
| 1598 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1599 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1600 | /* set vol=0 to output mixers */ |
| 1601 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1602 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1603 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1604 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1605 | /* set up input amps for analog loopback */ |
| 1606 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1607 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1608 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1609 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1610 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1611 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1612 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1613 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1614 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1615 | |
| 1616 | { } |
| 1617 | }; |
| 1618 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1619 | /* |
| 1620 | * 3-stack pin configuration: |
| 1621 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1622 | */ |
| 1623 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1624 | /* |
| 1625 | * preset connection lists of input pins |
| 1626 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1627 | */ |
| 1628 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1629 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1630 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1631 | |
| 1632 | /* |
| 1633 | * Set pin mode and muting |
| 1634 | */ |
| 1635 | /* set front pin widgets 0x14 for output */ |
| 1636 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1637 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1638 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1639 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1640 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1641 | /* Mic2 (as headphone out) for HP output */ |
| 1642 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1643 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1644 | /* Line In pin widget for input */ |
| 1645 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1646 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1647 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1648 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1649 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1650 | /* CD pin widget for input */ |
| 1651 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1652 | |
| 1653 | { } |
| 1654 | }; |
| 1655 | |
| 1656 | /* |
| 1657 | * 5-stack pin configuration: |
| 1658 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1659 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1660 | */ |
| 1661 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1662 | /* |
| 1663 | * preset connection lists of input pins |
| 1664 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1665 | */ |
| 1666 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1667 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1668 | |
| 1669 | /* |
| 1670 | * Set pin mode and muting |
| 1671 | */ |
| 1672 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1673 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1674 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1675 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1676 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1677 | /* unmute pins for output (no gain on this amp) */ |
| 1678 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1679 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1680 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1681 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1682 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1683 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1684 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1685 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1686 | /* Mic2 (as headphone out) for HP output */ |
| 1687 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1688 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1689 | /* Line In pin widget for input */ |
| 1690 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1691 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1692 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1693 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1694 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1695 | /* CD pin widget for input */ |
| 1696 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1697 | |
| 1698 | { } |
| 1699 | }; |
| 1700 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1701 | /* |
| 1702 | * W810 pin configuration: |
| 1703 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1704 | */ |
| 1705 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1706 | /* hphone/speaker input selector: front DAC */ |
| 1707 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1708 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1709 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1710 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1711 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1712 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1713 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1714 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1715 | |
| 1716 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1717 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1718 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1719 | { } |
| 1720 | }; |
| 1721 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1722 | /* |
| 1723 | * Z71V pin configuration: |
| 1724 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1725 | */ |
| 1726 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1727 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1728 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1729 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1730 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1731 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1732 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1733 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1734 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1735 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1736 | |
| 1737 | { } |
| 1738 | }; |
| 1739 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1740 | /* |
| 1741 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1742 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1743 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1744 | */ |
| 1745 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1746 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1747 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1748 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1749 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1750 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1751 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1752 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1753 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1754 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1755 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1756 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1757 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1758 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1759 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1760 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1761 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1762 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1763 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1764 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1765 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1766 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1767 | { } |
| 1768 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1769 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1770 | /* |
| 1771 | * Uniwill pin configuration: |
| 1772 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1773 | * line = 0x1a |
| 1774 | */ |
| 1775 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1776 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1777 | |
| 1778 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1779 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1780 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1781 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1782 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1783 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1784 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1785 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1786 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1787 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1788 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1789 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1790 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1791 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1792 | |
| 1793 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1794 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1795 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1796 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1797 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1798 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1799 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1800 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1801 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1802 | |
| 1803 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1804 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1805 | |
| 1806 | { } |
| 1807 | }; |
| 1808 | |
| 1809 | /* |
| 1810 | * Uniwill P53 |
| 1811 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1812 | */ |
| 1813 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1814 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1815 | |
| 1816 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1817 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1818 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1819 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1820 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1821 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1822 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1823 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1824 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1825 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1826 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1827 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1828 | |
| 1829 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1830 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1831 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1832 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1833 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1834 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1835 | |
| 1836 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1837 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1838 | |
| 1839 | { } |
| 1840 | }; |
| 1841 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1842 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1843 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1844 | { } |
| 1845 | }; |
| 1846 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1847 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1848 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1849 | { |
| 1850 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1851 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1852 | |
| 1853 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1854 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1855 | bits = present ? HDA_AMP_MUTE : 0; |
| 1856 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1857 | HDA_AMP_MUTE, bits); |
| 1858 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1859 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1860 | } |
| 1861 | |
| 1862 | /* auto-toggle front mic */ |
| 1863 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1864 | { |
| 1865 | unsigned int present; |
| 1866 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1867 | |
| 1868 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1869 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1870 | bits = present ? HDA_AMP_MUTE : 0; |
| 1871 | 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] | 1872 | } |
| 1873 | |
| 1874 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1875 | { |
| 1876 | alc880_uniwill_hp_automute(codec); |
| 1877 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1878 | } |
| 1879 | |
| 1880 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1881 | unsigned int res) |
| 1882 | { |
| 1883 | /* Looks like the unsol event is incompatible with the standard |
| 1884 | * definition. 4bit tag is placed at 28 bit! |
| 1885 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1886 | switch (res >> 28) { |
| 1887 | case ALC880_HP_EVENT: |
| 1888 | alc880_uniwill_hp_automute(codec); |
| 1889 | break; |
| 1890 | case ALC880_MIC_EVENT: |
| 1891 | alc880_uniwill_mic_automute(codec); |
| 1892 | break; |
| 1893 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1894 | } |
| 1895 | |
| 1896 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1897 | { |
| 1898 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1899 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1900 | |
| 1901 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1902 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1903 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 1904 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1905 | } |
| 1906 | |
| 1907 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1908 | { |
| 1909 | unsigned int present; |
| 1910 | |
| 1911 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1912 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1913 | present &= HDA_AMP_VOLMASK; |
| 1914 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1915 | HDA_AMP_VOLMASK, present); |
| 1916 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1917 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1918 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1919 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1920 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1921 | unsigned int res) |
| 1922 | { |
| 1923 | /* Looks like the unsol event is incompatible with the standard |
| 1924 | * definition. 4bit tag is placed at 28 bit! |
| 1925 | */ |
| 1926 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1927 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1928 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1929 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1930 | } |
| 1931 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1932 | /* |
| 1933 | * F1734 pin configuration: |
| 1934 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1935 | */ |
| 1936 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1937 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1938 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1939 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1940 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1941 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1942 | |
| 1943 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1944 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1945 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1946 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1947 | |
| 1948 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1949 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1950 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1951 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1952 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1953 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1954 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1955 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1956 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1957 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1958 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 1959 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 1960 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1961 | { } |
| 1962 | }; |
| 1963 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1964 | /* |
| 1965 | * ASUS pin configuration: |
| 1966 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1967 | */ |
| 1968 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1969 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1970 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1971 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1972 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1973 | |
| 1974 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1975 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1976 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1977 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1978 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1979 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1980 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1981 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1982 | |
| 1983 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1984 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1985 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1986 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1987 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1988 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1989 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1990 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1991 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1992 | |
| 1993 | { } |
| 1994 | }; |
| 1995 | |
| 1996 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1997 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1998 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1999 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2000 | /* Clevo m520g init */ |
| 2001 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2002 | /* headphone output */ |
| 2003 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2004 | /* line-out */ |
| 2005 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2006 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2007 | /* Line-in */ |
| 2008 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2009 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2010 | /* CD */ |
| 2011 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2012 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2013 | /* Mic1 (rear panel) */ |
| 2014 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2015 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2016 | /* Mic2 (front panel) */ |
| 2017 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2018 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2019 | /* headphone */ |
| 2020 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2021 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2022 | /* change to EAPD mode */ |
| 2023 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2024 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2025 | |
| 2026 | { } |
| 2027 | }; |
| 2028 | |
| 2029 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2030 | /* change to EAPD mode */ |
| 2031 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2032 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2033 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2034 | /* Headphone output */ |
| 2035 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2036 | /* Front output*/ |
| 2037 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2038 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2039 | |
| 2040 | /* Line In pin widget for input */ |
| 2041 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2042 | /* CD pin widget for input */ |
| 2043 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2044 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2045 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2046 | |
| 2047 | /* change to EAPD mode */ |
| 2048 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2049 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2050 | |
| 2051 | { } |
| 2052 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2053 | |
| 2054 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2055 | * LG m1 express dual |
| 2056 | * |
| 2057 | * Pin assignment: |
| 2058 | * Rear Line-In/Out (blue): 0x14 |
| 2059 | * Build-in Mic-In: 0x15 |
| 2060 | * Speaker-out: 0x17 |
| 2061 | * HP-Out (green): 0x1b |
| 2062 | * Mic-In/Out (red): 0x19 |
| 2063 | * SPDIF-Out: 0x1e |
| 2064 | */ |
| 2065 | |
| 2066 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2067 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2068 | 0x05, 0x02, 0x03 |
| 2069 | }; |
| 2070 | |
| 2071 | /* seems analog CD is not working */ |
| 2072 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2073 | .num_items = 3, |
| 2074 | .items = { |
| 2075 | { "Mic", 0x1 }, |
| 2076 | { "Line", 0x5 }, |
| 2077 | { "Internal Mic", 0x6 }, |
| 2078 | }, |
| 2079 | }; |
| 2080 | |
| 2081 | /* 2,4,6 channel modes */ |
| 2082 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2083 | /* set line-in and mic-in to input */ |
| 2084 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2085 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2086 | { } |
| 2087 | }; |
| 2088 | |
| 2089 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2090 | /* set line-in to out and mic-in to input */ |
| 2091 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2092 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2093 | { } |
| 2094 | }; |
| 2095 | |
| 2096 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2097 | /* set line-in and mic-in to output */ |
| 2098 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2099 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2100 | { } |
| 2101 | }; |
| 2102 | |
| 2103 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2104 | { 2, alc880_lg_ch2_init }, |
| 2105 | { 4, alc880_lg_ch4_init }, |
| 2106 | { 6, alc880_lg_ch6_init }, |
| 2107 | }; |
| 2108 | |
| 2109 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2110 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2111 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2112 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2113 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2114 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2115 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2116 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2117 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2118 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2119 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2120 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2121 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2122 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2123 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2124 | { |
| 2125 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2126 | .name = "Channel Mode", |
| 2127 | .info = alc_ch_mode_info, |
| 2128 | .get = alc_ch_mode_get, |
| 2129 | .put = alc_ch_mode_put, |
| 2130 | }, |
| 2131 | { } /* end */ |
| 2132 | }; |
| 2133 | |
| 2134 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2135 | /* set capture source to mic-in */ |
| 2136 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2137 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2138 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2139 | /* mute all amp mixer inputs */ |
| 2140 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2141 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2142 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2143 | /* line-in to input */ |
| 2144 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2145 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2146 | /* built-in mic */ |
| 2147 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2148 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2149 | /* speaker-out */ |
| 2150 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2151 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2152 | /* mic-in to input */ |
| 2153 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2154 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2155 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2156 | /* HP-out */ |
| 2157 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2158 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2159 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2160 | /* jack sense */ |
| 2161 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2162 | { } |
| 2163 | }; |
| 2164 | |
| 2165 | /* toggle speaker-output according to the hp-jack state */ |
| 2166 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2167 | { |
| 2168 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2169 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2170 | |
| 2171 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2172 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2173 | bits = present ? HDA_AMP_MUTE : 0; |
| 2174 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2175 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2176 | } |
| 2177 | |
| 2178 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2179 | { |
| 2180 | /* Looks like the unsol event is incompatible with the standard |
| 2181 | * definition. 4bit tag is placed at 28 bit! |
| 2182 | */ |
| 2183 | if ((res >> 28) == 0x01) |
| 2184 | alc880_lg_automute(codec); |
| 2185 | } |
| 2186 | |
| 2187 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2188 | * LG LW20 |
| 2189 | * |
| 2190 | * Pin assignment: |
| 2191 | * Speaker-out: 0x14 |
| 2192 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2193 | * Built-in Mic-In: 0x19 |
| 2194 | * Line-In: 0x1b |
| 2195 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2196 | * SPDIF-Out: 0x1e |
| 2197 | */ |
| 2198 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2199 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2200 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2201 | .items = { |
| 2202 | { "Mic", 0x0 }, |
| 2203 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2204 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2205 | }, |
| 2206 | }; |
| 2207 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2208 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2209 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2210 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2211 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2212 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2213 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2214 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2215 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2216 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2217 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2218 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2219 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2220 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2221 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2223 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2224 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2225 | { |
| 2226 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2227 | .name = "Channel Mode", |
| 2228 | .info = alc_ch_mode_info, |
| 2229 | .get = alc_ch_mode_get, |
| 2230 | .put = alc_ch_mode_put, |
| 2231 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2232 | { } /* end */ |
| 2233 | }; |
| 2234 | |
| 2235 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2236 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2237 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2238 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2239 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2240 | /* set capture source to mic-in */ |
| 2241 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2242 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2243 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2244 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2245 | /* speaker-out */ |
| 2246 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2247 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2248 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2249 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2250 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2251 | /* mic-in to input */ |
| 2252 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2253 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2254 | /* built-in mic */ |
| 2255 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2256 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2257 | /* jack sense */ |
| 2258 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2259 | { } |
| 2260 | }; |
| 2261 | |
| 2262 | /* toggle speaker-output according to the hp-jack state */ |
| 2263 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2264 | { |
| 2265 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2266 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2267 | |
| 2268 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2269 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2270 | bits = present ? HDA_AMP_MUTE : 0; |
| 2271 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2272 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2273 | } |
| 2274 | |
| 2275 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2276 | { |
| 2277 | /* Looks like the unsol event is incompatible with the standard |
| 2278 | * definition. 4bit tag is placed at 28 bit! |
| 2279 | */ |
| 2280 | if ((res >> 28) == 0x01) |
| 2281 | alc880_lg_lw_automute(codec); |
| 2282 | } |
| 2283 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2284 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2285 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2286 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2287 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2288 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2289 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2290 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2291 | { } /* end */ |
| 2292 | }; |
| 2293 | |
| 2294 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2295 | .num_items = 2, |
| 2296 | .items = { |
| 2297 | { "Mic", 0x0 }, |
| 2298 | { "Internal Mic", 0x1 }, |
| 2299 | }, |
| 2300 | }; |
| 2301 | |
| 2302 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2303 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2304 | |
| 2305 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2306 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2307 | |
| 2308 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2309 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2310 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2311 | /* Mic2 (as headphone out) for HP output */ |
| 2312 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2313 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2314 | /* Internal Speaker */ |
| 2315 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2316 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2317 | |
| 2318 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2319 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2320 | |
| 2321 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2322 | { } |
| 2323 | }; |
| 2324 | |
| 2325 | /* toggle speaker-output according to the hp-jack state */ |
| 2326 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2327 | { |
| 2328 | unsigned int present; |
| 2329 | unsigned char bits; |
| 2330 | |
| 2331 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2332 | AC_VERB_GET_PIN_SENSE, 0) |
| 2333 | & AC_PINSENSE_PRESENCE; |
| 2334 | bits = present ? HDA_AMP_MUTE : 0; |
| 2335 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2336 | HDA_AMP_MUTE, bits); |
| 2337 | if (present) |
| 2338 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2339 | else |
| 2340 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2341 | } |
| 2342 | |
| 2343 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2344 | unsigned int res) |
| 2345 | { |
| 2346 | /* Looks like the unsol event is incompatible with the standard |
| 2347 | * definition. 4bit tag is placed at 28 bit! |
| 2348 | */ |
| 2349 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2350 | alc880_medion_rim_automute(codec); |
| 2351 | } |
| 2352 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2353 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2354 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2355 | { 0x0b, HDA_INPUT, 0 }, |
| 2356 | { 0x0b, HDA_INPUT, 1 }, |
| 2357 | { 0x0b, HDA_INPUT, 2 }, |
| 2358 | { 0x0b, HDA_INPUT, 3 }, |
| 2359 | { 0x0b, HDA_INPUT, 4 }, |
| 2360 | { } /* end */ |
| 2361 | }; |
| 2362 | |
| 2363 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2364 | { 0x0b, HDA_INPUT, 1 }, |
| 2365 | { 0x0b, HDA_INPUT, 6 }, |
| 2366 | { 0x0b, HDA_INPUT, 7 }, |
| 2367 | { } /* end */ |
| 2368 | }; |
| 2369 | #endif |
| 2370 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2371 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2372 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2373 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2374 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2375 | static int alc_init(struct hda_codec *codec) |
| 2376 | { |
| 2377 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2378 | unsigned int i; |
| 2379 | |
| 2380 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2381 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2382 | |
| 2383 | if (spec->init_hook) |
| 2384 | spec->init_hook(codec); |
| 2385 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2386 | return 0; |
| 2387 | } |
| 2388 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2389 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2390 | { |
| 2391 | struct alc_spec *spec = codec->spec; |
| 2392 | |
| 2393 | if (spec->unsol_event) |
| 2394 | spec->unsol_event(codec, res); |
| 2395 | } |
| 2396 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2397 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2398 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2399 | { |
| 2400 | struct alc_spec *spec = codec->spec; |
| 2401 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2402 | } |
| 2403 | #endif |
| 2404 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2405 | /* |
| 2406 | * Analog playback callbacks |
| 2407 | */ |
| 2408 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2409 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2410 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2411 | { |
| 2412 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2413 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2414 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2415 | } |
| 2416 | |
| 2417 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2418 | struct hda_codec *codec, |
| 2419 | unsigned int stream_tag, |
| 2420 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2421 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2422 | { |
| 2423 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2424 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2425 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2426 | } |
| 2427 | |
| 2428 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2429 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2430 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2431 | { |
| 2432 | struct alc_spec *spec = codec->spec; |
| 2433 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2434 | } |
| 2435 | |
| 2436 | /* |
| 2437 | * Digital out |
| 2438 | */ |
| 2439 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2440 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2441 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2442 | { |
| 2443 | struct alc_spec *spec = codec->spec; |
| 2444 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2445 | } |
| 2446 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2447 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2448 | struct hda_codec *codec, |
| 2449 | unsigned int stream_tag, |
| 2450 | unsigned int format, |
| 2451 | struct snd_pcm_substream *substream) |
| 2452 | { |
| 2453 | struct alc_spec *spec = codec->spec; |
| 2454 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2455 | stream_tag, format, substream); |
| 2456 | } |
| 2457 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2458 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2459 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2460 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2461 | { |
| 2462 | struct alc_spec *spec = codec->spec; |
| 2463 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2464 | } |
| 2465 | |
| 2466 | /* |
| 2467 | * Analog capture |
| 2468 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2469 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2470 | struct hda_codec *codec, |
| 2471 | unsigned int stream_tag, |
| 2472 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2473 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2474 | { |
| 2475 | struct alc_spec *spec = codec->spec; |
| 2476 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2477 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2478 | stream_tag, 0, format); |
| 2479 | return 0; |
| 2480 | } |
| 2481 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2482 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2483 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2484 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2485 | { |
| 2486 | struct alc_spec *spec = codec->spec; |
| 2487 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2488 | snd_hda_codec_cleanup_stream(codec, |
| 2489 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2490 | return 0; |
| 2491 | } |
| 2492 | |
| 2493 | |
| 2494 | /* |
| 2495 | */ |
| 2496 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2497 | .substreams = 1, |
| 2498 | .channels_min = 2, |
| 2499 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2500 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2501 | .ops = { |
| 2502 | .open = alc880_playback_pcm_open, |
| 2503 | .prepare = alc880_playback_pcm_prepare, |
| 2504 | .cleanup = alc880_playback_pcm_cleanup |
| 2505 | }, |
| 2506 | }; |
| 2507 | |
| 2508 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2509 | .substreams = 1, |
| 2510 | .channels_min = 2, |
| 2511 | .channels_max = 2, |
| 2512 | /* NID is set in alc_build_pcms */ |
| 2513 | }; |
| 2514 | |
| 2515 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2516 | .substreams = 1, |
| 2517 | .channels_min = 2, |
| 2518 | .channels_max = 2, |
| 2519 | /* NID is set in alc_build_pcms */ |
| 2520 | }; |
| 2521 | |
| 2522 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2523 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2524 | .channels_min = 2, |
| 2525 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2526 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2527 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2528 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2529 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2530 | }, |
| 2531 | }; |
| 2532 | |
| 2533 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2534 | .substreams = 1, |
| 2535 | .channels_min = 2, |
| 2536 | .channels_max = 2, |
| 2537 | /* NID is set in alc_build_pcms */ |
| 2538 | .ops = { |
| 2539 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2540 | .close = alc880_dig_playback_pcm_close, |
| 2541 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2542 | }, |
| 2543 | }; |
| 2544 | |
| 2545 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2546 | .substreams = 1, |
| 2547 | .channels_min = 2, |
| 2548 | .channels_max = 2, |
| 2549 | /* NID is set in alc_build_pcms */ |
| 2550 | }; |
| 2551 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2552 | /* 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] | 2553 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2554 | .substreams = 0, |
| 2555 | .channels_min = 0, |
| 2556 | .channels_max = 0, |
| 2557 | }; |
| 2558 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2559 | static int alc_build_pcms(struct hda_codec *codec) |
| 2560 | { |
| 2561 | struct alc_spec *spec = codec->spec; |
| 2562 | struct hda_pcm *info = spec->pcm_rec; |
| 2563 | int i; |
| 2564 | |
| 2565 | codec->num_pcms = 1; |
| 2566 | codec->pcm_info = info; |
| 2567 | |
| 2568 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2569 | if (spec->stream_analog_playback) { |
| 2570 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2571 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2572 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2573 | } |
| 2574 | if (spec->stream_analog_capture) { |
| 2575 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2576 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2577 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2578 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2579 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2580 | if (spec->channel_mode) { |
| 2581 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2582 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2583 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2584 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2585 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2586 | } |
| 2587 | } |
| 2588 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2589 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2590 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2591 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2592 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2593 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2594 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2595 | if (spec->multiout.dig_out_nid && |
| 2596 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2597 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2598 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2599 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2600 | if (spec->dig_in_nid && |
| 2601 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2602 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2603 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2604 | } |
| 2605 | } |
| 2606 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2607 | /* If the use of more than one ADC is requested for the current |
| 2608 | * model, configure a second analog capture-only PCM. |
| 2609 | */ |
| 2610 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2611 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2612 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2613 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2614 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2615 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2616 | if (spec->alt_dac_nid) { |
| 2617 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2618 | *spec->stream_analog_alt_playback; |
| 2619 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2620 | spec->alt_dac_nid; |
| 2621 | } else { |
| 2622 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2623 | alc_pcm_null_stream; |
| 2624 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2625 | } |
| 2626 | if (spec->num_adc_nids > 1) { |
| 2627 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2628 | *spec->stream_analog_alt_capture; |
| 2629 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2630 | spec->adc_nids[1]; |
| 2631 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2632 | spec->num_adc_nids - 1; |
| 2633 | } else { |
| 2634 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2635 | alc_pcm_null_stream; |
| 2636 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2637 | } |
| 2638 | } |
| 2639 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2640 | return 0; |
| 2641 | } |
| 2642 | |
| 2643 | static void alc_free(struct hda_codec *codec) |
| 2644 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2645 | struct alc_spec *spec = codec->spec; |
| 2646 | unsigned int i; |
| 2647 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2648 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2649 | return; |
| 2650 | |
| 2651 | if (spec->kctl_alloc) { |
| 2652 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2653 | kfree(spec->kctl_alloc[i].name); |
| 2654 | kfree(spec->kctl_alloc); |
| 2655 | } |
| 2656 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2657 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2658 | } |
| 2659 | |
| 2660 | /* |
| 2661 | */ |
| 2662 | static struct hda_codec_ops alc_patch_ops = { |
| 2663 | .build_controls = alc_build_controls, |
| 2664 | .build_pcms = alc_build_pcms, |
| 2665 | .init = alc_init, |
| 2666 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2667 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2668 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2669 | .check_power_status = alc_check_power_status, |
| 2670 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2671 | }; |
| 2672 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2673 | |
| 2674 | /* |
| 2675 | * Test configuration for debugging |
| 2676 | * |
| 2677 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2678 | * enum controls. |
| 2679 | */ |
| 2680 | #ifdef CONFIG_SND_DEBUG |
| 2681 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2682 | 0x02, 0x03, 0x04, 0x05 |
| 2683 | }; |
| 2684 | |
| 2685 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2686 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2687 | .items = { |
| 2688 | { "In-1", 0x0 }, |
| 2689 | { "In-2", 0x1 }, |
| 2690 | { "In-3", 0x2 }, |
| 2691 | { "In-4", 0x3 }, |
| 2692 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2693 | { "Front", 0x5 }, |
| 2694 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2695 | }, |
| 2696 | }; |
| 2697 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2698 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2699 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2700 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2701 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2702 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2703 | }; |
| 2704 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2705 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2706 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2707 | { |
| 2708 | static char *texts[] = { |
| 2709 | "N/A", "Line Out", "HP Out", |
| 2710 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2711 | }; |
| 2712 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2713 | uinfo->count = 1; |
| 2714 | uinfo->value.enumerated.items = 8; |
| 2715 | if (uinfo->value.enumerated.item >= 8) |
| 2716 | uinfo->value.enumerated.item = 7; |
| 2717 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2718 | return 0; |
| 2719 | } |
| 2720 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2721 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2722 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2723 | { |
| 2724 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2725 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2726 | unsigned int pin_ctl, item = 0; |
| 2727 | |
| 2728 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2729 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2730 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2731 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2732 | item = 2; |
| 2733 | else |
| 2734 | item = 1; |
| 2735 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2736 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2737 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2738 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2739 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2740 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2741 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2742 | } |
| 2743 | } |
| 2744 | ucontrol->value.enumerated.item[0] = item; |
| 2745 | return 0; |
| 2746 | } |
| 2747 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2748 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2749 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2750 | { |
| 2751 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2752 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2753 | static unsigned int ctls[] = { |
| 2754 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2755 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2756 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2757 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2758 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2759 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2760 | }; |
| 2761 | unsigned int old_ctl, new_ctl; |
| 2762 | |
| 2763 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2764 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2765 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2766 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2767 | int val; |
| 2768 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2769 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2770 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2771 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2772 | HDA_AMP_MUTE : 0; |
| 2773 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2774 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2775 | return 1; |
| 2776 | } |
| 2777 | return 0; |
| 2778 | } |
| 2779 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2780 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2781 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2782 | { |
| 2783 | static char *texts[] = { |
| 2784 | "Front", "Surround", "CLFE", "Side" |
| 2785 | }; |
| 2786 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2787 | uinfo->count = 1; |
| 2788 | uinfo->value.enumerated.items = 4; |
| 2789 | if (uinfo->value.enumerated.item >= 4) |
| 2790 | uinfo->value.enumerated.item = 3; |
| 2791 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2792 | return 0; |
| 2793 | } |
| 2794 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2795 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2796 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2797 | { |
| 2798 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2799 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2800 | unsigned int sel; |
| 2801 | |
| 2802 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2803 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2804 | return 0; |
| 2805 | } |
| 2806 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2807 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2808 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2809 | { |
| 2810 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2811 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2812 | unsigned int sel; |
| 2813 | |
| 2814 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2815 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2816 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2817 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2818 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2819 | return 1; |
| 2820 | } |
| 2821 | return 0; |
| 2822 | } |
| 2823 | |
| 2824 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2825 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2826 | .name = xname, \ |
| 2827 | .info = alc_test_pin_ctl_info, \ |
| 2828 | .get = alc_test_pin_ctl_get, \ |
| 2829 | .put = alc_test_pin_ctl_put, \ |
| 2830 | .private_value = nid \ |
| 2831 | } |
| 2832 | |
| 2833 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2834 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2835 | .name = xname, \ |
| 2836 | .info = alc_test_pin_src_info, \ |
| 2837 | .get = alc_test_pin_src_get, \ |
| 2838 | .put = alc_test_pin_src_put, \ |
| 2839 | .private_value = nid \ |
| 2840 | } |
| 2841 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2842 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2843 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2844 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2845 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2846 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2847 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2848 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2849 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2850 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2851 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2852 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2853 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2854 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2855 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2856 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2857 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2858 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2859 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2860 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2861 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2862 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2863 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2864 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2865 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2866 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2867 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2868 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2869 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2870 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2871 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2872 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2873 | { |
| 2874 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2875 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2876 | .info = alc_ch_mode_info, |
| 2877 | .get = alc_ch_mode_get, |
| 2878 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2879 | }, |
| 2880 | { } /* end */ |
| 2881 | }; |
| 2882 | |
| 2883 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2884 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2886 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2887 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2888 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2889 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2890 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2891 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2892 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2893 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2894 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2895 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2896 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2897 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2898 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2899 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2900 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2901 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2902 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2903 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2904 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2905 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2906 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2907 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2908 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2909 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2910 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2911 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2912 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2913 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2914 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2915 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2916 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2917 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2918 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2919 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2920 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2921 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2922 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2923 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2924 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2925 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2926 | /* Analog input/passthru */ |
| 2927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2928 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2929 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2930 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2932 | { } |
| 2933 | }; |
| 2934 | #endif |
| 2935 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2936 | /* |
| 2937 | */ |
| 2938 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2939 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2940 | [ALC880_3ST] = "3stack", |
| 2941 | [ALC880_TCL_S700] = "tcl", |
| 2942 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2943 | [ALC880_CLEVO] = "clevo", |
| 2944 | [ALC880_5ST] = "5stack", |
| 2945 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2946 | [ALC880_W810] = "w810", |
| 2947 | [ALC880_Z71V] = "z71v", |
| 2948 | [ALC880_6ST] = "6stack", |
| 2949 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2950 | [ALC880_ASUS] = "asus", |
| 2951 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2952 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2953 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2954 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2955 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2956 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2957 | [ALC880_F1734] = "F1734", |
| 2958 | [ALC880_LG] = "lg", |
| 2959 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2960 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2961 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2962 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2963 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2964 | [ALC880_AUTO] = "auto", |
| 2965 | }; |
| 2966 | |
| 2967 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2968 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2969 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2970 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2971 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2972 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2973 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2974 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2975 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2976 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2977 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2978 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2979 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2980 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2981 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2982 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2983 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2984 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2985 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2986 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2987 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2988 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 2989 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2990 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2991 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2992 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2993 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2994 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2995 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2996 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2997 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2998 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2999 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3000 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3001 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3002 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3003 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3004 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3005 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3006 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3007 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3008 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3009 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3010 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3011 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3012 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3013 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3014 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3015 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3016 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3017 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3018 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3019 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3020 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3021 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3022 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3023 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3024 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3025 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3026 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3027 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3028 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3029 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3030 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3031 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3032 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3033 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3034 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3035 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3036 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3037 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3038 | {} |
| 3039 | }; |
| 3040 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3041 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3042 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3043 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3044 | static struct alc_config_preset alc880_presets[] = { |
| 3045 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3046 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3047 | .init_verbs = { alc880_volume_init_verbs, |
| 3048 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3049 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3050 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3051 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3052 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3053 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3054 | .input_mux = &alc880_capture_source, |
| 3055 | }, |
| 3056 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3057 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3058 | .init_verbs = { alc880_volume_init_verbs, |
| 3059 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3060 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3061 | .dac_nids = alc880_dac_nids, |
| 3062 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3063 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3064 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3065 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3066 | .input_mux = &alc880_capture_source, |
| 3067 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3068 | [ALC880_TCL_S700] = { |
| 3069 | .mixers = { alc880_tcl_s700_mixer }, |
| 3070 | .init_verbs = { alc880_volume_init_verbs, |
| 3071 | alc880_pin_tcl_S700_init_verbs, |
| 3072 | alc880_gpio2_init_verbs }, |
| 3073 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3074 | .dac_nids = alc880_dac_nids, |
| 3075 | .hp_nid = 0x03, |
| 3076 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3077 | .channel_mode = alc880_2_jack_modes, |
| 3078 | .input_mux = &alc880_capture_source, |
| 3079 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3080 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3081 | .mixers = { alc880_three_stack_mixer, |
| 3082 | alc880_five_stack_mixer}, |
| 3083 | .init_verbs = { alc880_volume_init_verbs, |
| 3084 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3085 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3086 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3087 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3088 | .channel_mode = alc880_fivestack_modes, |
| 3089 | .input_mux = &alc880_capture_source, |
| 3090 | }, |
| 3091 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3092 | .mixers = { alc880_three_stack_mixer, |
| 3093 | alc880_five_stack_mixer }, |
| 3094 | .init_verbs = { alc880_volume_init_verbs, |
| 3095 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3096 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3097 | .dac_nids = alc880_dac_nids, |
| 3098 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3099 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3100 | .channel_mode = alc880_fivestack_modes, |
| 3101 | .input_mux = &alc880_capture_source, |
| 3102 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3103 | [ALC880_6ST] = { |
| 3104 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3105 | .init_verbs = { alc880_volume_init_verbs, |
| 3106 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3107 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3108 | .dac_nids = alc880_6st_dac_nids, |
| 3109 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3110 | .channel_mode = alc880_sixstack_modes, |
| 3111 | .input_mux = &alc880_6stack_capture_source, |
| 3112 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3113 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3114 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3115 | .init_verbs = { alc880_volume_init_verbs, |
| 3116 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3117 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3118 | .dac_nids = alc880_6st_dac_nids, |
| 3119 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3120 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3121 | .channel_mode = alc880_sixstack_modes, |
| 3122 | .input_mux = &alc880_6stack_capture_source, |
| 3123 | }, |
| 3124 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3125 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3126 | .init_verbs = { alc880_volume_init_verbs, |
| 3127 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3128 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3129 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3130 | .dac_nids = alc880_w810_dac_nids, |
| 3131 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3132 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3133 | .channel_mode = alc880_w810_modes, |
| 3134 | .input_mux = &alc880_capture_source, |
| 3135 | }, |
| 3136 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3137 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3138 | .init_verbs = { alc880_volume_init_verbs, |
| 3139 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3140 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3141 | .dac_nids = alc880_z71v_dac_nids, |
| 3142 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3143 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3144 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3145 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3146 | .input_mux = &alc880_capture_source, |
| 3147 | }, |
| 3148 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3149 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3150 | .init_verbs = { alc880_volume_init_verbs, |
| 3151 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3152 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3153 | .dac_nids = alc880_f1734_dac_nids, |
| 3154 | .hp_nid = 0x02, |
| 3155 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3156 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3157 | .input_mux = &alc880_f1734_capture_source, |
| 3158 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3159 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3160 | }, |
| 3161 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3162 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3163 | .init_verbs = { alc880_volume_init_verbs, |
| 3164 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3165 | alc880_gpio1_init_verbs }, |
| 3166 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3167 | .dac_nids = alc880_asus_dac_nids, |
| 3168 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3169 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3170 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3171 | .input_mux = &alc880_capture_source, |
| 3172 | }, |
| 3173 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3174 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3175 | .init_verbs = { alc880_volume_init_verbs, |
| 3176 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3177 | alc880_gpio1_init_verbs }, |
| 3178 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3179 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3180 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3181 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3182 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3183 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3184 | .input_mux = &alc880_capture_source, |
| 3185 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3186 | [ALC880_ASUS_DIG2] = { |
| 3187 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3188 | .init_verbs = { alc880_volume_init_verbs, |
| 3189 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3190 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3191 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3192 | .dac_nids = alc880_asus_dac_nids, |
| 3193 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3194 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3195 | .channel_mode = alc880_asus_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 | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3199 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3200 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3201 | .init_verbs = { alc880_volume_init_verbs, |
| 3202 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3203 | alc880_gpio1_init_verbs }, |
| 3204 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3205 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3206 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3207 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3208 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3209 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3210 | .input_mux = &alc880_capture_source, |
| 3211 | }, |
| 3212 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3213 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3214 | .init_verbs = { alc880_volume_init_verbs, |
| 3215 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3216 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3217 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3218 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3219 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3220 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3221 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3222 | .input_mux = &alc880_capture_source, |
| 3223 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3224 | [ALC880_UNIWILL] = { |
| 3225 | .mixers = { alc880_uniwill_mixer }, |
| 3226 | .init_verbs = { alc880_volume_init_verbs, |
| 3227 | alc880_uniwill_init_verbs }, |
| 3228 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3229 | .dac_nids = alc880_asus_dac_nids, |
| 3230 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3231 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3232 | .channel_mode = alc880_threestack_modes, |
| 3233 | .need_dac_fix = 1, |
| 3234 | .input_mux = &alc880_capture_source, |
| 3235 | .unsol_event = alc880_uniwill_unsol_event, |
| 3236 | .init_hook = alc880_uniwill_automute, |
| 3237 | }, |
| 3238 | [ALC880_UNIWILL_P53] = { |
| 3239 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3240 | .init_verbs = { alc880_volume_init_verbs, |
| 3241 | alc880_uniwill_p53_init_verbs }, |
| 3242 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3243 | .dac_nids = alc880_asus_dac_nids, |
| 3244 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3245 | .channel_mode = alc880_threestack_modes, |
| 3246 | .input_mux = &alc880_capture_source, |
| 3247 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3248 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3249 | }, |
| 3250 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3251 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3252 | alc880_pcbeep_mixer, }, |
| 3253 | .init_verbs = { alc880_volume_init_verbs, |
| 3254 | alc880_uniwill_p53_init_verbs, |
| 3255 | alc880_beep_init_verbs }, |
| 3256 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3257 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3258 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3259 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3260 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3261 | .input_mux = &alc880_capture_source, |
| 3262 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3263 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3264 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3265 | [ALC880_CLEVO] = { |
| 3266 | .mixers = { alc880_three_stack_mixer }, |
| 3267 | .init_verbs = { alc880_volume_init_verbs, |
| 3268 | alc880_pin_clevo_init_verbs }, |
| 3269 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3270 | .dac_nids = alc880_dac_nids, |
| 3271 | .hp_nid = 0x03, |
| 3272 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3273 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3274 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3275 | .input_mux = &alc880_capture_source, |
| 3276 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3277 | [ALC880_LG] = { |
| 3278 | .mixers = { alc880_lg_mixer }, |
| 3279 | .init_verbs = { alc880_volume_init_verbs, |
| 3280 | alc880_lg_init_verbs }, |
| 3281 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3282 | .dac_nids = alc880_lg_dac_nids, |
| 3283 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3284 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3285 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3286 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3287 | .input_mux = &alc880_lg_capture_source, |
| 3288 | .unsol_event = alc880_lg_unsol_event, |
| 3289 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3290 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3291 | .loopbacks = alc880_lg_loopbacks, |
| 3292 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3293 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3294 | [ALC880_LG_LW] = { |
| 3295 | .mixers = { alc880_lg_lw_mixer }, |
| 3296 | .init_verbs = { alc880_volume_init_verbs, |
| 3297 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3298 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3299 | .dac_nids = alc880_dac_nids, |
| 3300 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3301 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3302 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3303 | .input_mux = &alc880_lg_lw_capture_source, |
| 3304 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3305 | .init_hook = alc880_lg_lw_automute, |
| 3306 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3307 | [ALC880_MEDION_RIM] = { |
| 3308 | .mixers = { alc880_medion_rim_mixer }, |
| 3309 | .init_verbs = { alc880_volume_init_verbs, |
| 3310 | alc880_medion_rim_init_verbs, |
| 3311 | alc_gpio2_init_verbs }, |
| 3312 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3313 | .dac_nids = alc880_dac_nids, |
| 3314 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3315 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3316 | .channel_mode = alc880_2_jack_modes, |
| 3317 | .input_mux = &alc880_medion_rim_capture_source, |
| 3318 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3319 | .init_hook = alc880_medion_rim_automute, |
| 3320 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3321 | #ifdef CONFIG_SND_DEBUG |
| 3322 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3323 | .mixers = { alc880_test_mixer }, |
| 3324 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3325 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3326 | .dac_nids = alc880_test_dac_nids, |
| 3327 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3328 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3329 | .channel_mode = alc880_test_modes, |
| 3330 | .input_mux = &alc880_test_capture_source, |
| 3331 | }, |
| 3332 | #endif |
| 3333 | }; |
| 3334 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3335 | /* |
| 3336 | * Automatic parse of I/O pins from the BIOS configuration |
| 3337 | */ |
| 3338 | |
| 3339 | #define NUM_CONTROL_ALLOC 32 |
| 3340 | #define NUM_VERB_ALLOC 32 |
| 3341 | |
| 3342 | enum { |
| 3343 | ALC_CTL_WIDGET_VOL, |
| 3344 | ALC_CTL_WIDGET_MUTE, |
| 3345 | ALC_CTL_BIND_MUTE, |
| 3346 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3347 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3348 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3349 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3350 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3351 | }; |
| 3352 | |
| 3353 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3354 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3355 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3356 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3357 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3358 | |
| 3359 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3360 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3361 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3362 | /* array + terminator */ |
| 3363 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3364 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3365 | return -ENOMEM; |
| 3366 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3367 | memcpy(knew, spec->kctl_alloc, |
| 3368 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3369 | kfree(spec->kctl_alloc); |
| 3370 | } |
| 3371 | spec->kctl_alloc = knew; |
| 3372 | spec->num_kctl_alloc = num; |
| 3373 | } |
| 3374 | |
| 3375 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3376 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3377 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3378 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3379 | return -ENOMEM; |
| 3380 | knew->private_value = val; |
| 3381 | spec->num_kctl_used++; |
| 3382 | return 0; |
| 3383 | } |
| 3384 | |
| 3385 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3386 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3387 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3388 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3389 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3390 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3391 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3392 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3393 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3394 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3395 | #define ALC880_PIN_CD_NID 0x1c |
| 3396 | |
| 3397 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3398 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3399 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3400 | { |
| 3401 | hda_nid_t nid; |
| 3402 | int assigned[4]; |
| 3403 | int i, j; |
| 3404 | |
| 3405 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3406 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3407 | |
| 3408 | /* check the pins hardwired to audio widget */ |
| 3409 | for (i = 0; i < cfg->line_outs; i++) { |
| 3410 | nid = cfg->line_out_pins[i]; |
| 3411 | if (alc880_is_fixed_pin(nid)) { |
| 3412 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3413 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3414 | assigned[idx] = 1; |
| 3415 | } |
| 3416 | } |
| 3417 | /* left pins can be connect to any audio widget */ |
| 3418 | for (i = 0; i < cfg->line_outs; i++) { |
| 3419 | nid = cfg->line_out_pins[i]; |
| 3420 | if (alc880_is_fixed_pin(nid)) |
| 3421 | continue; |
| 3422 | /* search for an empty channel */ |
| 3423 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3424 | if (!assigned[j]) { |
| 3425 | spec->multiout.dac_nids[i] = |
| 3426 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3427 | assigned[j] = 1; |
| 3428 | break; |
| 3429 | } |
| 3430 | } |
| 3431 | } |
| 3432 | spec->multiout.num_dacs = cfg->line_outs; |
| 3433 | return 0; |
| 3434 | } |
| 3435 | |
| 3436 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3437 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3438 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3439 | { |
| 3440 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3441 | static const char *chname[4] = { |
| 3442 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3443 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3444 | hda_nid_t nid; |
| 3445 | int i, err; |
| 3446 | |
| 3447 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3448 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3449 | continue; |
| 3450 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3451 | if (i == 2) { |
| 3452 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3453 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3454 | "Center Playback Volume", |
| 3455 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3456 | HDA_OUTPUT)); |
| 3457 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3458 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3459 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3460 | "LFE Playback Volume", |
| 3461 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3462 | HDA_OUTPUT)); |
| 3463 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3464 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3465 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3466 | "Center Playback Switch", |
| 3467 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3468 | HDA_INPUT)); |
| 3469 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3470 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3471 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3472 | "LFE Playback Switch", |
| 3473 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3474 | HDA_INPUT)); |
| 3475 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3476 | return err; |
| 3477 | } else { |
| 3478 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3479 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3480 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3481 | HDA_OUTPUT)); |
| 3482 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3483 | return err; |
| 3484 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3485 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3486 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3487 | HDA_INPUT)); |
| 3488 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3489 | return err; |
| 3490 | } |
| 3491 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3492 | return 0; |
| 3493 | } |
| 3494 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3495 | /* add playback controls for speaker and HP outputs */ |
| 3496 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3497 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3498 | { |
| 3499 | hda_nid_t nid; |
| 3500 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3501 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3502 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3503 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3504 | return 0; |
| 3505 | |
| 3506 | if (alc880_is_fixed_pin(pin)) { |
| 3507 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3508 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3509 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3510 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3511 | else |
| 3512 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3513 | /* control HP volume/switch on the output mixer amp */ |
| 3514 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3515 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3516 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3517 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3518 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3519 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3520 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3521 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3522 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3523 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3524 | return err; |
| 3525 | } else if (alc880_is_multi_pin(pin)) { |
| 3526 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3527 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3528 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3529 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3530 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3531 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3532 | return err; |
| 3533 | } |
| 3534 | return 0; |
| 3535 | } |
| 3536 | |
| 3537 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3538 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3539 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3540 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3541 | { |
| 3542 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3543 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3544 | |
| 3545 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3546 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3547 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3548 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3549 | return err; |
| 3550 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3551 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3552 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3553 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3554 | return err; |
| 3555 | return 0; |
| 3556 | } |
| 3557 | |
| 3558 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3559 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3560 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3561 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3562 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3563 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3564 | |
| 3565 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3566 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3567 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3568 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3569 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3570 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3571 | if (err < 0) |
| 3572 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3573 | imux->items[imux->num_items].label = |
| 3574 | auto_pin_cfg_labels[i]; |
| 3575 | imux->items[imux->num_items].index = |
| 3576 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3577 | imux->num_items++; |
| 3578 | } |
| 3579 | } |
| 3580 | return 0; |
| 3581 | } |
| 3582 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3583 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3584 | unsigned int pin_type) |
| 3585 | { |
| 3586 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3587 | pin_type); |
| 3588 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3589 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3590 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3591 | } |
| 3592 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3593 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3594 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3595 | int dac_idx) |
| 3596 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3597 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3598 | /* need the manual connection? */ |
| 3599 | if (alc880_is_multi_pin(nid)) { |
| 3600 | struct alc_spec *spec = codec->spec; |
| 3601 | int idx = alc880_multi_pin_idx(nid); |
| 3602 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3603 | AC_VERB_SET_CONNECT_SEL, |
| 3604 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3605 | } |
| 3606 | } |
| 3607 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3608 | static int get_pin_type(int line_out_type) |
| 3609 | { |
| 3610 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3611 | return PIN_HP; |
| 3612 | else |
| 3613 | return PIN_OUT; |
| 3614 | } |
| 3615 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3616 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3617 | { |
| 3618 | struct alc_spec *spec = codec->spec; |
| 3619 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3620 | |
| 3621 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3622 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3623 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3624 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3625 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3626 | } |
| 3627 | } |
| 3628 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3629 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3630 | { |
| 3631 | struct alc_spec *spec = codec->spec; |
| 3632 | hda_nid_t pin; |
| 3633 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3634 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3635 | if (pin) /* connect to front */ |
| 3636 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3637 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3638 | if (pin) /* connect to front */ |
| 3639 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3640 | } |
| 3641 | |
| 3642 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3643 | { |
| 3644 | struct alc_spec *spec = codec->spec; |
| 3645 | int i; |
| 3646 | |
| 3647 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3648 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3649 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3650 | snd_hda_codec_write(codec, nid, 0, |
| 3651 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3652 | i <= AUTO_PIN_FRONT_MIC ? |
| 3653 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3654 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3655 | snd_hda_codec_write(codec, nid, 0, |
| 3656 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3657 | AMP_OUT_MUTE); |
| 3658 | } |
| 3659 | } |
| 3660 | } |
| 3661 | |
| 3662 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3663 | /* return 1 if successful, 0 if the proper config is not found, |
| 3664 | * or a negative error code |
| 3665 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3666 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3667 | { |
| 3668 | struct alc_spec *spec = codec->spec; |
| 3669 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3670 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3671 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3672 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3673 | alc880_ignore); |
| 3674 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3675 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3676 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3677 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3678 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3679 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3680 | if (err < 0) |
| 3681 | return err; |
| 3682 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3683 | if (err < 0) |
| 3684 | return err; |
| 3685 | err = alc880_auto_create_extra_out(spec, |
| 3686 | spec->autocfg.speaker_pins[0], |
| 3687 | "Speaker"); |
| 3688 | if (err < 0) |
| 3689 | return err; |
| 3690 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3691 | "Headphone"); |
| 3692 | if (err < 0) |
| 3693 | return err; |
| 3694 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3695 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3696 | return err; |
| 3697 | |
| 3698 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3699 | |
| 3700 | if (spec->autocfg.dig_out_pin) |
| 3701 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3702 | if (spec->autocfg.dig_in_pin) |
| 3703 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3704 | |
| 3705 | if (spec->kctl_alloc) |
| 3706 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3707 | |
| 3708 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3709 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3710 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3711 | spec->input_mux = &spec->private_imux; |
| 3712 | |
| 3713 | return 1; |
| 3714 | } |
| 3715 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3716 | /* additional initialization for auto-configuration model */ |
| 3717 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3718 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3719 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3720 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3721 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3722 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3723 | if (spec->unsol_event) |
| 3724 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3725 | } |
| 3726 | |
| 3727 | /* |
| 3728 | * OK, here we have finally the patch for ALC880 |
| 3729 | */ |
| 3730 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3731 | static int patch_alc880(struct hda_codec *codec) |
| 3732 | { |
| 3733 | struct alc_spec *spec; |
| 3734 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3735 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3736 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3737 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3738 | if (spec == NULL) |
| 3739 | return -ENOMEM; |
| 3740 | |
| 3741 | codec->spec = spec; |
| 3742 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3743 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3744 | alc880_models, |
| 3745 | alc880_cfg_tbl); |
| 3746 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3747 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3748 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3749 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3750 | } |
| 3751 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3752 | if (board_config == ALC880_AUTO) { |
| 3753 | /* automatic parse from the BIOS config */ |
| 3754 | err = alc880_parse_auto_config(codec); |
| 3755 | if (err < 0) { |
| 3756 | alc_free(codec); |
| 3757 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3758 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3759 | printk(KERN_INFO |
| 3760 | "hda_codec: Cannot set up configuration " |
| 3761 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3762 | board_config = ALC880_3ST; |
| 3763 | } |
| 3764 | } |
| 3765 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3766 | if (board_config != ALC880_AUTO) |
| 3767 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3768 | |
| 3769 | spec->stream_name_analog = "ALC880 Analog"; |
| 3770 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3771 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3772 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3773 | |
| 3774 | spec->stream_name_digital = "ALC880 Digital"; |
| 3775 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3776 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3777 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3778 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3779 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3780 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3781 | /* get type */ |
| 3782 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3783 | if (wcap != AC_WID_AUD_IN) { |
| 3784 | spec->adc_nids = alc880_adc_nids_alt; |
| 3785 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3786 | spec->mixers[spec->num_mixers] = |
| 3787 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3788 | spec->num_mixers++; |
| 3789 | } else { |
| 3790 | spec->adc_nids = alc880_adc_nids; |
| 3791 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3792 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3793 | spec->num_mixers++; |
| 3794 | } |
| 3795 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3796 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3797 | spec->vmaster_nid = 0x0c; |
| 3798 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3799 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3800 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3801 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3802 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3803 | if (!spec->loopback.amplist) |
| 3804 | spec->loopback.amplist = alc880_loopbacks; |
| 3805 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3806 | |
| 3807 | return 0; |
| 3808 | } |
| 3809 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3810 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3811 | /* |
| 3812 | * ALC260 support |
| 3813 | */ |
| 3814 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3815 | static hda_nid_t alc260_dac_nids[1] = { |
| 3816 | /* front */ |
| 3817 | 0x02, |
| 3818 | }; |
| 3819 | |
| 3820 | static hda_nid_t alc260_adc_nids[1] = { |
| 3821 | /* ADC0 */ |
| 3822 | 0x04, |
| 3823 | }; |
| 3824 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3825 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3826 | /* ADC1 */ |
| 3827 | 0x05, |
| 3828 | }; |
| 3829 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3830 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3831 | /* ADC1, 0 */ |
| 3832 | 0x05, 0x04 |
| 3833 | }; |
| 3834 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3835 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3836 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3837 | */ |
| 3838 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3839 | /* ADC0, ADC1 */ |
| 3840 | 0x04, 0x05 |
| 3841 | }; |
| 3842 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3843 | #define ALC260_DIGOUT_NID 0x03 |
| 3844 | #define ALC260_DIGIN_NID 0x06 |
| 3845 | |
| 3846 | static struct hda_input_mux alc260_capture_source = { |
| 3847 | .num_items = 4, |
| 3848 | .items = { |
| 3849 | { "Mic", 0x0 }, |
| 3850 | { "Front Mic", 0x1 }, |
| 3851 | { "Line", 0x2 }, |
| 3852 | { "CD", 0x4 }, |
| 3853 | }, |
| 3854 | }; |
| 3855 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3856 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3857 | * headphone jack and the internal CD lines since these are the only pins at |
| 3858 | * which audio can appear. For flexibility, also allow the option of |
| 3859 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3860 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3861 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3862 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3863 | { |
| 3864 | .num_items = 3, |
| 3865 | .items = { |
| 3866 | { "Mic/Line", 0x0 }, |
| 3867 | { "CD", 0x4 }, |
| 3868 | { "Headphone", 0x2 }, |
| 3869 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3870 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3871 | { |
| 3872 | .num_items = 4, |
| 3873 | .items = { |
| 3874 | { "Mic/Line", 0x0 }, |
| 3875 | { "CD", 0x4 }, |
| 3876 | { "Headphone", 0x2 }, |
| 3877 | { "Mixer", 0x5 }, |
| 3878 | }, |
| 3879 | }, |
| 3880 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3881 | }; |
| 3882 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3883 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3884 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3885 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3886 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3887 | { |
| 3888 | .num_items = 4, |
| 3889 | .items = { |
| 3890 | { "Mic", 0x0 }, |
| 3891 | { "Line", 0x2 }, |
| 3892 | { "CD", 0x4 }, |
| 3893 | { "Headphone", 0x5 }, |
| 3894 | }, |
| 3895 | }, |
| 3896 | { |
| 3897 | .num_items = 5, |
| 3898 | .items = { |
| 3899 | { "Mic", 0x0 }, |
| 3900 | { "Line", 0x2 }, |
| 3901 | { "CD", 0x4 }, |
| 3902 | { "Headphone", 0x6 }, |
| 3903 | { "Mixer", 0x5 }, |
| 3904 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3905 | }, |
| 3906 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3907 | /* |
| 3908 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3909 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3910 | * element which allows changing the channel mode, so the verb list is |
| 3911 | * never used. |
| 3912 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3913 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3914 | { 2, NULL }, |
| 3915 | }; |
| 3916 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3917 | |
| 3918 | /* Mixer combinations |
| 3919 | * |
| 3920 | * basic: base_output + input + pc_beep + capture |
| 3921 | * HP: base_output + input + capture_alt |
| 3922 | * HP_3013: hp_3013 + input + capture |
| 3923 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3924 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3925 | */ |
| 3926 | |
| 3927 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3928 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3929 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3930 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3931 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3932 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3933 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3934 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3935 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3936 | |
| 3937 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3938 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3939 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3940 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3941 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3943 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3944 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3945 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3946 | { } /* end */ |
| 3947 | }; |
| 3948 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3949 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3950 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3951 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3952 | { } /* end */ |
| 3953 | }; |
| 3954 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3955 | /* update HP, line and mono out pins according to the master switch */ |
| 3956 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 3957 | hda_nid_t hp, hda_nid_t line, |
| 3958 | hda_nid_t mono) |
| 3959 | { |
| 3960 | struct alc_spec *spec = codec->spec; |
| 3961 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 3962 | /* change HP and line-out pins */ |
| 3963 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3964 | val); |
| 3965 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3966 | val); |
| 3967 | /* mono (speaker) depending on the HP jack sense */ |
| 3968 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 3969 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3970 | val); |
| 3971 | } |
| 3972 | |
| 3973 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 3974 | struct snd_ctl_elem_value *ucontrol) |
| 3975 | { |
| 3976 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3977 | struct alc_spec *spec = codec->spec; |
| 3978 | *ucontrol->value.integer.value = spec->master_sw; |
| 3979 | return 0; |
| 3980 | } |
| 3981 | |
| 3982 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 3983 | struct snd_ctl_elem_value *ucontrol) |
| 3984 | { |
| 3985 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3986 | struct alc_spec *spec = codec->spec; |
| 3987 | int val = !!*ucontrol->value.integer.value; |
| 3988 | hda_nid_t hp, line, mono; |
| 3989 | |
| 3990 | if (val == spec->master_sw) |
| 3991 | return 0; |
| 3992 | spec->master_sw = val; |
| 3993 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 3994 | line = (kcontrol->private_value >> 8) & 0xff; |
| 3995 | mono = kcontrol->private_value & 0xff; |
| 3996 | alc260_hp_master_update(codec, hp, line, mono); |
| 3997 | return 1; |
| 3998 | } |
| 3999 | |
| 4000 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4001 | { |
| 4002 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4003 | .name = "Master Playback Switch", |
| 4004 | .info = snd_ctl_boolean_mono_info, |
| 4005 | .get = alc260_hp_master_sw_get, |
| 4006 | .put = alc260_hp_master_sw_put, |
| 4007 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4008 | }, |
| 4009 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4010 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4011 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4012 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4013 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4014 | HDA_OUTPUT), |
| 4015 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4016 | { } /* end */ |
| 4017 | }; |
| 4018 | |
| 4019 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4020 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4021 | {}, |
| 4022 | }; |
| 4023 | |
| 4024 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4025 | { |
| 4026 | struct alc_spec *spec = codec->spec; |
| 4027 | unsigned int present; |
| 4028 | |
| 4029 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4030 | AC_VERB_GET_PIN_SENSE, 0); |
| 4031 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4032 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4033 | } |
| 4034 | |
| 4035 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4036 | { |
| 4037 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4038 | alc260_hp_automute(codec); |
| 4039 | } |
| 4040 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4041 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4042 | { |
| 4043 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4044 | .name = "Master Playback Switch", |
| 4045 | .info = snd_ctl_boolean_mono_info, |
| 4046 | .get = alc260_hp_master_sw_get, |
| 4047 | .put = alc260_hp_master_sw_put, |
| 4048 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 4049 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4050 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4051 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4052 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4053 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4054 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4055 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4056 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4057 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4058 | { } /* end */ |
| 4059 | }; |
| 4060 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4061 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4062 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4063 | {}, |
| 4064 | }; |
| 4065 | |
| 4066 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4067 | { |
| 4068 | struct alc_spec *spec = codec->spec; |
| 4069 | unsigned int present; |
| 4070 | |
| 4071 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4072 | AC_VERB_GET_PIN_SENSE, 0); |
| 4073 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4074 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 4075 | } |
| 4076 | |
| 4077 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4078 | unsigned int res) |
| 4079 | { |
| 4080 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4081 | alc260_hp_3013_automute(codec); |
| 4082 | } |
| 4083 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4084 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 4085 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4086 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4087 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4088 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4089 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4090 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4091 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4092 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4093 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4094 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4095 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4096 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4097 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4098 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4099 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4100 | { } /* end */ |
| 4101 | }; |
| 4102 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4103 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4104 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4105 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4106 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4107 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4108 | * revisions available in early 2006. Therefore for now allow the |
| 4109 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4110 | * that the lack of mic bias for this NID is intentional we could change the |
| 4111 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4112 | * |
| 4113 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4114 | * don't appear to make the mic bias available from the "line" jack, even |
| 4115 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4116 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4117 | * and the output jack. If this turns out to be the case for all such |
| 4118 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4119 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4120 | * |
| 4121 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4122 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4123 | * controls for such models. On models without a "mono speaker" the control |
| 4124 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4125 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4126 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4127 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4128 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4129 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4130 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4131 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4132 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4133 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4134 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4135 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4137 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4138 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4139 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4140 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4141 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4142 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4143 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4144 | { } /* end */ |
| 4145 | }; |
| 4146 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4147 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4148 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4149 | */ |
| 4150 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4151 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4152 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4153 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4154 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4155 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4156 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4157 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4158 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4159 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4160 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4161 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4162 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4163 | { } /* end */ |
| 4164 | }; |
| 4165 | |
| 4166 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4167 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4168 | */ |
| 4169 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4170 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4171 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4172 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4173 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4174 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4175 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4176 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4177 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4178 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4179 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4180 | { } /* end */ |
| 4181 | }; |
| 4182 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4183 | /* capture mixer elements */ |
| 4184 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4185 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4186 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4187 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4188 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4189 | { |
| 4190 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4191 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4192 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4193 | */ |
| 4194 | /* .name = "Capture Source", */ |
| 4195 | .name = "Input Source", |
| 4196 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4197 | .info = alc_mux_enum_info, |
| 4198 | .get = alc_mux_enum_get, |
| 4199 | .put = alc_mux_enum_put, |
| 4200 | }, |
| 4201 | { } /* end */ |
| 4202 | }; |
| 4203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4204 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4205 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4206 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4207 | { |
| 4208 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4209 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4210 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4211 | */ |
| 4212 | /* .name = "Capture Source", */ |
| 4213 | .name = "Input Source", |
| 4214 | .count = 1, |
| 4215 | .info = alc_mux_enum_info, |
| 4216 | .get = alc_mux_enum_get, |
| 4217 | .put = alc_mux_enum_put, |
| 4218 | }, |
| 4219 | { } /* end */ |
| 4220 | }; |
| 4221 | |
| 4222 | /* |
| 4223 | * initialization verbs |
| 4224 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4225 | static struct hda_verb alc260_init_verbs[] = { |
| 4226 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4227 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4228 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4229 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4230 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4231 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4232 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4233 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4234 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4236 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4237 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4238 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4239 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4240 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4241 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4242 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4243 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4244 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4245 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4246 | /* set connection select to line in (default select for this ADC) */ |
| 4247 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4248 | /* mute capture amp left and right */ |
| 4249 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4250 | /* set connection select to line in (default select for this ADC) */ |
| 4251 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4252 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4253 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4254 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4255 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4256 | /* set vol=0 HP mixer amp left and right */ |
| 4257 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4258 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4259 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4260 | /* set vol=0 Mono mixer amp left and right */ |
| 4261 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4262 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4263 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4264 | /* unmute LINE-2 out pin */ |
| 4265 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4266 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4267 | * Line In 2 = 0x03 |
| 4268 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4269 | /* mute analog inputs */ |
| 4270 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4271 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4272 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4273 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4274 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4275 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4276 | /* mute Front out path */ |
| 4277 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4278 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4279 | /* mute Headphone out path */ |
| 4280 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4281 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4282 | /* mute Mono out path */ |
| 4283 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4284 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4285 | { } |
| 4286 | }; |
| 4287 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4288 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4289 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4290 | /* Headphone and output */ |
| 4291 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4292 | /* mono output */ |
| 4293 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4294 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4295 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4296 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4297 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4298 | /* Line In pin widget for input */ |
| 4299 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4300 | /* Line-2 pin widget for output */ |
| 4301 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4302 | /* CD pin widget for input */ |
| 4303 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4304 | /* unmute amp left and right */ |
| 4305 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4306 | /* set connection select to line in (default select for this ADC) */ |
| 4307 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4308 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4309 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4310 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4311 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4312 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4313 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4314 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4315 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4316 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4317 | * Line In 2 = 0x03 |
| 4318 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4319 | /* mute analog inputs */ |
| 4320 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4321 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4322 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4323 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4324 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4325 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4326 | /* Unmute Front out path */ |
| 4327 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4328 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4329 | /* Unmute Headphone out path */ |
| 4330 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4331 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4332 | /* Unmute Mono out path */ |
| 4333 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4334 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4335 | { } |
| 4336 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4337 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4338 | |
| 4339 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4340 | /* Line out and output */ |
| 4341 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4342 | /* mono output */ |
| 4343 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4344 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4345 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4346 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4347 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4348 | /* Line In pin widget for input */ |
| 4349 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4350 | /* Headphone pin widget for output */ |
| 4351 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4352 | /* CD pin widget for input */ |
| 4353 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4354 | /* unmute amp left and right */ |
| 4355 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4356 | /* set connection select to line in (default select for this ADC) */ |
| 4357 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4358 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4359 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4360 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4361 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4362 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4363 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4364 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4365 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4366 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4367 | * Line In 2 = 0x03 |
| 4368 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4369 | /* mute analog inputs */ |
| 4370 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4371 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4372 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4373 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4374 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4375 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4376 | /* Unmute Front out path */ |
| 4377 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4378 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4379 | /* Unmute Headphone out path */ |
| 4380 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4381 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4382 | /* Unmute Mono out path */ |
| 4383 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4384 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4385 | { } |
| 4386 | }; |
| 4387 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4388 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4389 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4390 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4391 | */ |
| 4392 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4393 | /* Disable all GPIOs */ |
| 4394 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4395 | /* Internal speaker is connected to headphone pin */ |
| 4396 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4397 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4398 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4399 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4400 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4401 | /* Ensure all other unused pins are disabled and muted. */ |
| 4402 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4403 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4404 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4405 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4406 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4407 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4408 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4409 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4410 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4411 | /* Disable digital (SPDIF) pins */ |
| 4412 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4413 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4414 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4415 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4416 | * when acting as an output. |
| 4417 | */ |
| 4418 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4419 | |
| 4420 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4421 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4422 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4423 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4424 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4425 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4426 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4427 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4428 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4429 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4430 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4431 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4432 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4433 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4434 | * If the pin mode is changed by the user the pin mode control will |
| 4435 | * take care of enabling the pin's input/output buffers as needed. |
| 4436 | * Therefore there's no need to enable the input buffer at this |
| 4437 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4438 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4439 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4440 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4441 | * mixer ctrl) |
| 4442 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4443 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4444 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4445 | /* Mute capture amp left and right */ |
| 4446 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4447 | /* Set ADC connection select to match default mixer setting - line |
| 4448 | * in (on mic1 pin) |
| 4449 | */ |
| 4450 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4451 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4452 | /* Do the same for the second ADC: mute capture input amp and |
| 4453 | * set ADC connection to line in (on mic1 pin) |
| 4454 | */ |
| 4455 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4456 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4457 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4458 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4462 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4463 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4464 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4465 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4466 | {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] | 4467 | |
| 4468 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4469 | }; |
| 4470 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4471 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4472 | * similar laptops (adapted from Fujitsu init verbs). |
| 4473 | */ |
| 4474 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4475 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4476 | * the headphone jack. Turn this on and rely on the standard mute |
| 4477 | * methods whenever the user wants to turn these outputs off. |
| 4478 | */ |
| 4479 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4480 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4481 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4482 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4483 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4484 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4485 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4486 | /* Line In jack is connected to Line1 pin */ |
| 4487 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4488 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4489 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4490 | /* Ensure all other unused pins are disabled and muted. */ |
| 4491 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4492 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4493 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4494 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4495 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4496 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4497 | /* Disable digital (SPDIF) pins */ |
| 4498 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4499 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4500 | |
| 4501 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4502 | * bus when acting as outputs. |
| 4503 | */ |
| 4504 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4505 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4506 | |
| 4507 | /* Start with output sum widgets muted and their output gains at min */ |
| 4508 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4509 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4510 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4511 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4512 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4513 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4514 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4515 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4516 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4517 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4518 | /* Unmute Line-out pin widget amp left and right |
| 4519 | * (no equiv mixer ctrl) |
| 4520 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4521 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4522 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4523 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4524 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4525 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4526 | * will take care of enabling the pin's input/output buffers as needed. |
| 4527 | * Therefore there's no need to enable the input buffer at this |
| 4528 | * stage. |
| 4529 | */ |
| 4530 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4531 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4532 | |
| 4533 | /* Mute capture amp left and right */ |
| 4534 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4535 | /* Set ADC connection select to match default mixer setting - mic |
| 4536 | * (on mic1 pin) |
| 4537 | */ |
| 4538 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4539 | |
| 4540 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4541 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4542 | */ |
| 4543 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4544 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4545 | |
| 4546 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4547 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4552 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4553 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4554 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4555 | |
| 4556 | { } |
| 4557 | }; |
| 4558 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4559 | static struct hda_verb alc260_will_verbs[] = { |
| 4560 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4561 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4562 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4563 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4564 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4565 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4566 | {} |
| 4567 | }; |
| 4568 | |
| 4569 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4570 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4571 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4572 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4573 | |
| 4574 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4575 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4576 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4577 | |
| 4578 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4579 | {} |
| 4580 | }; |
| 4581 | |
| 4582 | /* toggle speaker-output according to the hp-jack state */ |
| 4583 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4584 | { |
| 4585 | unsigned int present; |
| 4586 | |
| 4587 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4588 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4589 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4590 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4591 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4592 | AC_VERB_SET_GPIO_DATA, 1); |
| 4593 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4594 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4595 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4596 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4597 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4598 | AC_VERB_SET_GPIO_DATA, 0); |
| 4599 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4600 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4601 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4602 | } |
| 4603 | } |
| 4604 | |
| 4605 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4606 | unsigned int res) |
| 4607 | { |
| 4608 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4609 | alc260_replacer_672v_automute(codec); |
| 4610 | } |
| 4611 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4612 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4613 | * configuration. |
| 4614 | */ |
| 4615 | #ifdef CONFIG_SND_DEBUG |
| 4616 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4617 | 0x02, |
| 4618 | }; |
| 4619 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4620 | 0x04, 0x05, |
| 4621 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4622 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4623 | * the signal assignments are different. This assumes that the first ADC |
| 4624 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4625 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4626 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4627 | { |
| 4628 | .num_items = 7, |
| 4629 | .items = { |
| 4630 | { "MIC1 pin", 0x0 }, |
| 4631 | { "MIC2 pin", 0x1 }, |
| 4632 | { "LINE1 pin", 0x2 }, |
| 4633 | { "LINE2 pin", 0x3 }, |
| 4634 | { "CD pin", 0x4 }, |
| 4635 | { "LINE-OUT pin", 0x5 }, |
| 4636 | { "HP-OUT pin", 0x6 }, |
| 4637 | }, |
| 4638 | }, |
| 4639 | { |
| 4640 | .num_items = 8, |
| 4641 | .items = { |
| 4642 | { "MIC1 pin", 0x0 }, |
| 4643 | { "MIC2 pin", 0x1 }, |
| 4644 | { "LINE1 pin", 0x2 }, |
| 4645 | { "LINE2 pin", 0x3 }, |
| 4646 | { "CD pin", 0x4 }, |
| 4647 | { "Mixer", 0x5 }, |
| 4648 | { "LINE-OUT pin", 0x6 }, |
| 4649 | { "HP-OUT pin", 0x7 }, |
| 4650 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4651 | }, |
| 4652 | }; |
| 4653 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4654 | /* Output driver widgets */ |
| 4655 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4656 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4657 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4658 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4659 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4660 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4661 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4662 | /* Modes for retasking pin widgets |
| 4663 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4664 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4665 | * mention this restriction. At this stage it's not clear whether |
| 4666 | * this behaviour is intentional or is a hardware bug in chip |
| 4667 | * revisions available at least up until early 2006. Therefore for |
| 4668 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4669 | * choices, but if it turns out that the lack of mic bias for these |
| 4670 | * NIDs is intentional we could change their modes from |
| 4671 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4672 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4673 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4674 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4675 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4676 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4677 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4678 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4679 | |
| 4680 | /* Loopback mixer controls */ |
| 4681 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4682 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4683 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4684 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4685 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4686 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4687 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4688 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4689 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4690 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4691 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4692 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4693 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4694 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4695 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4696 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4697 | |
| 4698 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4699 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4700 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4701 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4702 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4703 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4704 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4705 | * is ambigious as to which NID is which; testing on laptops which |
| 4706 | * make this output available should provide clarification. |
| 4707 | */ |
| 4708 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4709 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4710 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4711 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4712 | * this output to turn on an external amplifier. |
| 4713 | */ |
| 4714 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4715 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4716 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4717 | { } /* end */ |
| 4718 | }; |
| 4719 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4720 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4721 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4722 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4723 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4724 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4725 | /* Enable retasking pins as output, initially without power amp */ |
| 4726 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4727 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4728 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4729 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4730 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4731 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4732 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4733 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4734 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4735 | * payload also sets the generation to 0, output to be in "consumer" |
| 4736 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4737 | * control. |
| 4738 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4739 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4740 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4741 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4742 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4743 | * OUT1 sum bus when acting as an output. |
| 4744 | */ |
| 4745 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4746 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4747 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4748 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4749 | |
| 4750 | /* Start with output sum widgets muted and their output gains at min */ |
| 4751 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4752 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4753 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4754 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4755 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4756 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4757 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4758 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4759 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4760 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4761 | /* Unmute retasking pin widget output buffers since the default |
| 4762 | * state appears to be output. As the pin mode is changed by the |
| 4763 | * user the pin mode control will take care of enabling the pin's |
| 4764 | * input/output buffers as needed. |
| 4765 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4766 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4767 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4768 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4769 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4770 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4771 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4772 | /* Also unmute the mono-out pin widget */ |
| 4773 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4774 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4775 | /* Mute capture amp left and right */ |
| 4776 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4777 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4778 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4779 | */ |
| 4780 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4781 | |
| 4782 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4783 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4784 | */ |
| 4785 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4786 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4787 | |
| 4788 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4789 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4790 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4791 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4792 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4793 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4794 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4795 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4796 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4797 | |
| 4798 | { } |
| 4799 | }; |
| 4800 | #endif |
| 4801 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4802 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4803 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4804 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4805 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4806 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4807 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4808 | /* |
| 4809 | * for BIOS auto-configuration |
| 4810 | */ |
| 4811 | |
| 4812 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4813 | const char *pfx) |
| 4814 | { |
| 4815 | hda_nid_t nid_vol; |
| 4816 | unsigned long vol_val, sw_val; |
| 4817 | char name[32]; |
| 4818 | int err; |
| 4819 | |
| 4820 | if (nid >= 0x0f && nid < 0x11) { |
| 4821 | nid_vol = nid - 0x7; |
| 4822 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4823 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4824 | } else if (nid == 0x11) { |
| 4825 | nid_vol = nid - 0x7; |
| 4826 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4827 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4828 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4829 | nid_vol = 0x08; |
| 4830 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4831 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4832 | } else |
| 4833 | return 0; /* N/A */ |
| 4834 | |
| 4835 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4836 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4837 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4838 | return err; |
| 4839 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4840 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4841 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4842 | return err; |
| 4843 | return 1; |
| 4844 | } |
| 4845 | |
| 4846 | /* add playback controls from the parsed DAC table */ |
| 4847 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4848 | const struct auto_pin_cfg *cfg) |
| 4849 | { |
| 4850 | hda_nid_t nid; |
| 4851 | int err; |
| 4852 | |
| 4853 | spec->multiout.num_dacs = 1; |
| 4854 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4855 | spec->multiout.dac_nids[0] = 0x02; |
| 4856 | |
| 4857 | nid = cfg->line_out_pins[0]; |
| 4858 | if (nid) { |
| 4859 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4860 | if (err < 0) |
| 4861 | return err; |
| 4862 | } |
| 4863 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4864 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4865 | if (nid) { |
| 4866 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4867 | if (err < 0) |
| 4868 | return err; |
| 4869 | } |
| 4870 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4871 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4872 | if (nid) { |
| 4873 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4874 | if (err < 0) |
| 4875 | return err; |
| 4876 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4877 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4878 | } |
| 4879 | |
| 4880 | /* create playback/capture controls for input pins */ |
| 4881 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4882 | const struct auto_pin_cfg *cfg) |
| 4883 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4884 | struct hda_input_mux *imux = &spec->private_imux; |
| 4885 | int i, err, idx; |
| 4886 | |
| 4887 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4888 | if (cfg->input_pins[i] >= 0x12) { |
| 4889 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4890 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4891 | auto_pin_cfg_labels[i], idx, |
| 4892 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4893 | if (err < 0) |
| 4894 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4895 | imux->items[imux->num_items].label = |
| 4896 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4897 | imux->items[imux->num_items].index = idx; |
| 4898 | imux->num_items++; |
| 4899 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4900 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4901 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4902 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4903 | auto_pin_cfg_labels[i], idx, |
| 4904 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4905 | if (err < 0) |
| 4906 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4907 | imux->items[imux->num_items].label = |
| 4908 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4909 | imux->items[imux->num_items].index = idx; |
| 4910 | imux->num_items++; |
| 4911 | } |
| 4912 | } |
| 4913 | return 0; |
| 4914 | } |
| 4915 | |
| 4916 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4917 | hda_nid_t nid, int pin_type, |
| 4918 | int sel_idx) |
| 4919 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4920 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4921 | /* need the manual connection? */ |
| 4922 | if (nid >= 0x12) { |
| 4923 | int idx = nid - 0x12; |
| 4924 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4925 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4926 | } |
| 4927 | } |
| 4928 | |
| 4929 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4930 | { |
| 4931 | struct alc_spec *spec = codec->spec; |
| 4932 | hda_nid_t nid; |
| 4933 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4934 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4935 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4936 | if (nid) { |
| 4937 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4938 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4939 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4940 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4941 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4942 | if (nid) |
| 4943 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4944 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4945 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4946 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4947 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4948 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4949 | |
| 4950 | #define ALC260_PIN_CD_NID 0x16 |
| 4951 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4952 | { |
| 4953 | struct alc_spec *spec = codec->spec; |
| 4954 | int i; |
| 4955 | |
| 4956 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4957 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4958 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4959 | snd_hda_codec_write(codec, nid, 0, |
| 4960 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4961 | i <= AUTO_PIN_FRONT_MIC ? |
| 4962 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4963 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4964 | snd_hda_codec_write(codec, nid, 0, |
| 4965 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4966 | AMP_OUT_MUTE); |
| 4967 | } |
| 4968 | } |
| 4969 | } |
| 4970 | |
| 4971 | /* |
| 4972 | * generic initialization of ADC, input mixers and output mixers |
| 4973 | */ |
| 4974 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4975 | /* |
| 4976 | * Unmute ADC0-1 and set the default input to mic-in |
| 4977 | */ |
| 4978 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4979 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4980 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4981 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4982 | |
| 4983 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4984 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4985 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4986 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4987 | */ |
| 4988 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4989 | /* mute analog inputs */ |
| 4990 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4991 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4992 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4993 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4994 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4995 | |
| 4996 | /* |
| 4997 | * Set up output mixers (0x08 - 0x0a) |
| 4998 | */ |
| 4999 | /* set vol=0 to output mixers */ |
| 5000 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5001 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5002 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5003 | /* set up input amps for analog loopback */ |
| 5004 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5005 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5006 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5007 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5008 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5009 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5010 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5011 | |
| 5012 | { } |
| 5013 | }; |
| 5014 | |
| 5015 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5016 | { |
| 5017 | struct alc_spec *spec = codec->spec; |
| 5018 | unsigned int wcap; |
| 5019 | int err; |
| 5020 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5021 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5022 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5023 | alc260_ignore); |
| 5024 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5025 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5026 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5027 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5028 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5029 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5030 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5031 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5032 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5033 | return err; |
| 5034 | |
| 5035 | spec->multiout.max_channels = 2; |
| 5036 | |
| 5037 | if (spec->autocfg.dig_out_pin) |
| 5038 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 5039 | if (spec->kctl_alloc) |
| 5040 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 5041 | |
| 5042 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 5043 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5044 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5045 | spec->input_mux = &spec->private_imux; |
| 5046 | |
| 5047 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5048 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5049 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 5050 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5051 | spec->adc_nids = alc260_adc_nids_alt; |
| 5052 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5053 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5054 | } else { |
| 5055 | spec->adc_nids = alc260_adc_nids; |
| 5056 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5057 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5058 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5059 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5060 | |
| 5061 | return 1; |
| 5062 | } |
| 5063 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5064 | /* additional initialization for auto-configuration model */ |
| 5065 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5066 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5067 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5068 | alc260_auto_init_multi_out(codec); |
| 5069 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5070 | if (spec->unsol_event) |
| 5071 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5072 | } |
| 5073 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5074 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5075 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5076 | { 0x07, HDA_INPUT, 0 }, |
| 5077 | { 0x07, HDA_INPUT, 1 }, |
| 5078 | { 0x07, HDA_INPUT, 2 }, |
| 5079 | { 0x07, HDA_INPUT, 3 }, |
| 5080 | { 0x07, HDA_INPUT, 4 }, |
| 5081 | { } /* end */ |
| 5082 | }; |
| 5083 | #endif |
| 5084 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5085 | /* |
| 5086 | * ALC260 configurations |
| 5087 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5088 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5089 | [ALC260_BASIC] = "basic", |
| 5090 | [ALC260_HP] = "hp", |
| 5091 | [ALC260_HP_3013] = "hp-3013", |
| 5092 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5093 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5094 | [ALC260_WILL] = "will", |
| 5095 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5096 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5097 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5098 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5099 | [ALC260_AUTO] = "auto", |
| 5100 | }; |
| 5101 | |
| 5102 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5103 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5104 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5105 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5106 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5107 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 5108 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 5109 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 5110 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5111 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5112 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5113 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5114 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5115 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5116 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5117 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5118 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5119 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5120 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5121 | {} |
| 5122 | }; |
| 5123 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5124 | static struct alc_config_preset alc260_presets[] = { |
| 5125 | [ALC260_BASIC] = { |
| 5126 | .mixers = { alc260_base_output_mixer, |
| 5127 | alc260_input_mixer, |
| 5128 | alc260_pc_beep_mixer, |
| 5129 | alc260_capture_mixer }, |
| 5130 | .init_verbs = { alc260_init_verbs }, |
| 5131 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5132 | .dac_nids = alc260_dac_nids, |
| 5133 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5134 | .adc_nids = alc260_adc_nids, |
| 5135 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5136 | .channel_mode = alc260_modes, |
| 5137 | .input_mux = &alc260_capture_source, |
| 5138 | }, |
| 5139 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5140 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5141 | alc260_input_mixer, |
| 5142 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5143 | .init_verbs = { alc260_init_verbs, |
| 5144 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5145 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5146 | .dac_nids = alc260_dac_nids, |
| 5147 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5148 | .adc_nids = alc260_hp_adc_nids, |
| 5149 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5150 | .channel_mode = alc260_modes, |
| 5151 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5152 | .unsol_event = alc260_hp_unsol_event, |
| 5153 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5154 | }, |
| 5155 | [ALC260_HP_3013] = { |
| 5156 | .mixers = { alc260_hp_3013_mixer, |
| 5157 | alc260_input_mixer, |
| 5158 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5159 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5160 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5161 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5162 | .dac_nids = alc260_dac_nids, |
| 5163 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5164 | .adc_nids = alc260_hp_adc_nids, |
| 5165 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5166 | .channel_mode = alc260_modes, |
| 5167 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5168 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5169 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5170 | }, |
| 5171 | [ALC260_FUJITSU_S702X] = { |
| 5172 | .mixers = { alc260_fujitsu_mixer, |
| 5173 | alc260_capture_mixer }, |
| 5174 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5175 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5176 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5177 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5178 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5179 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5180 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5181 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5182 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5183 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5184 | [ALC260_ACER] = { |
| 5185 | .mixers = { alc260_acer_mixer, |
| 5186 | alc260_capture_mixer }, |
| 5187 | .init_verbs = { alc260_acer_init_verbs }, |
| 5188 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5189 | .dac_nids = alc260_dac_nids, |
| 5190 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5191 | .adc_nids = alc260_dual_adc_nids, |
| 5192 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5193 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5194 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5195 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5196 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5197 | [ALC260_WILL] = { |
| 5198 | .mixers = { alc260_will_mixer, |
| 5199 | alc260_capture_mixer }, |
| 5200 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5201 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5202 | .dac_nids = alc260_dac_nids, |
| 5203 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5204 | .adc_nids = alc260_adc_nids, |
| 5205 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5206 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5207 | .channel_mode = alc260_modes, |
| 5208 | .input_mux = &alc260_capture_source, |
| 5209 | }, |
| 5210 | [ALC260_REPLACER_672V] = { |
| 5211 | .mixers = { alc260_replacer_672v_mixer, |
| 5212 | alc260_capture_mixer }, |
| 5213 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5214 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5215 | .dac_nids = alc260_dac_nids, |
| 5216 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5217 | .adc_nids = alc260_adc_nids, |
| 5218 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5219 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5220 | .channel_mode = alc260_modes, |
| 5221 | .input_mux = &alc260_capture_source, |
| 5222 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5223 | .init_hook = alc260_replacer_672v_automute, |
| 5224 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5225 | #ifdef CONFIG_SND_DEBUG |
| 5226 | [ALC260_TEST] = { |
| 5227 | .mixers = { alc260_test_mixer, |
| 5228 | alc260_capture_mixer }, |
| 5229 | .init_verbs = { alc260_test_init_verbs }, |
| 5230 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5231 | .dac_nids = alc260_test_dac_nids, |
| 5232 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5233 | .adc_nids = alc260_test_adc_nids, |
| 5234 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5235 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5236 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5237 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5238 | }, |
| 5239 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5240 | }; |
| 5241 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5242 | static int patch_alc260(struct hda_codec *codec) |
| 5243 | { |
| 5244 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5245 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5246 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5247 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5248 | if (spec == NULL) |
| 5249 | return -ENOMEM; |
| 5250 | |
| 5251 | codec->spec = spec; |
| 5252 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5253 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5254 | alc260_models, |
| 5255 | alc260_cfg_tbl); |
| 5256 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5257 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5258 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5259 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5260 | } |
| 5261 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5262 | if (board_config == ALC260_AUTO) { |
| 5263 | /* automatic parse from the BIOS config */ |
| 5264 | err = alc260_parse_auto_config(codec); |
| 5265 | if (err < 0) { |
| 5266 | alc_free(codec); |
| 5267 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5268 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5269 | printk(KERN_INFO |
| 5270 | "hda_codec: Cannot set up configuration " |
| 5271 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5272 | board_config = ALC260_BASIC; |
| 5273 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5274 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5275 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5276 | if (board_config != ALC260_AUTO) |
| 5277 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5278 | |
| 5279 | spec->stream_name_analog = "ALC260 Analog"; |
| 5280 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5281 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5282 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5283 | spec->stream_name_digital = "ALC260 Digital"; |
| 5284 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5285 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5286 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5287 | spec->vmaster_nid = 0x08; |
| 5288 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5289 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5290 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5291 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5292 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5293 | if (!spec->loopback.amplist) |
| 5294 | spec->loopback.amplist = alc260_loopbacks; |
| 5295 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5296 | |
| 5297 | return 0; |
| 5298 | } |
| 5299 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5300 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5301 | /* |
| 5302 | * ALC882 support |
| 5303 | * |
| 5304 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5305 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5306 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5307 | * 6-channel independent captures. |
| 5308 | * |
| 5309 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5310 | * driver yet). |
| 5311 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5312 | #define ALC882_DIGOUT_NID 0x06 |
| 5313 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5314 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5315 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5316 | { 8, NULL } |
| 5317 | }; |
| 5318 | |
| 5319 | static hda_nid_t alc882_dac_nids[4] = { |
| 5320 | /* front, rear, clfe, rear_surr */ |
| 5321 | 0x02, 0x03, 0x04, 0x05 |
| 5322 | }; |
| 5323 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5324 | /* identical with ALC880 */ |
| 5325 | #define alc882_adc_nids alc880_adc_nids |
| 5326 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5327 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5328 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5329 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5330 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5331 | /* input MUX */ |
| 5332 | /* FIXME: should be a matrix-type input source selection */ |
| 5333 | |
| 5334 | static struct hda_input_mux alc882_capture_source = { |
| 5335 | .num_items = 4, |
| 5336 | .items = { |
| 5337 | { "Mic", 0x0 }, |
| 5338 | { "Front Mic", 0x1 }, |
| 5339 | { "Line", 0x2 }, |
| 5340 | { "CD", 0x4 }, |
| 5341 | }, |
| 5342 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5343 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5344 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5345 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5346 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5347 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5348 | { |
| 5349 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5350 | struct alc_spec *spec = codec->spec; |
| 5351 | const struct hda_input_mux *imux = spec->input_mux; |
| 5352 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5353 | hda_nid_t nid = spec->capsrc_nids ? |
| 5354 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5355 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5356 | unsigned int i, idx; |
| 5357 | |
| 5358 | idx = ucontrol->value.enumerated.item[0]; |
| 5359 | if (idx >= imux->num_items) |
| 5360 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5361 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5362 | return 0; |
| 5363 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5364 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5365 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5366 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5367 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5368 | } |
| 5369 | *cur_val = idx; |
| 5370 | return 1; |
| 5371 | } |
| 5372 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5373 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5374 | * 2ch mode |
| 5375 | */ |
| 5376 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5377 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5378 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5379 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5380 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5381 | { } /* end */ |
| 5382 | }; |
| 5383 | |
| 5384 | /* |
| 5385 | * 6ch mode |
| 5386 | */ |
| 5387 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5388 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5389 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5390 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5391 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5392 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5393 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5394 | { } /* end */ |
| 5395 | }; |
| 5396 | |
| 5397 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5398 | { 2, alc882_3ST_ch2_init }, |
| 5399 | { 6, alc882_3ST_ch6_init }, |
| 5400 | }; |
| 5401 | |
| 5402 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5403 | * 6ch mode |
| 5404 | */ |
| 5405 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5406 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5407 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5408 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5409 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5410 | { } /* end */ |
| 5411 | }; |
| 5412 | |
| 5413 | /* |
| 5414 | * 8ch mode |
| 5415 | */ |
| 5416 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5417 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5418 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5419 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5420 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5421 | { } /* end */ |
| 5422 | }; |
| 5423 | |
| 5424 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5425 | { 6, alc882_sixstack_ch6_init }, |
| 5426 | { 8, alc882_sixstack_ch8_init }, |
| 5427 | }; |
| 5428 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5429 | /* |
| 5430 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5431 | */ |
| 5432 | |
| 5433 | /* |
| 5434 | * 2ch mode |
| 5435 | */ |
| 5436 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5437 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5438 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5439 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5440 | { } /* end */ |
| 5441 | }; |
| 5442 | |
| 5443 | /* |
| 5444 | * 6ch mode |
| 5445 | */ |
| 5446 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5447 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5448 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5449 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5450 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5451 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5452 | { } /* end */ |
| 5453 | }; |
| 5454 | |
| 5455 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5456 | { 2, alc885_mbp_ch2_init }, |
| 5457 | { 6, alc885_mbp_ch6_init }, |
| 5458 | }; |
| 5459 | |
| 5460 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5461 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5462 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5463 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5464 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5465 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5466 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5467 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5468 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5469 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5470 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5471 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5472 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5473 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5474 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5475 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5476 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5477 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5478 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5479 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5480 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5481 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5482 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5483 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5484 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5485 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5486 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5487 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5488 | { } /* end */ |
| 5489 | }; |
| 5490 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5491 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5492 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5493 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5494 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5495 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5496 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5497 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5498 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5499 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5500 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5501 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5502 | { } /* end */ |
| 5503 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5504 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5505 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5506 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5507 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5508 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5509 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5510 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5511 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5512 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5513 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5514 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5515 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5516 | { } /* end */ |
| 5517 | }; |
| 5518 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5519 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5520 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5521 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5522 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5523 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5524 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5525 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5526 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5527 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5528 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5529 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5530 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5531 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5532 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5533 | { } /* end */ |
| 5534 | }; |
| 5535 | |
| 5536 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5537 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5538 | */ |
| 5539 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5540 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5541 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5542 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5543 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5544 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5545 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5546 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5547 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5548 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5549 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5552 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5553 | { } /* end */ |
| 5554 | }; |
| 5555 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5556 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5557 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5558 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5559 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5560 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5561 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5562 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5563 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5564 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5565 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5566 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5567 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5568 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5569 | { } /* end */ |
| 5570 | }; |
| 5571 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5572 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5573 | { |
| 5574 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5575 | .name = "Channel Mode", |
| 5576 | .info = alc_ch_mode_info, |
| 5577 | .get = alc_ch_mode_get, |
| 5578 | .put = alc_ch_mode_put, |
| 5579 | }, |
| 5580 | { } /* end */ |
| 5581 | }; |
| 5582 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5583 | static struct hda_verb alc882_init_verbs[] = { |
| 5584 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5586 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5587 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5588 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5589 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5590 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5591 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5592 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5593 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5594 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5595 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5596 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5597 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5598 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5599 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5600 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5601 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5602 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5603 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5604 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5605 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5606 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5607 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5608 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5609 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5610 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5611 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5612 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5613 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5614 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5615 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5616 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5617 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5618 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5619 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5620 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5621 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5622 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5623 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5624 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5625 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5626 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5627 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5628 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5629 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5630 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5631 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5632 | |
| 5633 | /* FIXME: use matrix-type input source selection */ |
| 5634 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5635 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5636 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5637 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5638 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5639 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5640 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5641 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5642 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5643 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5644 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5645 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5646 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5647 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5648 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5649 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5650 | /* ADC1: mute amp left and right */ |
| 5651 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5652 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5653 | /* ADC2: mute amp left and right */ |
| 5654 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5655 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5656 | /* ADC3: mute amp left and right */ |
| 5657 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5658 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5659 | |
| 5660 | { } |
| 5661 | }; |
| 5662 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5663 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5664 | /* change to EAPD mode */ |
| 5665 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5666 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5667 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5668 | }; |
| 5669 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5670 | /* Mac Pro test */ |
| 5671 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5672 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5673 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5674 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5675 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5676 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5677 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5678 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5679 | { } /* end */ |
| 5680 | }; |
| 5681 | |
| 5682 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5683 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5684 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5685 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5686 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5687 | /* Front Pin: output 0 (0x0c) */ |
| 5688 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5689 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5690 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5691 | /* Front Mic pin: input vref at 80% */ |
| 5692 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5693 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5694 | /* Speaker: output */ |
| 5695 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5696 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5697 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5698 | /* Headphone output (output 0 - 0x0c) */ |
| 5699 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5700 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5701 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5702 | |
| 5703 | /* FIXME: use matrix-type input source selection */ |
| 5704 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5705 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5706 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5707 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5708 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5709 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5710 | /* Input mixer2 */ |
| 5711 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5712 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5713 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5714 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5715 | /* Input mixer3 */ |
| 5716 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5717 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5718 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5719 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5720 | /* ADC1: mute amp left and right */ |
| 5721 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5722 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5723 | /* ADC2: mute amp left and right */ |
| 5724 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5725 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5726 | /* ADC3: mute amp left and right */ |
| 5727 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5728 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5729 | |
| 5730 | { } |
| 5731 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5732 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5733 | /* Macbook Pro rev3 */ |
| 5734 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5735 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5736 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5737 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5738 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5739 | /* Rear mixer */ |
| 5740 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5741 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5742 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5743 | /* Front Pin: output 0 (0x0c) */ |
| 5744 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5745 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5746 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5747 | /* HP Pin: output 0 (0x0d) */ |
| 5748 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5749 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5750 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5751 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5752 | /* Mic (rear) pin: input vref at 80% */ |
| 5753 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5754 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5755 | /* Front Mic pin: input vref at 80% */ |
| 5756 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5757 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5758 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5759 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5760 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5761 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5762 | |
| 5763 | /* FIXME: use matrix-type input source selection */ |
| 5764 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5765 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5766 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5767 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5768 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5769 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5770 | /* Input mixer2 */ |
| 5771 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5772 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5773 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5774 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5775 | /* Input mixer3 */ |
| 5776 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5777 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5778 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5779 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5780 | /* ADC1: mute amp left and right */ |
| 5781 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5782 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5783 | /* ADC2: mute amp left and right */ |
| 5784 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5785 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5786 | /* ADC3: mute amp left and right */ |
| 5787 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5788 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5789 | |
| 5790 | { } |
| 5791 | }; |
| 5792 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5793 | /* iMac 24 mixer. */ |
| 5794 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5795 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5796 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5797 | { } /* end */ |
| 5798 | }; |
| 5799 | |
| 5800 | /* iMac 24 init verbs. */ |
| 5801 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5802 | /* Internal speakers: output 0 (0x0c) */ |
| 5803 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5804 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5805 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5806 | /* Internal speakers: output 0 (0x0c) */ |
| 5807 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5808 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5809 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5810 | /* Headphone: output 0 (0x0c) */ |
| 5811 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5812 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5813 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5814 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5815 | /* Front Mic: input vref at 80% */ |
| 5816 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5817 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5818 | { } |
| 5819 | }; |
| 5820 | |
| 5821 | /* Toggle speaker-output according to the hp-jack state */ |
| 5822 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5823 | { |
| 5824 | unsigned int present; |
| 5825 | |
| 5826 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5827 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5828 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5829 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5830 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5831 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5832 | } |
| 5833 | |
| 5834 | /* Processes unsolicited events. */ |
| 5835 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5836 | unsigned int res) |
| 5837 | { |
| 5838 | /* Headphone insertion or removal. */ |
| 5839 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5840 | alc885_imac24_automute(codec); |
| 5841 | } |
| 5842 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5843 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5844 | { |
| 5845 | unsigned int present; |
| 5846 | |
| 5847 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5848 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5849 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5850 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5851 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5852 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5853 | |
| 5854 | } |
| 5855 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5856 | unsigned int res) |
| 5857 | { |
| 5858 | /* Headphone insertion or removal. */ |
| 5859 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5860 | alc885_mbp3_automute(codec); |
| 5861 | } |
| 5862 | |
| 5863 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5864 | static struct hda_verb alc882_targa_verbs[] = { |
| 5865 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5866 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5867 | |
| 5868 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5869 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5870 | |
| 5871 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5872 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5873 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5874 | |
| 5875 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5876 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5877 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5878 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5879 | { } /* end */ |
| 5880 | }; |
| 5881 | |
| 5882 | /* toggle speaker-output according to the hp-jack state */ |
| 5883 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5884 | { |
| 5885 | unsigned int present; |
| 5886 | |
| 5887 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5888 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5889 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5890 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5891 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5892 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5893 | } |
| 5894 | |
| 5895 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5896 | { |
| 5897 | /* Looks like the unsol event is incompatible with the standard |
| 5898 | * definition. 4bit tag is placed at 26 bit! |
| 5899 | */ |
| 5900 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5901 | alc882_targa_automute(codec); |
| 5902 | } |
| 5903 | } |
| 5904 | |
| 5905 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5906 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5907 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5908 | |
| 5909 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5910 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5911 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5912 | |
| 5913 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5914 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5915 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5916 | |
| 5917 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5918 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5919 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5920 | { } /* end */ |
| 5921 | }; |
| 5922 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5923 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5924 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5925 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5926 | |
| 5927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5928 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5929 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5930 | |
| 5931 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5932 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5933 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5934 | |
| 5935 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5936 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5937 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5938 | { } /* end */ |
| 5939 | }; |
| 5940 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5941 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5942 | { |
| 5943 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5944 | |
| 5945 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5946 | AC_VERB_GET_GPIO_DATA, 0); |
| 5947 | |
| 5948 | if (!muted) |
| 5949 | gpiostate |= (1 << pin); |
| 5950 | else |
| 5951 | gpiostate &= ~(1 << pin); |
| 5952 | |
| 5953 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5954 | AC_VERB_GET_GPIO_MASK, 0); |
| 5955 | gpiomask |= (1 << pin); |
| 5956 | |
| 5957 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5958 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5959 | gpiodir |= (1 << pin); |
| 5960 | |
| 5961 | |
| 5962 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5963 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5964 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5965 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5966 | |
| 5967 | msleep(1); |
| 5968 | |
| 5969 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5970 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5971 | } |
| 5972 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5973 | /* set up GPIO at initialization */ |
| 5974 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5975 | { |
| 5976 | alc882_gpio_mute(codec, 0, 0); |
| 5977 | alc882_gpio_mute(codec, 1, 0); |
| 5978 | } |
| 5979 | |
| 5980 | /* set up GPIO and update auto-muting at initialization */ |
| 5981 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5982 | { |
| 5983 | alc885_macpro_init_hook(codec); |
| 5984 | alc885_imac24_automute(codec); |
| 5985 | } |
| 5986 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5987 | /* |
| 5988 | * generic initialization of ADC, input mixers and output mixers |
| 5989 | */ |
| 5990 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5991 | /* |
| 5992 | * Unmute ADC0-2 and set the default input to mic-in |
| 5993 | */ |
| 5994 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5995 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5996 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5997 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5998 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5999 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6000 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6001 | /* 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] | 6002 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6003 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6004 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6005 | */ |
| 6006 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6007 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6008 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6009 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6010 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6011 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6012 | |
| 6013 | /* |
| 6014 | * Set up output mixers (0x0c - 0x0f) |
| 6015 | */ |
| 6016 | /* set vol=0 to output mixers */ |
| 6017 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6018 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6019 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6020 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6021 | /* set up input amps for analog loopback */ |
| 6022 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6023 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6024 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6025 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6026 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6027 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6028 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6029 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6030 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6031 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6032 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6033 | |
| 6034 | /* FIXME: use matrix-type input source selection */ |
| 6035 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6036 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6037 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6038 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6039 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6040 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6041 | /* Input mixer2 */ |
| 6042 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6043 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6044 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6045 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6046 | /* Input mixer3 */ |
| 6047 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6048 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6049 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6050 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6051 | |
| 6052 | { } |
| 6053 | }; |
| 6054 | |
| 6055 | /* capture mixer elements */ |
| 6056 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 6057 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6058 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6059 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6060 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6061 | { |
| 6062 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6063 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6064 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6065 | */ |
| 6066 | /* .name = "Capture Source", */ |
| 6067 | .name = "Input Source", |
| 6068 | .count = 2, |
| 6069 | .info = alc882_mux_enum_info, |
| 6070 | .get = alc882_mux_enum_get, |
| 6071 | .put = alc882_mux_enum_put, |
| 6072 | }, |
| 6073 | { } /* end */ |
| 6074 | }; |
| 6075 | |
| 6076 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 6077 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 6078 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 6079 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 6080 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 6081 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 6082 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 6083 | { |
| 6084 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6085 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6086 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6087 | */ |
| 6088 | /* .name = "Capture Source", */ |
| 6089 | .name = "Input Source", |
| 6090 | .count = 3, |
| 6091 | .info = alc882_mux_enum_info, |
| 6092 | .get = alc882_mux_enum_get, |
| 6093 | .put = alc882_mux_enum_put, |
| 6094 | }, |
| 6095 | { } /* end */ |
| 6096 | }; |
| 6097 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6098 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6099 | #define alc882_loopbacks alc880_loopbacks |
| 6100 | #endif |
| 6101 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6102 | /* pcm configuration: identiacal with ALC880 */ |
| 6103 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6104 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6105 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6106 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6107 | |
| 6108 | /* |
| 6109 | * configuration and preset |
| 6110 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6111 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6112 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6113 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6114 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6115 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6116 | [ALC882_TARGA] = "targa", |
| 6117 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6118 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6119 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6120 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6121 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6122 | [ALC882_AUTO] = "auto", |
| 6123 | }; |
| 6124 | |
| 6125 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6126 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6127 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6128 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6129 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6130 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6131 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6132 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6133 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6134 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6135 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6136 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6137 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6138 | {} |
| 6139 | }; |
| 6140 | |
| 6141 | static struct alc_config_preset alc882_presets[] = { |
| 6142 | [ALC882_3ST_DIG] = { |
| 6143 | .mixers = { alc882_base_mixer }, |
| 6144 | .init_verbs = { alc882_init_verbs }, |
| 6145 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6146 | .dac_nids = alc882_dac_nids, |
| 6147 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6148 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6149 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6150 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6151 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6152 | .input_mux = &alc882_capture_source, |
| 6153 | }, |
| 6154 | [ALC882_6ST_DIG] = { |
| 6155 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6156 | .init_verbs = { alc882_init_verbs }, |
| 6157 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6158 | .dac_nids = alc882_dac_nids, |
| 6159 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6160 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6161 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6162 | .channel_mode = alc882_sixstack_modes, |
| 6163 | .input_mux = &alc882_capture_source, |
| 6164 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6165 | [ALC882_ARIMA] = { |
| 6166 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6167 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6168 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6169 | .dac_nids = alc882_dac_nids, |
| 6170 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6171 | .channel_mode = alc882_sixstack_modes, |
| 6172 | .input_mux = &alc882_capture_source, |
| 6173 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6174 | [ALC882_W2JC] = { |
| 6175 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6176 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6177 | alc880_gpio1_init_verbs }, |
| 6178 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6179 | .dac_nids = alc882_dac_nids, |
| 6180 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6181 | .channel_mode = alc880_threestack_modes, |
| 6182 | .need_dac_fix = 1, |
| 6183 | .input_mux = &alc882_capture_source, |
| 6184 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6185 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6186 | [ALC885_MBP3] = { |
| 6187 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6188 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6189 | alc880_gpio1_init_verbs }, |
| 6190 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6191 | .dac_nids = alc882_dac_nids, |
| 6192 | .channel_mode = alc885_mbp_6ch_modes, |
| 6193 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6194 | .input_mux = &alc882_capture_source, |
| 6195 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6196 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6197 | .unsol_event = alc885_mbp3_unsol_event, |
| 6198 | .init_hook = alc885_mbp3_automute, |
| 6199 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6200 | [ALC885_MACPRO] = { |
| 6201 | .mixers = { alc882_macpro_mixer }, |
| 6202 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6203 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6204 | .dac_nids = alc882_dac_nids, |
| 6205 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6206 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6207 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6208 | .channel_mode = alc882_ch_modes, |
| 6209 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6210 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6211 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6212 | [ALC885_IMAC24] = { |
| 6213 | .mixers = { alc885_imac24_mixer }, |
| 6214 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6215 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6216 | .dac_nids = alc882_dac_nids, |
| 6217 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6218 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6219 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6220 | .channel_mode = alc882_ch_modes, |
| 6221 | .input_mux = &alc882_capture_source, |
| 6222 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6223 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6224 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6225 | [ALC882_TARGA] = { |
| 6226 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6227 | alc882_capture_mixer }, |
| 6228 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6229 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6230 | .dac_nids = alc882_dac_nids, |
| 6231 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6232 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6233 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6234 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6235 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6236 | .channel_mode = alc882_3ST_6ch_modes, |
| 6237 | .need_dac_fix = 1, |
| 6238 | .input_mux = &alc882_capture_source, |
| 6239 | .unsol_event = alc882_targa_unsol_event, |
| 6240 | .init_hook = alc882_targa_automute, |
| 6241 | }, |
| 6242 | [ALC882_ASUS_A7J] = { |
| 6243 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6244 | alc882_capture_mixer }, |
| 6245 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6246 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6247 | .dac_nids = alc882_dac_nids, |
| 6248 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6249 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6250 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6251 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6252 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6253 | .channel_mode = alc882_3ST_6ch_modes, |
| 6254 | .need_dac_fix = 1, |
| 6255 | .input_mux = &alc882_capture_source, |
| 6256 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6257 | [ALC882_ASUS_A7M] = { |
| 6258 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6259 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6260 | alc880_gpio1_init_verbs, |
| 6261 | alc882_asus_a7m_verbs }, |
| 6262 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6263 | .dac_nids = alc882_dac_nids, |
| 6264 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6265 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6266 | .channel_mode = alc880_threestack_modes, |
| 6267 | .need_dac_fix = 1, |
| 6268 | .input_mux = &alc882_capture_source, |
| 6269 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6270 | }; |
| 6271 | |
| 6272 | |
| 6273 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6274 | * Pin config fixes |
| 6275 | */ |
| 6276 | enum { |
| 6277 | PINFIX_ABIT_AW9D_MAX |
| 6278 | }; |
| 6279 | |
| 6280 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6281 | { 0x15, 0x01080104 }, /* side */ |
| 6282 | { 0x16, 0x01011012 }, /* rear */ |
| 6283 | { 0x17, 0x01016011 }, /* clfe */ |
| 6284 | { } |
| 6285 | }; |
| 6286 | |
| 6287 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6288 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6289 | }; |
| 6290 | |
| 6291 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6292 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6293 | {} |
| 6294 | }; |
| 6295 | |
| 6296 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6297 | * BIOS auto configuration |
| 6298 | */ |
| 6299 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6300 | hda_nid_t nid, int pin_type, |
| 6301 | int dac_idx) |
| 6302 | { |
| 6303 | /* set as output */ |
| 6304 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6305 | int idx; |
| 6306 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6307 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6308 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6309 | idx = 4; |
| 6310 | else |
| 6311 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6312 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6313 | |
| 6314 | } |
| 6315 | |
| 6316 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6317 | { |
| 6318 | struct alc_spec *spec = codec->spec; |
| 6319 | int i; |
| 6320 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6321 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6322 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6323 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6324 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6325 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6326 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6327 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6328 | } |
| 6329 | } |
| 6330 | |
| 6331 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6332 | { |
| 6333 | struct alc_spec *spec = codec->spec; |
| 6334 | hda_nid_t pin; |
| 6335 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6336 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6337 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6338 | /* use dac 0 */ |
| 6339 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6340 | pin = spec->autocfg.speaker_pins[0]; |
| 6341 | if (pin) |
| 6342 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6343 | } |
| 6344 | |
| 6345 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6346 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6347 | |
| 6348 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6349 | { |
| 6350 | struct alc_spec *spec = codec->spec; |
| 6351 | int i; |
| 6352 | |
| 6353 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6354 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6355 | unsigned int vref; |
| 6356 | if (!nid) |
| 6357 | continue; |
| 6358 | vref = PIN_IN; |
| 6359 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame^] | 6360 | unsigned int pincap; |
| 6361 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6362 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6363 | AC_PINCAP_VREF_80) |
| 6364 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6365 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6366 | snd_hda_codec_write(codec, nid, 0, |
| 6367 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6368 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6369 | snd_hda_codec_write(codec, nid, 0, |
| 6370 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6371 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6372 | } |
| 6373 | } |
| 6374 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6375 | /* add mic boosts if needed */ |
| 6376 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6377 | { |
| 6378 | struct alc_spec *spec = codec->spec; |
| 6379 | int err; |
| 6380 | hda_nid_t nid; |
| 6381 | |
| 6382 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6383 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6384 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6385 | "Mic Boost", |
| 6386 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6387 | if (err < 0) |
| 6388 | return err; |
| 6389 | } |
| 6390 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6391 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6392 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6393 | "Front Mic Boost", |
| 6394 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6395 | if (err < 0) |
| 6396 | return err; |
| 6397 | } |
| 6398 | return 0; |
| 6399 | } |
| 6400 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6401 | /* almost identical with ALC880 parser... */ |
| 6402 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6403 | { |
| 6404 | struct alc_spec *spec = codec->spec; |
| 6405 | int err = alc880_parse_auto_config(codec); |
| 6406 | |
| 6407 | if (err < 0) |
| 6408 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6409 | else if (!err) |
| 6410 | return 0; /* no config found */ |
| 6411 | |
| 6412 | err = alc_auto_add_mic_boost(codec); |
| 6413 | if (err < 0) |
| 6414 | return err; |
| 6415 | |
| 6416 | /* hack - override the init verbs */ |
| 6417 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6418 | |
| 6419 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6420 | } |
| 6421 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6422 | /* additional initialization for auto-configuration model */ |
| 6423 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6424 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6425 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6426 | alc882_auto_init_multi_out(codec); |
| 6427 | alc882_auto_init_hp_out(codec); |
| 6428 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6429 | if (spec->unsol_event) |
| 6430 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6431 | } |
| 6432 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6433 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6434 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6435 | static int patch_alc882(struct hda_codec *codec) |
| 6436 | { |
| 6437 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6438 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6439 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6440 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6441 | if (spec == NULL) |
| 6442 | return -ENOMEM; |
| 6443 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6444 | codec->spec = spec; |
| 6445 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6446 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6447 | alc882_models, |
| 6448 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6449 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6450 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6451 | /* Pick up systems that don't supply PCI SSID */ |
| 6452 | switch (codec->subsystem_id) { |
| 6453 | case 0x106b0c00: /* Mac Pro */ |
| 6454 | board_config = ALC885_MACPRO; |
| 6455 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6456 | case 0x106b1000: /* iMac 24 */ |
| 6457 | board_config = ALC885_IMAC24; |
| 6458 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame] | 6459 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6460 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6461 | board_config = ALC885_MBP3; |
| 6462 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6463 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6464 | /* ALC889A is handled better as ALC888-compatible */ |
| 6465 | if (codec->revision_id == 0x100103) { |
| 6466 | alc_free(codec); |
| 6467 | return patch_alc883(codec); |
| 6468 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6469 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6470 | "trying auto-probe from BIOS...\n"); |
| 6471 | board_config = ALC882_AUTO; |
| 6472 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6473 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6474 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6475 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6476 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6477 | if (board_config == ALC882_AUTO) { |
| 6478 | /* automatic parse from the BIOS config */ |
| 6479 | err = alc882_parse_auto_config(codec); |
| 6480 | if (err < 0) { |
| 6481 | alc_free(codec); |
| 6482 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6483 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6484 | printk(KERN_INFO |
| 6485 | "hda_codec: Cannot set up configuration " |
| 6486 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6487 | board_config = ALC882_3ST_DIG; |
| 6488 | } |
| 6489 | } |
| 6490 | |
| 6491 | if (board_config != ALC882_AUTO) |
| 6492 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6493 | |
| 6494 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6495 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6496 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6497 | /* FIXME: setup DAC5 */ |
| 6498 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6499 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6500 | |
| 6501 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6502 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6503 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6504 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6505 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6506 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6507 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6508 | /* get type */ |
| 6509 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6510 | if (wcap != AC_WID_AUD_IN) { |
| 6511 | spec->adc_nids = alc882_adc_nids_alt; |
| 6512 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6513 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6514 | spec->mixers[spec->num_mixers] = |
| 6515 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6516 | spec->num_mixers++; |
| 6517 | } else { |
| 6518 | spec->adc_nids = alc882_adc_nids; |
| 6519 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6520 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6521 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6522 | spec->num_mixers++; |
| 6523 | } |
| 6524 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6525 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6526 | spec->vmaster_nid = 0x0c; |
| 6527 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6528 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6529 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6530 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6531 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6532 | if (!spec->loopback.amplist) |
| 6533 | spec->loopback.amplist = alc882_loopbacks; |
| 6534 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6535 | |
| 6536 | return 0; |
| 6537 | } |
| 6538 | |
| 6539 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6540 | * ALC883 support |
| 6541 | * |
| 6542 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6543 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6544 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6545 | * 6-channel independent captures. |
| 6546 | * |
| 6547 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6548 | * driver yet). |
| 6549 | */ |
| 6550 | #define ALC883_DIGOUT_NID 0x06 |
| 6551 | #define ALC883_DIGIN_NID 0x0a |
| 6552 | |
| 6553 | static hda_nid_t alc883_dac_nids[4] = { |
| 6554 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6555 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6556 | }; |
| 6557 | |
| 6558 | static hda_nid_t alc883_adc_nids[2] = { |
| 6559 | /* ADC1-2 */ |
| 6560 | 0x08, 0x09, |
| 6561 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6562 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6563 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6564 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6565 | /* input MUX */ |
| 6566 | /* FIXME: should be a matrix-type input source selection */ |
| 6567 | |
| 6568 | static struct hda_input_mux alc883_capture_source = { |
| 6569 | .num_items = 4, |
| 6570 | .items = { |
| 6571 | { "Mic", 0x0 }, |
| 6572 | { "Front Mic", 0x1 }, |
| 6573 | { "Line", 0x2 }, |
| 6574 | { "CD", 0x4 }, |
| 6575 | }, |
| 6576 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6577 | |
| 6578 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6579 | .num_items = 2, |
| 6580 | .items = { |
| 6581 | { "Mic", 0x1 }, |
| 6582 | { "Line", 0x2 }, |
| 6583 | }, |
| 6584 | }; |
| 6585 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6586 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6587 | .num_items = 4, |
| 6588 | .items = { |
| 6589 | { "Mic", 0x0 }, |
| 6590 | { "iMic", 0x1 }, |
| 6591 | { "Line", 0x2 }, |
| 6592 | { "CD", 0x4 }, |
| 6593 | }, |
| 6594 | }; |
| 6595 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6596 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6597 | .num_items = 2, |
| 6598 | .items = { |
| 6599 | { "Mic", 0x0 }, |
| 6600 | { "Int Mic", 0x1 }, |
| 6601 | }, |
| 6602 | }; |
| 6603 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6604 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6605 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6606 | /* ALC883 has the ALC882-type input selection */ |
| 6607 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6608 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6609 | /* |
| 6610 | * 2ch mode |
| 6611 | */ |
| 6612 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6613 | { 2, NULL } |
| 6614 | }; |
| 6615 | |
| 6616 | /* |
| 6617 | * 2ch mode |
| 6618 | */ |
| 6619 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6620 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6621 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6622 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6623 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6624 | { } /* end */ |
| 6625 | }; |
| 6626 | |
| 6627 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6628 | * 4ch mode |
| 6629 | */ |
| 6630 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6631 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6632 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6633 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6634 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6635 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6636 | { } /* end */ |
| 6637 | }; |
| 6638 | |
| 6639 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6640 | * 6ch mode |
| 6641 | */ |
| 6642 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6643 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6644 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6645 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6646 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6647 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6648 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6649 | { } /* end */ |
| 6650 | }; |
| 6651 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6652 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6653 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6654 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6655 | { 6, alc883_3ST_ch6_init }, |
| 6656 | }; |
| 6657 | |
| 6658 | /* |
| 6659 | * 6ch mode |
| 6660 | */ |
| 6661 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6662 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6663 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6664 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6665 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6666 | { } /* end */ |
| 6667 | }; |
| 6668 | |
| 6669 | /* |
| 6670 | * 8ch mode |
| 6671 | */ |
| 6672 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6673 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6674 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6675 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6676 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6677 | { } /* end */ |
| 6678 | }; |
| 6679 | |
| 6680 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6681 | { 6, alc883_sixstack_ch6_init }, |
| 6682 | { 8, alc883_sixstack_ch8_init }, |
| 6683 | }; |
| 6684 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6685 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6686 | /* eanable EAPD on medion laptop */ |
| 6687 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6688 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6689 | { } |
| 6690 | }; |
| 6691 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6692 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6693 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6694 | */ |
| 6695 | |
| 6696 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6697 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6698 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6699 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6700 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6701 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6702 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6703 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6704 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6705 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6706 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6707 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6708 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6709 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6710 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6711 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6712 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6713 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6714 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6715 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6716 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6717 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6718 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6719 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6720 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6721 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6722 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6723 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6724 | { |
| 6725 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6726 | /* .name = "Capture Source", */ |
| 6727 | .name = "Input Source", |
| 6728 | .count = 2, |
| 6729 | .info = alc883_mux_enum_info, |
| 6730 | .get = alc883_mux_enum_get, |
| 6731 | .put = alc883_mux_enum_put, |
| 6732 | }, |
| 6733 | { } /* end */ |
| 6734 | }; |
| 6735 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6736 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6737 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6738 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6739 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6740 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6741 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6742 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6743 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6744 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6745 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6746 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6747 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6748 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6749 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6750 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6751 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6752 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6753 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6754 | { |
| 6755 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6756 | /* .name = "Capture Source", */ |
| 6757 | .name = "Input Source", |
| 6758 | .count = 2, |
| 6759 | .info = alc883_mux_enum_info, |
| 6760 | .get = alc883_mux_enum_get, |
| 6761 | .put = alc883_mux_enum_put, |
| 6762 | }, |
| 6763 | { } /* end */ |
| 6764 | }; |
| 6765 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 6766 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 6767 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6768 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6769 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6770 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6771 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6772 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6773 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6774 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6775 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6776 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6777 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6778 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6779 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6780 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6781 | { |
| 6782 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6783 | /* .name = "Capture Source", */ |
| 6784 | .name = "Input Source", |
| 6785 | .count = 2, |
| 6786 | .info = alc883_mux_enum_info, |
| 6787 | .get = alc883_mux_enum_get, |
| 6788 | .put = alc883_mux_enum_put, |
| 6789 | }, |
| 6790 | { } /* end */ |
| 6791 | }; |
| 6792 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6793 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 6794 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6795 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6796 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6797 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6799 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6800 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6801 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6802 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6803 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6804 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6805 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6806 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6807 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6808 | { |
| 6809 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6810 | /* .name = "Capture Source", */ |
| 6811 | .name = "Input Source", |
| 6812 | .count = 2, |
| 6813 | .info = alc883_mux_enum_info, |
| 6814 | .get = alc883_mux_enum_get, |
| 6815 | .put = alc883_mux_enum_put, |
| 6816 | }, |
| 6817 | { } /* end */ |
| 6818 | }; |
| 6819 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6820 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6821 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6822 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6823 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6824 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6825 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6826 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6827 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6828 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6829 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6830 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6831 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6832 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6833 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6834 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6835 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6836 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6837 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6838 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6839 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6840 | { |
| 6841 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6842 | /* .name = "Capture Source", */ |
| 6843 | .name = "Input Source", |
| 6844 | .count = 2, |
| 6845 | .info = alc883_mux_enum_info, |
| 6846 | .get = alc883_mux_enum_get, |
| 6847 | .put = alc883_mux_enum_put, |
| 6848 | }, |
| 6849 | { } /* end */ |
| 6850 | }; |
| 6851 | |
| 6852 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6853 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6854 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6855 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6856 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6857 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6858 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6859 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6860 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6861 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6862 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6863 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6864 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6865 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6866 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6867 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6869 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6870 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6871 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6872 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6873 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6874 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6875 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6876 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6877 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6878 | { |
| 6879 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6880 | /* .name = "Capture Source", */ |
| 6881 | .name = "Input Source", |
| 6882 | .count = 2, |
| 6883 | .info = alc883_mux_enum_info, |
| 6884 | .get = alc883_mux_enum_get, |
| 6885 | .put = alc883_mux_enum_put, |
| 6886 | }, |
| 6887 | { } /* end */ |
| 6888 | }; |
| 6889 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6890 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6891 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6892 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6893 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6894 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6895 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6896 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6897 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6898 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6899 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6900 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6901 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6902 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6903 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6904 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6905 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6906 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6907 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6908 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6909 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6910 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6911 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6912 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6913 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6914 | |
| 6915 | { |
| 6916 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6917 | /* .name = "Capture Source", */ |
| 6918 | .name = "Input Source", |
| 6919 | .count = 1, |
| 6920 | .info = alc883_mux_enum_info, |
| 6921 | .get = alc883_mux_enum_get, |
| 6922 | .put = alc883_mux_enum_put, |
| 6923 | }, |
| 6924 | { } /* end */ |
| 6925 | }; |
| 6926 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6927 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6928 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6929 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6930 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6931 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6932 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6933 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6934 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6935 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6936 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6940 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6941 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6942 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6943 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6944 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6945 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6946 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6947 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6948 | { |
| 6949 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6950 | /* .name = "Capture Source", */ |
| 6951 | .name = "Input Source", |
| 6952 | .count = 2, |
| 6953 | .info = alc883_mux_enum_info, |
| 6954 | .get = alc883_mux_enum_get, |
| 6955 | .put = alc883_mux_enum_put, |
| 6956 | }, |
| 6957 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6958 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6959 | |
| 6960 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6961 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6962 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6963 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6964 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6965 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6966 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6967 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6968 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 6969 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6970 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6971 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6972 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6973 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6974 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6975 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6976 | { |
| 6977 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6978 | /* .name = "Capture Source", */ |
| 6979 | .name = "Input Source", |
| 6980 | .count = 2, |
| 6981 | .info = alc883_mux_enum_info, |
| 6982 | .get = alc883_mux_enum_get, |
| 6983 | .put = alc883_mux_enum_put, |
| 6984 | }, |
| 6985 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6986 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6987 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6988 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6989 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6990 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6991 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6992 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6993 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6994 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6995 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6996 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6997 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6998 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6999 | { |
| 7000 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7001 | /* .name = "Capture Source", */ |
| 7002 | .name = "Input Source", |
| 7003 | .count = 1, |
| 7004 | .info = alc883_mux_enum_info, |
| 7005 | .get = alc883_mux_enum_get, |
| 7006 | .put = alc883_mux_enum_put, |
| 7007 | }, |
| 7008 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7009 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7010 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7011 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7012 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7013 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7014 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7015 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7016 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7017 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7018 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7019 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7020 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, 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 | |
| 7037 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7038 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7039 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7040 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7041 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7042 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7043 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7044 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7045 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7046 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7047 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7048 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7049 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7050 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7051 | { |
| 7052 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7053 | /* .name = "Capture Source", */ |
| 7054 | .name = "Input Source", |
| 7055 | .count = 2, |
| 7056 | .info = alc883_mux_enum_info, |
| 7057 | .get = alc883_mux_enum_get, |
| 7058 | .put = alc883_mux_enum_put, |
| 7059 | }, |
| 7060 | { } /* end */ |
| 7061 | }; |
| 7062 | |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7063 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7064 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7065 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7066 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7067 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7068 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7069 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7070 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7071 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7072 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7073 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7074 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7075 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7076 | { |
| 7077 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7078 | /* .name = "Capture Source", */ |
| 7079 | .name = "Input Source", |
| 7080 | .count = 2, |
| 7081 | .info = alc883_mux_enum_info, |
| 7082 | .get = alc883_mux_enum_get, |
| 7083 | .put = alc883_mux_enum_put, |
| 7084 | }, |
| 7085 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7086 | }; |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7087 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7088 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7089 | { |
| 7090 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7091 | .name = "Channel Mode", |
| 7092 | .info = alc_ch_mode_info, |
| 7093 | .get = alc_ch_mode_get, |
| 7094 | .put = alc_ch_mode_put, |
| 7095 | }, |
| 7096 | { } /* end */ |
| 7097 | }; |
| 7098 | |
| 7099 | static struct hda_verb alc883_init_verbs[] = { |
| 7100 | /* ADC1: mute amp left and right */ |
| 7101 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7102 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7103 | /* ADC2: mute amp left and right */ |
| 7104 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7105 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7106 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7108 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7109 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7110 | /* Rear mixer */ |
| 7111 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7112 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7113 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7114 | /* CLFE mixer */ |
| 7115 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7116 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7117 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7118 | /* Side mixer */ |
| 7119 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7120 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7121 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7122 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7123 | /* mute analog input loopbacks */ |
| 7124 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7125 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7126 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7127 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7129 | |
| 7130 | /* Front Pin: output 0 (0x0c) */ |
| 7131 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7132 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7133 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7134 | /* Rear Pin: output 1 (0x0d) */ |
| 7135 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7136 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7137 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7138 | /* CLFE Pin: output 2 (0x0e) */ |
| 7139 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7140 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7141 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7142 | /* Side Pin: output 3 (0x0f) */ |
| 7143 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7144 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7145 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7146 | /* Mic (rear) pin: input vref at 80% */ |
| 7147 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7148 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7149 | /* Front Mic pin: input vref at 80% */ |
| 7150 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7151 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7152 | /* Line In pin: input */ |
| 7153 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7154 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7155 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7156 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7157 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7158 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7159 | /* CD pin widget for input */ |
| 7160 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7161 | |
| 7162 | /* FIXME: use matrix-type input source selection */ |
| 7163 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7164 | /* Input mixer2 */ |
| 7165 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7166 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7167 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7168 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7169 | /* Input mixer3 */ |
| 7170 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7171 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7172 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7173 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7174 | { } |
| 7175 | }; |
| 7176 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7177 | /* toggle speaker-output according to the hp-jack state */ |
| 7178 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7179 | { |
| 7180 | unsigned int present; |
| 7181 | |
| 7182 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7183 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7184 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7185 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7186 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7187 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7188 | } |
| 7189 | |
| 7190 | /* auto-toggle front mic */ |
| 7191 | /* |
| 7192 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7193 | { |
| 7194 | unsigned int present; |
| 7195 | unsigned char bits; |
| 7196 | |
| 7197 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7198 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7199 | bits = present ? HDA_AMP_MUTE : 0; |
| 7200 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7201 | } |
| 7202 | */ |
| 7203 | |
| 7204 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7205 | { |
| 7206 | alc883_mitac_hp_automute(codec); |
| 7207 | /* alc883_mitac_mic_automute(codec); */ |
| 7208 | } |
| 7209 | |
| 7210 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7211 | unsigned int res) |
| 7212 | { |
| 7213 | switch (res >> 26) { |
| 7214 | case ALC880_HP_EVENT: |
| 7215 | alc883_mitac_hp_automute(codec); |
| 7216 | break; |
| 7217 | case ALC880_MIC_EVENT: |
| 7218 | /* alc883_mitac_mic_automute(codec); */ |
| 7219 | break; |
| 7220 | } |
| 7221 | } |
| 7222 | |
| 7223 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7224 | /* HP */ |
| 7225 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7226 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7227 | /* Subwoofer */ |
| 7228 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7229 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7230 | |
| 7231 | /* enable unsolicited event */ |
| 7232 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7233 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7234 | |
| 7235 | { } /* end */ |
| 7236 | }; |
| 7237 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7238 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7239 | /* HP */ |
| 7240 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7241 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7242 | /* Int speaker */ |
| 7243 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7244 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7245 | |
| 7246 | /* enable unsolicited event */ |
| 7247 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7248 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7249 | |
| 7250 | { } /* end */ |
| 7251 | }; |
| 7252 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7253 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7254 | /* HP */ |
| 7255 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7256 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7257 | /* Subwoofer */ |
| 7258 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7259 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7260 | |
| 7261 | /* enable unsolicited event */ |
| 7262 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7263 | |
| 7264 | { } /* end */ |
| 7265 | }; |
| 7266 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7267 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7268 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7269 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7270 | |
| 7271 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7272 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7273 | |
| 7274 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7275 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7276 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7277 | |
| 7278 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7279 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7280 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7281 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7282 | |
| 7283 | { } /* end */ |
| 7284 | }; |
| 7285 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7286 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7287 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7288 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7289 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7290 | { } /* end */ |
| 7291 | }; |
| 7292 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7293 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7294 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7295 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7296 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7297 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7298 | { } /* end */ |
| 7299 | }; |
| 7300 | |
| 7301 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7302 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7303 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7304 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7305 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7306 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7307 | { } /* end */ |
| 7308 | }; |
| 7309 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7310 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7311 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7312 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7313 | |
| 7314 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7315 | |
| 7316 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7317 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7318 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7319 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7320 | { } /* end */ |
| 7321 | }; |
| 7322 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7323 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7324 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7325 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7326 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7327 | { } |
| 7328 | }; |
| 7329 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7330 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7331 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7332 | { } |
| 7333 | }; |
| 7334 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7335 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7336 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7337 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7338 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7339 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7340 | { } |
| 7341 | }; |
| 7342 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7343 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7344 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7345 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7346 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7347 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7348 | { } |
| 7349 | }; |
| 7350 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7351 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7352 | { 2, alc888_3st_hp_2ch_init }, |
| 7353 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7354 | }; |
| 7355 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7356 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7357 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7358 | { |
| 7359 | unsigned int present; |
| 7360 | |
| 7361 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7362 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7363 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7364 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7365 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7366 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7367 | } |
| 7368 | |
| 7369 | /* toggle RCA according to the front-jack state */ |
| 7370 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7371 | { |
| 7372 | unsigned int present; |
| 7373 | |
| 7374 | present = snd_hda_codec_read(codec, 0x14, 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, 0x15, HDA_OUTPUT, 0, |
| 7377 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7378 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7379 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7380 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7381 | unsigned int res) |
| 7382 | { |
| 7383 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7384 | alc888_lenovo_ms7195_front_automute(codec); |
| 7385 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7386 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7387 | } |
| 7388 | |
| 7389 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7390 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7391 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7392 | |
| 7393 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7394 | |
| 7395 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7396 | { } /* end */ |
| 7397 | }; |
| 7398 | |
| 7399 | /* toggle speaker-output according to the hp-jack state */ |
| 7400 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7401 | { |
| 7402 | unsigned int present; |
| 7403 | |
| 7404 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7405 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7406 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7407 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7408 | } |
| 7409 | |
| 7410 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7411 | unsigned int res) |
| 7412 | { |
| 7413 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7414 | alc883_medion_md2_automute(codec); |
| 7415 | } |
| 7416 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7417 | /* toggle speaker-output according to the hp-jack state */ |
| 7418 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7419 | { |
| 7420 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7421 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7422 | |
| 7423 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7424 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7425 | bits = present ? HDA_AMP_MUTE : 0; |
| 7426 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7427 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7428 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7429 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7430 | } |
| 7431 | |
| 7432 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7433 | { |
| 7434 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7435 | alc883_tagra_automute(codec); |
| 7436 | } |
| 7437 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7438 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7439 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7440 | { |
| 7441 | unsigned int present; |
| 7442 | unsigned char bits; |
| 7443 | |
| 7444 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7445 | & AC_PINSENSE_PRESENCE; |
| 7446 | bits = present ? HDA_AMP_MUTE : 0; |
| 7447 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7448 | HDA_AMP_MUTE, bits); |
| 7449 | } |
| 7450 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7451 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7452 | { |
| 7453 | unsigned int present; |
| 7454 | |
| 7455 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7456 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7457 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7458 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7459 | } |
| 7460 | |
| 7461 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7462 | { |
| 7463 | alc883_clevo_m720_hp_automute(codec); |
| 7464 | alc883_clevo_m720_mic_automute(codec); |
| 7465 | } |
| 7466 | |
| 7467 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7468 | unsigned int res) |
| 7469 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7470 | switch (res >> 26) { |
| 7471 | case ALC880_HP_EVENT: |
| 7472 | alc883_clevo_m720_hp_automute(codec); |
| 7473 | break; |
| 7474 | case ALC880_MIC_EVENT: |
| 7475 | alc883_clevo_m720_mic_automute(codec); |
| 7476 | break; |
| 7477 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7478 | } |
| 7479 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7480 | /* toggle speaker-output according to the hp-jack state */ |
| 7481 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7482 | { |
| 7483 | unsigned int present; |
| 7484 | unsigned char bits; |
| 7485 | |
| 7486 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7487 | & AC_PINSENSE_PRESENCE; |
| 7488 | bits = present ? HDA_AMP_MUTE : 0; |
| 7489 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7490 | HDA_AMP_MUTE, bits); |
| 7491 | } |
| 7492 | |
| 7493 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7494 | unsigned int res) |
| 7495 | { |
| 7496 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7497 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7498 | } |
| 7499 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7500 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7501 | { |
| 7502 | unsigned int present; |
| 7503 | unsigned char bits; |
| 7504 | |
| 7505 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7506 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7507 | bits = present ? 0x80 : 0; |
| 7508 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7509 | 0x80, bits); |
| 7510 | } |
| 7511 | |
| 7512 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7513 | unsigned int res) |
| 7514 | { |
| 7515 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7516 | alc883_haier_w66_automute(codec); |
| 7517 | } |
| 7518 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7519 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7520 | { |
| 7521 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7522 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7523 | |
| 7524 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7525 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7526 | bits = present ? HDA_AMP_MUTE : 0; |
| 7527 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7528 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7529 | } |
| 7530 | |
| 7531 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7532 | { |
| 7533 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7534 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7535 | |
| 7536 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7537 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7538 | bits = present ? HDA_AMP_MUTE : 0; |
| 7539 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7540 | HDA_AMP_MUTE, bits); |
| 7541 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7542 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7543 | } |
| 7544 | |
| 7545 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7546 | unsigned int res) |
| 7547 | { |
| 7548 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7549 | alc883_lenovo_101e_all_automute(codec); |
| 7550 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7551 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7552 | } |
| 7553 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7554 | /* toggle speaker-output according to the hp-jack state */ |
| 7555 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7556 | { |
| 7557 | unsigned int present; |
| 7558 | |
| 7559 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7560 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7561 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7562 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7563 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7564 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7565 | } |
| 7566 | |
| 7567 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7568 | unsigned int res) |
| 7569 | { |
| 7570 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7571 | alc883_acer_aspire_automute(codec); |
| 7572 | } |
| 7573 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7574 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7575 | /* HP Pin: output 0 (0x0c) */ |
| 7576 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7577 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7578 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7579 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7580 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7581 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7582 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7583 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7584 | /* eanable EAPD on medion laptop */ |
| 7585 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7586 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7587 | /* enable unsolicited event */ |
| 7588 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7589 | { } |
| 7590 | }; |
| 7591 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7592 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7593 | { |
| 7594 | unsigned int present; |
| 7595 | |
| 7596 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7597 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7598 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7599 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7600 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7601 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7602 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7603 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7604 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7605 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7606 | } |
| 7607 | |
| 7608 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7609 | unsigned int res) |
| 7610 | { |
| 7611 | switch (res >> 26) { |
| 7612 | case ALC880_HP_EVENT: |
| 7613 | printk("hp_event\n"); |
| 7614 | alc888_6st_dell_front_automute(codec); |
| 7615 | break; |
| 7616 | } |
| 7617 | } |
| 7618 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7619 | /* |
| 7620 | * generic initialization of ADC, input mixers and output mixers |
| 7621 | */ |
| 7622 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7623 | /* |
| 7624 | * Unmute ADC0-2 and set the default input to mic-in |
| 7625 | */ |
| 7626 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7627 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7628 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7629 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7630 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7631 | /* 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] | 7632 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7633 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7634 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7635 | */ |
| 7636 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7637 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7638 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7639 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7641 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7642 | |
| 7643 | /* |
| 7644 | * Set up output mixers (0x0c - 0x0f) |
| 7645 | */ |
| 7646 | /* set vol=0 to output mixers */ |
| 7647 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7648 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7649 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7650 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7651 | /* set up input amps for analog loopback */ |
| 7652 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7653 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7654 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7655 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7656 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7657 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7658 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7659 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7660 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7661 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7662 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7663 | |
| 7664 | /* FIXME: use matrix-type input source selection */ |
| 7665 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7666 | /* Input mixer1 */ |
| 7667 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7668 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7669 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7670 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7671 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7672 | /* Input mixer2 */ |
| 7673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7675 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7676 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7677 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7678 | |
| 7679 | { } |
| 7680 | }; |
| 7681 | |
| 7682 | /* capture mixer elements */ |
| 7683 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7684 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7685 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7686 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7687 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7688 | { |
| 7689 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7690 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7691 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7692 | */ |
| 7693 | /* .name = "Capture Source", */ |
| 7694 | .name = "Input Source", |
| 7695 | .count = 2, |
| 7696 | .info = alc882_mux_enum_info, |
| 7697 | .get = alc882_mux_enum_get, |
| 7698 | .put = alc882_mux_enum_put, |
| 7699 | }, |
| 7700 | { } /* end */ |
| 7701 | }; |
| 7702 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7703 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7704 | #define alc883_loopbacks alc880_loopbacks |
| 7705 | #endif |
| 7706 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7707 | /* pcm configuration: identiacal with ALC880 */ |
| 7708 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7709 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7710 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7711 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7712 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7713 | |
| 7714 | /* |
| 7715 | * configuration and preset |
| 7716 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7717 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7718 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7719 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7720 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7721 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7722 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7723 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7724 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7725 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7726 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7727 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7728 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7729 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7730 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7731 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7732 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7733 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7734 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7735 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7736 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7737 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7738 | [ALC883_AUTO] = "auto", |
| 7739 | }; |
| 7740 | |
| 7741 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7742 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7743 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7744 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7745 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7746 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7747 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7748 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7749 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7750 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 7751 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7752 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 7753 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7754 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7755 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7756 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7757 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7758 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7759 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7760 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7761 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7762 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7763 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 7764 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7765 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7766 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7767 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7768 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7769 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7770 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7771 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7772 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7773 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7774 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7775 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7776 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 7777 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7778 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7779 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7780 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7781 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7782 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 7783 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7784 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7785 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7786 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7787 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7788 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7789 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7790 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7791 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7792 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 7793 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7794 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7795 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7796 | {} |
| 7797 | }; |
| 7798 | |
| 7799 | static struct alc_config_preset alc883_presets[] = { |
| 7800 | [ALC883_3ST_2ch_DIG] = { |
| 7801 | .mixers = { alc883_3ST_2ch_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_2ch_modes), |
| 7808 | .channel_mode = alc883_3ST_2ch_modes, |
| 7809 | .input_mux = &alc883_capture_source, |
| 7810 | }, |
| 7811 | [ALC883_3ST_6ch_DIG] = { |
| 7812 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7813 | .init_verbs = { alc883_init_verbs }, |
| 7814 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7815 | .dac_nids = alc883_dac_nids, |
| 7816 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7817 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7818 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7819 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7820 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7821 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7822 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7823 | [ALC883_3ST_6ch] = { |
| 7824 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7825 | .init_verbs = { alc883_init_verbs }, |
| 7826 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7827 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7828 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7829 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7830 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7831 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7832 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7833 | [ALC883_6ST_DIG] = { |
| 7834 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7835 | .init_verbs = { alc883_init_verbs }, |
| 7836 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7837 | .dac_nids = alc883_dac_nids, |
| 7838 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7839 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7840 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7841 | .channel_mode = alc883_sixstack_modes, |
| 7842 | .input_mux = &alc883_capture_source, |
| 7843 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7844 | [ALC883_TARGA_DIG] = { |
| 7845 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7846 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7847 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7848 | .dac_nids = alc883_dac_nids, |
| 7849 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7850 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7851 | .channel_mode = alc883_3ST_6ch_modes, |
| 7852 | .need_dac_fix = 1, |
| 7853 | .input_mux = &alc883_capture_source, |
| 7854 | .unsol_event = alc883_tagra_unsol_event, |
| 7855 | .init_hook = alc883_tagra_automute, |
| 7856 | }, |
| 7857 | [ALC883_TARGA_2ch_DIG] = { |
| 7858 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7859 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7860 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7861 | .dac_nids = alc883_dac_nids, |
| 7862 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7863 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7864 | .channel_mode = alc883_3ST_2ch_modes, |
| 7865 | .input_mux = &alc883_capture_source, |
| 7866 | .unsol_event = alc883_tagra_unsol_event, |
| 7867 | .init_hook = alc883_tagra_automute, |
| 7868 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7869 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7870 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7871 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7872 | * and the headphone jack. Turn this on and rely on the |
| 7873 | * standard mute methods whenever the user wants to turn |
| 7874 | * these outputs off. |
| 7875 | */ |
| 7876 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7877 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7878 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7879 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7880 | .channel_mode = alc883_3ST_2ch_modes, |
| 7881 | .input_mux = &alc883_capture_source, |
| 7882 | }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7883 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7884 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7885 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7886 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7887 | .dac_nids = alc883_dac_nids, |
| 7888 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7889 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7890 | .channel_mode = alc883_3ST_2ch_modes, |
| 7891 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7892 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7893 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7894 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7895 | [ALC883_MEDION] = { |
| 7896 | .mixers = { alc883_fivestack_mixer, |
| 7897 | alc883_chmode_mixer }, |
| 7898 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7899 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7900 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7901 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7902 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7903 | .channel_mode = alc883_sixstack_modes, |
| 7904 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7905 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7906 | [ALC883_MEDION_MD2] = { |
| 7907 | .mixers = { alc883_medion_md2_mixer}, |
| 7908 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7909 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7910 | .dac_nids = alc883_dac_nids, |
| 7911 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [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 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7916 | .init_hook = alc883_medion_md2_automute, |
| 7917 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7918 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7919 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7920 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7921 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7922 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7923 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7924 | .channel_mode = alc883_3ST_2ch_modes, |
| 7925 | .input_mux = &alc883_capture_source, |
| 7926 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7927 | [ALC883_CLEVO_M720] = { |
| 7928 | .mixers = { alc883_clevo_m720_mixer }, |
| 7929 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7930 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7931 | .dac_nids = alc883_dac_nids, |
| 7932 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7933 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7934 | .channel_mode = alc883_3ST_2ch_modes, |
| 7935 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7936 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 7937 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7938 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7939 | [ALC883_LENOVO_101E_2ch] = { |
| 7940 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7941 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7942 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7943 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7944 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7945 | .channel_mode = alc883_3ST_2ch_modes, |
| 7946 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7947 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7948 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7949 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7950 | [ALC883_LENOVO_NB0763] = { |
| 7951 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7952 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7953 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7954 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7955 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7956 | .channel_mode = alc883_3ST_2ch_modes, |
| 7957 | .need_dac_fix = 1, |
| 7958 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7959 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7960 | .init_hook = alc883_medion_md2_automute, |
| 7961 | }, |
| 7962 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7963 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7964 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7965 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7966 | .dac_nids = alc883_dac_nids, |
| 7967 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7968 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7969 | .channel_mode = alc883_3ST_6ch_modes, |
| 7970 | .need_dac_fix = 1, |
| 7971 | .input_mux = &alc883_capture_source, |
| 7972 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7973 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7974 | }, |
| 7975 | [ALC883_HAIER_W66] = { |
| 7976 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7977 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7978 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7979 | .dac_nids = alc883_dac_nids, |
| 7980 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7981 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7982 | .channel_mode = alc883_3ST_2ch_modes, |
| 7983 | .input_mux = &alc883_capture_source, |
| 7984 | .unsol_event = alc883_haier_w66_unsol_event, |
| 7985 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 7986 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7987 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 7988 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 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] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 7998 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 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}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 8651 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8652 | }; |
| 8653 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8654 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8655 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8656 | { |
| 8657 | struct alc_spec *spec = codec->spec; |
| 8658 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8659 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8660 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8661 | /* need to execute and sync at first */ |
| 8662 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8663 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8664 | AC_VERB_GET_PIN_SENSE, 0); |
| 8665 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8666 | if (spec->jack_present) { |
| 8667 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8668 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8669 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8670 | } else { |
| 8671 | /* unmute internal speaker if necessary */ |
| 8672 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8673 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8674 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8675 | } |
| 8676 | } |
| 8677 | |
| 8678 | /* unsolicited event for HP jack sensing */ |
| 8679 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8680 | unsigned int res) |
| 8681 | { |
| 8682 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8683 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8684 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8685 | } |
| 8686 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8687 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8688 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8689 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8690 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8691 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8692 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8693 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8694 | AC_VERB_GET_PIN_SENSE, 0); |
| 8695 | present = (present & 0x80000000) != 0; |
| 8696 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8697 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8698 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8699 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8700 | } else { |
| 8701 | /* unmute internal speaker if necessary */ |
| 8702 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8703 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8704 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8705 | } |
| 8706 | } |
| 8707 | |
| 8708 | /* unsolicited event for HP jack sensing */ |
| 8709 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8710 | unsigned int res) |
| 8711 | { |
| 8712 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8713 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8714 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8715 | } |
| 8716 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8717 | /* |
| 8718 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8719 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 8720 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8721 | */ |
| 8722 | |
| 8723 | #define ALC_HP_EVENT 0x37 |
| 8724 | |
| 8725 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8726 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8727 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8728 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8729 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8730 | {} |
| 8731 | }; |
| 8732 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8733 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 8734 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8735 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8736 | {} |
| 8737 | }; |
| 8738 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8739 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8740 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8741 | .items = { |
| 8742 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8743 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8744 | { "CD", 0x4 }, |
| 8745 | }, |
| 8746 | }; |
| 8747 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8748 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8749 | .num_items = 5, |
| 8750 | .items = { |
| 8751 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8752 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8753 | { "Line", 0x2 }, |
| 8754 | { "CD", 0x4 }, |
| 8755 | { "AUX IN", 0x6 }, |
| 8756 | }, |
| 8757 | }; |
| 8758 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8759 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8760 | .num_items = 4, |
| 8761 | .items = { |
| 8762 | { "Mic", 0x0 }, |
| 8763 | { "Front Mic", 0x2 }, |
| 8764 | { "Line", 0x1 }, |
| 8765 | { "CD", 0x4 }, |
| 8766 | }, |
| 8767 | }; |
| 8768 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8769 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8770 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8771 | { |
| 8772 | struct alc_spec *spec = codec->spec; |
| 8773 | unsigned int mute; |
| 8774 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8775 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8776 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8777 | /* need to execute and sync at first */ |
| 8778 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8779 | /* check laptop HP jack */ |
| 8780 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8781 | AC_VERB_GET_PIN_SENSE, 0); |
| 8782 | /* need to execute and sync at first */ |
| 8783 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8784 | /* check docking HP jack */ |
| 8785 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 8786 | AC_VERB_GET_PIN_SENSE, 0); |
| 8787 | if (present & AC_PINSENSE_PRESENCE) |
| 8788 | spec->jack_present = 1; |
| 8789 | else |
| 8790 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8791 | spec->sense_updated = 1; |
| 8792 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8793 | /* unmute internal speaker only if both HPs are unplugged and |
| 8794 | * master switch is on |
| 8795 | */ |
| 8796 | if (spec->jack_present) |
| 8797 | mute = HDA_AMP_MUTE; |
| 8798 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8799 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8800 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8801 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8802 | } |
| 8803 | |
| 8804 | /* unsolicited event for HP jack sensing */ |
| 8805 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8806 | unsigned int res) |
| 8807 | { |
| 8808 | if ((res >> 26) != ALC_HP_EVENT) |
| 8809 | return; |
| 8810 | alc262_fujitsu_automute(codec, 1); |
| 8811 | } |
| 8812 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8813 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 8814 | { |
| 8815 | alc262_fujitsu_automute(codec, 1); |
| 8816 | } |
| 8817 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8818 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8819 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8820 | .ops = &snd_hda_bind_vol, |
| 8821 | .values = { |
| 8822 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8823 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8824 | 0 |
| 8825 | }, |
| 8826 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8827 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8828 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8829 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 8830 | { |
| 8831 | struct alc_spec *spec = codec->spec; |
| 8832 | unsigned int mute; |
| 8833 | |
| 8834 | if (force || !spec->sense_updated) { |
| 8835 | unsigned int present_int_hp; |
| 8836 | /* need to execute and sync at first */ |
| 8837 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8838 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 8839 | AC_VERB_GET_PIN_SENSE, 0); |
| 8840 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 8841 | spec->sense_updated = 1; |
| 8842 | } |
| 8843 | if (spec->jack_present) { |
| 8844 | /* mute internal speaker */ |
| 8845 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8846 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8847 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8848 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8849 | } else { |
| 8850 | /* unmute internal speaker if necessary */ |
| 8851 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8852 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8853 | HDA_AMP_MUTE, mute); |
| 8854 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8855 | HDA_AMP_MUTE, mute); |
| 8856 | } |
| 8857 | } |
| 8858 | |
| 8859 | /* unsolicited event for HP jack sensing */ |
| 8860 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 8861 | unsigned int res) |
| 8862 | { |
| 8863 | if ((res >> 26) != ALC_HP_EVENT) |
| 8864 | return; |
| 8865 | alc262_lenovo_3000_automute(codec, 1); |
| 8866 | } |
| 8867 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8868 | /* bind hp and internal speaker mute (with plug check) */ |
| 8869 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8870 | struct snd_ctl_elem_value *ucontrol) |
| 8871 | { |
| 8872 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8873 | long *valp = ucontrol->value.integer.value; |
| 8874 | int change; |
| 8875 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8876 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8877 | HDA_AMP_MUTE, |
| 8878 | valp ? 0 : HDA_AMP_MUTE); |
| 8879 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8880 | HDA_AMP_MUTE, |
| 8881 | valp ? 0 : HDA_AMP_MUTE); |
| 8882 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8883 | if (change) |
| 8884 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8885 | return change; |
| 8886 | } |
| 8887 | |
| 8888 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8889 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8890 | { |
| 8891 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8892 | .name = "Master Playback Switch", |
| 8893 | .info = snd_hda_mixer_amp_switch_info, |
| 8894 | .get = snd_hda_mixer_amp_switch_get, |
| 8895 | .put = alc262_fujitsu_master_sw_put, |
| 8896 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8897 | }, |
| 8898 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8899 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 8900 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 8901 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8902 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8903 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8904 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8905 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8906 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8907 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8908 | { } /* end */ |
| 8909 | }; |
| 8910 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8911 | /* bind hp and internal speaker mute (with plug check) */ |
| 8912 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8913 | struct snd_ctl_elem_value *ucontrol) |
| 8914 | { |
| 8915 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8916 | long *valp = ucontrol->value.integer.value; |
| 8917 | int change; |
| 8918 | |
| 8919 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8920 | HDA_AMP_MUTE, |
| 8921 | valp ? 0 : HDA_AMP_MUTE); |
| 8922 | |
| 8923 | if (change) |
| 8924 | alc262_lenovo_3000_automute(codec, 0); |
| 8925 | return change; |
| 8926 | } |
| 8927 | |
| 8928 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 8929 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 8930 | { |
| 8931 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8932 | .name = "Master Playback Switch", |
| 8933 | .info = snd_hda_mixer_amp_switch_info, |
| 8934 | .get = snd_hda_mixer_amp_switch_get, |
| 8935 | .put = alc262_lenovo_3000_master_sw_put, |
| 8936 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 8937 | }, |
| 8938 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8939 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8940 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8941 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8942 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8943 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8944 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8945 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8946 | { } /* end */ |
| 8947 | }; |
| 8948 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8949 | /* additional init verbs for Benq laptops */ |
| 8950 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8951 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8952 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8953 | {} |
| 8954 | }; |
| 8955 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8956 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8957 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8958 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8959 | |
| 8960 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8961 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8962 | {} |
| 8963 | }; |
| 8964 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8965 | /* Samsung Q1 Ultra Vista model setup */ |
| 8966 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8967 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8968 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8971 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8972 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8973 | { } /* end */ |
| 8974 | }; |
| 8975 | |
| 8976 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8977 | /* output mixer */ |
| 8978 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8979 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8980 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8981 | /* speaker */ |
| 8982 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8983 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8984 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8985 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8986 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8987 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8988 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8989 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8990 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8991 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8992 | /* internal mic */ |
| 8993 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8994 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8995 | /* ADC, choose mic */ |
| 8996 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8997 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8998 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8999 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9000 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9001 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9002 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9003 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9004 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 9005 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9006 | {} |
| 9007 | }; |
| 9008 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9009 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9010 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9011 | { |
| 9012 | struct alc_spec *spec = codec->spec; |
| 9013 | unsigned int 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 = 0; |
| 9016 | /* auto-mute only when HP is used as HP */ |
| 9017 | if (!spec->cur_mux[0]) { |
| 9018 | unsigned int present; |
| 9019 | /* need to execute and sync at first */ |
| 9020 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9021 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9022 | AC_VERB_GET_PIN_SENSE, 0); |
| 9023 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9024 | if (spec->jack_present) |
| 9025 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9026 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9027 | /* mute/unmute internal speaker */ |
| 9028 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9029 | HDA_AMP_MUTE, mute); |
| 9030 | /* mute/unmute HP */ |
| 9031 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9032 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9033 | } |
| 9034 | |
| 9035 | /* unsolicited event for HP jack sensing */ |
| 9036 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9037 | unsigned int res) |
| 9038 | { |
| 9039 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9040 | return; |
| 9041 | alc262_ultra_automute(codec); |
| 9042 | } |
| 9043 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9044 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9045 | .num_items = 2, |
| 9046 | .items = { |
| 9047 | { "Mic", 0x1 }, |
| 9048 | { "Headphone", 0x7 }, |
| 9049 | }, |
| 9050 | }; |
| 9051 | |
| 9052 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9053 | struct snd_ctl_elem_value *ucontrol) |
| 9054 | { |
| 9055 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9056 | struct alc_spec *spec = codec->spec; |
| 9057 | int ret; |
| 9058 | |
| 9059 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 9060 | if (!ret) |
| 9061 | return 0; |
| 9062 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9063 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9064 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9065 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9066 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9067 | return ret; |
| 9068 | } |
| 9069 | |
| 9070 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9071 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9072 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9073 | { |
| 9074 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9075 | .name = "Capture Source", |
| 9076 | .info = alc882_mux_enum_info, |
| 9077 | .get = alc882_mux_enum_get, |
| 9078 | .put = alc262_ultra_mux_enum_put, |
| 9079 | }, |
| 9080 | { } /* end */ |
| 9081 | }; |
| 9082 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9083 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9084 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9085 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9086 | { |
| 9087 | hda_nid_t nid; |
| 9088 | int err; |
| 9089 | |
| 9090 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9091 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9092 | spec->multiout.dac_nids[0] = 2; |
| 9093 | |
| 9094 | nid = cfg->line_out_pins[0]; |
| 9095 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9096 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9097 | "Front Playback Volume", |
| 9098 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9099 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9100 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9101 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9102 | "Front Playback Switch", |
| 9103 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9104 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9105 | return err; |
| 9106 | } |
| 9107 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9108 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9109 | if (nid) { |
| 9110 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9111 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9112 | "Speaker Playback Volume", |
| 9113 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9114 | HDA_OUTPUT)); |
| 9115 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9116 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9117 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9118 | "Speaker Playback Switch", |
| 9119 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9120 | HDA_OUTPUT)); |
| 9121 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9122 | return err; |
| 9123 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9124 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9125 | "Speaker Playback Switch", |
| 9126 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9127 | HDA_OUTPUT)); |
| 9128 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9129 | return err; |
| 9130 | } |
| 9131 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9132 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9133 | if (nid) { |
| 9134 | /* spec->multiout.hp_nid = 2; */ |
| 9135 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9136 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9137 | "Headphone Playback Volume", |
| 9138 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9139 | HDA_OUTPUT)); |
| 9140 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9141 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9142 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9143 | "Headphone Playback Switch", |
| 9144 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9145 | HDA_OUTPUT)); |
| 9146 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9147 | return err; |
| 9148 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9149 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9150 | "Headphone Playback Switch", |
| 9151 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9152 | HDA_OUTPUT)); |
| 9153 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9154 | return err; |
| 9155 | } |
| 9156 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9157 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9158 | } |
| 9159 | |
| 9160 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9161 | #define alc262_auto_create_analog_input_ctls \ |
| 9162 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9163 | |
| 9164 | /* |
| 9165 | * generic initialization of ADC, input mixers and output mixers |
| 9166 | */ |
| 9167 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9168 | /* |
| 9169 | * Unmute ADC0-2 and set the default input to mic-in |
| 9170 | */ |
| 9171 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9172 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9173 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9174 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9175 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9176 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9177 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9178 | /* 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] | 9179 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9180 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9181 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9182 | */ |
| 9183 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9184 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9185 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9186 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9187 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9188 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9189 | |
| 9190 | /* |
| 9191 | * Set up output mixers (0x0c - 0x0f) |
| 9192 | */ |
| 9193 | /* set vol=0 to output mixers */ |
| 9194 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9195 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9196 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9197 | |
| 9198 | /* set up input amps for analog loopback */ |
| 9199 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9200 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9201 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9202 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9203 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9204 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9205 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9206 | |
| 9207 | /* FIXME: use matrix-type input source selection */ |
| 9208 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9209 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9210 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9211 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9212 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9213 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9214 | /* Input mixer2 */ |
| 9215 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9216 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9217 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9218 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9219 | /* Input mixer3 */ |
| 9220 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9221 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9222 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9223 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9224 | |
| 9225 | { } |
| 9226 | }; |
| 9227 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9228 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9229 | /* |
| 9230 | * Unmute ADC0-2 and set the default input to mic-in |
| 9231 | */ |
| 9232 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9233 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9234 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9235 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9236 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9237 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9238 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9239 | /* 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] | 9240 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9241 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9242 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9243 | */ |
| 9244 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9245 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9246 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9247 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9248 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9249 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9250 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9251 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9252 | |
| 9253 | /* |
| 9254 | * Set up output mixers (0x0c - 0x0e) |
| 9255 | */ |
| 9256 | /* set vol=0 to output mixers */ |
| 9257 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9258 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9259 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9260 | |
| 9261 | /* set up input amps for analog loopback */ |
| 9262 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9263 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9264 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9265 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9266 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9267 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9268 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9269 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9270 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9271 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9272 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9273 | |
| 9274 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9275 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9276 | |
| 9277 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9278 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9279 | |
| 9280 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9281 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9282 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9283 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9284 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9285 | |
| 9286 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9287 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9288 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9289 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9290 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9291 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9292 | |
| 9293 | |
| 9294 | /* FIXME: use matrix-type input source selection */ |
| 9295 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9296 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9297 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9298 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9299 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9300 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9301 | /* Input mixer2 */ |
| 9302 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9303 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9304 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9305 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9306 | /* Input mixer3 */ |
| 9307 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9308 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9309 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9310 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9311 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9312 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9313 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9314 | { } |
| 9315 | }; |
| 9316 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9317 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9318 | /* |
| 9319 | * Unmute ADC0-2 and set the default input to mic-in |
| 9320 | */ |
| 9321 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9322 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9323 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9324 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9325 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9326 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9327 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9328 | /* 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] | 9329 | * mixer widget |
| 9330 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9331 | * panel mic (mic 2) |
| 9332 | */ |
| 9333 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9334 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9335 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9336 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9337 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9338 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9339 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9340 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9341 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9342 | /* |
| 9343 | * Set up output mixers (0x0c - 0x0e) |
| 9344 | */ |
| 9345 | /* set vol=0 to output mixers */ |
| 9346 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9347 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9349 | |
| 9350 | /* set up input amps for analog loopback */ |
| 9351 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9352 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9353 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9354 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9355 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9356 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9357 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9358 | |
| 9359 | |
| 9360 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9361 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9362 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9363 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9364 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9365 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9366 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9367 | |
| 9368 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9369 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9370 | |
| 9371 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9372 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9373 | |
| 9374 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9375 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9376 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9377 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9378 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9379 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9380 | |
| 9381 | /* FIXME: use matrix-type input source selection */ |
| 9382 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9383 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9384 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9385 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9386 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9387 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9388 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9389 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9390 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9391 | /* Input mixer2 */ |
| 9392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9393 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9394 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9395 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9396 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9397 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9398 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9399 | /* Input mixer3 */ |
| 9400 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9401 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9402 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9403 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9404 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9405 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9406 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9407 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9408 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9409 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9410 | { } |
| 9411 | }; |
| 9412 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9413 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9414 | #define alc262_loopbacks alc880_loopbacks |
| 9415 | #endif |
| 9416 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9417 | /* pcm configuration: identiacal with ALC880 */ |
| 9418 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9419 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9420 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9421 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9422 | |
| 9423 | /* |
| 9424 | * BIOS auto configuration |
| 9425 | */ |
| 9426 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9427 | { |
| 9428 | struct alc_spec *spec = codec->spec; |
| 9429 | int err; |
| 9430 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9431 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9432 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9433 | alc262_ignore); |
| 9434 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9435 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9436 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9437 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9438 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9439 | if (err < 0) |
| 9440 | return err; |
| 9441 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9442 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9443 | return err; |
| 9444 | |
| 9445 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9446 | |
| 9447 | if (spec->autocfg.dig_out_pin) |
| 9448 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9449 | if (spec->autocfg.dig_in_pin) |
| 9450 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9451 | |
| 9452 | if (spec->kctl_alloc) |
| 9453 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9454 | |
| 9455 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9456 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9457 | spec->input_mux = &spec->private_imux; |
| 9458 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9459 | err = alc_auto_add_mic_boost(codec); |
| 9460 | if (err < 0) |
| 9461 | return err; |
| 9462 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9463 | return 1; |
| 9464 | } |
| 9465 | |
| 9466 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9467 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9468 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 9469 | |
| 9470 | |
| 9471 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9472 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9473 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9474 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9475 | alc262_auto_init_multi_out(codec); |
| 9476 | alc262_auto_init_hp_out(codec); |
| 9477 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9478 | if (spec->unsol_event) |
| 9479 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9480 | } |
| 9481 | |
| 9482 | /* |
| 9483 | * configuration and preset |
| 9484 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9485 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9486 | [ALC262_BASIC] = "basic", |
| 9487 | [ALC262_HIPPO] = "hippo", |
| 9488 | [ALC262_HIPPO_1] = "hippo_1", |
| 9489 | [ALC262_FUJITSU] = "fujitsu", |
| 9490 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9491 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9492 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9493 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9494 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9495 | [ALC262_BENQ_T31] = "benq-t31", |
| 9496 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9497 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9498 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9499 | [ALC262_AUTO] = "auto", |
| 9500 | }; |
| 9501 | |
| 9502 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9503 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 9504 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9505 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9506 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9507 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9508 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9509 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9510 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9511 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9512 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9513 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9514 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9515 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9516 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9517 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9518 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9519 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9520 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9521 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9522 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9523 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9524 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9525 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9526 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9527 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9528 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9529 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9530 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9531 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9532 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9533 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9534 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9535 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9536 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9537 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9538 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9539 | {} |
| 9540 | }; |
| 9541 | |
| 9542 | static struct alc_config_preset alc262_presets[] = { |
| 9543 | [ALC262_BASIC] = { |
| 9544 | .mixers = { alc262_base_mixer }, |
| 9545 | .init_verbs = { alc262_init_verbs }, |
| 9546 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9547 | .dac_nids = alc262_dac_nids, |
| 9548 | .hp_nid = 0x03, |
| 9549 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9550 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9551 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9552 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9553 | [ALC262_HIPPO] = { |
| 9554 | .mixers = { alc262_base_mixer }, |
| 9555 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9556 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9557 | .dac_nids = alc262_dac_nids, |
| 9558 | .hp_nid = 0x03, |
| 9559 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9560 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9561 | .channel_mode = alc262_modes, |
| 9562 | .input_mux = &alc262_capture_source, |
| 9563 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9564 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9565 | }, |
| 9566 | [ALC262_HIPPO_1] = { |
| 9567 | .mixers = { alc262_hippo1_mixer }, |
| 9568 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9569 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9570 | .dac_nids = alc262_dac_nids, |
| 9571 | .hp_nid = 0x02, |
| 9572 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9573 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9574 | .channel_mode = alc262_modes, |
| 9575 | .input_mux = &alc262_capture_source, |
| 9576 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9577 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9578 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9579 | [ALC262_FUJITSU] = { |
| 9580 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9581 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9582 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9583 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9584 | .dac_nids = alc262_dac_nids, |
| 9585 | .hp_nid = 0x03, |
| 9586 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9587 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9588 | .channel_mode = alc262_modes, |
| 9589 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9590 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9591 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9592 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9593 | [ALC262_HP_BPC] = { |
| 9594 | .mixers = { alc262_HP_BPC_mixer }, |
| 9595 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9596 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9597 | .dac_nids = alc262_dac_nids, |
| 9598 | .hp_nid = 0x03, |
| 9599 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9600 | .channel_mode = alc262_modes, |
| 9601 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9602 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 9603 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9604 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9605 | [ALC262_HP_BPC_D7000_WF] = { |
| 9606 | .mixers = { alc262_HP_BPC_WildWest_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 | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9617 | [ALC262_HP_BPC_D7000_WL] = { |
| 9618 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9619 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9620 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9621 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9622 | .dac_nids = alc262_dac_nids, |
| 9623 | .hp_nid = 0x03, |
| 9624 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9625 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9626 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9627 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9628 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9629 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9630 | [ALC262_HP_TC_T5735] = { |
| 9631 | .mixers = { alc262_hp_t5735_mixer }, |
| 9632 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9633 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9634 | .dac_nids = alc262_dac_nids, |
| 9635 | .hp_nid = 0x03, |
| 9636 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9637 | .channel_mode = alc262_modes, |
| 9638 | .input_mux = &alc262_capture_source, |
| 9639 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9640 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9641 | }, |
| 9642 | [ALC262_HP_RP5700] = { |
| 9643 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9644 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9645 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9646 | .dac_nids = alc262_dac_nids, |
| 9647 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9648 | .channel_mode = alc262_modes, |
| 9649 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9650 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9651 | [ALC262_BENQ_ED8] = { |
| 9652 | .mixers = { alc262_base_mixer }, |
| 9653 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9654 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9655 | .dac_nids = alc262_dac_nids, |
| 9656 | .hp_nid = 0x03, |
| 9657 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9658 | .channel_mode = alc262_modes, |
| 9659 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9660 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9661 | [ALC262_SONY_ASSAMD] = { |
| 9662 | .mixers = { alc262_sony_mixer }, |
| 9663 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9664 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9665 | .dac_nids = alc262_dac_nids, |
| 9666 | .hp_nid = 0x02, |
| 9667 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9668 | .channel_mode = alc262_modes, |
| 9669 | .input_mux = &alc262_capture_source, |
| 9670 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9671 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9672 | }, |
| 9673 | [ALC262_BENQ_T31] = { |
| 9674 | .mixers = { alc262_benq_t31_mixer }, |
| 9675 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9676 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9677 | .dac_nids = alc262_dac_nids, |
| 9678 | .hp_nid = 0x03, |
| 9679 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9680 | .channel_mode = alc262_modes, |
| 9681 | .input_mux = &alc262_capture_source, |
| 9682 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9683 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9684 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9685 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9686 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 9687 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9688 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9689 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9690 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9691 | .channel_mode = alc262_modes, |
| 9692 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9693 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 9694 | .capsrc_nids = alc262_capsrc_nids, |
| 9695 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9696 | .unsol_event = alc262_ultra_unsol_event, |
| 9697 | .init_hook = alc262_ultra_automute, |
| 9698 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9699 | [ALC262_LENOVO_3000] = { |
| 9700 | .mixers = { alc262_lenovo_3000_mixer }, |
| 9701 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9702 | alc262_lenovo_3000_unsol_verbs }, |
| 9703 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9704 | .dac_nids = alc262_dac_nids, |
| 9705 | .hp_nid = 0x03, |
| 9706 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9707 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9708 | .channel_mode = alc262_modes, |
| 9709 | .input_mux = &alc262_fujitsu_capture_source, |
| 9710 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 9711 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9712 | }; |
| 9713 | |
| 9714 | static int patch_alc262(struct hda_codec *codec) |
| 9715 | { |
| 9716 | struct alc_spec *spec; |
| 9717 | int board_config; |
| 9718 | int err; |
| 9719 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9720 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9721 | if (spec == NULL) |
| 9722 | return -ENOMEM; |
| 9723 | |
| 9724 | codec->spec = spec; |
| 9725 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9726 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9727 | * under-run |
| 9728 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9729 | { |
| 9730 | int tmp; |
| 9731 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9732 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9733 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9734 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9735 | } |
| 9736 | #endif |
| 9737 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9738 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9739 | alc262_models, |
| 9740 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9741 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9742 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9743 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9744 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9745 | board_config = ALC262_AUTO; |
| 9746 | } |
| 9747 | |
| 9748 | if (board_config == ALC262_AUTO) { |
| 9749 | /* automatic parse from the BIOS config */ |
| 9750 | err = alc262_parse_auto_config(codec); |
| 9751 | if (err < 0) { |
| 9752 | alc_free(codec); |
| 9753 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9754 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9755 | printk(KERN_INFO |
| 9756 | "hda_codec: Cannot set up configuration " |
| 9757 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9758 | board_config = ALC262_BASIC; |
| 9759 | } |
| 9760 | } |
| 9761 | |
| 9762 | if (board_config != ALC262_AUTO) |
| 9763 | setup_preset(spec, &alc262_presets[board_config]); |
| 9764 | |
| 9765 | spec->stream_name_analog = "ALC262 Analog"; |
| 9766 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9767 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9768 | |
| 9769 | spec->stream_name_digital = "ALC262 Digital"; |
| 9770 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9771 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9772 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9773 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9774 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9775 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9776 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9777 | /* get type */ |
| 9778 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9779 | if (wcap != AC_WID_AUD_IN) { |
| 9780 | spec->adc_nids = alc262_adc_nids_alt; |
| 9781 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9782 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9783 | spec->mixers[spec->num_mixers] = |
| 9784 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9785 | spec->num_mixers++; |
| 9786 | } else { |
| 9787 | spec->adc_nids = alc262_adc_nids; |
| 9788 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9789 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9790 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9791 | spec->num_mixers++; |
| 9792 | } |
| 9793 | } |
| 9794 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9795 | spec->vmaster_nid = 0x0c; |
| 9796 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9797 | codec->patch_ops = alc_patch_ops; |
| 9798 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9799 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9800 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9801 | if (!spec->loopback.amplist) |
| 9802 | spec->loopback.amplist = alc262_loopbacks; |
| 9803 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9804 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9805 | return 0; |
| 9806 | } |
| 9807 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9808 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9809 | * ALC268 channel source setting (2 channel) |
| 9810 | */ |
| 9811 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9812 | #define alc268_modes alc260_modes |
| 9813 | |
| 9814 | static hda_nid_t alc268_dac_nids[2] = { |
| 9815 | /* front, hp */ |
| 9816 | 0x02, 0x03 |
| 9817 | }; |
| 9818 | |
| 9819 | static hda_nid_t alc268_adc_nids[2] = { |
| 9820 | /* ADC0-1 */ |
| 9821 | 0x08, 0x07 |
| 9822 | }; |
| 9823 | |
| 9824 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9825 | /* ADC0 */ |
| 9826 | 0x08 |
| 9827 | }; |
| 9828 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 9829 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 9830 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9831 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9832 | /* output mixer control */ |
| 9833 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9834 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9835 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9837 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9838 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9839 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9840 | { } |
| 9841 | }; |
| 9842 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 9843 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 9844 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 9845 | .ops = &snd_hda_bind_sw, |
| 9846 | .values = { |
| 9847 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 9848 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 9849 | 0 |
| 9850 | }, |
| 9851 | }; |
| 9852 | |
| 9853 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 9854 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 9855 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 9856 | { } |
| 9857 | }; |
| 9858 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9859 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9860 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9861 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9862 | { } |
| 9863 | }; |
| 9864 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9865 | /* Toshiba specific */ |
| 9866 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9867 | |
| 9868 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9869 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9870 | { } /* end */ |
| 9871 | }; |
| 9872 | |
| 9873 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9874 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9875 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9876 | .ops = &snd_hda_bind_vol, |
| 9877 | .values = { |
| 9878 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9879 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9880 | 0 |
| 9881 | }, |
| 9882 | }; |
| 9883 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9884 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9885 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9886 | { |
| 9887 | struct alc_spec *spec = codec->spec; |
| 9888 | unsigned int mute; |
| 9889 | |
| 9890 | if (force || !spec->sense_updated) { |
| 9891 | unsigned int present; |
| 9892 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9893 | AC_VERB_GET_PIN_SENSE, 0); |
| 9894 | spec->jack_present = (present & 0x80000000) != 0; |
| 9895 | spec->sense_updated = 1; |
| 9896 | } |
| 9897 | if (spec->jack_present) |
| 9898 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9899 | else /* unmute internal speaker if necessary */ |
| 9900 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9901 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9902 | HDA_AMP_MUTE, mute); |
| 9903 | } |
| 9904 | |
| 9905 | |
| 9906 | /* bind hp and internal speaker mute (with plug check) */ |
| 9907 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9908 | struct snd_ctl_elem_value *ucontrol) |
| 9909 | { |
| 9910 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9911 | long *valp = ucontrol->value.integer.value; |
| 9912 | int change; |
| 9913 | |
| 9914 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9915 | HDA_AMP_MUTE, |
| 9916 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9917 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9918 | HDA_AMP_MUTE, |
| 9919 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9920 | if (change) |
| 9921 | alc268_acer_automute(codec, 0); |
| 9922 | return change; |
| 9923 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9924 | |
| 9925 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9926 | /* output mixer control */ |
| 9927 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9928 | { |
| 9929 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9930 | .name = "Master Playback Switch", |
| 9931 | .info = snd_hda_mixer_amp_switch_info, |
| 9932 | .get = snd_hda_mixer_amp_switch_get, |
| 9933 | .put = alc268_acer_master_sw_put, |
| 9934 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9935 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9936 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9937 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9938 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9939 | { } |
| 9940 | }; |
| 9941 | |
| 9942 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 9943 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 9944 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9945 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9946 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 9947 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9948 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9949 | |
| 9950 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9951 | { } |
| 9952 | }; |
| 9953 | |
| 9954 | /* unsolicited event for HP jack sensing */ |
| 9955 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9956 | unsigned int res) |
| 9957 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9958 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9959 | return; |
| 9960 | alc268_toshiba_automute(codec); |
| 9961 | } |
| 9962 | |
| 9963 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9964 | unsigned int res) |
| 9965 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9966 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9967 | return; |
| 9968 | alc268_acer_automute(codec, 1); |
| 9969 | } |
| 9970 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9971 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9972 | { |
| 9973 | alc268_acer_automute(codec, 1); |
| 9974 | } |
| 9975 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9976 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 9977 | /* output mixer control */ |
| 9978 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9979 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9980 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9981 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9982 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9983 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9984 | { } |
| 9985 | }; |
| 9986 | |
| 9987 | static struct hda_verb alc268_dell_verbs[] = { |
| 9988 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9989 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9990 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9991 | { } |
| 9992 | }; |
| 9993 | |
| 9994 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9995 | static void alc268_dell_automute(struct hda_codec *codec) |
| 9996 | { |
| 9997 | unsigned int present; |
| 9998 | unsigned int mute; |
| 9999 | |
| 10000 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 10001 | if (present & 0x80000000) |
| 10002 | mute = HDA_AMP_MUTE; |
| 10003 | else |
| 10004 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 10005 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10006 | HDA_AMP_MUTE, mute); |
| 10007 | } |
| 10008 | |
| 10009 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 10010 | unsigned int res) |
| 10011 | { |
| 10012 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10013 | return; |
| 10014 | alc268_dell_automute(codec); |
| 10015 | } |
| 10016 | |
| 10017 | #define alc268_dell_init_hook alc268_dell_automute |
| 10018 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10019 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 10020 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10021 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10022 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10023 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10024 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10025 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10026 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 10027 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10028 | { } |
| 10029 | }; |
| 10030 | |
| 10031 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 10032 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10033 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 10034 | { } |
| 10035 | }; |
| 10036 | |
| 10037 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 10038 | { |
| 10039 | unsigned int present; |
| 10040 | |
| 10041 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 10042 | & AC_PINSENSE_PRESENCE; |
| 10043 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10044 | present ? 0 : PIN_OUT); |
| 10045 | } |
| 10046 | |
| 10047 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 10048 | { |
| 10049 | unsigned int present; |
| 10050 | |
| 10051 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10052 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10053 | snd_hda_codec_write(codec, 0x23, 0, |
| 10054 | AC_VERB_SET_CONNECT_SEL, |
| 10055 | present ? 0x00 : 0x01); |
| 10056 | } |
| 10057 | |
| 10058 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 10059 | { |
| 10060 | alc267_quanta_il1_hp_automute(codec); |
| 10061 | alc267_quanta_il1_mic_automute(codec); |
| 10062 | } |
| 10063 | |
| 10064 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 10065 | unsigned int res) |
| 10066 | { |
| 10067 | switch (res >> 26) { |
| 10068 | case ALC880_HP_EVENT: |
| 10069 | alc267_quanta_il1_hp_automute(codec); |
| 10070 | break; |
| 10071 | case ALC880_MIC_EVENT: |
| 10072 | alc267_quanta_il1_mic_automute(codec); |
| 10073 | break; |
| 10074 | } |
| 10075 | } |
| 10076 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10077 | /* |
| 10078 | * generic initialization of ADC, input mixers and output mixers |
| 10079 | */ |
| 10080 | static struct hda_verb alc268_base_init_verbs[] = { |
| 10081 | /* Unmute DAC0-1 and set vol = 0 */ |
| 10082 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10083 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10084 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10085 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10086 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10087 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10088 | |
| 10089 | /* |
| 10090 | * Set up output mixers (0x0c - 0x0e) |
| 10091 | */ |
| 10092 | /* set vol=0 to output mixers */ |
| 10093 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10094 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10095 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10096 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10097 | |
| 10098 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10099 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10100 | |
| 10101 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10102 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10103 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10104 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10105 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10106 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10107 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10108 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10109 | |
| 10110 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10111 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10112 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10113 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10114 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10115 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10116 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10117 | |
| 10118 | /* set PCBEEP vol = 0, mute connections */ |
| 10119 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10120 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10121 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10122 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10123 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 10124 | |
| 10125 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10126 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10127 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10128 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10129 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10130 | { } |
| 10131 | }; |
| 10132 | |
| 10133 | /* |
| 10134 | * generic initialization of ADC, input mixers and output mixers |
| 10135 | */ |
| 10136 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 10137 | /* set output DAC */ |
| 10138 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10139 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10140 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10141 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10142 | |
| 10143 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10144 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10145 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10146 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10147 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10148 | |
| 10149 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10150 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10151 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10152 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10153 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10154 | |
| 10155 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10156 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10157 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10158 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10159 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10160 | /* set PCBEEP vol = 0, mute connections */ |
| 10161 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10162 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10163 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10164 | |
| 10165 | { } |
| 10166 | }; |
| 10167 | |
| 10168 | #define alc268_mux_enum_info alc_mux_enum_info |
| 10169 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10170 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10171 | |
| 10172 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 10173 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10174 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10175 | { |
| 10176 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10177 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10178 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10179 | */ |
| 10180 | /* .name = "Capture Source", */ |
| 10181 | .name = "Input Source", |
| 10182 | .count = 1, |
| 10183 | .info = alc268_mux_enum_info, |
| 10184 | .get = alc268_mux_enum_get, |
| 10185 | .put = alc268_mux_enum_put, |
| 10186 | }, |
| 10187 | { } /* end */ |
| 10188 | }; |
| 10189 | |
| 10190 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 10191 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10192 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10193 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10194 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10195 | { |
| 10196 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10197 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10198 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10199 | */ |
| 10200 | /* .name = "Capture Source", */ |
| 10201 | .name = "Input Source", |
| 10202 | .count = 2, |
| 10203 | .info = alc268_mux_enum_info, |
| 10204 | .get = alc268_mux_enum_get, |
| 10205 | .put = alc268_mux_enum_put, |
| 10206 | }, |
| 10207 | { } /* end */ |
| 10208 | }; |
| 10209 | |
| 10210 | static struct hda_input_mux alc268_capture_source = { |
| 10211 | .num_items = 4, |
| 10212 | .items = { |
| 10213 | { "Mic", 0x0 }, |
| 10214 | { "Front Mic", 0x1 }, |
| 10215 | { "Line", 0x2 }, |
| 10216 | { "CD", 0x3 }, |
| 10217 | }, |
| 10218 | }; |
| 10219 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10220 | static struct hda_input_mux alc268_acer_capture_source = { |
| 10221 | .num_items = 3, |
| 10222 | .items = { |
| 10223 | { "Mic", 0x0 }, |
| 10224 | { "Internal Mic", 0x6 }, |
| 10225 | { "Line", 0x2 }, |
| 10226 | }, |
| 10227 | }; |
| 10228 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10229 | #ifdef CONFIG_SND_DEBUG |
| 10230 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10231 | /* Volume widgets */ |
| 10232 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10233 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10234 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10235 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10236 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 10237 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 10238 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 10239 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 10240 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 10241 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 10242 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 10243 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 10244 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 10245 | /* The below appears problematic on some hardwares */ |
| 10246 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10247 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10248 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10249 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 10250 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 10251 | |
| 10252 | /* Modes for retasking pin widgets */ |
| 10253 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 10254 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 10255 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 10256 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 10257 | |
| 10258 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 10259 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 10260 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 10261 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 10262 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 10263 | |
| 10264 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 10265 | * The ALC268 does not have an SPDIF input. |
| 10266 | */ |
| 10267 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 10268 | |
| 10269 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 10270 | * this output to turn on an external amplifier. |
| 10271 | */ |
| 10272 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 10273 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 10274 | |
| 10275 | { } /* end */ |
| 10276 | }; |
| 10277 | #endif |
| 10278 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10279 | /* create input playback/capture controls for the given pin */ |
| 10280 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 10281 | const char *ctlname, int idx) |
| 10282 | { |
| 10283 | char name[32]; |
| 10284 | int err; |
| 10285 | |
| 10286 | sprintf(name, "%s Playback Volume", ctlname); |
| 10287 | if (nid == 0x14) { |
| 10288 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10289 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 10290 | HDA_OUTPUT)); |
| 10291 | if (err < 0) |
| 10292 | return err; |
| 10293 | } else if (nid == 0x15) { |
| 10294 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10295 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 10296 | HDA_OUTPUT)); |
| 10297 | if (err < 0) |
| 10298 | return err; |
| 10299 | } else |
| 10300 | return -1; |
| 10301 | sprintf(name, "%s Playback Switch", ctlname); |
| 10302 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10303 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 10304 | if (err < 0) |
| 10305 | return err; |
| 10306 | return 0; |
| 10307 | } |
| 10308 | |
| 10309 | /* add playback controls from the parsed DAC table */ |
| 10310 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10311 | const struct auto_pin_cfg *cfg) |
| 10312 | { |
| 10313 | hda_nid_t nid; |
| 10314 | int err; |
| 10315 | |
| 10316 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 10317 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10318 | spec->multiout.dac_nids[0] = 2; |
| 10319 | spec->multiout.dac_nids[1] = 3; |
| 10320 | |
| 10321 | nid = cfg->line_out_pins[0]; |
| 10322 | if (nid) |
| 10323 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 10324 | |
| 10325 | nid = cfg->speaker_pins[0]; |
| 10326 | if (nid == 0x1d) { |
| 10327 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10328 | "Speaker Playback Volume", |
| 10329 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10330 | if (err < 0) |
| 10331 | return err; |
| 10332 | } |
| 10333 | nid = cfg->hp_pins[0]; |
| 10334 | if (nid) |
| 10335 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 10336 | |
| 10337 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 10338 | if (nid == 0x16) { |
| 10339 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10340 | "Mono Playback Switch", |
| 10341 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 10342 | if (err < 0) |
| 10343 | return err; |
| 10344 | } |
| 10345 | return 0; |
| 10346 | } |
| 10347 | |
| 10348 | /* create playback/capture controls for input pins */ |
| 10349 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10350 | const struct auto_pin_cfg *cfg) |
| 10351 | { |
| 10352 | struct hda_input_mux *imux = &spec->private_imux; |
| 10353 | int i, idx1; |
| 10354 | |
| 10355 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10356 | switch(cfg->input_pins[i]) { |
| 10357 | case 0x18: |
| 10358 | idx1 = 0; /* Mic 1 */ |
| 10359 | break; |
| 10360 | case 0x19: |
| 10361 | idx1 = 1; /* Mic 2 */ |
| 10362 | break; |
| 10363 | case 0x1a: |
| 10364 | idx1 = 2; /* Line In */ |
| 10365 | break; |
| 10366 | case 0x1c: |
| 10367 | idx1 = 3; /* CD */ |
| 10368 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 10369 | case 0x12: |
| 10370 | case 0x13: |
| 10371 | idx1 = 6; /* digital mics */ |
| 10372 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10373 | default: |
| 10374 | continue; |
| 10375 | } |
| 10376 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 10377 | imux->items[imux->num_items].index = idx1; |
| 10378 | imux->num_items++; |
| 10379 | } |
| 10380 | return 0; |
| 10381 | } |
| 10382 | |
| 10383 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 10384 | { |
| 10385 | struct alc_spec *spec = codec->spec; |
| 10386 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10387 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10388 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10389 | unsigned int dac_vol1, dac_vol2; |
| 10390 | |
| 10391 | if (speaker_nid) { |
| 10392 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 10393 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 10394 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10395 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10396 | AMP_IN_UNMUTE(1)); |
| 10397 | snd_hda_codec_write(codec, 0x10, 0, |
| 10398 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10399 | AMP_IN_UNMUTE(1)); |
| 10400 | } else { |
| 10401 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10402 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10403 | snd_hda_codec_write(codec, 0x10, 0, |
| 10404 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10405 | } |
| 10406 | |
| 10407 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 10408 | if (line_nid == 0x14) |
| 10409 | dac_vol2 = AMP_OUT_ZERO; |
| 10410 | else if (line_nid == 0x15) |
| 10411 | dac_vol1 = AMP_OUT_ZERO; |
| 10412 | if (hp_nid == 0x14) |
| 10413 | dac_vol2 = AMP_OUT_ZERO; |
| 10414 | else if (hp_nid == 0x15) |
| 10415 | dac_vol1 = AMP_OUT_ZERO; |
| 10416 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10417 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10418 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10419 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10420 | |
| 10421 | snd_hda_codec_write(codec, 0x02, 0, |
| 10422 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10423 | snd_hda_codec_write(codec, 0x03, 0, |
| 10424 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10425 | } |
| 10426 | |
| 10427 | /* pcm configuration: identiacal with ALC880 */ |
| 10428 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10429 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10430 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10431 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10432 | |
| 10433 | /* |
| 10434 | * BIOS auto configuration |
| 10435 | */ |
| 10436 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10437 | { |
| 10438 | struct alc_spec *spec = codec->spec; |
| 10439 | int err; |
| 10440 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10441 | |
| 10442 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10443 | alc268_ignore); |
| 10444 | if (err < 0) |
| 10445 | return err; |
| 10446 | if (!spec->autocfg.line_outs) |
| 10447 | return 0; /* can't find valid BIOS pin config */ |
| 10448 | |
| 10449 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10450 | if (err < 0) |
| 10451 | return err; |
| 10452 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10453 | if (err < 0) |
| 10454 | return err; |
| 10455 | |
| 10456 | spec->multiout.max_channels = 2; |
| 10457 | |
| 10458 | /* digital only support output */ |
| 10459 | if (spec->autocfg.dig_out_pin) |
| 10460 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10461 | |
| 10462 | if (spec->kctl_alloc) |
| 10463 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10464 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10465 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 10466 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 10467 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10468 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10469 | spec->num_mux_defs = 1; |
| 10470 | spec->input_mux = &spec->private_imux; |
| 10471 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10472 | err = alc_auto_add_mic_boost(codec); |
| 10473 | if (err < 0) |
| 10474 | return err; |
| 10475 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10476 | return 1; |
| 10477 | } |
| 10478 | |
| 10479 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10480 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10481 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10482 | |
| 10483 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10484 | static void alc268_auto_init(struct hda_codec *codec) |
| 10485 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10486 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10487 | alc268_auto_init_multi_out(codec); |
| 10488 | alc268_auto_init_hp_out(codec); |
| 10489 | alc268_auto_init_mono_speaker_out(codec); |
| 10490 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10491 | if (spec->unsol_event) |
| 10492 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10493 | } |
| 10494 | |
| 10495 | /* |
| 10496 | * configuration and preset |
| 10497 | */ |
| 10498 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10499 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10500 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10501 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10502 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10503 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10504 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10505 | #ifdef CONFIG_SND_DEBUG |
| 10506 | [ALC268_TEST] = "test", |
| 10507 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10508 | [ALC268_AUTO] = "auto", |
| 10509 | }; |
| 10510 | |
| 10511 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 10512 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10513 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10514 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10515 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10516 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10517 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10518 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10519 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10520 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10521 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 10522 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10523 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10524 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10525 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10526 | {} |
| 10527 | }; |
| 10528 | |
| 10529 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10530 | [ALC267_QUANTA_IL1] = { |
| 10531 | .mixers = { alc267_quanta_il1_mixer }, |
| 10532 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10533 | alc267_quanta_il1_verbs }, |
| 10534 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10535 | .dac_nids = alc268_dac_nids, |
| 10536 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10537 | .adc_nids = alc268_adc_nids_alt, |
| 10538 | .hp_nid = 0x03, |
| 10539 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10540 | .channel_mode = alc268_modes, |
| 10541 | .input_mux = &alc268_capture_source, |
| 10542 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 10543 | .init_hook = alc267_quanta_il1_automute, |
| 10544 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10545 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10546 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10547 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10548 | .init_verbs = { alc268_base_init_verbs }, |
| 10549 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10550 | .dac_nids = alc268_dac_nids, |
| 10551 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10552 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10553 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10554 | .hp_nid = 0x03, |
| 10555 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10556 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10557 | .channel_mode = alc268_modes, |
| 10558 | .input_mux = &alc268_capture_source, |
| 10559 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10560 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10561 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10562 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10563 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10564 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10565 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10566 | .dac_nids = alc268_dac_nids, |
| 10567 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10568 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10569 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10570 | .hp_nid = 0x03, |
| 10571 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10572 | .channel_mode = alc268_modes, |
| 10573 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10574 | .unsol_event = alc268_toshiba_unsol_event, |
| 10575 | .init_hook = alc268_toshiba_automute, |
| 10576 | }, |
| 10577 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10578 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 10579 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10580 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10581 | alc268_acer_verbs }, |
| 10582 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10583 | .dac_nids = alc268_dac_nids, |
| 10584 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10585 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10586 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10587 | .hp_nid = 0x02, |
| 10588 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10589 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10590 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10591 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10592 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10593 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10594 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10595 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10596 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10597 | alc268_dell_verbs }, |
| 10598 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10599 | .dac_nids = alc268_dac_nids, |
| 10600 | .hp_nid = 0x02, |
| 10601 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10602 | .channel_mode = alc268_modes, |
| 10603 | .unsol_event = alc268_dell_unsol_event, |
| 10604 | .init_hook = alc268_dell_init_hook, |
| 10605 | .input_mux = &alc268_capture_source, |
| 10606 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10607 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10608 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10609 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10610 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10611 | alc268_toshiba_verbs }, |
| 10612 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10613 | .dac_nids = alc268_dac_nids, |
| 10614 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10615 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10616 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10617 | .hp_nid = 0x03, |
| 10618 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10619 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10620 | .channel_mode = alc268_modes, |
| 10621 | .input_mux = &alc268_capture_source, |
| 10622 | .unsol_event = alc268_toshiba_unsol_event, |
| 10623 | .init_hook = alc268_toshiba_automute |
| 10624 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10625 | #ifdef CONFIG_SND_DEBUG |
| 10626 | [ALC268_TEST] = { |
| 10627 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10628 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10629 | alc268_volume_init_verbs }, |
| 10630 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10631 | .dac_nids = alc268_dac_nids, |
| 10632 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10633 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10634 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10635 | .hp_nid = 0x03, |
| 10636 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10637 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10638 | .channel_mode = alc268_modes, |
| 10639 | .input_mux = &alc268_capture_source, |
| 10640 | }, |
| 10641 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10642 | }; |
| 10643 | |
| 10644 | static int patch_alc268(struct hda_codec *codec) |
| 10645 | { |
| 10646 | struct alc_spec *spec; |
| 10647 | int board_config; |
| 10648 | int err; |
| 10649 | |
| 10650 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10651 | if (spec == NULL) |
| 10652 | return -ENOMEM; |
| 10653 | |
| 10654 | codec->spec = spec; |
| 10655 | |
| 10656 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10657 | alc268_models, |
| 10658 | alc268_cfg_tbl); |
| 10659 | |
| 10660 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10661 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10662 | "trying auto-probe from BIOS...\n"); |
| 10663 | board_config = ALC268_AUTO; |
| 10664 | } |
| 10665 | |
| 10666 | if (board_config == ALC268_AUTO) { |
| 10667 | /* automatic parse from the BIOS config */ |
| 10668 | err = alc268_parse_auto_config(codec); |
| 10669 | if (err < 0) { |
| 10670 | alc_free(codec); |
| 10671 | return err; |
| 10672 | } else if (!err) { |
| 10673 | printk(KERN_INFO |
| 10674 | "hda_codec: Cannot set up configuration " |
| 10675 | "from BIOS. Using base mode...\n"); |
| 10676 | board_config = ALC268_3ST; |
| 10677 | } |
| 10678 | } |
| 10679 | |
| 10680 | if (board_config != ALC268_AUTO) |
| 10681 | setup_preset(spec, &alc268_presets[board_config]); |
| 10682 | |
| 10683 | spec->stream_name_analog = "ALC268 Analog"; |
| 10684 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10685 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10686 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10687 | |
| 10688 | spec->stream_name_digital = "ALC268 Digital"; |
| 10689 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10690 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10691 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 10692 | /* override the amp caps for beep generator */ |
| 10693 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 10694 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 10695 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 10696 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 10697 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 10698 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10699 | if (!spec->adc_nids && spec->input_mux) { |
| 10700 | /* check whether NID 0x07 is valid */ |
| 10701 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10702 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10703 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10704 | /* get type */ |
| 10705 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 10706 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10707 | spec->adc_nids = alc268_adc_nids_alt; |
| 10708 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10709 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10710 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10711 | spec->num_mixers++; |
| 10712 | } else { |
| 10713 | spec->adc_nids = alc268_adc_nids; |
| 10714 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10715 | spec->mixers[spec->num_mixers] = |
| 10716 | alc268_capture_mixer; |
| 10717 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10718 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10719 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10720 | /* set default input source */ |
| 10721 | for (i = 0; i < spec->num_adc_nids; i++) |
| 10722 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 10723 | 0, AC_VERB_SET_CONNECT_SEL, |
| 10724 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10725 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10726 | |
| 10727 | spec->vmaster_nid = 0x02; |
| 10728 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10729 | codec->patch_ops = alc_patch_ops; |
| 10730 | if (board_config == ALC268_AUTO) |
| 10731 | spec->init_hook = alc268_auto_init; |
| 10732 | |
| 10733 | return 0; |
| 10734 | } |
| 10735 | |
| 10736 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10737 | * ALC269 channel source setting (2 channel) |
| 10738 | */ |
| 10739 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10740 | |
| 10741 | #define alc269_dac_nids alc260_dac_nids |
| 10742 | |
| 10743 | static hda_nid_t alc269_adc_nids[1] = { |
| 10744 | /* ADC1 */ |
| 10745 | 0x07, |
| 10746 | }; |
| 10747 | |
| 10748 | #define alc269_modes alc260_modes |
| 10749 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10750 | |
| 10751 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10752 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10753 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10754 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10755 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10756 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10757 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10758 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10759 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10760 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10761 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10762 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10763 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10764 | { } /* end */ |
| 10765 | }; |
| 10766 | |
| 10767 | /* capture mixer elements */ |
| 10768 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10769 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10770 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10771 | { |
| 10772 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10773 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10774 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10775 | */ |
| 10776 | /* .name = "Capture Source", */ |
| 10777 | .name = "Input Source", |
| 10778 | .count = 1, |
| 10779 | .info = alc_mux_enum_info, |
| 10780 | .get = alc_mux_enum_get, |
| 10781 | .put = alc_mux_enum_put, |
| 10782 | }, |
| 10783 | { } /* end */ |
| 10784 | }; |
| 10785 | |
| 10786 | /* |
| 10787 | * generic initialization of ADC, input mixers and output mixers |
| 10788 | */ |
| 10789 | static struct hda_verb alc269_init_verbs[] = { |
| 10790 | /* |
| 10791 | * Unmute ADC0 and set the default input to mic-in |
| 10792 | */ |
| 10793 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10794 | |
| 10795 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 10796 | * analog-loopback mixer widget |
| 10797 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10798 | * front panel mic (mic 2) |
| 10799 | */ |
| 10800 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10801 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10802 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10803 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10804 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10805 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10806 | |
| 10807 | /* |
| 10808 | * Set up output mixers (0x0c - 0x0e) |
| 10809 | */ |
| 10810 | /* set vol=0 to output mixers */ |
| 10811 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10812 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10813 | |
| 10814 | /* set up input amps for analog loopback */ |
| 10815 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10816 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10818 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10819 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10820 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10821 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10822 | |
| 10823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10824 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10825 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10826 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10827 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10828 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10829 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10830 | |
| 10831 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10832 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10833 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10834 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10835 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10836 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10837 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10838 | |
| 10839 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10840 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10841 | |
| 10842 | /* FIXME: use matrix-type input source selection */ |
| 10843 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10844 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10845 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10846 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10847 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10848 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10849 | |
| 10850 | /* set EAPD */ |
| 10851 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10852 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10853 | { } |
| 10854 | }; |
| 10855 | |
| 10856 | /* add playback controls from the parsed DAC table */ |
| 10857 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10858 | const struct auto_pin_cfg *cfg) |
| 10859 | { |
| 10860 | hda_nid_t nid; |
| 10861 | int err; |
| 10862 | |
| 10863 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10864 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10865 | spec->multiout.dac_nids[0] = 2; |
| 10866 | |
| 10867 | nid = cfg->line_out_pins[0]; |
| 10868 | if (nid) { |
| 10869 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10870 | "Front Playback Volume", |
| 10871 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10872 | if (err < 0) |
| 10873 | return err; |
| 10874 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10875 | "Front Playback Switch", |
| 10876 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10877 | if (err < 0) |
| 10878 | return err; |
| 10879 | } |
| 10880 | |
| 10881 | nid = cfg->speaker_pins[0]; |
| 10882 | if (nid) { |
| 10883 | if (!cfg->line_out_pins[0]) { |
| 10884 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10885 | "Speaker Playback Volume", |
| 10886 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10887 | HDA_OUTPUT)); |
| 10888 | if (err < 0) |
| 10889 | return err; |
| 10890 | } |
| 10891 | if (nid == 0x16) { |
| 10892 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10893 | "Speaker Playback Switch", |
| 10894 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10895 | HDA_OUTPUT)); |
| 10896 | if (err < 0) |
| 10897 | return err; |
| 10898 | } else { |
| 10899 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10900 | "Speaker Playback Switch", |
| 10901 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10902 | HDA_OUTPUT)); |
| 10903 | if (err < 0) |
| 10904 | return err; |
| 10905 | } |
| 10906 | } |
| 10907 | nid = cfg->hp_pins[0]; |
| 10908 | if (nid) { |
| 10909 | /* spec->multiout.hp_nid = 2; */ |
| 10910 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10911 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10912 | "Headphone Playback Volume", |
| 10913 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10914 | HDA_OUTPUT)); |
| 10915 | if (err < 0) |
| 10916 | return err; |
| 10917 | } |
| 10918 | if (nid == 0x16) { |
| 10919 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10920 | "Headphone Playback Switch", |
| 10921 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10922 | HDA_OUTPUT)); |
| 10923 | if (err < 0) |
| 10924 | return err; |
| 10925 | } else { |
| 10926 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10927 | "Headphone Playback Switch", |
| 10928 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10929 | HDA_OUTPUT)); |
| 10930 | if (err < 0) |
| 10931 | return err; |
| 10932 | } |
| 10933 | } |
| 10934 | return 0; |
| 10935 | } |
| 10936 | |
| 10937 | #define alc269_auto_create_analog_input_ctls \ |
| 10938 | alc880_auto_create_analog_input_ctls |
| 10939 | |
| 10940 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10941 | #define alc269_loopbacks alc880_loopbacks |
| 10942 | #endif |
| 10943 | |
| 10944 | /* pcm configuration: identiacal with ALC880 */ |
| 10945 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10946 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10947 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10948 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10949 | |
| 10950 | /* |
| 10951 | * BIOS auto configuration |
| 10952 | */ |
| 10953 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10954 | { |
| 10955 | struct alc_spec *spec = codec->spec; |
| 10956 | int err; |
| 10957 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10958 | |
| 10959 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10960 | alc269_ignore); |
| 10961 | if (err < 0) |
| 10962 | return err; |
| 10963 | |
| 10964 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10965 | if (err < 0) |
| 10966 | return err; |
| 10967 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10968 | if (err < 0) |
| 10969 | return err; |
| 10970 | |
| 10971 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10972 | |
| 10973 | if (spec->autocfg.dig_out_pin) |
| 10974 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10975 | |
| 10976 | if (spec->kctl_alloc) |
| 10977 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10978 | |
| 10979 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10980 | spec->num_mux_defs = 1; |
| 10981 | spec->input_mux = &spec->private_imux; |
| 10982 | |
| 10983 | err = alc_auto_add_mic_boost(codec); |
| 10984 | if (err < 0) |
| 10985 | return err; |
| 10986 | |
| 10987 | return 1; |
| 10988 | } |
| 10989 | |
| 10990 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10991 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10992 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10993 | |
| 10994 | |
| 10995 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10996 | static void alc269_auto_init(struct hda_codec *codec) |
| 10997 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10998 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10999 | alc269_auto_init_multi_out(codec); |
| 11000 | alc269_auto_init_hp_out(codec); |
| 11001 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11002 | if (spec->unsol_event) |
| 11003 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11004 | } |
| 11005 | |
| 11006 | /* |
| 11007 | * configuration and preset |
| 11008 | */ |
| 11009 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 11010 | [ALC269_BASIC] = "basic", |
| 11011 | }; |
| 11012 | |
| 11013 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 11014 | {} |
| 11015 | }; |
| 11016 | |
| 11017 | static struct alc_config_preset alc269_presets[] = { |
| 11018 | [ALC269_BASIC] = { |
| 11019 | .mixers = { alc269_base_mixer }, |
| 11020 | .init_verbs = { alc269_init_verbs }, |
| 11021 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11022 | .dac_nids = alc269_dac_nids, |
| 11023 | .hp_nid = 0x03, |
| 11024 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11025 | .channel_mode = alc269_modes, |
| 11026 | .input_mux = &alc269_capture_source, |
| 11027 | }, |
| 11028 | }; |
| 11029 | |
| 11030 | static int patch_alc269(struct hda_codec *codec) |
| 11031 | { |
| 11032 | struct alc_spec *spec; |
| 11033 | int board_config; |
| 11034 | int err; |
| 11035 | |
| 11036 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11037 | if (spec == NULL) |
| 11038 | return -ENOMEM; |
| 11039 | |
| 11040 | codec->spec = spec; |
| 11041 | |
| 11042 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 11043 | alc269_models, |
| 11044 | alc269_cfg_tbl); |
| 11045 | |
| 11046 | if (board_config < 0) { |
| 11047 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 11048 | "trying auto-probe from BIOS...\n"); |
| 11049 | board_config = ALC269_AUTO; |
| 11050 | } |
| 11051 | |
| 11052 | if (board_config == ALC269_AUTO) { |
| 11053 | /* automatic parse from the BIOS config */ |
| 11054 | err = alc269_parse_auto_config(codec); |
| 11055 | if (err < 0) { |
| 11056 | alc_free(codec); |
| 11057 | return err; |
| 11058 | } else if (!err) { |
| 11059 | printk(KERN_INFO |
| 11060 | "hda_codec: Cannot set up configuration " |
| 11061 | "from BIOS. Using base mode...\n"); |
| 11062 | board_config = ALC269_BASIC; |
| 11063 | } |
| 11064 | } |
| 11065 | |
| 11066 | if (board_config != ALC269_AUTO) |
| 11067 | setup_preset(spec, &alc269_presets[board_config]); |
| 11068 | |
| 11069 | spec->stream_name_analog = "ALC269 Analog"; |
| 11070 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 11071 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 11072 | |
| 11073 | spec->stream_name_digital = "ALC269 Digital"; |
| 11074 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 11075 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 11076 | |
| 11077 | spec->adc_nids = alc269_adc_nids; |
| 11078 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 11079 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 11080 | spec->num_mixers++; |
| 11081 | |
| 11082 | codec->patch_ops = alc_patch_ops; |
| 11083 | if (board_config == ALC269_AUTO) |
| 11084 | spec->init_hook = alc269_auto_init; |
| 11085 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11086 | if (!spec->loopback.amplist) |
| 11087 | spec->loopback.amplist = alc269_loopbacks; |
| 11088 | #endif |
| 11089 | |
| 11090 | return 0; |
| 11091 | } |
| 11092 | |
| 11093 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11094 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 11095 | */ |
| 11096 | |
| 11097 | /* |
| 11098 | * set the path ways for 2 channel output |
| 11099 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 11100 | */ |
| 11101 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 11102 | /* set pin widget 1Ah (line in) for input */ |
| 11103 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11104 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11105 | * the vref |
| 11106 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11107 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11108 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11109 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11110 | #if 0 |
| 11111 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11112 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11113 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11114 | { } /* end */ |
| 11115 | }; |
| 11116 | /* |
| 11117 | * 6ch mode |
| 11118 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 11119 | */ |
| 11120 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 11121 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11122 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11123 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11124 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11125 | |
| 11126 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11127 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11128 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11129 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11130 | #if 0 |
| 11131 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11132 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11133 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11134 | { } /* end */ |
| 11135 | }; |
| 11136 | |
| 11137 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 11138 | { 2, alc861_threestack_ch2_init }, |
| 11139 | { 6, alc861_threestack_ch6_init }, |
| 11140 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11141 | /* Set mic1 as input and unmute the mixer */ |
| 11142 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 11143 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11144 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11145 | { } /* end */ |
| 11146 | }; |
| 11147 | /* Set mic1 as output and mute mixer */ |
| 11148 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 11149 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11150 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11151 | { } /* end */ |
| 11152 | }; |
| 11153 | |
| 11154 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 11155 | { 2, alc861_uniwill_m31_ch2_init }, |
| 11156 | { 4, alc861_uniwill_m31_ch4_init }, |
| 11157 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11158 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11159 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 11160 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 11161 | /* set pin widget 1Ah (line in) for input */ |
| 11162 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11163 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11164 | * the vref |
| 11165 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11166 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11167 | |
| 11168 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11169 | #if 0 |
| 11170 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11171 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11172 | #endif |
| 11173 | { } /* end */ |
| 11174 | }; |
| 11175 | /* Set mic1 nad line-in as output and mute mixer */ |
| 11176 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 11177 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11178 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11179 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11180 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11181 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11182 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11183 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11184 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11185 | |
| 11186 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11187 | #if 0 |
| 11188 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11189 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11190 | #endif |
| 11191 | { } /* end */ |
| 11192 | }; |
| 11193 | |
| 11194 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 11195 | { 2, alc861_asus_ch2_init }, |
| 11196 | { 6, alc861_asus_ch6_init }, |
| 11197 | }; |
| 11198 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11199 | /* patch-ALC861 */ |
| 11200 | |
| 11201 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 11202 | /* output mixer control */ |
| 11203 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11204 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11205 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11206 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11207 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11208 | |
| 11209 | /*Input mixer control */ |
| 11210 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11211 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11212 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11213 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11214 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11215 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11216 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11217 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11218 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11219 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11220 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11221 | /* Capture mixer control */ |
| 11222 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11223 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11224 | { |
| 11225 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11226 | .name = "Capture Source", |
| 11227 | .count = 1, |
| 11228 | .info = alc_mux_enum_info, |
| 11229 | .get = alc_mux_enum_get, |
| 11230 | .put = alc_mux_enum_put, |
| 11231 | }, |
| 11232 | { } /* end */ |
| 11233 | }; |
| 11234 | |
| 11235 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 11236 | /* output mixer control */ |
| 11237 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11238 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11239 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11240 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11241 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11242 | |
| 11243 | /* Input mixer control */ |
| 11244 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11245 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11246 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11247 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11248 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11249 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11250 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11251 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11252 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11253 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11254 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11255 | /* Capture mixer control */ |
| 11256 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11257 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11258 | { |
| 11259 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11260 | .name = "Capture Source", |
| 11261 | .count = 1, |
| 11262 | .info = alc_mux_enum_info, |
| 11263 | .get = alc_mux_enum_get, |
| 11264 | .put = alc_mux_enum_put, |
| 11265 | }, |
| 11266 | { |
| 11267 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11268 | .name = "Channel Mode", |
| 11269 | .info = alc_ch_mode_info, |
| 11270 | .get = alc_ch_mode_get, |
| 11271 | .put = alc_ch_mode_put, |
| 11272 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 11273 | }, |
| 11274 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11275 | }; |
| 11276 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11277 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11278 | /* output mixer control */ |
| 11279 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11280 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11281 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11282 | |
| 11283 | /*Capture mixer control */ |
| 11284 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11285 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11286 | { |
| 11287 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11288 | .name = "Capture Source", |
| 11289 | .count = 1, |
| 11290 | .info = alc_mux_enum_info, |
| 11291 | .get = alc_mux_enum_get, |
| 11292 | .put = alc_mux_enum_put, |
| 11293 | }, |
| 11294 | |
| 11295 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11296 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11297 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11298 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 11299 | /* output mixer control */ |
| 11300 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11301 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11302 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11303 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11304 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11305 | |
| 11306 | /* Input mixer control */ |
| 11307 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11308 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11309 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11310 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11311 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11312 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11313 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11314 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11315 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11316 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11317 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11318 | /* Capture mixer control */ |
| 11319 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11320 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11321 | { |
| 11322 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11323 | .name = "Capture Source", |
| 11324 | .count = 1, |
| 11325 | .info = alc_mux_enum_info, |
| 11326 | .get = alc_mux_enum_get, |
| 11327 | .put = alc_mux_enum_put, |
| 11328 | }, |
| 11329 | { |
| 11330 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11331 | .name = "Channel Mode", |
| 11332 | .info = alc_ch_mode_info, |
| 11333 | .get = alc_ch_mode_get, |
| 11334 | .put = alc_ch_mode_put, |
| 11335 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11336 | }, |
| 11337 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11338 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11339 | |
| 11340 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 11341 | /* output mixer control */ |
| 11342 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11343 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11344 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11345 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11346 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11347 | |
| 11348 | /* Input mixer control */ |
| 11349 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11350 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11351 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11352 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11353 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11354 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11355 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11356 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11357 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11358 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 11359 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11360 | /* Capture mixer control */ |
| 11361 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11362 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11363 | { |
| 11364 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11365 | .name = "Capture Source", |
| 11366 | .count = 1, |
| 11367 | .info = alc_mux_enum_info, |
| 11368 | .get = alc_mux_enum_get, |
| 11369 | .put = alc_mux_enum_put, |
| 11370 | }, |
| 11371 | { |
| 11372 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11373 | .name = "Channel Mode", |
| 11374 | .info = alc_ch_mode_info, |
| 11375 | .get = alc_ch_mode_get, |
| 11376 | .put = alc_ch_mode_put, |
| 11377 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 11378 | }, |
| 11379 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11380 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11381 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11382 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11383 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11384 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11385 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11386 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11387 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11388 | { } |
| 11389 | }; |
| 11390 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11391 | /* |
| 11392 | * generic initialization of ADC, input mixers and output mixers |
| 11393 | */ |
| 11394 | static struct hda_verb alc861_base_init_verbs[] = { |
| 11395 | /* |
| 11396 | * Unmute ADC0 and set the default input to mic-in |
| 11397 | */ |
| 11398 | /* port-A for surround (rear panel) */ |
| 11399 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11400 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11401 | /* port-B for mic-in (rear panel) with vref */ |
| 11402 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11403 | /* port-C for line-in (rear panel) */ |
| 11404 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11405 | /* port-D for Front */ |
| 11406 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11407 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11408 | /* port-E for HP out (front panel) */ |
| 11409 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11410 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11411 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11412 | /* port-F for mic-in (front panel) with vref */ |
| 11413 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11414 | /* port-G for CLFE (rear panel) */ |
| 11415 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11416 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11417 | /* port-H for side (rear panel) */ |
| 11418 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11419 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11420 | /* CD-in */ |
| 11421 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11422 | /* route front mic to ADC1*/ |
| 11423 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11424 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11425 | |
| 11426 | /* Unmute DAC0~3 & spdif out*/ |
| 11427 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11428 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11429 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11430 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11431 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11432 | |
| 11433 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11434 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11435 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11436 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11437 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11438 | |
| 11439 | /* Unmute Stereo Mixer 15 */ |
| 11440 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11441 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11442 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11443 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11444 | |
| 11445 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11446 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11447 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11448 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11449 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11450 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11451 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11452 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11453 | /* hp used DAC 3 (Front) */ |
| 11454 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11455 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11456 | |
| 11457 | { } |
| 11458 | }; |
| 11459 | |
| 11460 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 11461 | /* |
| 11462 | * Unmute ADC0 and set the default input to mic-in |
| 11463 | */ |
| 11464 | /* port-A for surround (rear panel) */ |
| 11465 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11466 | /* port-B for mic-in (rear panel) with vref */ |
| 11467 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11468 | /* port-C for line-in (rear panel) */ |
| 11469 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11470 | /* port-D for Front */ |
| 11471 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11472 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11473 | /* port-E for HP out (front panel) */ |
| 11474 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11475 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11476 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11477 | /* port-F for mic-in (front panel) with vref */ |
| 11478 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11479 | /* port-G for CLFE (rear panel) */ |
| 11480 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11481 | /* port-H for side (rear panel) */ |
| 11482 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11483 | /* CD-in */ |
| 11484 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11485 | /* route front mic to ADC1*/ |
| 11486 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11487 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11488 | /* Unmute DAC0~3 & spdif out*/ |
| 11489 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11490 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11491 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11492 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11493 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11494 | |
| 11495 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11496 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11497 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11498 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11499 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11500 | |
| 11501 | /* Unmute Stereo Mixer 15 */ |
| 11502 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11503 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11504 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11505 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11506 | |
| 11507 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11508 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11509 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11510 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11511 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11512 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11513 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11514 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11515 | /* hp used DAC 3 (Front) */ |
| 11516 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11517 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11518 | { } |
| 11519 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11520 | |
| 11521 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11522 | /* |
| 11523 | * Unmute ADC0 and set the default input to mic-in |
| 11524 | */ |
| 11525 | /* port-A for surround (rear panel) */ |
| 11526 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11527 | /* port-B for mic-in (rear panel) with vref */ |
| 11528 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11529 | /* port-C for line-in (rear panel) */ |
| 11530 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11531 | /* port-D for Front */ |
| 11532 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11533 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11534 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11535 | /* this has to be set to VREF80 */ |
| 11536 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11537 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11538 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11539 | /* port-F for mic-in (front panel) with vref */ |
| 11540 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11541 | /* port-G for CLFE (rear panel) */ |
| 11542 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11543 | /* port-H for side (rear panel) */ |
| 11544 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11545 | /* CD-in */ |
| 11546 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11547 | /* route front mic to ADC1*/ |
| 11548 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11549 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11550 | /* Unmute DAC0~3 & spdif out*/ |
| 11551 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11552 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11553 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11554 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11555 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11556 | |
| 11557 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11558 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11559 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11560 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11561 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11562 | |
| 11563 | /* Unmute Stereo Mixer 15 */ |
| 11564 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11565 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11566 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11567 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11568 | |
| 11569 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11570 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11571 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11572 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11573 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11574 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11575 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11576 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11577 | /* hp used DAC 3 (Front) */ |
| 11578 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11579 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11580 | { } |
| 11581 | }; |
| 11582 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11583 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 11584 | /* |
| 11585 | * Unmute ADC0 and set the default input to mic-in |
| 11586 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11587 | /* port-A for surround (rear panel) |
| 11588 | * according to codec#0 this is the HP jack |
| 11589 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11590 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 11591 | /* route front PCM to HP */ |
| 11592 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11593 | /* port-B for mic-in (rear panel) with vref */ |
| 11594 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11595 | /* port-C for line-in (rear panel) */ |
| 11596 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11597 | /* port-D for Front */ |
| 11598 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11599 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11600 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11601 | /* this has to be set to VREF80 */ |
| 11602 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11603 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11604 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11605 | /* port-F for mic-in (front panel) with vref */ |
| 11606 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11607 | /* port-G for CLFE (rear panel) */ |
| 11608 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11609 | /* port-H for side (rear panel) */ |
| 11610 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11611 | /* CD-in */ |
| 11612 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11613 | /* route front mic to ADC1*/ |
| 11614 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11615 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11616 | /* Unmute DAC0~3 & spdif out*/ |
| 11617 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11618 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11619 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11620 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11621 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11622 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11623 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11624 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11625 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11626 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11627 | |
| 11628 | /* Unmute Stereo Mixer 15 */ |
| 11629 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11630 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11631 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11632 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11633 | |
| 11634 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11635 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11636 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11637 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11638 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11639 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11640 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11641 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11642 | /* hp used DAC 3 (Front) */ |
| 11643 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11644 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11645 | { } |
| 11646 | }; |
| 11647 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11648 | /* additional init verbs for ASUS laptops */ |
| 11649 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 11650 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 11651 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 11652 | { } |
| 11653 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11654 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11655 | /* |
| 11656 | * generic initialization of ADC, input mixers and output mixers |
| 11657 | */ |
| 11658 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 11659 | /* |
| 11660 | * Unmute ADC0 and set the default input to mic-in |
| 11661 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11662 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11663 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11664 | |
| 11665 | /* Unmute DAC0~3 & spdif out*/ |
| 11666 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11667 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11668 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11669 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11670 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11671 | |
| 11672 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11673 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11674 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11675 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11676 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11677 | |
| 11678 | /* Unmute Stereo Mixer 15 */ |
| 11679 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11680 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11681 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11682 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 11683 | |
| 11684 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11685 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11686 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11687 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11688 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11689 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11690 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11691 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11692 | |
| 11693 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11694 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11695 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11696 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11697 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11698 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11699 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11700 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11701 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11702 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11703 | |
| 11704 | { } |
| 11705 | }; |
| 11706 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11707 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11708 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11709 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11710 | { } |
| 11711 | }; |
| 11712 | |
| 11713 | /* toggle speaker-output according to the hp-jack state */ |
| 11714 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11715 | { |
| 11716 | unsigned int present; |
| 11717 | |
| 11718 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11719 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11720 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11721 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11722 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11723 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11724 | } |
| 11725 | |
| 11726 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11727 | unsigned int res) |
| 11728 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11729 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11730 | alc861_toshiba_automute(codec); |
| 11731 | } |
| 11732 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11733 | /* pcm configuration: identiacal with ALC880 */ |
| 11734 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11735 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11736 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11737 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11738 | |
| 11739 | |
| 11740 | #define ALC861_DIGOUT_NID 0x07 |
| 11741 | |
| 11742 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11743 | { 8, NULL } |
| 11744 | }; |
| 11745 | |
| 11746 | static hda_nid_t alc861_dac_nids[4] = { |
| 11747 | /* front, surround, clfe, side */ |
| 11748 | 0x03, 0x06, 0x05, 0x04 |
| 11749 | }; |
| 11750 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11751 | static hda_nid_t alc660_dac_nids[3] = { |
| 11752 | /* front, clfe, surround */ |
| 11753 | 0x03, 0x05, 0x06 |
| 11754 | }; |
| 11755 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11756 | static hda_nid_t alc861_adc_nids[1] = { |
| 11757 | /* ADC0-2 */ |
| 11758 | 0x08, |
| 11759 | }; |
| 11760 | |
| 11761 | static struct hda_input_mux alc861_capture_source = { |
| 11762 | .num_items = 5, |
| 11763 | .items = { |
| 11764 | { "Mic", 0x0 }, |
| 11765 | { "Front Mic", 0x3 }, |
| 11766 | { "Line", 0x1 }, |
| 11767 | { "CD", 0x4 }, |
| 11768 | { "Mixer", 0x5 }, |
| 11769 | }, |
| 11770 | }; |
| 11771 | |
| 11772 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11773 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11774 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11775 | { |
| 11776 | int i; |
| 11777 | hda_nid_t nid; |
| 11778 | |
| 11779 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11780 | for (i = 0; i < cfg->line_outs; i++) { |
| 11781 | nid = cfg->line_out_pins[i]; |
| 11782 | if (nid) { |
| 11783 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11784 | continue; |
| 11785 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11786 | } |
| 11787 | } |
| 11788 | spec->multiout.num_dacs = cfg->line_outs; |
| 11789 | return 0; |
| 11790 | } |
| 11791 | |
| 11792 | /* add playback controls from the parsed DAC table */ |
| 11793 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11794 | const struct auto_pin_cfg *cfg) |
| 11795 | { |
| 11796 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11797 | static const char *chname[4] = { |
| 11798 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11799 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11800 | hda_nid_t nid; |
| 11801 | int i, idx, err; |
| 11802 | |
| 11803 | for (i = 0; i < cfg->line_outs; i++) { |
| 11804 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11805 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11806 | continue; |
| 11807 | if (nid == 0x05) { |
| 11808 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11809 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11810 | "Center Playback Switch", |
| 11811 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11812 | HDA_OUTPUT)); |
| 11813 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11814 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11815 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11816 | "LFE Playback Switch", |
| 11817 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11818 | HDA_OUTPUT)); |
| 11819 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11820 | return err; |
| 11821 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11822 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11823 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11824 | if (nid == alc861_dac_nids[idx]) |
| 11825 | break; |
| 11826 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11827 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11828 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11829 | HDA_OUTPUT)); |
| 11830 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11831 | return err; |
| 11832 | } |
| 11833 | } |
| 11834 | return 0; |
| 11835 | } |
| 11836 | |
| 11837 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11838 | { |
| 11839 | int err; |
| 11840 | hda_nid_t nid; |
| 11841 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11842 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11843 | return 0; |
| 11844 | |
| 11845 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11846 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11847 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11848 | "Headphone Playback Switch", |
| 11849 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11850 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11851 | return err; |
| 11852 | spec->multiout.hp_nid = nid; |
| 11853 | } |
| 11854 | return 0; |
| 11855 | } |
| 11856 | |
| 11857 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11858 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11859 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11860 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11861 | struct hda_input_mux *imux = &spec->private_imux; |
| 11862 | int i, err, idx, idx1; |
| 11863 | |
| 11864 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11865 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11866 | case 0x0c: |
| 11867 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11868 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11869 | break; |
| 11870 | case 0x0f: |
| 11871 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11872 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11873 | break; |
| 11874 | case 0x0d: |
| 11875 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11876 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11877 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11878 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11879 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11880 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11881 | break; |
| 11882 | case 0x11: |
| 11883 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11884 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11885 | break; |
| 11886 | default: |
| 11887 | continue; |
| 11888 | } |
| 11889 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11890 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11891 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11892 | if (err < 0) |
| 11893 | return err; |
| 11894 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11895 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11896 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11897 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11898 | } |
| 11899 | return 0; |
| 11900 | } |
| 11901 | |
| 11902 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11903 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11904 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11905 | |
| 11906 | { |
| 11907 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11908 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11909 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11910 | */ |
| 11911 | /* .name = "Capture Source", */ |
| 11912 | .name = "Input Source", |
| 11913 | .count = 1, |
| 11914 | .info = alc_mux_enum_info, |
| 11915 | .get = alc_mux_enum_get, |
| 11916 | .put = alc_mux_enum_put, |
| 11917 | }, |
| 11918 | { } /* end */ |
| 11919 | }; |
| 11920 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11921 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11922 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11923 | int pin_type, int dac_idx) |
| 11924 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 11925 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11926 | pin_type); |
| 11927 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11928 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11929 | } |
| 11930 | |
| 11931 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11932 | { |
| 11933 | struct alc_spec *spec = codec->spec; |
| 11934 | int i; |
| 11935 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11936 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11937 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11938 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11939 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11940 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11941 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11942 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11943 | } |
| 11944 | } |
| 11945 | |
| 11946 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11947 | { |
| 11948 | struct alc_spec *spec = codec->spec; |
| 11949 | hda_nid_t pin; |
| 11950 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11951 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11952 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11953 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11954 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11955 | pin = spec->autocfg.speaker_pins[0]; |
| 11956 | if (pin) |
| 11957 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11958 | } |
| 11959 | |
| 11960 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11961 | { |
| 11962 | struct alc_spec *spec = codec->spec; |
| 11963 | int i; |
| 11964 | |
| 11965 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11966 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11967 | if (nid >= 0x0c && nid <= 0x11) { |
| 11968 | snd_hda_codec_write(codec, nid, 0, |
| 11969 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11970 | i <= AUTO_PIN_FRONT_MIC ? |
| 11971 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11972 | } |
| 11973 | } |
| 11974 | } |
| 11975 | |
| 11976 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11977 | /* return 1 if successful, 0 if the proper config is not found, |
| 11978 | * or a negative error code |
| 11979 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11980 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11981 | { |
| 11982 | struct alc_spec *spec = codec->spec; |
| 11983 | int err; |
| 11984 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11985 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11986 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11987 | alc861_ignore); |
| 11988 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11989 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11990 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11991 | return 0; /* can't find valid BIOS pin config */ |
| 11992 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11993 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11994 | if (err < 0) |
| 11995 | return err; |
| 11996 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11997 | if (err < 0) |
| 11998 | return err; |
| 11999 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 12000 | if (err < 0) |
| 12001 | return err; |
| 12002 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12003 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12004 | return err; |
| 12005 | |
| 12006 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12007 | |
| 12008 | if (spec->autocfg.dig_out_pin) |
| 12009 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 12010 | |
| 12011 | if (spec->kctl_alloc) |
| 12012 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12013 | |
| 12014 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 12015 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12016 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12017 | spec->input_mux = &spec->private_imux; |
| 12018 | |
| 12019 | spec->adc_nids = alc861_adc_nids; |
| 12020 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 12021 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 12022 | spec->num_mixers++; |
| 12023 | |
| 12024 | return 1; |
| 12025 | } |
| 12026 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12027 | /* additional initialization for auto-configuration model */ |
| 12028 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12029 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12030 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12031 | alc861_auto_init_multi_out(codec); |
| 12032 | alc861_auto_init_hp_out(codec); |
| 12033 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12034 | if (spec->unsol_event) |
| 12035 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12036 | } |
| 12037 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12038 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12039 | static struct hda_amp_list alc861_loopbacks[] = { |
| 12040 | { 0x15, HDA_INPUT, 0 }, |
| 12041 | { 0x15, HDA_INPUT, 1 }, |
| 12042 | { 0x15, HDA_INPUT, 2 }, |
| 12043 | { 0x15, HDA_INPUT, 3 }, |
| 12044 | { } /* end */ |
| 12045 | }; |
| 12046 | #endif |
| 12047 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12048 | |
| 12049 | /* |
| 12050 | * configuration and preset |
| 12051 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12052 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 12053 | [ALC861_3ST] = "3stack", |
| 12054 | [ALC660_3ST] = "3stack-660", |
| 12055 | [ALC861_3ST_DIG] = "3stack-dig", |
| 12056 | [ALC861_6ST_DIG] = "6stack-dig", |
| 12057 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 12058 | [ALC861_TOSHIBA] = "toshiba", |
| 12059 | [ALC861_ASUS] = "asus", |
| 12060 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 12061 | [ALC861_AUTO] = "auto", |
| 12062 | }; |
| 12063 | |
| 12064 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 12065 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12066 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12067 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12068 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12069 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12070 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 12071 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 12072 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 12073 | * Any other models that need this preset? |
| 12074 | */ |
| 12075 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 12076 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 12077 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12078 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 12079 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 12080 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 12081 | /* FIXME: the below seems conflict */ |
| 12082 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 12083 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 12084 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12085 | {} |
| 12086 | }; |
| 12087 | |
| 12088 | static struct alc_config_preset alc861_presets[] = { |
| 12089 | [ALC861_3ST] = { |
| 12090 | .mixers = { alc861_3ST_mixer }, |
| 12091 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12092 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12093 | .dac_nids = alc861_dac_nids, |
| 12094 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12095 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12096 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12097 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12098 | .adc_nids = alc861_adc_nids, |
| 12099 | .input_mux = &alc861_capture_source, |
| 12100 | }, |
| 12101 | [ALC861_3ST_DIG] = { |
| 12102 | .mixers = { alc861_base_mixer }, |
| 12103 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12104 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12105 | .dac_nids = alc861_dac_nids, |
| 12106 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12107 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12108 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12109 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12110 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12111 | .adc_nids = alc861_adc_nids, |
| 12112 | .input_mux = &alc861_capture_source, |
| 12113 | }, |
| 12114 | [ALC861_6ST_DIG] = { |
| 12115 | .mixers = { alc861_base_mixer }, |
| 12116 | .init_verbs = { alc861_base_init_verbs }, |
| 12117 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12118 | .dac_nids = alc861_dac_nids, |
| 12119 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12120 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 12121 | .channel_mode = alc861_8ch_modes, |
| 12122 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12123 | .adc_nids = alc861_adc_nids, |
| 12124 | .input_mux = &alc861_capture_source, |
| 12125 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12126 | [ALC660_3ST] = { |
| 12127 | .mixers = { alc861_3ST_mixer }, |
| 12128 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12129 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 12130 | .dac_nids = alc660_dac_nids, |
| 12131 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12132 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12133 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12134 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12135 | .adc_nids = alc861_adc_nids, |
| 12136 | .input_mux = &alc861_capture_source, |
| 12137 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12138 | [ALC861_UNIWILL_M31] = { |
| 12139 | .mixers = { alc861_uniwill_m31_mixer }, |
| 12140 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 12141 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12142 | .dac_nids = alc861_dac_nids, |
| 12143 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12144 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12145 | .channel_mode = alc861_uniwill_m31_modes, |
| 12146 | .need_dac_fix = 1, |
| 12147 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12148 | .adc_nids = alc861_adc_nids, |
| 12149 | .input_mux = &alc861_capture_source, |
| 12150 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12151 | [ALC861_TOSHIBA] = { |
| 12152 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12153 | .init_verbs = { alc861_base_init_verbs, |
| 12154 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12155 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12156 | .dac_nids = alc861_dac_nids, |
| 12157 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12158 | .channel_mode = alc883_3ST_2ch_modes, |
| 12159 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12160 | .adc_nids = alc861_adc_nids, |
| 12161 | .input_mux = &alc861_capture_source, |
| 12162 | .unsol_event = alc861_toshiba_unsol_event, |
| 12163 | .init_hook = alc861_toshiba_automute, |
| 12164 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12165 | [ALC861_ASUS] = { |
| 12166 | .mixers = { alc861_asus_mixer }, |
| 12167 | .init_verbs = { alc861_asus_init_verbs }, |
| 12168 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12169 | .dac_nids = alc861_dac_nids, |
| 12170 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12171 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 12172 | .channel_mode = alc861_asus_modes, |
| 12173 | .need_dac_fix = 1, |
| 12174 | .hp_nid = 0x06, |
| 12175 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12176 | .adc_nids = alc861_adc_nids, |
| 12177 | .input_mux = &alc861_capture_source, |
| 12178 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12179 | [ALC861_ASUS_LAPTOP] = { |
| 12180 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 12181 | .init_verbs = { alc861_asus_init_verbs, |
| 12182 | alc861_asus_laptop_init_verbs }, |
| 12183 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12184 | .dac_nids = alc861_dac_nids, |
| 12185 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12186 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12187 | .channel_mode = alc883_3ST_2ch_modes, |
| 12188 | .need_dac_fix = 1, |
| 12189 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12190 | .adc_nids = alc861_adc_nids, |
| 12191 | .input_mux = &alc861_capture_source, |
| 12192 | }, |
| 12193 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12194 | |
| 12195 | |
| 12196 | static int patch_alc861(struct hda_codec *codec) |
| 12197 | { |
| 12198 | struct alc_spec *spec; |
| 12199 | int board_config; |
| 12200 | int err; |
| 12201 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12202 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12203 | if (spec == NULL) |
| 12204 | return -ENOMEM; |
| 12205 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12206 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12207 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12208 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 12209 | alc861_models, |
| 12210 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12211 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12212 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12213 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 12214 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12215 | board_config = ALC861_AUTO; |
| 12216 | } |
| 12217 | |
| 12218 | if (board_config == ALC861_AUTO) { |
| 12219 | /* automatic parse from the BIOS config */ |
| 12220 | err = alc861_parse_auto_config(codec); |
| 12221 | if (err < 0) { |
| 12222 | alc_free(codec); |
| 12223 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12224 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12225 | printk(KERN_INFO |
| 12226 | "hda_codec: Cannot set up configuration " |
| 12227 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12228 | board_config = ALC861_3ST_DIG; |
| 12229 | } |
| 12230 | } |
| 12231 | |
| 12232 | if (board_config != ALC861_AUTO) |
| 12233 | setup_preset(spec, &alc861_presets[board_config]); |
| 12234 | |
| 12235 | spec->stream_name_analog = "ALC861 Analog"; |
| 12236 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 12237 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 12238 | |
| 12239 | spec->stream_name_digital = "ALC861 Digital"; |
| 12240 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 12241 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 12242 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12243 | spec->vmaster_nid = 0x03; |
| 12244 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12245 | codec->patch_ops = alc_patch_ops; |
| 12246 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12247 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12248 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12249 | if (!spec->loopback.amplist) |
| 12250 | spec->loopback.amplist = alc861_loopbacks; |
| 12251 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12252 | |
| 12253 | return 0; |
| 12254 | } |
| 12255 | |
| 12256 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12257 | * ALC861-VD support |
| 12258 | * |
| 12259 | * Based on ALC882 |
| 12260 | * |
| 12261 | * In addition, an independent DAC |
| 12262 | */ |
| 12263 | #define ALC861VD_DIGOUT_NID 0x06 |
| 12264 | |
| 12265 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 12266 | /* front, surr, clfe, side surr */ |
| 12267 | 0x02, 0x03, 0x04, 0x05 |
| 12268 | }; |
| 12269 | |
| 12270 | /* dac_nids for ALC660vd are in a different order - according to |
| 12271 | * Realtek's driver. |
| 12272 | * This should probably tesult in a different mixer for 6stack models |
| 12273 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 12274 | * - and it is the same as in 861vd. |
| 12275 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 12276 | */ |
| 12277 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 12278 | /* front, rear, clfe, rear_surr */ |
| 12279 | 0x02, 0x04, 0x03 |
| 12280 | }; |
| 12281 | |
| 12282 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 12283 | /* ADC0 */ |
| 12284 | 0x09, |
| 12285 | }; |
| 12286 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12287 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 12288 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12289 | /* input MUX */ |
| 12290 | /* FIXME: should be a matrix-type input source selection */ |
| 12291 | static struct hda_input_mux alc861vd_capture_source = { |
| 12292 | .num_items = 4, |
| 12293 | .items = { |
| 12294 | { "Mic", 0x0 }, |
| 12295 | { "Front Mic", 0x1 }, |
| 12296 | { "Line", 0x2 }, |
| 12297 | { "CD", 0x4 }, |
| 12298 | }, |
| 12299 | }; |
| 12300 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12301 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12302 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12303 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12304 | { "Ext Mic", 0x0 }, |
| 12305 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12306 | }, |
| 12307 | }; |
| 12308 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12309 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 12310 | .num_items = 2, |
| 12311 | .items = { |
| 12312 | { "Front Mic", 0x0 }, |
| 12313 | { "ATAPI Mic", 0x1 }, |
| 12314 | }, |
| 12315 | }; |
| 12316 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12317 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 12318 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12319 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 12320 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12321 | |
| 12322 | /* |
| 12323 | * 2ch mode |
| 12324 | */ |
| 12325 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 12326 | { 2, NULL } |
| 12327 | }; |
| 12328 | |
| 12329 | /* |
| 12330 | * 6ch mode |
| 12331 | */ |
| 12332 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 12333 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12334 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12335 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12336 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12337 | { } /* end */ |
| 12338 | }; |
| 12339 | |
| 12340 | /* |
| 12341 | * 8ch mode |
| 12342 | */ |
| 12343 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 12344 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12345 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12346 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12347 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12348 | { } /* end */ |
| 12349 | }; |
| 12350 | |
| 12351 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 12352 | { 6, alc861vd_6stack_ch6_init }, |
| 12353 | { 8, alc861vd_6stack_ch8_init }, |
| 12354 | }; |
| 12355 | |
| 12356 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 12357 | { |
| 12358 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12359 | .name = "Channel Mode", |
| 12360 | .info = alc_ch_mode_info, |
| 12361 | .get = alc_ch_mode_get, |
| 12362 | .put = alc_ch_mode_put, |
| 12363 | }, |
| 12364 | { } /* end */ |
| 12365 | }; |
| 12366 | |
| 12367 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 12368 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 12369 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 12370 | |
| 12371 | { |
| 12372 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12373 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12374 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12375 | */ |
| 12376 | /* .name = "Capture Source", */ |
| 12377 | .name = "Input Source", |
| 12378 | .count = 1, |
| 12379 | .info = alc861vd_mux_enum_info, |
| 12380 | .get = alc861vd_mux_enum_get, |
| 12381 | .put = alc861vd_mux_enum_put, |
| 12382 | }, |
| 12383 | { } /* end */ |
| 12384 | }; |
| 12385 | |
| 12386 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12387 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12388 | */ |
| 12389 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 12390 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12391 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12392 | |
| 12393 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12394 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12395 | |
| 12396 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 12397 | HDA_OUTPUT), |
| 12398 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 12399 | HDA_OUTPUT), |
| 12400 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12401 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 12402 | |
| 12403 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 12404 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12405 | |
| 12406 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12407 | |
| 12408 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12409 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12410 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12411 | |
| 12412 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12413 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12414 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12415 | |
| 12416 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12417 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12418 | |
| 12419 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12420 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12421 | |
| 12422 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12423 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12424 | |
| 12425 | { } /* end */ |
| 12426 | }; |
| 12427 | |
| 12428 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 12429 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12430 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12431 | |
| 12432 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12433 | |
| 12434 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12435 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12436 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12437 | |
| 12438 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12439 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12440 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12441 | |
| 12442 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12443 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12444 | |
| 12445 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12446 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12447 | |
| 12448 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12449 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12450 | |
| 12451 | { } /* end */ |
| 12452 | }; |
| 12453 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12454 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 12455 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12456 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 12457 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12458 | |
| 12459 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12460 | |
| 12461 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12462 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12463 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12464 | |
| 12465 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12466 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12467 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12468 | |
| 12469 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12470 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12471 | |
| 12472 | { } /* end */ |
| 12473 | }; |
| 12474 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12475 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 12476 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12477 | */ |
| 12478 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12479 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12480 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12481 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12482 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12483 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12484 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12485 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12486 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12487 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12488 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12489 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 12490 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12491 | { } /* end */ |
| 12492 | }; |
| 12493 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12494 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12495 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12496 | */ |
| 12497 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12498 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12499 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12500 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12501 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12502 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12503 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12504 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12505 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12506 | |
| 12507 | { } /* end */ |
| 12508 | }; |
| 12509 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12510 | /* |
| 12511 | * generic initialization of ADC, input mixers and output mixers |
| 12512 | */ |
| 12513 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12514 | /* |
| 12515 | * Unmute ADC0 and set the default input to mic-in |
| 12516 | */ |
| 12517 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12518 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12519 | |
| 12520 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12521 | * the analog-loopback mixer widget |
| 12522 | */ |
| 12523 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12524 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12525 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12526 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12527 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12528 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12529 | |
| 12530 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12531 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12532 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12533 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12534 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12535 | |
| 12536 | /* |
| 12537 | * Set up output mixers (0x02 - 0x05) |
| 12538 | */ |
| 12539 | /* set vol=0 to output mixers */ |
| 12540 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12541 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12542 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12543 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12544 | |
| 12545 | /* set up input amps for analog loopback */ |
| 12546 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12547 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12548 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12549 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12550 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12551 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12552 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12553 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12554 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12555 | |
| 12556 | { } |
| 12557 | }; |
| 12558 | |
| 12559 | /* |
| 12560 | * 3-stack pin configuration: |
| 12561 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 12562 | */ |
| 12563 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 12564 | /* |
| 12565 | * Set pin mode and muting |
| 12566 | */ |
| 12567 | /* set front pin widgets 0x14 for output */ |
| 12568 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12569 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12570 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12571 | |
| 12572 | /* Mic (rear) pin: input vref at 80% */ |
| 12573 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12574 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12575 | /* Front Mic pin: input vref at 80% */ |
| 12576 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12577 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12578 | /* Line In pin: input */ |
| 12579 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12580 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12581 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12582 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12583 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12584 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12585 | /* CD pin widget for input */ |
| 12586 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12587 | |
| 12588 | { } |
| 12589 | }; |
| 12590 | |
| 12591 | /* |
| 12592 | * 6-stack pin configuration: |
| 12593 | */ |
| 12594 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 12595 | /* |
| 12596 | * Set pin mode and muting |
| 12597 | */ |
| 12598 | /* set front pin widgets 0x14 for output */ |
| 12599 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12600 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12601 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12602 | |
| 12603 | /* Rear Pin: output 1 (0x0d) */ |
| 12604 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12605 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12606 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12607 | /* CLFE Pin: output 2 (0x0e) */ |
| 12608 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12609 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12610 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 12611 | /* Side Pin: output 3 (0x0f) */ |
| 12612 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12613 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12614 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 12615 | |
| 12616 | /* Mic (rear) pin: input vref at 80% */ |
| 12617 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12618 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12619 | /* Front Mic pin: input vref at 80% */ |
| 12620 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12621 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12622 | /* Line In pin: input */ |
| 12623 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12624 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12625 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12626 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12627 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12628 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12629 | /* CD pin widget for input */ |
| 12630 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12631 | |
| 12632 | { } |
| 12633 | }; |
| 12634 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12635 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 12636 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12637 | { } |
| 12638 | }; |
| 12639 | |
| 12640 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 12641 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12642 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12643 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12644 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12645 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12646 | {} |
| 12647 | }; |
| 12648 | |
| 12649 | /* toggle speaker-output according to the hp-jack state */ |
| 12650 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 12651 | { |
| 12652 | unsigned int present; |
| 12653 | unsigned char bits; |
| 12654 | |
| 12655 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12656 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12657 | bits = present ? HDA_AMP_MUTE : 0; |
| 12658 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12659 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12660 | } |
| 12661 | |
| 12662 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 12663 | { |
| 12664 | unsigned int present; |
| 12665 | unsigned char bits; |
| 12666 | |
| 12667 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12668 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12669 | bits = present ? HDA_AMP_MUTE : 0; |
| 12670 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 12671 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12672 | } |
| 12673 | |
| 12674 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 12675 | { |
| 12676 | alc861vd_lenovo_hp_automute(codec); |
| 12677 | alc861vd_lenovo_mic_automute(codec); |
| 12678 | } |
| 12679 | |
| 12680 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12681 | unsigned int res) |
| 12682 | { |
| 12683 | switch (res >> 26) { |
| 12684 | case ALC880_HP_EVENT: |
| 12685 | alc861vd_lenovo_hp_automute(codec); |
| 12686 | break; |
| 12687 | case ALC880_MIC_EVENT: |
| 12688 | alc861vd_lenovo_mic_automute(codec); |
| 12689 | break; |
| 12690 | } |
| 12691 | } |
| 12692 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12693 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12694 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12695 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12696 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12697 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12698 | |
| 12699 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12700 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12701 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12702 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12703 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12704 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12705 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12706 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12707 | |
| 12708 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12709 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12710 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12711 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12712 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12713 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12714 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12715 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12716 | |
| 12717 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12718 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12719 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12720 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12721 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12722 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12723 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12724 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12725 | |
| 12726 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12727 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12730 | |
| 12731 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12732 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12733 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12734 | |
| 12735 | { } /* end */ |
| 12736 | }; |
| 12737 | |
| 12738 | /* toggle speaker-output according to the hp-jack state */ |
| 12739 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12740 | { |
| 12741 | unsigned int present; |
| 12742 | |
| 12743 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12744 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12745 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12746 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12747 | } |
| 12748 | |
| 12749 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12750 | { |
| 12751 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12752 | alc861vd_dallas_automute(codec); |
| 12753 | } |
| 12754 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12755 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12756 | #define alc861vd_loopbacks alc880_loopbacks |
| 12757 | #endif |
| 12758 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12759 | /* pcm configuration: identiacal with ALC880 */ |
| 12760 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12761 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12762 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12763 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12764 | |
| 12765 | /* |
| 12766 | * configuration and preset |
| 12767 | */ |
| 12768 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12769 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12770 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12771 | [ALC861VD_3ST] = "3stack", |
| 12772 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12773 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12774 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12775 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12776 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12777 | [ALC861VD_AUTO] = "auto", |
| 12778 | }; |
| 12779 | |
| 12780 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12781 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12782 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12783 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12784 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12785 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12786 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12787 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 12788 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12789 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 12790 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12791 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 12792 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12793 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12794 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12795 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12796 | {} |
| 12797 | }; |
| 12798 | |
| 12799 | static struct alc_config_preset alc861vd_presets[] = { |
| 12800 | [ALC660VD_3ST] = { |
| 12801 | .mixers = { alc861vd_3st_mixer }, |
| 12802 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12803 | alc861vd_3stack_init_verbs }, |
| 12804 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12805 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12806 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12807 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12808 | .input_mux = &alc861vd_capture_source, |
| 12809 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12810 | [ALC660VD_3ST_DIG] = { |
| 12811 | .mixers = { alc861vd_3st_mixer }, |
| 12812 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12813 | alc861vd_3stack_init_verbs }, |
| 12814 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12815 | .dac_nids = alc660vd_dac_nids, |
| 12816 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12817 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12818 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12819 | .input_mux = &alc861vd_capture_source, |
| 12820 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12821 | [ALC861VD_3ST] = { |
| 12822 | .mixers = { alc861vd_3st_mixer }, |
| 12823 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12824 | alc861vd_3stack_init_verbs }, |
| 12825 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12826 | .dac_nids = alc861vd_dac_nids, |
| 12827 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12828 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12829 | .input_mux = &alc861vd_capture_source, |
| 12830 | }, |
| 12831 | [ALC861VD_3ST_DIG] = { |
| 12832 | .mixers = { alc861vd_3st_mixer }, |
| 12833 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12834 | alc861vd_3stack_init_verbs }, |
| 12835 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12836 | .dac_nids = alc861vd_dac_nids, |
| 12837 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12838 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12839 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12840 | .input_mux = &alc861vd_capture_source, |
| 12841 | }, |
| 12842 | [ALC861VD_6ST_DIG] = { |
| 12843 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12844 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12845 | alc861vd_6stack_init_verbs }, |
| 12846 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12847 | .dac_nids = alc861vd_dac_nids, |
| 12848 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12849 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12850 | .channel_mode = alc861vd_6stack_modes, |
| 12851 | .input_mux = &alc861vd_capture_source, |
| 12852 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12853 | [ALC861VD_LENOVO] = { |
| 12854 | .mixers = { alc861vd_lenovo_mixer }, |
| 12855 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12856 | alc861vd_3stack_init_verbs, |
| 12857 | alc861vd_eapd_verbs, |
| 12858 | alc861vd_lenovo_unsol_verbs }, |
| 12859 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12860 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12861 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12862 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12863 | .input_mux = &alc861vd_capture_source, |
| 12864 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12865 | .init_hook = alc861vd_lenovo_automute, |
| 12866 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12867 | [ALC861VD_DALLAS] = { |
| 12868 | .mixers = { alc861vd_dallas_mixer }, |
| 12869 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12870 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12871 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12872 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12873 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12874 | .input_mux = &alc861vd_dallas_capture_source, |
| 12875 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12876 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12877 | }, |
| 12878 | [ALC861VD_HP] = { |
| 12879 | .mixers = { alc861vd_hp_mixer }, |
| 12880 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12881 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12882 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12883 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12884 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12885 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12886 | .input_mux = &alc861vd_hp_capture_source, |
| 12887 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12888 | .init_hook = alc861vd_dallas_automute, |
| 12889 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12890 | }; |
| 12891 | |
| 12892 | /* |
| 12893 | * BIOS auto configuration |
| 12894 | */ |
| 12895 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12896 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12897 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12898 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12899 | } |
| 12900 | |
| 12901 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12902 | { |
| 12903 | struct alc_spec *spec = codec->spec; |
| 12904 | int i; |
| 12905 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12906 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12907 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12908 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12909 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12910 | if (nid) |
| 12911 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12912 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12913 | } |
| 12914 | } |
| 12915 | |
| 12916 | |
| 12917 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12918 | { |
| 12919 | struct alc_spec *spec = codec->spec; |
| 12920 | hda_nid_t pin; |
| 12921 | |
| 12922 | pin = spec->autocfg.hp_pins[0]; |
| 12923 | if (pin) /* connect to front and use dac 0 */ |
| 12924 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12925 | pin = spec->autocfg.speaker_pins[0]; |
| 12926 | if (pin) |
| 12927 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12928 | } |
| 12929 | |
| 12930 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12931 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12932 | |
| 12933 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12934 | { |
| 12935 | struct alc_spec *spec = codec->spec; |
| 12936 | int i; |
| 12937 | |
| 12938 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12939 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12940 | if (alc861vd_is_input_pin(nid)) { |
| 12941 | snd_hda_codec_write(codec, nid, 0, |
| 12942 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12943 | i <= AUTO_PIN_FRONT_MIC ? |
| 12944 | PIN_VREF80 : PIN_IN); |
| 12945 | if (nid != ALC861VD_PIN_CD_NID) |
| 12946 | snd_hda_codec_write(codec, nid, 0, |
| 12947 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12948 | AMP_OUT_MUTE); |
| 12949 | } |
| 12950 | } |
| 12951 | } |
| 12952 | |
| 12953 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12954 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12955 | |
| 12956 | /* add playback controls from the parsed DAC table */ |
| 12957 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12958 | * different NIDs for mute/unmute switch and volume control */ |
| 12959 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12960 | const struct auto_pin_cfg *cfg) |
| 12961 | { |
| 12962 | char name[32]; |
| 12963 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12964 | hda_nid_t nid_v, nid_s; |
| 12965 | int i, err; |
| 12966 | |
| 12967 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12968 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12969 | continue; |
| 12970 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12971 | alc880_dac_to_idx( |
| 12972 | spec->multiout.dac_nids[i])); |
| 12973 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12974 | alc880_dac_to_idx( |
| 12975 | spec->multiout.dac_nids[i])); |
| 12976 | |
| 12977 | if (i == 2) { |
| 12978 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12979 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12980 | "Center Playback Volume", |
| 12981 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12982 | HDA_OUTPUT)); |
| 12983 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12984 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12985 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12986 | "LFE Playback Volume", |
| 12987 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12988 | HDA_OUTPUT)); |
| 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 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12992 | "Center Playback Switch", |
| 12993 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12994 | HDA_INPUT)); |
| 12995 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12996 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12997 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12998 | "LFE Playback Switch", |
| 12999 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 13000 | HDA_INPUT)); |
| 13001 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13002 | return err; |
| 13003 | } else { |
| 13004 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13005 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13006 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 13007 | HDA_OUTPUT)); |
| 13008 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13009 | return err; |
| 13010 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13011 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13012 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13013 | HDA_INPUT)); |
| 13014 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13015 | return err; |
| 13016 | } |
| 13017 | } |
| 13018 | return 0; |
| 13019 | } |
| 13020 | |
| 13021 | /* add playback controls for speaker and HP outputs */ |
| 13022 | /* Based on ALC880 version. But ALC861VD has separate, |
| 13023 | * different NIDs for mute/unmute switch and volume control */ |
| 13024 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 13025 | hda_nid_t pin, const char *pfx) |
| 13026 | { |
| 13027 | hda_nid_t nid_v, nid_s; |
| 13028 | int err; |
| 13029 | char name[32]; |
| 13030 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13031 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13032 | return 0; |
| 13033 | |
| 13034 | if (alc880_is_fixed_pin(pin)) { |
| 13035 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13036 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13037 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13038 | spec->multiout.hp_nid = nid_v; |
| 13039 | else |
| 13040 | spec->multiout.extra_out_nid[0] = nid_v; |
| 13041 | /* control HP volume/switch on the output mixer amp */ |
| 13042 | nid_v = alc861vd_idx_to_mixer_vol( |
| 13043 | alc880_fixed_pin_idx(pin)); |
| 13044 | nid_s = alc861vd_idx_to_mixer_switch( |
| 13045 | alc880_fixed_pin_idx(pin)); |
| 13046 | |
| 13047 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13048 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13049 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 13050 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13051 | return err; |
| 13052 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13053 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13054 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 13055 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13056 | return err; |
| 13057 | } else if (alc880_is_multi_pin(pin)) { |
| 13058 | /* set manual connection */ |
| 13059 | /* we have only a switch on HP-out PIN */ |
| 13060 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13061 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13062 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13063 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13064 | return err; |
| 13065 | } |
| 13066 | return 0; |
| 13067 | } |
| 13068 | |
| 13069 | /* parse the BIOS configuration and set up the alc_spec |
| 13070 | * return 1 if successful, 0 if the proper config is not found, |
| 13071 | * or a negative error code |
| 13072 | * Based on ALC880 version - had to change it to override |
| 13073 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 13074 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 13075 | { |
| 13076 | struct alc_spec *spec = codec->spec; |
| 13077 | int err; |
| 13078 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 13079 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13080 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13081 | alc861vd_ignore); |
| 13082 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13083 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13084 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13085 | return 0; /* can't find valid BIOS pin config */ |
| 13086 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13087 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13088 | if (err < 0) |
| 13089 | return err; |
| 13090 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13091 | if (err < 0) |
| 13092 | return err; |
| 13093 | err = alc861vd_auto_create_extra_out(spec, |
| 13094 | spec->autocfg.speaker_pins[0], |
| 13095 | "Speaker"); |
| 13096 | if (err < 0) |
| 13097 | return err; |
| 13098 | err = alc861vd_auto_create_extra_out(spec, |
| 13099 | spec->autocfg.hp_pins[0], |
| 13100 | "Headphone"); |
| 13101 | if (err < 0) |
| 13102 | return err; |
| 13103 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13104 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13105 | return err; |
| 13106 | |
| 13107 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13108 | |
| 13109 | if (spec->autocfg.dig_out_pin) |
| 13110 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 13111 | |
| 13112 | if (spec->kctl_alloc) |
| 13113 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13114 | |
| 13115 | spec->init_verbs[spec->num_init_verbs++] |
| 13116 | = alc861vd_volume_init_verbs; |
| 13117 | |
| 13118 | spec->num_mux_defs = 1; |
| 13119 | spec->input_mux = &spec->private_imux; |
| 13120 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13121 | err = alc_auto_add_mic_boost(codec); |
| 13122 | if (err < 0) |
| 13123 | return err; |
| 13124 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13125 | return 1; |
| 13126 | } |
| 13127 | |
| 13128 | /* additional initialization for auto-configuration model */ |
| 13129 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 13130 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13131 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13132 | alc861vd_auto_init_multi_out(codec); |
| 13133 | alc861vd_auto_init_hp_out(codec); |
| 13134 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13135 | if (spec->unsol_event) |
| 13136 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13137 | } |
| 13138 | |
| 13139 | static int patch_alc861vd(struct hda_codec *codec) |
| 13140 | { |
| 13141 | struct alc_spec *spec; |
| 13142 | int err, board_config; |
| 13143 | |
| 13144 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13145 | if (spec == NULL) |
| 13146 | return -ENOMEM; |
| 13147 | |
| 13148 | codec->spec = spec; |
| 13149 | |
| 13150 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 13151 | alc861vd_models, |
| 13152 | alc861vd_cfg_tbl); |
| 13153 | |
| 13154 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 13155 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 13156 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 13157 | board_config = ALC861VD_AUTO; |
| 13158 | } |
| 13159 | |
| 13160 | if (board_config == ALC861VD_AUTO) { |
| 13161 | /* automatic parse from the BIOS config */ |
| 13162 | err = alc861vd_parse_auto_config(codec); |
| 13163 | if (err < 0) { |
| 13164 | alc_free(codec); |
| 13165 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13166 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13167 | printk(KERN_INFO |
| 13168 | "hda_codec: Cannot set up configuration " |
| 13169 | "from BIOS. Using base mode...\n"); |
| 13170 | board_config = ALC861VD_3ST; |
| 13171 | } |
| 13172 | } |
| 13173 | |
| 13174 | if (board_config != ALC861VD_AUTO) |
| 13175 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 13176 | |
| 13177 | spec->stream_name_analog = "ALC861VD Analog"; |
| 13178 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 13179 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 13180 | |
| 13181 | spec->stream_name_digital = "ALC861VD Digital"; |
| 13182 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 13183 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 13184 | |
| 13185 | spec->adc_nids = alc861vd_adc_nids; |
| 13186 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13187 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13188 | |
| 13189 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 13190 | spec->num_mixers++; |
| 13191 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13192 | spec->vmaster_nid = 0x02; |
| 13193 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13194 | codec->patch_ops = alc_patch_ops; |
| 13195 | |
| 13196 | if (board_config == ALC861VD_AUTO) |
| 13197 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13198 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13199 | if (!spec->loopback.amplist) |
| 13200 | spec->loopback.amplist = alc861vd_loopbacks; |
| 13201 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13202 | |
| 13203 | return 0; |
| 13204 | } |
| 13205 | |
| 13206 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13207 | * ALC662 support |
| 13208 | * |
| 13209 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 13210 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 13211 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 13212 | * 6-channel independent captures. |
| 13213 | * |
| 13214 | * In addition, an independent DAC for the multi-playback (not used in this |
| 13215 | * driver yet). |
| 13216 | */ |
| 13217 | #define ALC662_DIGOUT_NID 0x06 |
| 13218 | #define ALC662_DIGIN_NID 0x0a |
| 13219 | |
| 13220 | static hda_nid_t alc662_dac_nids[4] = { |
| 13221 | /* front, rear, clfe, rear_surr */ |
| 13222 | 0x02, 0x03, 0x04 |
| 13223 | }; |
| 13224 | |
| 13225 | static hda_nid_t alc662_adc_nids[1] = { |
| 13226 | /* ADC1-2 */ |
| 13227 | 0x09, |
| 13228 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13229 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 13230 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13231 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13232 | /* input MUX */ |
| 13233 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13234 | static struct hda_input_mux alc662_capture_source = { |
| 13235 | .num_items = 4, |
| 13236 | .items = { |
| 13237 | { "Mic", 0x0 }, |
| 13238 | { "Front Mic", 0x1 }, |
| 13239 | { "Line", 0x2 }, |
| 13240 | { "CD", 0x4 }, |
| 13241 | }, |
| 13242 | }; |
| 13243 | |
| 13244 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 13245 | .num_items = 2, |
| 13246 | .items = { |
| 13247 | { "Mic", 0x1 }, |
| 13248 | { "Line", 0x2 }, |
| 13249 | }, |
| 13250 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13251 | |
| 13252 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 13253 | .num_items = 2, |
| 13254 | .items = { |
| 13255 | { "i-Mic", 0x1 }, |
| 13256 | { "e-Mic", 0x0 }, |
| 13257 | }, |
| 13258 | }; |
| 13259 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13260 | static struct hda_input_mux alc663_capture_source = { |
| 13261 | .num_items = 3, |
| 13262 | .items = { |
| 13263 | { "Mic", 0x0 }, |
| 13264 | { "Front Mic", 0x1 }, |
| 13265 | { "Line", 0x2 }, |
| 13266 | }, |
| 13267 | }; |
| 13268 | |
| 13269 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 13270 | .num_items = 2, |
| 13271 | .items = { |
| 13272 | { "Ext-Mic", 0x0 }, |
| 13273 | { "D-Mic", 0x9 }, |
| 13274 | }, |
| 13275 | }; |
| 13276 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13277 | #define alc662_mux_enum_info alc_mux_enum_info |
| 13278 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13279 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13280 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13281 | /* |
| 13282 | * 2ch mode |
| 13283 | */ |
| 13284 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 13285 | { 2, NULL } |
| 13286 | }; |
| 13287 | |
| 13288 | /* |
| 13289 | * 2ch mode |
| 13290 | */ |
| 13291 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 13292 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 13293 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13294 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 13295 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13296 | { } /* end */ |
| 13297 | }; |
| 13298 | |
| 13299 | /* |
| 13300 | * 6ch mode |
| 13301 | */ |
| 13302 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 13303 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13304 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13305 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 13306 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13307 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13308 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13309 | { } /* end */ |
| 13310 | }; |
| 13311 | |
| 13312 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 13313 | { 2, alc662_3ST_ch2_init }, |
| 13314 | { 6, alc662_3ST_ch6_init }, |
| 13315 | }; |
| 13316 | |
| 13317 | /* |
| 13318 | * 2ch mode |
| 13319 | */ |
| 13320 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 13321 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13322 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13323 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13324 | { } /* end */ |
| 13325 | }; |
| 13326 | |
| 13327 | /* |
| 13328 | * 6ch mode |
| 13329 | */ |
| 13330 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 13331 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13332 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13333 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13334 | { } /* end */ |
| 13335 | }; |
| 13336 | |
| 13337 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 13338 | { 2, alc662_sixstack_ch6_init }, |
| 13339 | { 6, alc662_sixstack_ch8_init }, |
| 13340 | }; |
| 13341 | |
| 13342 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13343 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13344 | */ |
| 13345 | |
| 13346 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 13347 | /* output mixer control */ |
| 13348 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13349 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13350 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13351 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13352 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13353 | 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] | 13354 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13355 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13356 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13357 | |
| 13358 | /*Input mixer control */ |
| 13359 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 13360 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 13361 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 13362 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 13363 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 13364 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 13365 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 13366 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13367 | { } /* end */ |
| 13368 | }; |
| 13369 | |
| 13370 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 13371 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13372 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13373 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13374 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13375 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13376 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13377 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13379 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13380 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13381 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13382 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13383 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13384 | { } /* end */ |
| 13385 | }; |
| 13386 | |
| 13387 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 13388 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13389 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13390 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13391 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13392 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13393 | 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] | 13394 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13395 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13396 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13397 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13398 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13399 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13400 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13401 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13402 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13403 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13404 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13405 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13406 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13407 | { } /* end */ |
| 13408 | }; |
| 13409 | |
| 13410 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 13411 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13412 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13413 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13414 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13415 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13416 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13417 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13418 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13419 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13420 | { } /* end */ |
| 13421 | }; |
| 13422 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13423 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13424 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13425 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 13426 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13427 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13428 | |
| 13429 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 13430 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13431 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13432 | |
| 13433 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 13434 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13435 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13436 | { } /* end */ |
| 13437 | }; |
| 13438 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13439 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 13440 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13441 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13442 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13443 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 13444 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13445 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13446 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13447 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13448 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13449 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13450 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13451 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13452 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13453 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13454 | { } /* end */ |
| 13455 | }; |
| 13456 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13457 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
| 13458 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13459 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13460 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13461 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13462 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13463 | HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), |
| 13464 | { } /* end */ |
| 13465 | }; |
| 13466 | |
| 13467 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 13468 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13469 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13470 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13471 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13472 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13473 | |
| 13474 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13475 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13476 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13477 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13478 | { } /* end */ |
| 13479 | }; |
| 13480 | |
| 13481 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 13482 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13483 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13484 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13485 | |
| 13486 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13487 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13488 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13489 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13490 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13491 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13492 | { } /* end */ |
| 13493 | }; |
| 13494 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13495 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 13496 | { |
| 13497 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13498 | .name = "Channel Mode", |
| 13499 | .info = alc_ch_mode_info, |
| 13500 | .get = alc_ch_mode_get, |
| 13501 | .put = alc_ch_mode_put, |
| 13502 | }, |
| 13503 | { } /* end */ |
| 13504 | }; |
| 13505 | |
| 13506 | static struct hda_verb alc662_init_verbs[] = { |
| 13507 | /* ADC: mute amp left and right */ |
| 13508 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13509 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13510 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 13511 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13512 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13513 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13514 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13515 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13516 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13517 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13519 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13520 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13521 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13522 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13523 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13524 | |
| 13525 | /* Front Pin: output 0 (0x0c) */ |
| 13526 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13527 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13528 | |
| 13529 | /* Rear Pin: output 1 (0x0d) */ |
| 13530 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13531 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13532 | |
| 13533 | /* CLFE Pin: output 2 (0x0e) */ |
| 13534 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13535 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13536 | |
| 13537 | /* Mic (rear) pin: input vref at 80% */ |
| 13538 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13539 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13540 | /* Front Mic pin: input vref at 80% */ |
| 13541 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13542 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13543 | /* Line In pin: input */ |
| 13544 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13545 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13546 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13547 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13548 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13549 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13550 | /* CD pin widget for input */ |
| 13551 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13552 | |
| 13553 | /* FIXME: use matrix-type input source selection */ |
| 13554 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13555 | /* Input mixer */ |
| 13556 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13557 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13558 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13559 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13560 | |
| 13561 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13562 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13563 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13564 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13565 | |
| 13566 | /* always trun on EAPD */ |
| 13567 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13568 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13569 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13570 | { } |
| 13571 | }; |
| 13572 | |
| 13573 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 13574 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13575 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13576 | {} |
| 13577 | }; |
| 13578 | |
| 13579 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 13580 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13581 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13582 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13583 | }; |
| 13584 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13585 | /* Set Unsolicited Event*/ |
| 13586 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 13587 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13588 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13589 | {} |
| 13590 | }; |
| 13591 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13592 | /* |
| 13593 | * generic initialization of ADC, input mixers and output mixers |
| 13594 | */ |
| 13595 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 13596 | /* |
| 13597 | * Unmute ADC and set the default input to mic-in |
| 13598 | */ |
| 13599 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13600 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13601 | |
| 13602 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 13603 | * mixer widget |
| 13604 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 13605 | * panel mic (mic 2) |
| 13606 | */ |
| 13607 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13608 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13609 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13610 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13611 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13612 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13613 | |
| 13614 | /* |
| 13615 | * Set up output mixers (0x0c - 0x0f) |
| 13616 | */ |
| 13617 | /* set vol=0 to output mixers */ |
| 13618 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13619 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13620 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13621 | |
| 13622 | /* set up input amps for analog loopback */ |
| 13623 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13624 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13625 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13626 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13627 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13628 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13629 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13630 | |
| 13631 | |
| 13632 | /* FIXME: use matrix-type input source selection */ |
| 13633 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13634 | /* Input mixer */ |
| 13635 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13636 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13637 | { } |
| 13638 | }; |
| 13639 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13640 | static struct hda_verb alc663_m51va_init_verbs[] = { |
| 13641 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13642 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13643 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 13644 | |
| 13645 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 13646 | |
| 13647 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13648 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13649 | {} |
| 13650 | }; |
| 13651 | |
| 13652 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 13653 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13654 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 13655 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 13656 | |
| 13657 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13658 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13659 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 13660 | |
| 13661 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13662 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 13663 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 13664 | {} |
| 13665 | }; |
| 13666 | |
| 13667 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 13668 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13669 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13670 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 13671 | |
| 13672 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13673 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13674 | {} |
| 13675 | }; |
| 13676 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13677 | /* capture mixer elements */ |
| 13678 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 13679 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13680 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13681 | { |
| 13682 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13683 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13684 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13685 | */ |
| 13686 | /* .name = "Capture Source", */ |
| 13687 | .name = "Input Source", |
| 13688 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 13689 | .info = alc662_mux_enum_info, |
| 13690 | .get = alc662_mux_enum_get, |
| 13691 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13692 | }, |
| 13693 | { } /* end */ |
| 13694 | }; |
| 13695 | |
| 13696 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 13697 | { |
| 13698 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13699 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13700 | |
| 13701 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13702 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13703 | bits = present ? HDA_AMP_MUTE : 0; |
| 13704 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13705 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13706 | } |
| 13707 | |
| 13708 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 13709 | { |
| 13710 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13711 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13712 | |
| 13713 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13714 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13715 | bits = present ? HDA_AMP_MUTE : 0; |
| 13716 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13717 | HDA_AMP_MUTE, bits); |
| 13718 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13719 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13720 | } |
| 13721 | |
| 13722 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 13723 | unsigned int res) |
| 13724 | { |
| 13725 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13726 | alc662_lenovo_101e_all_automute(codec); |
| 13727 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 13728 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 13729 | } |
| 13730 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13731 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 13732 | { |
| 13733 | unsigned int present; |
| 13734 | |
| 13735 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13736 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13737 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13738 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13739 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13740 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13741 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13742 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13743 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13744 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13745 | } |
| 13746 | |
| 13747 | /* unsolicited event for HP jack sensing */ |
| 13748 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13749 | unsigned int res) |
| 13750 | { |
| 13751 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13752 | alc262_hippo1_automute( codec ); |
| 13753 | |
| 13754 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13755 | alc662_eeepc_mic_automute(codec); |
| 13756 | } |
| 13757 | |
| 13758 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13759 | { |
| 13760 | alc262_hippo1_automute( codec ); |
| 13761 | alc662_eeepc_mic_automute(codec); |
| 13762 | } |
| 13763 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13764 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13765 | { |
| 13766 | unsigned int mute; |
| 13767 | unsigned int present; |
| 13768 | |
| 13769 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13770 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13771 | AC_VERB_GET_PIN_SENSE, 0); |
| 13772 | present = (present & 0x80000000) != 0; |
| 13773 | if (present) { |
| 13774 | /* mute internal speaker */ |
| 13775 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13776 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13777 | } else { |
| 13778 | /* unmute internal speaker if necessary */ |
| 13779 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13780 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13781 | HDA_AMP_MUTE, mute); |
| 13782 | } |
| 13783 | } |
| 13784 | |
| 13785 | /* unsolicited event for HP jack sensing */ |
| 13786 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 13787 | unsigned int res) |
| 13788 | { |
| 13789 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13790 | alc662_eeepc_ep20_automute(codec); |
| 13791 | } |
| 13792 | |
| 13793 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 13794 | { |
| 13795 | alc662_eeepc_ep20_automute(codec); |
| 13796 | } |
| 13797 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13798 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 13799 | { |
| 13800 | unsigned int present; |
| 13801 | unsigned char bits; |
| 13802 | |
| 13803 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 13804 | AC_VERB_GET_PIN_SENSE, 0) |
| 13805 | & AC_PINSENSE_PRESENCE; |
| 13806 | bits = present ? HDA_AMP_MUTE : 0; |
| 13807 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13808 | HDA_AMP_MUTE, bits); |
| 13809 | } |
| 13810 | |
| 13811 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 13812 | { |
| 13813 | unsigned int present; |
| 13814 | |
| 13815 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13816 | AC_VERB_GET_PIN_SENSE, 0) |
| 13817 | & AC_PINSENSE_PRESENCE; |
| 13818 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13819 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13820 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13821 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13822 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13823 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
| 13824 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13825 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
| 13826 | } |
| 13827 | |
| 13828 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 13829 | unsigned int res) |
| 13830 | { |
| 13831 | switch (res >> 26) { |
| 13832 | case ALC880_HP_EVENT: |
| 13833 | alc663_m51va_speaker_automute(codec); |
| 13834 | break; |
| 13835 | case ALC880_MIC_EVENT: |
| 13836 | alc663_m51va_mic_automute(codec); |
| 13837 | break; |
| 13838 | } |
| 13839 | } |
| 13840 | |
| 13841 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 13842 | { |
| 13843 | alc663_m51va_speaker_automute(codec); |
| 13844 | alc663_m51va_mic_automute(codec); |
| 13845 | } |
| 13846 | |
| 13847 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 13848 | { |
| 13849 | unsigned int present; |
| 13850 | unsigned char bits; |
| 13851 | |
| 13852 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 13853 | AC_VERB_GET_PIN_SENSE, 0) |
| 13854 | & AC_PINSENSE_PRESENCE; |
| 13855 | bits = present ? HDA_AMP_MUTE : 0; |
| 13856 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13857 | HDA_AMP_MUTE, bits); |
| 13858 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13859 | HDA_AMP_MUTE, bits); |
| 13860 | } |
| 13861 | |
| 13862 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 13863 | { |
| 13864 | unsigned int present; |
| 13865 | unsigned char bits; |
| 13866 | |
| 13867 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13868 | AC_VERB_GET_PIN_SENSE, 0) |
| 13869 | & AC_PINSENSE_PRESENCE; |
| 13870 | bits = present ? HDA_AMP_MUTE : 0; |
| 13871 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13872 | HDA_AMP_MUTE, bits); |
| 13873 | } |
| 13874 | |
| 13875 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 13876 | unsigned int res) |
| 13877 | { |
| 13878 | switch (res >> 26) { |
| 13879 | case ALC880_HP_EVENT: |
| 13880 | alc663_g71v_hp_automute(codec); |
| 13881 | break; |
| 13882 | case ALC880_FRONT_EVENT: |
| 13883 | alc663_g71v_front_automute(codec); |
| 13884 | break; |
| 13885 | case ALC880_MIC_EVENT: |
| 13886 | alc662_eeepc_mic_automute(codec); |
| 13887 | break; |
| 13888 | } |
| 13889 | } |
| 13890 | |
| 13891 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 13892 | { |
| 13893 | alc663_g71v_front_automute(codec); |
| 13894 | alc663_g71v_hp_automute(codec); |
| 13895 | alc662_eeepc_mic_automute(codec); |
| 13896 | } |
| 13897 | |
| 13898 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 13899 | unsigned int res) |
| 13900 | { |
| 13901 | switch (res >> 26) { |
| 13902 | case ALC880_HP_EVENT: |
| 13903 | alc663_m51va_speaker_automute(codec); |
| 13904 | break; |
| 13905 | case ALC880_MIC_EVENT: |
| 13906 | alc662_eeepc_mic_automute(codec); |
| 13907 | break; |
| 13908 | } |
| 13909 | } |
| 13910 | |
| 13911 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 13912 | { |
| 13913 | alc663_m51va_speaker_automute(codec); |
| 13914 | alc662_eeepc_mic_automute(codec); |
| 13915 | } |
| 13916 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13917 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13918 | #define alc662_loopbacks alc880_loopbacks |
| 13919 | #endif |
| 13920 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13921 | |
| 13922 | /* pcm configuration: identiacal with ALC880 */ |
| 13923 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 13924 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 13925 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 13926 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 13927 | |
| 13928 | /* |
| 13929 | * configuration and preset |
| 13930 | */ |
| 13931 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 13932 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 13933 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 13934 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 13935 | [ALC662_5ST_DIG] = "6stack-dig", |
| 13936 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 13937 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13938 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13939 | [ALC663_ASUS_M51VA] = "m51va", |
| 13940 | [ALC663_ASUS_G71V] = "g71v", |
| 13941 | [ALC663_ASUS_H13] = "h13", |
| 13942 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13943 | [ALC662_AUTO] = "auto", |
| 13944 | }; |
| 13945 | |
| 13946 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13947 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V), |
| 13948 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
| 13949 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 13950 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13951 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13952 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13953 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13954 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
| 13955 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
| 13956 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13957 | {} |
| 13958 | }; |
| 13959 | |
| 13960 | static struct alc_config_preset alc662_presets[] = { |
| 13961 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13962 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13963 | .init_verbs = { alc662_init_verbs }, |
| 13964 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13965 | .dac_nids = alc662_dac_nids, |
| 13966 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13967 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13968 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13969 | .channel_mode = alc662_3ST_2ch_modes, |
| 13970 | .input_mux = &alc662_capture_source, |
| 13971 | }, |
| 13972 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13973 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13974 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13975 | .init_verbs = { alc662_init_verbs }, |
| 13976 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13977 | .dac_nids = alc662_dac_nids, |
| 13978 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13979 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13980 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13981 | .channel_mode = alc662_3ST_6ch_modes, |
| 13982 | .need_dac_fix = 1, |
| 13983 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13984 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13985 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13986 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13987 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13988 | .init_verbs = { alc662_init_verbs }, |
| 13989 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13990 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13991 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13992 | .channel_mode = alc662_3ST_6ch_modes, |
| 13993 | .need_dac_fix = 1, |
| 13994 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13995 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13996 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13997 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13998 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13999 | .init_verbs = { alc662_init_verbs }, |
| 14000 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14001 | .dac_nids = alc662_dac_nids, |
| 14002 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14003 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14004 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 14005 | .channel_mode = alc662_5stack_modes, |
| 14006 | .input_mux = &alc662_capture_source, |
| 14007 | }, |
| 14008 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14009 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14010 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 14011 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14012 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14013 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14014 | .channel_mode = alc662_3ST_2ch_modes, |
| 14015 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 14016 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 14017 | .init_hook = alc662_lenovo_101e_all_automute, |
| 14018 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14019 | [ALC662_ASUS_EEEPC_P701] = { |
| 14020 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 14021 | .init_verbs = { alc662_init_verbs, |
| 14022 | alc662_eeepc_sue_init_verbs }, |
| 14023 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14024 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14025 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14026 | .channel_mode = alc662_3ST_2ch_modes, |
| 14027 | .input_mux = &alc662_eeepc_capture_source, |
| 14028 | .unsol_event = alc662_eeepc_unsol_event, |
| 14029 | .init_hook = alc662_eeepc_inithook, |
| 14030 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14031 | [ALC662_ASUS_EEEPC_EP20] = { |
| 14032 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 14033 | alc662_chmode_mixer }, |
| 14034 | .init_verbs = { alc662_init_verbs, |
| 14035 | alc662_eeepc_ep20_sue_init_verbs }, |
| 14036 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14037 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14038 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14039 | .channel_mode = alc662_3ST_6ch_modes, |
| 14040 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 14041 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 14042 | .init_hook = alc662_eeepc_ep20_inithook, |
| 14043 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14044 | [ALC663_ASUS_M51VA] = { |
| 14045 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 14046 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 14047 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14048 | .dac_nids = alc662_dac_nids, |
| 14049 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14050 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14051 | .channel_mode = alc662_3ST_2ch_modes, |
| 14052 | .input_mux = &alc663_m51va_capture_source, |
| 14053 | .unsol_event = alc663_m51va_unsol_event, |
| 14054 | .init_hook = alc663_m51va_inithook, |
| 14055 | }, |
| 14056 | [ALC663_ASUS_G71V] = { |
| 14057 | .mixers = { alc663_g71v_mixer, alc662_capture_mixer}, |
| 14058 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 14059 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14060 | .dac_nids = alc662_dac_nids, |
| 14061 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14062 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14063 | .channel_mode = alc662_3ST_2ch_modes, |
| 14064 | .input_mux = &alc662_eeepc_capture_source, |
| 14065 | .unsol_event = alc663_g71v_unsol_event, |
| 14066 | .init_hook = alc663_g71v_inithook, |
| 14067 | }, |
| 14068 | [ALC663_ASUS_H13] = { |
| 14069 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 14070 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 14071 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14072 | .dac_nids = alc662_dac_nids, |
| 14073 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14074 | .channel_mode = alc662_3ST_2ch_modes, |
| 14075 | .input_mux = &alc663_m51va_capture_source, |
| 14076 | .unsol_event = alc663_m51va_unsol_event, |
| 14077 | .init_hook = alc663_m51va_inithook, |
| 14078 | }, |
| 14079 | [ALC663_ASUS_G50V] = { |
| 14080 | .mixers = { alc663_g50v_mixer, alc662_capture_mixer}, |
| 14081 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 14082 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14083 | .dac_nids = alc662_dac_nids, |
| 14084 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14085 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14086 | .channel_mode = alc662_3ST_6ch_modes, |
| 14087 | .input_mux = &alc663_capture_source, |
| 14088 | .unsol_event = alc663_g50v_unsol_event, |
| 14089 | .init_hook = alc663_g50v_inithook, |
| 14090 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14091 | }; |
| 14092 | |
| 14093 | |
| 14094 | /* |
| 14095 | * BIOS auto configuration |
| 14096 | */ |
| 14097 | |
| 14098 | /* add playback controls from the parsed DAC table */ |
| 14099 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14100 | const struct auto_pin_cfg *cfg) |
| 14101 | { |
| 14102 | char name[32]; |
| 14103 | static const char *chname[4] = { |
| 14104 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14105 | }; |
| 14106 | hda_nid_t nid; |
| 14107 | int i, err; |
| 14108 | |
| 14109 | for (i = 0; i < cfg->line_outs; i++) { |
| 14110 | if (!spec->multiout.dac_nids[i]) |
| 14111 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14112 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14113 | if (i == 2) { |
| 14114 | /* Center/LFE */ |
| 14115 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14116 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14117 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 14118 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14119 | if (err < 0) |
| 14120 | return err; |
| 14121 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14122 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14123 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 14124 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14125 | if (err < 0) |
| 14126 | return err; |
| 14127 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14128 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14129 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 14130 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14131 | if (err < 0) |
| 14132 | return err; |
| 14133 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14134 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14135 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 14136 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14137 | if (err < 0) |
| 14138 | return err; |
| 14139 | } else { |
| 14140 | sprintf(name, "%s Playback Volume", chname[i]); |
| 14141 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14142 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 14143 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14144 | if (err < 0) |
| 14145 | return err; |
| 14146 | sprintf(name, "%s Playback Switch", chname[i]); |
| 14147 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14148 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 14149 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14150 | if (err < 0) |
| 14151 | return err; |
| 14152 | } |
| 14153 | } |
| 14154 | return 0; |
| 14155 | } |
| 14156 | |
| 14157 | /* add playback controls for speaker and HP outputs */ |
| 14158 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 14159 | const char *pfx) |
| 14160 | { |
| 14161 | hda_nid_t nid; |
| 14162 | int err; |
| 14163 | char name[32]; |
| 14164 | |
| 14165 | if (!pin) |
| 14166 | return 0; |
| 14167 | |
| 14168 | if (alc880_is_fixed_pin(pin)) { |
| 14169 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14170 | /* printk("DAC nid=%x\n",nid); */ |
| 14171 | /* specify the DAC as the extra output */ |
| 14172 | if (!spec->multiout.hp_nid) |
| 14173 | spec->multiout.hp_nid = nid; |
| 14174 | else |
| 14175 | spec->multiout.extra_out_nid[0] = nid; |
| 14176 | /* control HP volume/switch on the output mixer amp */ |
| 14177 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14178 | sprintf(name, "%s Playback Volume", pfx); |
| 14179 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14180 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 14181 | if (err < 0) |
| 14182 | return err; |
| 14183 | sprintf(name, "%s Playback Switch", pfx); |
| 14184 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14185 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 14186 | if (err < 0) |
| 14187 | return err; |
| 14188 | } else if (alc880_is_multi_pin(pin)) { |
| 14189 | /* set manual connection */ |
| 14190 | /* we have only a switch on HP-out PIN */ |
| 14191 | sprintf(name, "%s Playback Switch", pfx); |
| 14192 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14193 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14194 | if (err < 0) |
| 14195 | return err; |
| 14196 | } |
| 14197 | return 0; |
| 14198 | } |
| 14199 | |
| 14200 | /* create playback/capture controls for input pins */ |
| 14201 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 14202 | const struct auto_pin_cfg *cfg) |
| 14203 | { |
| 14204 | struct hda_input_mux *imux = &spec->private_imux; |
| 14205 | int i, err, idx; |
| 14206 | |
| 14207 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14208 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 14209 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 14210 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14211 | auto_pin_cfg_labels[i], |
| 14212 | idx, 0x0b); |
| 14213 | if (err < 0) |
| 14214 | return err; |
| 14215 | imux->items[imux->num_items].label = |
| 14216 | auto_pin_cfg_labels[i]; |
| 14217 | imux->items[imux->num_items].index = |
| 14218 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 14219 | imux->num_items++; |
| 14220 | } |
| 14221 | } |
| 14222 | return 0; |
| 14223 | } |
| 14224 | |
| 14225 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14226 | hda_nid_t nid, int pin_type, |
| 14227 | int dac_idx) |
| 14228 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14229 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14230 | /* need the manual connection? */ |
| 14231 | if (alc880_is_multi_pin(nid)) { |
| 14232 | struct alc_spec *spec = codec->spec; |
| 14233 | int idx = alc880_multi_pin_idx(nid); |
| 14234 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 14235 | AC_VERB_SET_CONNECT_SEL, |
| 14236 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 14237 | } |
| 14238 | } |
| 14239 | |
| 14240 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 14241 | { |
| 14242 | struct alc_spec *spec = codec->spec; |
| 14243 | int i; |
| 14244 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14245 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14246 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14247 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14248 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14249 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14250 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14251 | i); |
| 14252 | } |
| 14253 | } |
| 14254 | |
| 14255 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 14256 | { |
| 14257 | struct alc_spec *spec = codec->spec; |
| 14258 | hda_nid_t pin; |
| 14259 | |
| 14260 | pin = spec->autocfg.hp_pins[0]; |
| 14261 | if (pin) /* connect to front */ |
| 14262 | /* use dac 0 */ |
| 14263 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14264 | pin = spec->autocfg.speaker_pins[0]; |
| 14265 | if (pin) |
| 14266 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14267 | } |
| 14268 | |
| 14269 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14270 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 14271 | |
| 14272 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 14273 | { |
| 14274 | struct alc_spec *spec = codec->spec; |
| 14275 | int i; |
| 14276 | |
| 14277 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14278 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14279 | if (alc662_is_input_pin(nid)) { |
| 14280 | snd_hda_codec_write(codec, nid, 0, |
| 14281 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14282 | (i <= AUTO_PIN_FRONT_MIC ? |
| 14283 | PIN_VREF80 : PIN_IN)); |
| 14284 | if (nid != ALC662_PIN_CD_NID) |
| 14285 | snd_hda_codec_write(codec, nid, 0, |
| 14286 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14287 | AMP_OUT_MUTE); |
| 14288 | } |
| 14289 | } |
| 14290 | } |
| 14291 | |
| 14292 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 14293 | { |
| 14294 | struct alc_spec *spec = codec->spec; |
| 14295 | int err; |
| 14296 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 14297 | |
| 14298 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14299 | alc662_ignore); |
| 14300 | if (err < 0) |
| 14301 | return err; |
| 14302 | if (!spec->autocfg.line_outs) |
| 14303 | return 0; /* can't find valid BIOS pin config */ |
| 14304 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14305 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14306 | if (err < 0) |
| 14307 | return err; |
| 14308 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14309 | if (err < 0) |
| 14310 | return err; |
| 14311 | err = alc662_auto_create_extra_out(spec, |
| 14312 | spec->autocfg.speaker_pins[0], |
| 14313 | "Speaker"); |
| 14314 | if (err < 0) |
| 14315 | return err; |
| 14316 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 14317 | "Headphone"); |
| 14318 | if (err < 0) |
| 14319 | return err; |
| 14320 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14321 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14322 | return err; |
| 14323 | |
| 14324 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14325 | |
| 14326 | if (spec->autocfg.dig_out_pin) |
| 14327 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 14328 | |
| 14329 | if (spec->kctl_alloc) |
| 14330 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 14331 | |
| 14332 | spec->num_mux_defs = 1; |
| 14333 | spec->input_mux = &spec->private_imux; |
| 14334 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14335 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14336 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 14337 | spec->num_mixers++; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14338 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14339 | } |
| 14340 | |
| 14341 | /* additional initialization for auto-configuration model */ |
| 14342 | static void alc662_auto_init(struct hda_codec *codec) |
| 14343 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14344 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14345 | alc662_auto_init_multi_out(codec); |
| 14346 | alc662_auto_init_hp_out(codec); |
| 14347 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14348 | if (spec->unsol_event) |
| 14349 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14350 | } |
| 14351 | |
| 14352 | static int patch_alc662(struct hda_codec *codec) |
| 14353 | { |
| 14354 | struct alc_spec *spec; |
| 14355 | int err, board_config; |
| 14356 | |
| 14357 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14358 | if (!spec) |
| 14359 | return -ENOMEM; |
| 14360 | |
| 14361 | codec->spec = spec; |
| 14362 | |
| 14363 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 14364 | alc662_models, |
| 14365 | alc662_cfg_tbl); |
| 14366 | if (board_config < 0) { |
| 14367 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 14368 | "trying auto-probe from BIOS...\n"); |
| 14369 | board_config = ALC662_AUTO; |
| 14370 | } |
| 14371 | |
| 14372 | if (board_config == ALC662_AUTO) { |
| 14373 | /* automatic parse from the BIOS config */ |
| 14374 | err = alc662_parse_auto_config(codec); |
| 14375 | if (err < 0) { |
| 14376 | alc_free(codec); |
| 14377 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14378 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14379 | printk(KERN_INFO |
| 14380 | "hda_codec: Cannot set up configuration " |
| 14381 | "from BIOS. Using base mode...\n"); |
| 14382 | board_config = ALC662_3ST_2ch_DIG; |
| 14383 | } |
| 14384 | } |
| 14385 | |
| 14386 | if (board_config != ALC662_AUTO) |
| 14387 | setup_preset(spec, &alc662_presets[board_config]); |
| 14388 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14389 | if (codec->vendor_id == 0x10ec0663) { |
| 14390 | spec->stream_name_analog = "ALC663 Analog"; |
| 14391 | spec->stream_name_digital = "ALC663 Digital"; |
| 14392 | } else { |
| 14393 | spec->stream_name_analog = "ALC662 Analog"; |
| 14394 | spec->stream_name_digital = "ALC662 Digital"; |
| 14395 | } |
| 14396 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14397 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 14398 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 14399 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14400 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 14401 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 14402 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14403 | spec->adc_nids = alc662_adc_nids; |
| 14404 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 14405 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14406 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14407 | spec->vmaster_nid = 0x02; |
| 14408 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14409 | codec->patch_ops = alc_patch_ops; |
| 14410 | if (board_config == ALC662_AUTO) |
| 14411 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14412 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14413 | if (!spec->loopback.amplist) |
| 14414 | spec->loopback.amplist = alc662_loopbacks; |
| 14415 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14416 | |
| 14417 | return 0; |
| 14418 | } |
| 14419 | |
| 14420 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14421 | * patch entries |
| 14422 | */ |
| 14423 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 14424 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14425 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14426 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14427 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14428 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14429 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14430 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14431 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 14432 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 14433 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14434 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 14435 | .patch = patch_alc883 }, |
| 14436 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 14437 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14438 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14439 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14440 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14441 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 14442 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 14443 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14444 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14445 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14446 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14447 | {} /* terminator */ |
| 14448 | }; |