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 | 7cf51e4 | 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" |
| 33 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 34 | #define ALC880_FRONT_EVENT 0x01 |
| 35 | #define ALC880_DCVOL_EVENT 0x02 |
| 36 | #define ALC880_HP_EVENT 0x04 |
| 37 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
| 39 | /* ALC880 board config type */ |
| 40 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | ALC880_3ST, |
| 42 | ALC880_3ST_DIG, |
| 43 | ALC880_5ST, |
| 44 | ALC880_5ST_DIG, |
| 45 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 46 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 47 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 48 | ALC880_6ST_DIG, |
| 49 | ALC880_F1734, |
| 50 | ALC880_ASUS, |
| 51 | ALC880_ASUS_DIG, |
| 52 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 53 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 54 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 55 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL, |
| 57 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 58 | ALC880_CLEVO, |
| 59 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 60 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 61 | ALC880_LG_LW, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 62 | #ifdef CONFIG_SND_DEBUG |
| 63 | ALC880_TEST, |
| 64 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 65 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 66 | ALC880_MODEL_LAST /* last tag */ |
| 67 | }; |
| 68 | |
| 69 | /* ALC260 models */ |
| 70 | enum { |
| 71 | ALC260_BASIC, |
| 72 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 73 | ALC260_HP_3013, |
| 74 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 75 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 76 | ALC260_WILL, |
| 77 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 78 | #ifdef CONFIG_SND_DEBUG |
| 79 | ALC260_TEST, |
| 80 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 81 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 82 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | }; |
| 84 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | /* ALC262 models */ |
| 86 | enum { |
| 87 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 88 | ALC262_HIPPO, |
| 89 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 90 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 91 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 92 | ALC262_HP_BPC_D7000_WL, |
| 93 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 94 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 95 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 96 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 97 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 98 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 99 | ALC262_ULTRA, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 100 | ALC262_AUTO, |
| 101 | ALC262_MODEL_LAST /* last tag */ |
| 102 | }; |
| 103 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 104 | /* ALC268 models */ |
| 105 | enum { |
| 106 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 107 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 108 | ALC268_ACER, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 109 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 110 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 111 | #ifdef CONFIG_SND_DEBUG |
| 112 | ALC268_TEST, |
| 113 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | ALC268_AUTO, |
| 115 | ALC268_MODEL_LAST /* last tag */ |
| 116 | }; |
| 117 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 118 | /* ALC269 models */ |
| 119 | enum { |
| 120 | ALC269_BASIC, |
| 121 | ALC269_AUTO, |
| 122 | ALC269_MODEL_LAST /* last tag */ |
| 123 | }; |
| 124 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 125 | /* ALC861 models */ |
| 126 | enum { |
| 127 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 128 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 129 | ALC861_3ST_DIG, |
| 130 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 131 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 132 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 133 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 134 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 135 | ALC861_AUTO, |
| 136 | ALC861_MODEL_LAST, |
| 137 | }; |
| 138 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 139 | /* ALC861-VD models */ |
| 140 | enum { |
| 141 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 142 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 143 | ALC861VD_3ST, |
| 144 | ALC861VD_3ST_DIG, |
| 145 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 146 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 147 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 148 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 149 | ALC861VD_AUTO, |
| 150 | ALC861VD_MODEL_LAST, |
| 151 | }; |
| 152 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 153 | /* ALC662 models */ |
| 154 | enum { |
| 155 | ALC662_3ST_2ch_DIG, |
| 156 | ALC662_3ST_6ch_DIG, |
| 157 | ALC662_3ST_6ch, |
| 158 | ALC662_5ST_DIG, |
| 159 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 160 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 161 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 162 | ALC662_AUTO, |
| 163 | ALC662_MODEL_LAST, |
| 164 | }; |
| 165 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 166 | /* ALC882 models */ |
| 167 | enum { |
| 168 | ALC882_3ST_DIG, |
| 169 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 170 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 171 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 172 | ALC882_TARGA, |
| 173 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 174 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 175 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 176 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 177 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 178 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 179 | ALC882_MODEL_LAST, |
| 180 | }; |
| 181 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 182 | /* ALC883 models */ |
| 183 | enum { |
| 184 | ALC883_3ST_2ch_DIG, |
| 185 | ALC883_3ST_6ch_DIG, |
| 186 | ALC883_3ST_6ch, |
| 187 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 188 | ALC883_TARGA_DIG, |
| 189 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 190 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 191 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 192 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 193 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 194 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 195 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 196 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 197 | ALC888_LENOVO_MS7195_DIG, |
| 198 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 199 | ALC888_6ST_HP, |
| 200 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 201 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 202 | ALC883_MITAC, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 203 | ALC883_AUTO, |
| 204 | ALC883_MODEL_LAST, |
| 205 | }; |
| 206 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 207 | /* for GPIO Poll */ |
| 208 | #define GPIO_MASK 0x03 |
| 209 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | struct alc_spec { |
| 211 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 212 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | unsigned int num_mixers; |
| 214 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 215 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 216 | * don't forget NULL |
| 217 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 218 | */ |
| 219 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 221 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | struct hda_pcm_stream *stream_analog_playback; |
| 223 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 224 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 225 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 227 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | struct hda_pcm_stream *stream_digital_playback; |
| 229 | struct hda_pcm_stream *stream_digital_capture; |
| 230 | |
| 231 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 232 | struct hda_multi_out multiout; /* playback set-up |
| 233 | * max_channels, dacs must be set |
| 234 | * dig_out_nid and hp_nid are optional |
| 235 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 236 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | |
| 238 | /* capture */ |
| 239 | unsigned int num_adc_nids; |
| 240 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 241 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | |
| 243 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 244 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | const struct hda_input_mux *input_mux; |
| 246 | unsigned int cur_mux[3]; |
| 247 | |
| 248 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 249 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 251 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | |
| 253 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 254 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 255 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 256 | /* dynamic controls, init_verbs and input_mux */ |
| 257 | struct auto_pin_cfg autocfg; |
| 258 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 259 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 260 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 261 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 262 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 263 | /* hooks */ |
| 264 | void (*init_hook)(struct hda_codec *codec); |
| 265 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 266 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 267 | /* for pin sensing */ |
| 268 | unsigned int sense_updated: 1; |
| 269 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 270 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 271 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 272 | /* for virtual master */ |
| 273 | hda_nid_t vmaster_nid; |
| 274 | u32 vmaster_tlv[4]; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 275 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 276 | struct hda_loopback_check loopback; |
| 277 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 278 | }; |
| 279 | |
| 280 | /* |
| 281 | * configuration template - to be copied to the spec instance |
| 282 | */ |
| 283 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 284 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 285 | * with spec |
| 286 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 287 | const struct hda_verb *init_verbs[5]; |
| 288 | unsigned int num_dacs; |
| 289 | hda_nid_t *dac_nids; |
| 290 | hda_nid_t dig_out_nid; /* optional */ |
| 291 | hda_nid_t hp_nid; /* optional */ |
| 292 | unsigned int num_adc_nids; |
| 293 | hda_nid_t *adc_nids; |
| 294 | hda_nid_t dig_in_nid; |
| 295 | unsigned int num_channel_mode; |
| 296 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 297 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 298 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 299 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 300 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 301 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 302 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 303 | struct hda_amp_list *loopbacks; |
| 304 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | }; |
| 306 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | |
| 308 | /* |
| 309 | * input MUX handling |
| 310 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 311 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 312 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | { |
| 314 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 315 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 316 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 317 | if (mux_idx >= spec->num_mux_defs) |
| 318 | mux_idx = 0; |
| 319 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | } |
| 321 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 322 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 323 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | { |
| 325 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 326 | struct alc_spec *spec = codec->spec; |
| 327 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 328 | |
| 329 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 330 | return 0; |
| 331 | } |
| 332 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 333 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 334 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | { |
| 336 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 337 | struct alc_spec *spec = codec->spec; |
| 338 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 339 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 340 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 341 | spec->adc_nids[adc_idx], |
| 342 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | } |
| 344 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 345 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | /* |
| 347 | * channel mode setting |
| 348 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 349 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 350 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | { |
| 352 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 353 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 354 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 355 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | } |
| 357 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 358 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 359 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | { |
| 361 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 362 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 363 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 364 | spec->num_channel_mode, |
| 365 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | } |
| 367 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 368 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 369 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 370 | { |
| 371 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 372 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 373 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 374 | spec->num_channel_mode, |
| 375 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 376 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 377 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 378 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | } |
| 380 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 382 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 383 | * instead of "%" to avoid consequences of accidently treating the % as |
| 384 | * being part of a format specifier. Maximum allowed length of a value is |
| 385 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 386 | * |
| 387 | * Note: some retasking pin complexes seem to ignore requests for input |
| 388 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 389 | * are requested. Therefore order this list so that this behaviour will not |
| 390 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 391 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 392 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 393 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 394 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 395 | "Mic 50pc bias", "Mic 80pc bias", |
| 396 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 397 | }; |
| 398 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 399 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 400 | }; |
| 401 | /* 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] | 402 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 403 | * addition, "input" pins may or may not process the mic bias option |
| 404 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 405 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 406 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 407 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 408 | #define ALC_PIN_DIR_IN 0x00 |
| 409 | #define ALC_PIN_DIR_OUT 0x01 |
| 410 | #define ALC_PIN_DIR_INOUT 0x02 |
| 411 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 412 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 413 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 414 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 415 | * For each direction the minimum and maximum values are given. |
| 416 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 417 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 418 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 419 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 420 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 421 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 422 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 423 | }; |
| 424 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 425 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 426 | #define alc_pin_mode_n_items(_dir) \ |
| 427 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 428 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 429 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 430 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 431 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 432 | unsigned int item_num = uinfo->value.enumerated.item; |
| 433 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 434 | |
| 435 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 436 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 437 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 438 | |
| 439 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 440 | item_num = alc_pin_mode_min(dir); |
| 441 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 442 | return 0; |
| 443 | } |
| 444 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 445 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 446 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 447 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 448 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 449 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 450 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 451 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 452 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 453 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 454 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 455 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 456 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 457 | /* Find enumerated value for current pinctl setting */ |
| 458 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 459 | 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] | 460 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 461 | *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] | 462 | return 0; |
| 463 | } |
| 464 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 465 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 466 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 467 | { |
| 468 | signed int change; |
| 469 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 470 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 471 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 472 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 473 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 474 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 475 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 476 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 477 | 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] | 478 | val = alc_pin_mode_min(dir); |
| 479 | |
| 480 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 481 | if (change) { |
| 482 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 483 | snd_hda_codec_write_cache(codec, nid, 0, |
| 484 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 485 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 486 | |
| 487 | /* Also enable the retasking pin's input/output as required |
| 488 | * for the requested pin mode. Enum values of 2 or less are |
| 489 | * input modes. |
| 490 | * |
| 491 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 492 | * reduces noise slightly (particularly on input) so we'll |
| 493 | * do it. However, having both input and output buffers |
| 494 | * enabled simultaneously doesn't seem to be problematic if |
| 495 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 496 | */ |
| 497 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 498 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 499 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 500 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 501 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 502 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 503 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 504 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 505 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 506 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 507 | } |
| 508 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 509 | return change; |
| 510 | } |
| 511 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 512 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 513 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 514 | .info = alc_pin_mode_info, \ |
| 515 | .get = alc_pin_mode_get, \ |
| 516 | .put = alc_pin_mode_put, \ |
| 517 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 518 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 519 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 520 | * together using a mask with more than one bit set. This control is |
| 521 | * currently used only by the ALC260 test model. At this stage they are not |
| 522 | * needed for any "production" models. |
| 523 | */ |
| 524 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 525 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 526 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 527 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 528 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 529 | { |
| 530 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 531 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 532 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 533 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 534 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 535 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 536 | |
| 537 | *valp = (val & mask) != 0; |
| 538 | return 0; |
| 539 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 540 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 541 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 542 | { |
| 543 | signed int change; |
| 544 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 545 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 546 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 547 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 548 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 549 | AC_VERB_GET_GPIO_DATA, |
| 550 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 551 | |
| 552 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 553 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 554 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 555 | gpio_data &= ~mask; |
| 556 | else |
| 557 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 558 | snd_hda_codec_write_cache(codec, nid, 0, |
| 559 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 560 | |
| 561 | return change; |
| 562 | } |
| 563 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 564 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 565 | .info = alc_gpio_data_info, \ |
| 566 | .get = alc_gpio_data_get, \ |
| 567 | .put = alc_gpio_data_put, \ |
| 568 | .private_value = nid | (mask<<16) } |
| 569 | #endif /* CONFIG_SND_DEBUG */ |
| 570 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 571 | /* A switch control to allow the enabling of the digital IO pins on the |
| 572 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 573 | * to provide something in the test model allowing digital outputs to be |
| 574 | * identified if present. If models are found which can utilise these |
| 575 | * outputs a more complete mixer control can be devised for those models if |
| 576 | * necessary. |
| 577 | */ |
| 578 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 579 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 580 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 581 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 582 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 583 | { |
| 584 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 585 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 586 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 587 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 588 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 589 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 590 | |
| 591 | *valp = (val & mask) != 0; |
| 592 | return 0; |
| 593 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 594 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 595 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 596 | { |
| 597 | signed int change; |
| 598 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 599 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 600 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 601 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 602 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 603 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 604 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 605 | |
| 606 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 607 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 608 | if (val==0) |
| 609 | ctrl_data &= ~mask; |
| 610 | else |
| 611 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 612 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 613 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 614 | |
| 615 | return change; |
| 616 | } |
| 617 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 618 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 619 | .info = alc_spdif_ctrl_info, \ |
| 620 | .get = alc_spdif_ctrl_get, \ |
| 621 | .put = alc_spdif_ctrl_put, \ |
| 622 | .private_value = nid | (mask<<16) } |
| 623 | #endif /* CONFIG_SND_DEBUG */ |
| 624 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 625 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 626 | * Again, this is only used in the ALC26x test models to help identify when |
| 627 | * the EAPD line must be asserted for features to work. |
| 628 | */ |
| 629 | #ifdef CONFIG_SND_DEBUG |
| 630 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 631 | |
| 632 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 633 | struct snd_ctl_elem_value *ucontrol) |
| 634 | { |
| 635 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 636 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 637 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 638 | long *valp = ucontrol->value.integer.value; |
| 639 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 640 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 641 | |
| 642 | *valp = (val & mask) != 0; |
| 643 | return 0; |
| 644 | } |
| 645 | |
| 646 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 647 | struct snd_ctl_elem_value *ucontrol) |
| 648 | { |
| 649 | int change; |
| 650 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 651 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 652 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 653 | long val = *ucontrol->value.integer.value; |
| 654 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 655 | AC_VERB_GET_EAPD_BTLENABLE, |
| 656 | 0x00); |
| 657 | |
| 658 | /* Set/unset the masked control bit(s) as needed */ |
| 659 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 660 | if (!val) |
| 661 | ctrl_data &= ~mask; |
| 662 | else |
| 663 | ctrl_data |= mask; |
| 664 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 665 | ctrl_data); |
| 666 | |
| 667 | return change; |
| 668 | } |
| 669 | |
| 670 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 671 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 672 | .info = alc_eapd_ctrl_info, \ |
| 673 | .get = alc_eapd_ctrl_get, \ |
| 674 | .put = alc_eapd_ctrl_put, \ |
| 675 | .private_value = nid | (mask<<16) } |
| 676 | #endif /* CONFIG_SND_DEBUG */ |
| 677 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 678 | /* |
| 679 | * set up from the preset table |
| 680 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 681 | static void setup_preset(struct alc_spec *spec, |
| 682 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 683 | { |
| 684 | int i; |
| 685 | |
| 686 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 687 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 688 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 689 | i++) |
| 690 | spec->init_verbs[spec->num_init_verbs++] = |
| 691 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 692 | |
| 693 | spec->channel_mode = preset->channel_mode; |
| 694 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 695 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 696 | |
| 697 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 698 | |
| 699 | spec->multiout.num_dacs = preset->num_dacs; |
| 700 | spec->multiout.dac_nids = preset->dac_nids; |
| 701 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 702 | spec->multiout.hp_nid = preset->hp_nid; |
| 703 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 704 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 705 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 706 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 707 | spec->input_mux = preset->input_mux; |
| 708 | |
| 709 | spec->num_adc_nids = preset->num_adc_nids; |
| 710 | spec->adc_nids = preset->adc_nids; |
| 711 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 712 | |
| 713 | spec->unsol_event = preset->unsol_event; |
| 714 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 715 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 716 | spec->loopback.amplist = preset->loopbacks; |
| 717 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 718 | } |
| 719 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 720 | /* Enable GPIO mask and set output */ |
| 721 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 722 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 723 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 724 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 725 | { } |
| 726 | }; |
| 727 | |
| 728 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 729 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 730 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 731 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 732 | { } |
| 733 | }; |
| 734 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 735 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 736 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 737 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 738 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 739 | { } |
| 740 | }; |
| 741 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 742 | static void alc_sku_automute(struct hda_codec *codec) |
| 743 | { |
| 744 | struct alc_spec *spec = codec->spec; |
| 745 | unsigned int mute; |
| 746 | unsigned int present; |
| 747 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 748 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 749 | |
| 750 | /* need to execute and sync at first */ |
| 751 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 752 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 753 | AC_VERB_GET_PIN_SENSE, 0); |
| 754 | spec->jack_present = (present & 0x80000000) != 0; |
| 755 | if (spec->jack_present) { |
| 756 | /* mute internal speaker */ |
| 757 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, |
| 758 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 759 | } else { |
| 760 | /* unmute internal speaker if necessary */ |
| 761 | mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0); |
| 762 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, |
| 763 | HDA_AMP_MUTE, mute); |
| 764 | } |
| 765 | } |
| 766 | |
| 767 | /* unsolicited event for HP jack sensing */ |
| 768 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 769 | { |
| 770 | if (codec->vendor_id == 0x10ec0880) |
| 771 | res >>= 28; |
| 772 | else |
| 773 | res >>= 26; |
| 774 | if (res != ALC880_HP_EVENT) |
| 775 | return; |
| 776 | |
| 777 | alc_sku_automute(codec); |
| 778 | } |
| 779 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 780 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 781 | * 31 ~ 16 : Manufacture ID |
| 782 | * 15 ~ 8 : SKU ID |
| 783 | * 7 ~ 0 : Assembly ID |
| 784 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 785 | */ |
| 786 | static void alc_subsystem_id(struct hda_codec *codec, |
| 787 | unsigned int porta, unsigned int porte, |
| 788 | unsigned int portd) |
| 789 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 790 | unsigned int ass, tmp, i; |
| 791 | unsigned nid; |
| 792 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 793 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 794 | ass = codec->subsystem_id & 0xffff; |
| 795 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 796 | goto do_sku; |
| 797 | |
| 798 | /* |
| 799 | * 31~30 : port conetcivity |
| 800 | * 29~21 : reserve |
| 801 | * 20 : PCBEEP input |
| 802 | * 19~16 : Check sum (15:1) |
| 803 | * 15~1 : Custom |
| 804 | * 0 : override |
| 805 | */ |
| 806 | nid = 0x1d; |
| 807 | if (codec->vendor_id == 0x10ec0260) |
| 808 | nid = 0x17; |
| 809 | ass = snd_hda_codec_read(codec, nid, 0, |
| 810 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 811 | if (!(ass & 1) && !(ass & 0x100000)) |
| 812 | return; |
| 813 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 814 | return; |
| 815 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 816 | /* check sum */ |
| 817 | tmp = 0; |
| 818 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 819 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 820 | tmp++; |
| 821 | } |
| 822 | if (((ass >> 16) & 0xf) != tmp) |
| 823 | return; |
| 824 | do_sku: |
| 825 | /* |
| 826 | * 0 : override |
| 827 | * 1 : Swap Jack |
| 828 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 829 | * 3~5 : External Amplifier control |
| 830 | * 7~6 : Reserved |
| 831 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 832 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 833 | switch (tmp) { |
| 834 | case 1: |
| 835 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 836 | break; |
| 837 | case 3: |
| 838 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 839 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 840 | case 7: |
| 841 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 842 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 843 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 844 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 845 | case 0x10ec0260: |
| 846 | snd_hda_codec_write(codec, 0x0f, 0, |
| 847 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 848 | snd_hda_codec_write(codec, 0x10, 0, |
| 849 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 850 | break; |
| 851 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 852 | case 0x10ec0267: |
| 853 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 854 | case 0x10ec0269: |
| 855 | case 0x10ec0862: |
| 856 | case 0x10ec0662: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 857 | snd_hda_codec_write(codec, 0x14, 0, |
| 858 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 859 | snd_hda_codec_write(codec, 0x15, 0, |
| 860 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 861 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 862 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 863 | switch (codec->vendor_id) { |
| 864 | case 0x10ec0260: |
| 865 | snd_hda_codec_write(codec, 0x1a, 0, |
| 866 | AC_VERB_SET_COEF_INDEX, 7); |
| 867 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 868 | AC_VERB_GET_PROC_COEF, 0); |
| 869 | snd_hda_codec_write(codec, 0x1a, 0, |
| 870 | AC_VERB_SET_COEF_INDEX, 7); |
| 871 | snd_hda_codec_write(codec, 0x1a, 0, |
| 872 | AC_VERB_SET_PROC_COEF, |
| 873 | tmp | 0x2010); |
| 874 | break; |
| 875 | case 0x10ec0262: |
| 876 | case 0x10ec0880: |
| 877 | case 0x10ec0882: |
| 878 | case 0x10ec0883: |
| 879 | case 0x10ec0885: |
| 880 | case 0x10ec0888: |
| 881 | snd_hda_codec_write(codec, 0x20, 0, |
| 882 | AC_VERB_SET_COEF_INDEX, 7); |
| 883 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 884 | AC_VERB_GET_PROC_COEF, 0); |
| 885 | snd_hda_codec_write(codec, 0x20, 0, |
| 886 | AC_VERB_SET_COEF_INDEX, 7); |
| 887 | snd_hda_codec_write(codec, 0x20, 0, |
| 888 | AC_VERB_SET_PROC_COEF, |
| 889 | tmp | 0x2010); |
| 890 | break; |
| 891 | case 0x10ec0267: |
| 892 | case 0x10ec0268: |
| 893 | snd_hda_codec_write(codec, 0x20, 0, |
| 894 | AC_VERB_SET_COEF_INDEX, 7); |
| 895 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 896 | AC_VERB_GET_PROC_COEF, 0); |
| 897 | snd_hda_codec_write(codec, 0x20, 0, |
| 898 | AC_VERB_SET_COEF_INDEX, 7); |
| 899 | snd_hda_codec_write(codec, 0x20, 0, |
| 900 | AC_VERB_SET_PROC_COEF, |
| 901 | tmp | 0x3000); |
| 902 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 903 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 904 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 905 | break; |
| 906 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 907 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 908 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 909 | * when the external headphone out jack is plugged" |
| 910 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 911 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 912 | return; |
| 913 | /* |
| 914 | * 10~8 : Jack location |
| 915 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 916 | * 14~13: Resvered |
| 917 | * 15 : 1 --> enable the function "Mute internal speaker |
| 918 | * when the external headphone out jack is plugged" |
| 919 | */ |
| 920 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 921 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 922 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 923 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 924 | else |
| 925 | return; |
| 926 | } |
| 927 | |
| 928 | if (!spec->autocfg.hp_pins[0]) { |
| 929 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 930 | if (tmp == 0) |
| 931 | spec->autocfg.hp_pins[0] = porta; |
| 932 | else if (tmp == 1) |
| 933 | spec->autocfg.hp_pins[0] = porte; |
| 934 | else if (tmp == 2) |
| 935 | spec->autocfg.hp_pins[0] = portd; |
| 936 | else |
| 937 | return; |
| 938 | } |
| 939 | |
| 940 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 941 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 942 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 943 | spec->unsol_event = alc_sku_unsol_event; |
| 944 | spec->init_hook = alc_sku_automute; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 945 | } |
| 946 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 947 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 948 | * Fix-up pin default configurations |
| 949 | */ |
| 950 | |
| 951 | struct alc_pincfg { |
| 952 | hda_nid_t nid; |
| 953 | u32 val; |
| 954 | }; |
| 955 | |
| 956 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 957 | const struct snd_pci_quirk *quirk, |
| 958 | const struct alc_pincfg **pinfix) |
| 959 | { |
| 960 | const struct alc_pincfg *cfg; |
| 961 | |
| 962 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 963 | if (!quirk) |
| 964 | return; |
| 965 | |
| 966 | cfg = pinfix[quirk->value]; |
| 967 | for (; cfg->nid; cfg++) { |
| 968 | int i; |
| 969 | u32 val = cfg->val; |
| 970 | for (i = 0; i < 4; i++) { |
| 971 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 972 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 973 | val & 0xff); |
| 974 | val >>= 8; |
| 975 | } |
| 976 | } |
| 977 | } |
| 978 | |
| 979 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 980 | * ALC880 3-stack model |
| 981 | * |
| 982 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 983 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 984 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 985 | */ |
| 986 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 987 | static hda_nid_t alc880_dac_nids[4] = { |
| 988 | /* front, rear, clfe, rear_surr */ |
| 989 | 0x02, 0x05, 0x04, 0x03 |
| 990 | }; |
| 991 | |
| 992 | static hda_nid_t alc880_adc_nids[3] = { |
| 993 | /* ADC0-2 */ |
| 994 | 0x07, 0x08, 0x09, |
| 995 | }; |
| 996 | |
| 997 | /* The datasheet says the node 0x07 is connected from inputs, |
| 998 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 999 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1000 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1001 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1002 | /* ADC1-2 */ |
| 1003 | 0x08, 0x09, |
| 1004 | }; |
| 1005 | |
| 1006 | #define ALC880_DIGOUT_NID 0x06 |
| 1007 | #define ALC880_DIGIN_NID 0x0a |
| 1008 | |
| 1009 | static struct hda_input_mux alc880_capture_source = { |
| 1010 | .num_items = 4, |
| 1011 | .items = { |
| 1012 | { "Mic", 0x0 }, |
| 1013 | { "Front Mic", 0x3 }, |
| 1014 | { "Line", 0x2 }, |
| 1015 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1016 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1017 | }; |
| 1018 | |
| 1019 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1020 | /* 2ch mode */ |
| 1021 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1022 | /* set line-in to input, mute it */ |
| 1023 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1024 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1025 | /* set mic-in to input vref 80%, mute it */ |
| 1026 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1027 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1028 | { } /* end */ |
| 1029 | }; |
| 1030 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1031 | /* 6ch mode */ |
| 1032 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1033 | /* set line-in to output, unmute it */ |
| 1034 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1035 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1036 | /* set mic-in to output, unmute it */ |
| 1037 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1038 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1039 | { } /* end */ |
| 1040 | }; |
| 1041 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1042 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1043 | { 2, alc880_threestack_ch2_init }, |
| 1044 | { 6, alc880_threestack_ch6_init }, |
| 1045 | }; |
| 1046 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1047 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1048 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1049 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1050 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1051 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1052 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1053 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1054 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1055 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1056 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1057 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1058 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1059 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1060 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1061 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1062 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1063 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1064 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1065 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1066 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1067 | { |
| 1068 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1069 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1070 | .info = alc_ch_mode_info, |
| 1071 | .get = alc_ch_mode_get, |
| 1072 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1073 | }, |
| 1074 | { } /* end */ |
| 1075 | }; |
| 1076 | |
| 1077 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1078 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1079 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1080 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1081 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1082 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1083 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1084 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1085 | { |
| 1086 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1087 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1088 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1089 | */ |
| 1090 | /* .name = "Capture Source", */ |
| 1091 | .name = "Input Source", |
| 1092 | .count = 3, |
| 1093 | .info = alc_mux_enum_info, |
| 1094 | .get = alc_mux_enum_get, |
| 1095 | .put = alc_mux_enum_put, |
| 1096 | }, |
| 1097 | { } /* end */ |
| 1098 | }; |
| 1099 | |
| 1100 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1101 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1102 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1103 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1104 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1105 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1106 | { |
| 1107 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1108 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1109 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1110 | */ |
| 1111 | /* .name = "Capture Source", */ |
| 1112 | .name = "Input Source", |
| 1113 | .count = 2, |
| 1114 | .info = alc_mux_enum_info, |
| 1115 | .get = alc_mux_enum_get, |
| 1116 | .put = alc_mux_enum_put, |
| 1117 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1118 | { } /* end */ |
| 1119 | }; |
| 1120 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1121 | |
| 1122 | |
| 1123 | /* |
| 1124 | * ALC880 5-stack model |
| 1125 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1126 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1127 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1128 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1129 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1130 | */ |
| 1131 | |
| 1132 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1133 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1134 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1135 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1136 | { } /* end */ |
| 1137 | }; |
| 1138 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1139 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1140 | /* 6ch mode */ |
| 1141 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1142 | /* set line-in to input, mute it */ |
| 1143 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1144 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1145 | { } /* end */ |
| 1146 | }; |
| 1147 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1148 | /* 8ch mode */ |
| 1149 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1150 | /* set line-in to output, unmute it */ |
| 1151 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1152 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1153 | { } /* end */ |
| 1154 | }; |
| 1155 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1156 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1157 | { 6, alc880_fivestack_ch6_init }, |
| 1158 | { 8, alc880_fivestack_ch8_init }, |
| 1159 | }; |
| 1160 | |
| 1161 | |
| 1162 | /* |
| 1163 | * ALC880 6-stack model |
| 1164 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1165 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1166 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1167 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1168 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1169 | */ |
| 1170 | |
| 1171 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1172 | /* front, rear, clfe, rear_surr */ |
| 1173 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1174 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1175 | |
| 1176 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1177 | .num_items = 4, |
| 1178 | .items = { |
| 1179 | { "Mic", 0x0 }, |
| 1180 | { "Front Mic", 0x1 }, |
| 1181 | { "Line", 0x2 }, |
| 1182 | { "CD", 0x4 }, |
| 1183 | }, |
| 1184 | }; |
| 1185 | |
| 1186 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1187 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1188 | { 8, NULL }, |
| 1189 | }; |
| 1190 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1191 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1192 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1193 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1194 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1195 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1196 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1197 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1198 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1199 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1200 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1201 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1202 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1203 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1204 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1205 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1206 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1207 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1208 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1209 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1210 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1211 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1212 | { |
| 1213 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1214 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1215 | .info = alc_ch_mode_info, |
| 1216 | .get = alc_ch_mode_get, |
| 1217 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1218 | }, |
| 1219 | { } /* end */ |
| 1220 | }; |
| 1221 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1222 | |
| 1223 | /* |
| 1224 | * ALC880 W810 model |
| 1225 | * |
| 1226 | * W810 has rear IO for: |
| 1227 | * Front (DAC 02) |
| 1228 | * Surround (DAC 03) |
| 1229 | * Center/LFE (DAC 04) |
| 1230 | * Digital out (06) |
| 1231 | * |
| 1232 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1233 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1234 | * |
| 1235 | * There is a variable resistor to control the speaker or headphone |
| 1236 | * volume. This is a hardware-only device without a software API. |
| 1237 | * |
| 1238 | * Plugging headphones in will disable the internal speakers. This is |
| 1239 | * implemented in hardware, not via the driver using jack sense. In |
| 1240 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1241 | * disable both the speakers and headphones. |
| 1242 | * |
| 1243 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1244 | * These may not do anything useful with this driver yet, because I |
| 1245 | * haven't setup any initialization verbs for these yet... |
| 1246 | */ |
| 1247 | |
| 1248 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1249 | /* front, rear/surround, clfe */ |
| 1250 | 0x02, 0x03, 0x04 |
| 1251 | }; |
| 1252 | |
| 1253 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1254 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1255 | { 6, NULL } |
| 1256 | }; |
| 1257 | |
| 1258 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1259 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1260 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1261 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1262 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1263 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1264 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1265 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1266 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1267 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1268 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1269 | { } /* end */ |
| 1270 | }; |
| 1271 | |
| 1272 | |
| 1273 | /* |
| 1274 | * Z710V model |
| 1275 | * |
| 1276 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1277 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1278 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1279 | */ |
| 1280 | |
| 1281 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1282 | 0x02 |
| 1283 | }; |
| 1284 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1285 | |
| 1286 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1287 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1288 | { 2, NULL } |
| 1289 | }; |
| 1290 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1291 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1292 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1293 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1294 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1295 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1296 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1297 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1298 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1299 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1300 | { } /* end */ |
| 1301 | }; |
| 1302 | |
| 1303 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1304 | /* |
| 1305 | * ALC880 F1734 model |
| 1306 | * |
| 1307 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1308 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1309 | */ |
| 1310 | |
| 1311 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1312 | 0x03 |
| 1313 | }; |
| 1314 | #define ALC880_F1734_HP_DAC 0x02 |
| 1315 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1316 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1317 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1318 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1319 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1320 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1321 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1322 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame^] | 1323 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1324 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1325 | { } /* end */ |
| 1326 | }; |
| 1327 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame^] | 1328 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1329 | .num_items = 2, |
| 1330 | .items = { |
| 1331 | { "Mic", 0x1 }, |
| 1332 | { "CD", 0x4 }, |
| 1333 | }, |
| 1334 | }; |
| 1335 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1336 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1337 | /* |
| 1338 | * ALC880 ASUS model |
| 1339 | * |
| 1340 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1341 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1342 | * Mic = 0x18, Line = 0x1a |
| 1343 | */ |
| 1344 | |
| 1345 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1346 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1347 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1348 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1349 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1350 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1351 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1352 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1353 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1354 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1355 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1356 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1357 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1358 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1359 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1360 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1361 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1362 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1363 | { |
| 1364 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1365 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1366 | .info = alc_ch_mode_info, |
| 1367 | .get = alc_ch_mode_get, |
| 1368 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1369 | }, |
| 1370 | { } /* end */ |
| 1371 | }; |
| 1372 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1373 | /* |
| 1374 | * ALC880 ASUS W1V model |
| 1375 | * |
| 1376 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1377 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1378 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1379 | */ |
| 1380 | |
| 1381 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1382 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1383 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1384 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1385 | { } /* end */ |
| 1386 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1387 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1388 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1389 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1390 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1391 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1392 | { } /* end */ |
| 1393 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1394 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1395 | /* TCL S700 */ |
| 1396 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1397 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1398 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1399 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1400 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1401 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1402 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1403 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1404 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1405 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1406 | { |
| 1407 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1408 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1409 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1410 | */ |
| 1411 | /* .name = "Capture Source", */ |
| 1412 | .name = "Input Source", |
| 1413 | .count = 1, |
| 1414 | .info = alc_mux_enum_info, |
| 1415 | .get = alc_mux_enum_get, |
| 1416 | .put = alc_mux_enum_put, |
| 1417 | }, |
| 1418 | { } /* end */ |
| 1419 | }; |
| 1420 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1421 | /* Uniwill */ |
| 1422 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1423 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1424 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1425 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1426 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1427 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1428 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1429 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1430 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1431 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1432 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1433 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1434 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1435 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1436 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1437 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1438 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1439 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1440 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1441 | { |
| 1442 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1443 | .name = "Channel Mode", |
| 1444 | .info = alc_ch_mode_info, |
| 1445 | .get = alc_ch_mode_get, |
| 1446 | .put = alc_ch_mode_put, |
| 1447 | }, |
| 1448 | { } /* end */ |
| 1449 | }; |
| 1450 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1451 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1452 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1453 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1454 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1455 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1456 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1457 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1458 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1459 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1460 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1461 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1462 | { } /* end */ |
| 1463 | }; |
| 1464 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1465 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1466 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1467 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1468 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1469 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1470 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1471 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1472 | { } /* end */ |
| 1473 | }; |
| 1474 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1475 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1476 | * virtual master controls |
| 1477 | */ |
| 1478 | |
| 1479 | /* |
| 1480 | * slave controls for virtual master |
| 1481 | */ |
| 1482 | static const char *alc_slave_vols[] = { |
| 1483 | "Front Playback Volume", |
| 1484 | "Surround Playback Volume", |
| 1485 | "Center Playback Volume", |
| 1486 | "LFE Playback Volume", |
| 1487 | "Side Playback Volume", |
| 1488 | "Headphone Playback Volume", |
| 1489 | "Speaker Playback Volume", |
| 1490 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1491 | "Line-Out Playback Volume", |
| 1492 | NULL, |
| 1493 | }; |
| 1494 | |
| 1495 | static const char *alc_slave_sws[] = { |
| 1496 | "Front Playback Switch", |
| 1497 | "Surround Playback Switch", |
| 1498 | "Center Playback Switch", |
| 1499 | "LFE Playback Switch", |
| 1500 | "Side Playback Switch", |
| 1501 | "Headphone Playback Switch", |
| 1502 | "Speaker Playback Switch", |
| 1503 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1504 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1505 | NULL, |
| 1506 | }; |
| 1507 | |
| 1508 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1509 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1510 | */ |
| 1511 | static int alc_build_controls(struct hda_codec *codec) |
| 1512 | { |
| 1513 | struct alc_spec *spec = codec->spec; |
| 1514 | int err; |
| 1515 | int i; |
| 1516 | |
| 1517 | for (i = 0; i < spec->num_mixers; i++) { |
| 1518 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1519 | if (err < 0) |
| 1520 | return err; |
| 1521 | } |
| 1522 | |
| 1523 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1524 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1525 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1526 | if (err < 0) |
| 1527 | return err; |
| 1528 | } |
| 1529 | if (spec->dig_in_nid) { |
| 1530 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1531 | if (err < 0) |
| 1532 | return err; |
| 1533 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1534 | |
| 1535 | /* if we have no master control, let's create it */ |
| 1536 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
| 1537 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
| 1538 | HDA_OUTPUT, spec->vmaster_tlv); |
| 1539 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
| 1540 | spec->vmaster_tlv, alc_slave_vols); |
| 1541 | if (err < 0) |
| 1542 | return err; |
| 1543 | } |
| 1544 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1545 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1546 | NULL, alc_slave_sws); |
| 1547 | if (err < 0) |
| 1548 | return err; |
| 1549 | } |
| 1550 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1551 | return 0; |
| 1552 | } |
| 1553 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1554 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1555 | /* |
| 1556 | * initialize the codec volumes, etc |
| 1557 | */ |
| 1558 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1559 | /* |
| 1560 | * generic initialization of ADC, input mixers and output mixers |
| 1561 | */ |
| 1562 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1563 | /* |
| 1564 | * Unmute ADC0-2 and set the default input to mic-in |
| 1565 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1566 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1567 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1568 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1569 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1570 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1571 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1572 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1573 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1574 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1575 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1576 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1577 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1578 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1579 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1580 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1581 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1582 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1583 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1584 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1585 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1586 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1587 | /* |
| 1588 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1589 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1590 | /* set vol=0 to output mixers */ |
| 1591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1592 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1593 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1594 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1595 | /* set up input amps for analog loopback */ |
| 1596 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1597 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1599 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1600 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1601 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1602 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1603 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1604 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1605 | |
| 1606 | { } |
| 1607 | }; |
| 1608 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1609 | /* |
| 1610 | * 3-stack pin configuration: |
| 1611 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1612 | */ |
| 1613 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1614 | /* |
| 1615 | * preset connection lists of input pins |
| 1616 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1617 | */ |
| 1618 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1619 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1620 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1621 | |
| 1622 | /* |
| 1623 | * Set pin mode and muting |
| 1624 | */ |
| 1625 | /* set front pin widgets 0x14 for output */ |
| 1626 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1627 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1628 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1629 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1630 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1631 | /* Mic2 (as headphone out) for HP output */ |
| 1632 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1633 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1634 | /* Line In pin widget for input */ |
| 1635 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1636 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1637 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1638 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1639 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1640 | /* CD pin widget for input */ |
| 1641 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1642 | |
| 1643 | { } |
| 1644 | }; |
| 1645 | |
| 1646 | /* |
| 1647 | * 5-stack pin configuration: |
| 1648 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1649 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1650 | */ |
| 1651 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1652 | /* |
| 1653 | * preset connection lists of input pins |
| 1654 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1655 | */ |
| 1656 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1657 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1658 | |
| 1659 | /* |
| 1660 | * Set pin mode and muting |
| 1661 | */ |
| 1662 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1663 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1664 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1665 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1666 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1667 | /* unmute pins for output (no gain on this amp) */ |
| 1668 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1669 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1670 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1671 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1672 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1673 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1674 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1675 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1676 | /* Mic2 (as headphone out) for HP output */ |
| 1677 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1678 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1679 | /* Line In pin widget for input */ |
| 1680 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1681 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1682 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1683 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1684 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1685 | /* CD pin widget for input */ |
| 1686 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1687 | |
| 1688 | { } |
| 1689 | }; |
| 1690 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1691 | /* |
| 1692 | * W810 pin configuration: |
| 1693 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1694 | */ |
| 1695 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1696 | /* hphone/speaker input selector: front DAC */ |
| 1697 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1698 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1699 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1700 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1701 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1702 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1703 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1704 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1705 | |
| 1706 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1707 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1708 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1709 | { } |
| 1710 | }; |
| 1711 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1712 | /* |
| 1713 | * Z71V pin configuration: |
| 1714 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1715 | */ |
| 1716 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1717 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1718 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1719 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1720 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1721 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1722 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1723 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1724 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1725 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1726 | |
| 1727 | { } |
| 1728 | }; |
| 1729 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1730 | /* |
| 1731 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1732 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1733 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1734 | */ |
| 1735 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1736 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1737 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1738 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1739 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1740 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1742 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1743 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1744 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1745 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1746 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1747 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1748 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1749 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1750 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1751 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1752 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1753 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1754 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1755 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1756 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1757 | { } |
| 1758 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1759 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1760 | /* |
| 1761 | * Uniwill pin configuration: |
| 1762 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1763 | * line = 0x1a |
| 1764 | */ |
| 1765 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1766 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1767 | |
| 1768 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1769 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1770 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1771 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1772 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1773 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1774 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1775 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1776 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1777 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1778 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1779 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1780 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1781 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1782 | |
| 1783 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1784 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1785 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1786 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1787 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1788 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1789 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1790 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1791 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1792 | |
| 1793 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1794 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1795 | |
| 1796 | { } |
| 1797 | }; |
| 1798 | |
| 1799 | /* |
| 1800 | * Uniwill P53 |
| 1801 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1802 | */ |
| 1803 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1804 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1805 | |
| 1806 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1807 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1808 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1809 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1810 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1811 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1812 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1813 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1814 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1815 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1816 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1817 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1818 | |
| 1819 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1820 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1821 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1822 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1823 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1824 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1825 | |
| 1826 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1827 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1828 | |
| 1829 | { } |
| 1830 | }; |
| 1831 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1832 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1833 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1834 | { } |
| 1835 | }; |
| 1836 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1837 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1838 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1839 | { |
| 1840 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1841 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1842 | |
| 1843 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1844 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1845 | bits = present ? HDA_AMP_MUTE : 0; |
| 1846 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1847 | HDA_AMP_MUTE, bits); |
| 1848 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1849 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1850 | } |
| 1851 | |
| 1852 | /* auto-toggle front mic */ |
| 1853 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1854 | { |
| 1855 | unsigned int present; |
| 1856 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1857 | |
| 1858 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1859 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1860 | bits = present ? HDA_AMP_MUTE : 0; |
| 1861 | 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] | 1862 | } |
| 1863 | |
| 1864 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1865 | { |
| 1866 | alc880_uniwill_hp_automute(codec); |
| 1867 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1868 | } |
| 1869 | |
| 1870 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1871 | unsigned int res) |
| 1872 | { |
| 1873 | /* Looks like the unsol event is incompatible with the standard |
| 1874 | * definition. 4bit tag is placed at 28 bit! |
| 1875 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1876 | switch (res >> 28) { |
| 1877 | case ALC880_HP_EVENT: |
| 1878 | alc880_uniwill_hp_automute(codec); |
| 1879 | break; |
| 1880 | case ALC880_MIC_EVENT: |
| 1881 | alc880_uniwill_mic_automute(codec); |
| 1882 | break; |
| 1883 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1884 | } |
| 1885 | |
| 1886 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1887 | { |
| 1888 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1889 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1890 | |
| 1891 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1892 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1893 | bits = present ? HDA_AMP_MUTE : 0; |
| 1894 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1895 | } |
| 1896 | |
| 1897 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1898 | { |
| 1899 | unsigned int present; |
| 1900 | |
| 1901 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1902 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1903 | present &= HDA_AMP_VOLMASK; |
| 1904 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1905 | HDA_AMP_VOLMASK, present); |
| 1906 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1907 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1908 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1909 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1910 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1911 | unsigned int res) |
| 1912 | { |
| 1913 | /* Looks like the unsol event is incompatible with the standard |
| 1914 | * definition. 4bit tag is placed at 28 bit! |
| 1915 | */ |
| 1916 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1917 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1918 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1919 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1920 | } |
| 1921 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1922 | /* |
| 1923 | * F1734 pin configuration: |
| 1924 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1925 | */ |
| 1926 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1927 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1928 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1929 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1930 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1931 | |
| 1932 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1933 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1934 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1935 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1936 | |
| 1937 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1938 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1939 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1940 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1941 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1942 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1943 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1944 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1945 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1946 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame^] | 1947 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 1948 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 1949 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1950 | { } |
| 1951 | }; |
| 1952 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1953 | /* |
| 1954 | * ASUS pin configuration: |
| 1955 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1956 | */ |
| 1957 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1958 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1959 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1960 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1961 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1962 | |
| 1963 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1964 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1965 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1966 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1967 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1968 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1969 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1970 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1971 | |
| 1972 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1973 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1974 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1975 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1976 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1977 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1978 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1979 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1980 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1981 | |
| 1982 | { } |
| 1983 | }; |
| 1984 | |
| 1985 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1986 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1987 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1988 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1989 | /* Clevo m520g init */ |
| 1990 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1991 | /* headphone output */ |
| 1992 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1993 | /* line-out */ |
| 1994 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1995 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1996 | /* Line-in */ |
| 1997 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1998 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1999 | /* CD */ |
| 2000 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2001 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2002 | /* Mic1 (rear panel) */ |
| 2003 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2004 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2005 | /* Mic2 (front panel) */ |
| 2006 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2007 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2008 | /* headphone */ |
| 2009 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2010 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2011 | /* change to EAPD mode */ |
| 2012 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2013 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2014 | |
| 2015 | { } |
| 2016 | }; |
| 2017 | |
| 2018 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2019 | /* change to EAPD mode */ |
| 2020 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2021 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2022 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2023 | /* Headphone output */ |
| 2024 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2025 | /* Front output*/ |
| 2026 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2027 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2028 | |
| 2029 | /* Line In pin widget for input */ |
| 2030 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2031 | /* CD pin widget for input */ |
| 2032 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2033 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2034 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2035 | |
| 2036 | /* change to EAPD mode */ |
| 2037 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2038 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2039 | |
| 2040 | { } |
| 2041 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2042 | |
| 2043 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2044 | * LG m1 express dual |
| 2045 | * |
| 2046 | * Pin assignment: |
| 2047 | * Rear Line-In/Out (blue): 0x14 |
| 2048 | * Build-in Mic-In: 0x15 |
| 2049 | * Speaker-out: 0x17 |
| 2050 | * HP-Out (green): 0x1b |
| 2051 | * Mic-In/Out (red): 0x19 |
| 2052 | * SPDIF-Out: 0x1e |
| 2053 | */ |
| 2054 | |
| 2055 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2056 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2057 | 0x05, 0x02, 0x03 |
| 2058 | }; |
| 2059 | |
| 2060 | /* seems analog CD is not working */ |
| 2061 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2062 | .num_items = 3, |
| 2063 | .items = { |
| 2064 | { "Mic", 0x1 }, |
| 2065 | { "Line", 0x5 }, |
| 2066 | { "Internal Mic", 0x6 }, |
| 2067 | }, |
| 2068 | }; |
| 2069 | |
| 2070 | /* 2,4,6 channel modes */ |
| 2071 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2072 | /* set line-in and mic-in to input */ |
| 2073 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2074 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2075 | { } |
| 2076 | }; |
| 2077 | |
| 2078 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2079 | /* set line-in to out and mic-in to input */ |
| 2080 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2081 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2082 | { } |
| 2083 | }; |
| 2084 | |
| 2085 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2086 | /* set line-in and mic-in to output */ |
| 2087 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2088 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2089 | { } |
| 2090 | }; |
| 2091 | |
| 2092 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2093 | { 2, alc880_lg_ch2_init }, |
| 2094 | { 4, alc880_lg_ch4_init }, |
| 2095 | { 6, alc880_lg_ch6_init }, |
| 2096 | }; |
| 2097 | |
| 2098 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2099 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2100 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2101 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2102 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2103 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2104 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2105 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2106 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2107 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2109 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2110 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2111 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2112 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2113 | { |
| 2114 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2115 | .name = "Channel Mode", |
| 2116 | .info = alc_ch_mode_info, |
| 2117 | .get = alc_ch_mode_get, |
| 2118 | .put = alc_ch_mode_put, |
| 2119 | }, |
| 2120 | { } /* end */ |
| 2121 | }; |
| 2122 | |
| 2123 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2124 | /* set capture source to mic-in */ |
| 2125 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2126 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2127 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2128 | /* mute all amp mixer inputs */ |
| 2129 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2130 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2132 | /* line-in to input */ |
| 2133 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2134 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2135 | /* built-in mic */ |
| 2136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2137 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2138 | /* speaker-out */ |
| 2139 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2140 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2141 | /* mic-in to input */ |
| 2142 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2143 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2144 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2145 | /* HP-out */ |
| 2146 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2147 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2148 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2149 | /* jack sense */ |
| 2150 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2151 | { } |
| 2152 | }; |
| 2153 | |
| 2154 | /* toggle speaker-output according to the hp-jack state */ |
| 2155 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2156 | { |
| 2157 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2158 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2159 | |
| 2160 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2161 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2162 | bits = present ? HDA_AMP_MUTE : 0; |
| 2163 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2164 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2165 | } |
| 2166 | |
| 2167 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2168 | { |
| 2169 | /* Looks like the unsol event is incompatible with the standard |
| 2170 | * definition. 4bit tag is placed at 28 bit! |
| 2171 | */ |
| 2172 | if ((res >> 28) == 0x01) |
| 2173 | alc880_lg_automute(codec); |
| 2174 | } |
| 2175 | |
| 2176 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2177 | * LG LW20 |
| 2178 | * |
| 2179 | * Pin assignment: |
| 2180 | * Speaker-out: 0x14 |
| 2181 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2182 | * Built-in Mic-In: 0x19 |
| 2183 | * Line-In: 0x1b |
| 2184 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2185 | * SPDIF-Out: 0x1e |
| 2186 | */ |
| 2187 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2188 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2189 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2190 | .items = { |
| 2191 | { "Mic", 0x0 }, |
| 2192 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2193 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2194 | }, |
| 2195 | }; |
| 2196 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2197 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2198 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2199 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2200 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2201 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2202 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2203 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2204 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2205 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2206 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2207 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2208 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2209 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2210 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2211 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2212 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2213 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2214 | { |
| 2215 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2216 | .name = "Channel Mode", |
| 2217 | .info = alc_ch_mode_info, |
| 2218 | .get = alc_ch_mode_get, |
| 2219 | .put = alc_ch_mode_put, |
| 2220 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2221 | { } /* end */ |
| 2222 | }; |
| 2223 | |
| 2224 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2225 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2226 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2227 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2228 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2229 | /* set capture source to mic-in */ |
| 2230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2231 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2232 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2233 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2234 | /* speaker-out */ |
| 2235 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2236 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2237 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2238 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2239 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2240 | /* mic-in to input */ |
| 2241 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2242 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2243 | /* built-in mic */ |
| 2244 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2245 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2246 | /* jack sense */ |
| 2247 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2248 | { } |
| 2249 | }; |
| 2250 | |
| 2251 | /* toggle speaker-output according to the hp-jack state */ |
| 2252 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2253 | { |
| 2254 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2255 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2256 | |
| 2257 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2258 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2259 | bits = present ? HDA_AMP_MUTE : 0; |
| 2260 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2261 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2262 | } |
| 2263 | |
| 2264 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2265 | { |
| 2266 | /* Looks like the unsol event is incompatible with the standard |
| 2267 | * definition. 4bit tag is placed at 28 bit! |
| 2268 | */ |
| 2269 | if ((res >> 28) == 0x01) |
| 2270 | alc880_lg_lw_automute(codec); |
| 2271 | } |
| 2272 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2273 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2274 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2275 | { 0x0b, HDA_INPUT, 0 }, |
| 2276 | { 0x0b, HDA_INPUT, 1 }, |
| 2277 | { 0x0b, HDA_INPUT, 2 }, |
| 2278 | { 0x0b, HDA_INPUT, 3 }, |
| 2279 | { 0x0b, HDA_INPUT, 4 }, |
| 2280 | { } /* end */ |
| 2281 | }; |
| 2282 | |
| 2283 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2284 | { 0x0b, HDA_INPUT, 1 }, |
| 2285 | { 0x0b, HDA_INPUT, 6 }, |
| 2286 | { 0x0b, HDA_INPUT, 7 }, |
| 2287 | { } /* end */ |
| 2288 | }; |
| 2289 | #endif |
| 2290 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2291 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2292 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2293 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2294 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2295 | static int alc_init(struct hda_codec *codec) |
| 2296 | { |
| 2297 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2298 | unsigned int i; |
| 2299 | |
| 2300 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2301 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2302 | |
| 2303 | if (spec->init_hook) |
| 2304 | spec->init_hook(codec); |
| 2305 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2306 | return 0; |
| 2307 | } |
| 2308 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2309 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2310 | { |
| 2311 | struct alc_spec *spec = codec->spec; |
| 2312 | |
| 2313 | if (spec->unsol_event) |
| 2314 | spec->unsol_event(codec, res); |
| 2315 | } |
| 2316 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2317 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2318 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2319 | { |
| 2320 | struct alc_spec *spec = codec->spec; |
| 2321 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2322 | } |
| 2323 | #endif |
| 2324 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2325 | /* |
| 2326 | * Analog playback callbacks |
| 2327 | */ |
| 2328 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2329 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2330 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2331 | { |
| 2332 | struct alc_spec *spec = codec->spec; |
| 2333 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 2334 | } |
| 2335 | |
| 2336 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2337 | struct hda_codec *codec, |
| 2338 | unsigned int stream_tag, |
| 2339 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2340 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2341 | { |
| 2342 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2343 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2344 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2345 | } |
| 2346 | |
| 2347 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2348 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2349 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2350 | { |
| 2351 | struct alc_spec *spec = codec->spec; |
| 2352 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2353 | } |
| 2354 | |
| 2355 | /* |
| 2356 | * Digital out |
| 2357 | */ |
| 2358 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2359 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2360 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2361 | { |
| 2362 | struct alc_spec *spec = codec->spec; |
| 2363 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2364 | } |
| 2365 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2366 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2367 | struct hda_codec *codec, |
| 2368 | unsigned int stream_tag, |
| 2369 | unsigned int format, |
| 2370 | struct snd_pcm_substream *substream) |
| 2371 | { |
| 2372 | struct alc_spec *spec = codec->spec; |
| 2373 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2374 | stream_tag, format, substream); |
| 2375 | } |
| 2376 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2377 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2378 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2379 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2380 | { |
| 2381 | struct alc_spec *spec = codec->spec; |
| 2382 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2383 | } |
| 2384 | |
| 2385 | /* |
| 2386 | * Analog capture |
| 2387 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2388 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2389 | struct hda_codec *codec, |
| 2390 | unsigned int stream_tag, |
| 2391 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2392 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2393 | { |
| 2394 | struct alc_spec *spec = codec->spec; |
| 2395 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2396 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2397 | stream_tag, 0, format); |
| 2398 | return 0; |
| 2399 | } |
| 2400 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2401 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2402 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2403 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2404 | { |
| 2405 | struct alc_spec *spec = codec->spec; |
| 2406 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2407 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2408 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2409 | return 0; |
| 2410 | } |
| 2411 | |
| 2412 | |
| 2413 | /* |
| 2414 | */ |
| 2415 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2416 | .substreams = 1, |
| 2417 | .channels_min = 2, |
| 2418 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2419 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2420 | .ops = { |
| 2421 | .open = alc880_playback_pcm_open, |
| 2422 | .prepare = alc880_playback_pcm_prepare, |
| 2423 | .cleanup = alc880_playback_pcm_cleanup |
| 2424 | }, |
| 2425 | }; |
| 2426 | |
| 2427 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2428 | .substreams = 1, |
| 2429 | .channels_min = 2, |
| 2430 | .channels_max = 2, |
| 2431 | /* NID is set in alc_build_pcms */ |
| 2432 | }; |
| 2433 | |
| 2434 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2435 | .substreams = 1, |
| 2436 | .channels_min = 2, |
| 2437 | .channels_max = 2, |
| 2438 | /* NID is set in alc_build_pcms */ |
| 2439 | }; |
| 2440 | |
| 2441 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2442 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2443 | .channels_min = 2, |
| 2444 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2445 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2446 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2447 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2448 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2449 | }, |
| 2450 | }; |
| 2451 | |
| 2452 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2453 | .substreams = 1, |
| 2454 | .channels_min = 2, |
| 2455 | .channels_max = 2, |
| 2456 | /* NID is set in alc_build_pcms */ |
| 2457 | .ops = { |
| 2458 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2459 | .close = alc880_dig_playback_pcm_close, |
| 2460 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2461 | }, |
| 2462 | }; |
| 2463 | |
| 2464 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2465 | .substreams = 1, |
| 2466 | .channels_min = 2, |
| 2467 | .channels_max = 2, |
| 2468 | /* NID is set in alc_build_pcms */ |
| 2469 | }; |
| 2470 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2471 | /* 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] | 2472 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2473 | .substreams = 0, |
| 2474 | .channels_min = 0, |
| 2475 | .channels_max = 0, |
| 2476 | }; |
| 2477 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2478 | static int alc_build_pcms(struct hda_codec *codec) |
| 2479 | { |
| 2480 | struct alc_spec *spec = codec->spec; |
| 2481 | struct hda_pcm *info = spec->pcm_rec; |
| 2482 | int i; |
| 2483 | |
| 2484 | codec->num_pcms = 1; |
| 2485 | codec->pcm_info = info; |
| 2486 | |
| 2487 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2488 | if (spec->stream_analog_playback) { |
| 2489 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2490 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2491 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2492 | } |
| 2493 | if (spec->stream_analog_capture) { |
| 2494 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2495 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2496 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2497 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2498 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2499 | if (spec->channel_mode) { |
| 2500 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2501 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2502 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2503 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2504 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2505 | } |
| 2506 | } |
| 2507 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2508 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2509 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2510 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2511 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2512 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2513 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2514 | if (spec->multiout.dig_out_nid && |
| 2515 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2516 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2517 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2518 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2519 | if (spec->dig_in_nid && |
| 2520 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2521 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2522 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2523 | } |
| 2524 | } |
| 2525 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2526 | /* If the use of more than one ADC is requested for the current |
| 2527 | * model, configure a second analog capture-only PCM. |
| 2528 | */ |
| 2529 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2530 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2531 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2532 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2533 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2534 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2535 | if (spec->alt_dac_nid) { |
| 2536 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2537 | *spec->stream_analog_alt_playback; |
| 2538 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2539 | spec->alt_dac_nid; |
| 2540 | } else { |
| 2541 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2542 | alc_pcm_null_stream; |
| 2543 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2544 | } |
| 2545 | if (spec->num_adc_nids > 1) { |
| 2546 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2547 | *spec->stream_analog_alt_capture; |
| 2548 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2549 | spec->adc_nids[1]; |
| 2550 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2551 | spec->num_adc_nids - 1; |
| 2552 | } else { |
| 2553 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2554 | alc_pcm_null_stream; |
| 2555 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2556 | } |
| 2557 | } |
| 2558 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2559 | return 0; |
| 2560 | } |
| 2561 | |
| 2562 | static void alc_free(struct hda_codec *codec) |
| 2563 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2564 | struct alc_spec *spec = codec->spec; |
| 2565 | unsigned int i; |
| 2566 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2567 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2568 | return; |
| 2569 | |
| 2570 | if (spec->kctl_alloc) { |
| 2571 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2572 | kfree(spec->kctl_alloc[i].name); |
| 2573 | kfree(spec->kctl_alloc); |
| 2574 | } |
| 2575 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2576 | } |
| 2577 | |
| 2578 | /* |
| 2579 | */ |
| 2580 | static struct hda_codec_ops alc_patch_ops = { |
| 2581 | .build_controls = alc_build_controls, |
| 2582 | .build_pcms = alc_build_pcms, |
| 2583 | .init = alc_init, |
| 2584 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2585 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2586 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2587 | .check_power_status = alc_check_power_status, |
| 2588 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2589 | }; |
| 2590 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2591 | |
| 2592 | /* |
| 2593 | * Test configuration for debugging |
| 2594 | * |
| 2595 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2596 | * enum controls. |
| 2597 | */ |
| 2598 | #ifdef CONFIG_SND_DEBUG |
| 2599 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2600 | 0x02, 0x03, 0x04, 0x05 |
| 2601 | }; |
| 2602 | |
| 2603 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2604 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2605 | .items = { |
| 2606 | { "In-1", 0x0 }, |
| 2607 | { "In-2", 0x1 }, |
| 2608 | { "In-3", 0x2 }, |
| 2609 | { "In-4", 0x3 }, |
| 2610 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2611 | { "Front", 0x5 }, |
| 2612 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2613 | }, |
| 2614 | }; |
| 2615 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2616 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2617 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2618 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2619 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2620 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2621 | }; |
| 2622 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2623 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2624 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2625 | { |
| 2626 | static char *texts[] = { |
| 2627 | "N/A", "Line Out", "HP Out", |
| 2628 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2629 | }; |
| 2630 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2631 | uinfo->count = 1; |
| 2632 | uinfo->value.enumerated.items = 8; |
| 2633 | if (uinfo->value.enumerated.item >= 8) |
| 2634 | uinfo->value.enumerated.item = 7; |
| 2635 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2636 | return 0; |
| 2637 | } |
| 2638 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2639 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2640 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2641 | { |
| 2642 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2643 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2644 | unsigned int pin_ctl, item = 0; |
| 2645 | |
| 2646 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2647 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2648 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2649 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2650 | item = 2; |
| 2651 | else |
| 2652 | item = 1; |
| 2653 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2654 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2655 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2656 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2657 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2658 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2659 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2660 | } |
| 2661 | } |
| 2662 | ucontrol->value.enumerated.item[0] = item; |
| 2663 | return 0; |
| 2664 | } |
| 2665 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2666 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2667 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2668 | { |
| 2669 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2670 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2671 | static unsigned int ctls[] = { |
| 2672 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2673 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2674 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2675 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2676 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2677 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2678 | }; |
| 2679 | unsigned int old_ctl, new_ctl; |
| 2680 | |
| 2681 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2682 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2683 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2684 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2685 | int val; |
| 2686 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2687 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2688 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2689 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2690 | HDA_AMP_MUTE : 0; |
| 2691 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2692 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2693 | return 1; |
| 2694 | } |
| 2695 | return 0; |
| 2696 | } |
| 2697 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2698 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2699 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2700 | { |
| 2701 | static char *texts[] = { |
| 2702 | "Front", "Surround", "CLFE", "Side" |
| 2703 | }; |
| 2704 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2705 | uinfo->count = 1; |
| 2706 | uinfo->value.enumerated.items = 4; |
| 2707 | if (uinfo->value.enumerated.item >= 4) |
| 2708 | uinfo->value.enumerated.item = 3; |
| 2709 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2710 | return 0; |
| 2711 | } |
| 2712 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2713 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2714 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2715 | { |
| 2716 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2717 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2718 | unsigned int sel; |
| 2719 | |
| 2720 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2721 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2722 | return 0; |
| 2723 | } |
| 2724 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2725 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2726 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2727 | { |
| 2728 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2729 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2730 | unsigned int sel; |
| 2731 | |
| 2732 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2733 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2734 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2735 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2736 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2737 | return 1; |
| 2738 | } |
| 2739 | return 0; |
| 2740 | } |
| 2741 | |
| 2742 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2743 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2744 | .name = xname, \ |
| 2745 | .info = alc_test_pin_ctl_info, \ |
| 2746 | .get = alc_test_pin_ctl_get, \ |
| 2747 | .put = alc_test_pin_ctl_put, \ |
| 2748 | .private_value = nid \ |
| 2749 | } |
| 2750 | |
| 2751 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2752 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2753 | .name = xname, \ |
| 2754 | .info = alc_test_pin_src_info, \ |
| 2755 | .get = alc_test_pin_src_get, \ |
| 2756 | .put = alc_test_pin_src_put, \ |
| 2757 | .private_value = nid \ |
| 2758 | } |
| 2759 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2760 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2761 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2762 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2763 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2764 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2765 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2766 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2767 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2768 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2769 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2770 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2771 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2772 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2773 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2774 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2775 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2776 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2777 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2778 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2779 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2780 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2781 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2782 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2783 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2784 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2785 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2786 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2787 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2788 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2789 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2790 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2791 | { |
| 2792 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2793 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2794 | .info = alc_ch_mode_info, |
| 2795 | .get = alc_ch_mode_get, |
| 2796 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2797 | }, |
| 2798 | { } /* end */ |
| 2799 | }; |
| 2800 | |
| 2801 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2802 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2803 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2804 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2805 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2806 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2807 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2808 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2809 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2810 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2811 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2812 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2813 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2814 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2815 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2816 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2817 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2818 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2819 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2820 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2821 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2822 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2823 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2824 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2825 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2826 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2827 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2828 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2829 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2830 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2831 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2832 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2833 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2834 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2835 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2836 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2837 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2838 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2839 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2840 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2841 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2842 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2843 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2844 | /* Analog input/passthru */ |
| 2845 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2846 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2847 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2848 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2849 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2850 | { } |
| 2851 | }; |
| 2852 | #endif |
| 2853 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2854 | /* |
| 2855 | */ |
| 2856 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2857 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2858 | [ALC880_3ST] = "3stack", |
| 2859 | [ALC880_TCL_S700] = "tcl", |
| 2860 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2861 | [ALC880_CLEVO] = "clevo", |
| 2862 | [ALC880_5ST] = "5stack", |
| 2863 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2864 | [ALC880_W810] = "w810", |
| 2865 | [ALC880_Z71V] = "z71v", |
| 2866 | [ALC880_6ST] = "6stack", |
| 2867 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2868 | [ALC880_ASUS] = "asus", |
| 2869 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2870 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2871 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2872 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2873 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2874 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2875 | [ALC880_F1734] = "F1734", |
| 2876 | [ALC880_LG] = "lg", |
| 2877 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2878 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2879 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2880 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2881 | [ALC880_AUTO] = "auto", |
| 2882 | }; |
| 2883 | |
| 2884 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2885 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2886 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2887 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2888 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2889 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2890 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2891 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2892 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2893 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2894 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2895 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2896 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2897 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2898 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2899 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2900 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2901 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2902 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2903 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2904 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2905 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2906 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2907 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2908 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2909 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2910 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2911 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2912 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2913 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2914 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2915 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2916 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2917 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2918 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2919 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2920 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2921 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2922 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2923 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2924 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2925 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2926 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2927 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2928 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2929 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2930 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2931 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2932 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2933 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2934 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2935 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2936 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2937 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2938 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2939 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 2940 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2941 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2942 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2943 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2944 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2945 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2946 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2947 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2948 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2949 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2950 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2951 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 2952 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2953 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2954 | {} |
| 2955 | }; |
| 2956 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2957 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2958 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2959 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2960 | static struct alc_config_preset alc880_presets[] = { |
| 2961 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2962 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2963 | .init_verbs = { alc880_volume_init_verbs, |
| 2964 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2965 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2966 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2967 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2968 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2969 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2970 | .input_mux = &alc880_capture_source, |
| 2971 | }, |
| 2972 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2973 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2974 | .init_verbs = { alc880_volume_init_verbs, |
| 2975 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2976 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2977 | .dac_nids = alc880_dac_nids, |
| 2978 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2979 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2980 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2981 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2982 | .input_mux = &alc880_capture_source, |
| 2983 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2984 | [ALC880_TCL_S700] = { |
| 2985 | .mixers = { alc880_tcl_s700_mixer }, |
| 2986 | .init_verbs = { alc880_volume_init_verbs, |
| 2987 | alc880_pin_tcl_S700_init_verbs, |
| 2988 | alc880_gpio2_init_verbs }, |
| 2989 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2990 | .dac_nids = alc880_dac_nids, |
| 2991 | .hp_nid = 0x03, |
| 2992 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2993 | .channel_mode = alc880_2_jack_modes, |
| 2994 | .input_mux = &alc880_capture_source, |
| 2995 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2996 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2997 | .mixers = { alc880_three_stack_mixer, |
| 2998 | alc880_five_stack_mixer}, |
| 2999 | .init_verbs = { alc880_volume_init_verbs, |
| 3000 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3001 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3002 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3003 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3004 | .channel_mode = alc880_fivestack_modes, |
| 3005 | .input_mux = &alc880_capture_source, |
| 3006 | }, |
| 3007 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3008 | .mixers = { alc880_three_stack_mixer, |
| 3009 | alc880_five_stack_mixer }, |
| 3010 | .init_verbs = { alc880_volume_init_verbs, |
| 3011 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3012 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3013 | .dac_nids = alc880_dac_nids, |
| 3014 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3015 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3016 | .channel_mode = alc880_fivestack_modes, |
| 3017 | .input_mux = &alc880_capture_source, |
| 3018 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3019 | [ALC880_6ST] = { |
| 3020 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3021 | .init_verbs = { alc880_volume_init_verbs, |
| 3022 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3023 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3024 | .dac_nids = alc880_6st_dac_nids, |
| 3025 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3026 | .channel_mode = alc880_sixstack_modes, |
| 3027 | .input_mux = &alc880_6stack_capture_source, |
| 3028 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3029 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3030 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3031 | .init_verbs = { alc880_volume_init_verbs, |
| 3032 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3033 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3034 | .dac_nids = alc880_6st_dac_nids, |
| 3035 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3036 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3037 | .channel_mode = alc880_sixstack_modes, |
| 3038 | .input_mux = &alc880_6stack_capture_source, |
| 3039 | }, |
| 3040 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3041 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3042 | .init_verbs = { alc880_volume_init_verbs, |
| 3043 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3044 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3045 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3046 | .dac_nids = alc880_w810_dac_nids, |
| 3047 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3048 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3049 | .channel_mode = alc880_w810_modes, |
| 3050 | .input_mux = &alc880_capture_source, |
| 3051 | }, |
| 3052 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3053 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3054 | .init_verbs = { alc880_volume_init_verbs, |
| 3055 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3056 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3057 | .dac_nids = alc880_z71v_dac_nids, |
| 3058 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3059 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3060 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3061 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3062 | .input_mux = &alc880_capture_source, |
| 3063 | }, |
| 3064 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3065 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3066 | .init_verbs = { alc880_volume_init_verbs, |
| 3067 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3068 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3069 | .dac_nids = alc880_f1734_dac_nids, |
| 3070 | .hp_nid = 0x02, |
| 3071 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3072 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame^] | 3073 | .input_mux = &alc880_f1734_capture_source, |
| 3074 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3075 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3076 | }, |
| 3077 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3078 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3079 | .init_verbs = { alc880_volume_init_verbs, |
| 3080 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3081 | alc880_gpio1_init_verbs }, |
| 3082 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3083 | .dac_nids = alc880_asus_dac_nids, |
| 3084 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3085 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3086 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3087 | .input_mux = &alc880_capture_source, |
| 3088 | }, |
| 3089 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3090 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3091 | .init_verbs = { alc880_volume_init_verbs, |
| 3092 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3093 | alc880_gpio1_init_verbs }, |
| 3094 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3095 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3096 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3097 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3098 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3099 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3100 | .input_mux = &alc880_capture_source, |
| 3101 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3102 | [ALC880_ASUS_DIG2] = { |
| 3103 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3104 | .init_verbs = { alc880_volume_init_verbs, |
| 3105 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3106 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3107 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3108 | .dac_nids = alc880_asus_dac_nids, |
| 3109 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3110 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3111 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3112 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3113 | .input_mux = &alc880_capture_source, |
| 3114 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3115 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3116 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3117 | .init_verbs = { alc880_volume_init_verbs, |
| 3118 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3119 | alc880_gpio1_init_verbs }, |
| 3120 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3121 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3122 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3123 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3124 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3125 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3126 | .input_mux = &alc880_capture_source, |
| 3127 | }, |
| 3128 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3129 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3130 | .init_verbs = { alc880_volume_init_verbs, |
| 3131 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3132 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3133 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3134 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3135 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3136 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3137 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3138 | .input_mux = &alc880_capture_source, |
| 3139 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3140 | [ALC880_UNIWILL] = { |
| 3141 | .mixers = { alc880_uniwill_mixer }, |
| 3142 | .init_verbs = { alc880_volume_init_verbs, |
| 3143 | alc880_uniwill_init_verbs }, |
| 3144 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3145 | .dac_nids = alc880_asus_dac_nids, |
| 3146 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3147 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3148 | .channel_mode = alc880_threestack_modes, |
| 3149 | .need_dac_fix = 1, |
| 3150 | .input_mux = &alc880_capture_source, |
| 3151 | .unsol_event = alc880_uniwill_unsol_event, |
| 3152 | .init_hook = alc880_uniwill_automute, |
| 3153 | }, |
| 3154 | [ALC880_UNIWILL_P53] = { |
| 3155 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3156 | .init_verbs = { alc880_volume_init_verbs, |
| 3157 | alc880_uniwill_p53_init_verbs }, |
| 3158 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3159 | .dac_nids = alc880_asus_dac_nids, |
| 3160 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3161 | .channel_mode = alc880_threestack_modes, |
| 3162 | .input_mux = &alc880_capture_source, |
| 3163 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3164 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3165 | }, |
| 3166 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3167 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3168 | alc880_pcbeep_mixer, }, |
| 3169 | .init_verbs = { alc880_volume_init_verbs, |
| 3170 | alc880_uniwill_p53_init_verbs, |
| 3171 | alc880_beep_init_verbs }, |
| 3172 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3173 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3174 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3175 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3176 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3177 | .input_mux = &alc880_capture_source, |
| 3178 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3179 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3180 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3181 | [ALC880_CLEVO] = { |
| 3182 | .mixers = { alc880_three_stack_mixer }, |
| 3183 | .init_verbs = { alc880_volume_init_verbs, |
| 3184 | alc880_pin_clevo_init_verbs }, |
| 3185 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3186 | .dac_nids = alc880_dac_nids, |
| 3187 | .hp_nid = 0x03, |
| 3188 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3189 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3190 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3191 | .input_mux = &alc880_capture_source, |
| 3192 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3193 | [ALC880_LG] = { |
| 3194 | .mixers = { alc880_lg_mixer }, |
| 3195 | .init_verbs = { alc880_volume_init_verbs, |
| 3196 | alc880_lg_init_verbs }, |
| 3197 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3198 | .dac_nids = alc880_lg_dac_nids, |
| 3199 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3200 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3201 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3202 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3203 | .input_mux = &alc880_lg_capture_source, |
| 3204 | .unsol_event = alc880_lg_unsol_event, |
| 3205 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3206 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3207 | .loopbacks = alc880_lg_loopbacks, |
| 3208 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3209 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3210 | [ALC880_LG_LW] = { |
| 3211 | .mixers = { alc880_lg_lw_mixer }, |
| 3212 | .init_verbs = { alc880_volume_init_verbs, |
| 3213 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3214 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3215 | .dac_nids = alc880_dac_nids, |
| 3216 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3217 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3218 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3219 | .input_mux = &alc880_lg_lw_capture_source, |
| 3220 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3221 | .init_hook = alc880_lg_lw_automute, |
| 3222 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3223 | #ifdef CONFIG_SND_DEBUG |
| 3224 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3225 | .mixers = { alc880_test_mixer }, |
| 3226 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3227 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3228 | .dac_nids = alc880_test_dac_nids, |
| 3229 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3230 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3231 | .channel_mode = alc880_test_modes, |
| 3232 | .input_mux = &alc880_test_capture_source, |
| 3233 | }, |
| 3234 | #endif |
| 3235 | }; |
| 3236 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3237 | /* |
| 3238 | * Automatic parse of I/O pins from the BIOS configuration |
| 3239 | */ |
| 3240 | |
| 3241 | #define NUM_CONTROL_ALLOC 32 |
| 3242 | #define NUM_VERB_ALLOC 32 |
| 3243 | |
| 3244 | enum { |
| 3245 | ALC_CTL_WIDGET_VOL, |
| 3246 | ALC_CTL_WIDGET_MUTE, |
| 3247 | ALC_CTL_BIND_MUTE, |
| 3248 | }; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3249 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3250 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3251 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3252 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3253 | }; |
| 3254 | |
| 3255 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3256 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3257 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3258 | { |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3259 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3260 | |
| 3261 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3262 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3263 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3264 | /* array + terminator */ |
| 3265 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3266 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3267 | return -ENOMEM; |
| 3268 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3269 | memcpy(knew, spec->kctl_alloc, |
| 3270 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3271 | kfree(spec->kctl_alloc); |
| 3272 | } |
| 3273 | spec->kctl_alloc = knew; |
| 3274 | spec->num_kctl_alloc = num; |
| 3275 | } |
| 3276 | |
| 3277 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3278 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3279 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3280 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3281 | return -ENOMEM; |
| 3282 | knew->private_value = val; |
| 3283 | spec->num_kctl_used++; |
| 3284 | return 0; |
| 3285 | } |
| 3286 | |
| 3287 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3288 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3289 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3290 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3291 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3292 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3293 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3294 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3295 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3296 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3297 | #define ALC880_PIN_CD_NID 0x1c |
| 3298 | |
| 3299 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3300 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3301 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3302 | { |
| 3303 | hda_nid_t nid; |
| 3304 | int assigned[4]; |
| 3305 | int i, j; |
| 3306 | |
| 3307 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3308 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3309 | |
| 3310 | /* check the pins hardwired to audio widget */ |
| 3311 | for (i = 0; i < cfg->line_outs; i++) { |
| 3312 | nid = cfg->line_out_pins[i]; |
| 3313 | if (alc880_is_fixed_pin(nid)) { |
| 3314 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3315 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3316 | assigned[idx] = 1; |
| 3317 | } |
| 3318 | } |
| 3319 | /* left pins can be connect to any audio widget */ |
| 3320 | for (i = 0; i < cfg->line_outs; i++) { |
| 3321 | nid = cfg->line_out_pins[i]; |
| 3322 | if (alc880_is_fixed_pin(nid)) |
| 3323 | continue; |
| 3324 | /* search for an empty channel */ |
| 3325 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3326 | if (!assigned[j]) { |
| 3327 | spec->multiout.dac_nids[i] = |
| 3328 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3329 | assigned[j] = 1; |
| 3330 | break; |
| 3331 | } |
| 3332 | } |
| 3333 | } |
| 3334 | spec->multiout.num_dacs = cfg->line_outs; |
| 3335 | return 0; |
| 3336 | } |
| 3337 | |
| 3338 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3339 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3340 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3341 | { |
| 3342 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3343 | static const char *chname[4] = { |
| 3344 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3345 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3346 | hda_nid_t nid; |
| 3347 | int i, err; |
| 3348 | |
| 3349 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3350 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3351 | continue; |
| 3352 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3353 | if (i == 2) { |
| 3354 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3355 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3356 | "Center Playback Volume", |
| 3357 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3358 | HDA_OUTPUT)); |
| 3359 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3360 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3361 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3362 | "LFE Playback Volume", |
| 3363 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3364 | HDA_OUTPUT)); |
| 3365 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3366 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3367 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3368 | "Center Playback Switch", |
| 3369 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3370 | HDA_INPUT)); |
| 3371 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3372 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3373 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3374 | "LFE Playback Switch", |
| 3375 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3376 | HDA_INPUT)); |
| 3377 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3378 | return err; |
| 3379 | } else { |
| 3380 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3381 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3382 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3383 | HDA_OUTPUT)); |
| 3384 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3385 | return err; |
| 3386 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3387 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3388 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3389 | HDA_INPUT)); |
| 3390 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3391 | return err; |
| 3392 | } |
| 3393 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3394 | return 0; |
| 3395 | } |
| 3396 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3397 | /* add playback controls for speaker and HP outputs */ |
| 3398 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3399 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3400 | { |
| 3401 | hda_nid_t nid; |
| 3402 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3403 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3404 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3405 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3406 | return 0; |
| 3407 | |
| 3408 | if (alc880_is_fixed_pin(pin)) { |
| 3409 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3410 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3411 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3412 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3413 | else |
| 3414 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3415 | /* control HP volume/switch on the output mixer amp */ |
| 3416 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3417 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3418 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3419 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3420 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3421 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3422 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3423 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3424 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3425 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3426 | return err; |
| 3427 | } else if (alc880_is_multi_pin(pin)) { |
| 3428 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3429 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3430 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3431 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3432 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3433 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3434 | return err; |
| 3435 | } |
| 3436 | return 0; |
| 3437 | } |
| 3438 | |
| 3439 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3440 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3441 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3442 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3443 | { |
| 3444 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3445 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3446 | |
| 3447 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3448 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3449 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3450 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3451 | return err; |
| 3452 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3453 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3454 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3455 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3456 | return err; |
| 3457 | return 0; |
| 3458 | } |
| 3459 | |
| 3460 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3461 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3462 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3463 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3464 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3465 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3466 | |
| 3467 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3468 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3469 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3470 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3471 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3472 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3473 | if (err < 0) |
| 3474 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3475 | imux->items[imux->num_items].label = |
| 3476 | auto_pin_cfg_labels[i]; |
| 3477 | imux->items[imux->num_items].index = |
| 3478 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3479 | imux->num_items++; |
| 3480 | } |
| 3481 | } |
| 3482 | return 0; |
| 3483 | } |
| 3484 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3485 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3486 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3487 | int dac_idx) |
| 3488 | { |
| 3489 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3490 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3491 | pin_type); |
| 3492 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3493 | AMP_OUT_UNMUTE); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3494 | /* need the manual connection? */ |
| 3495 | if (alc880_is_multi_pin(nid)) { |
| 3496 | struct alc_spec *spec = codec->spec; |
| 3497 | int idx = alc880_multi_pin_idx(nid); |
| 3498 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3499 | AC_VERB_SET_CONNECT_SEL, |
| 3500 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3501 | } |
| 3502 | } |
| 3503 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3504 | static int get_pin_type(int line_out_type) |
| 3505 | { |
| 3506 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3507 | return PIN_HP; |
| 3508 | else |
| 3509 | return PIN_OUT; |
| 3510 | } |
| 3511 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3512 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3513 | { |
| 3514 | struct alc_spec *spec = codec->spec; |
| 3515 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3516 | |
| 3517 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3518 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3519 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3520 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3521 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3522 | } |
| 3523 | } |
| 3524 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3525 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3526 | { |
| 3527 | struct alc_spec *spec = codec->spec; |
| 3528 | hda_nid_t pin; |
| 3529 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3530 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3531 | if (pin) /* connect to front */ |
| 3532 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3533 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3534 | if (pin) /* connect to front */ |
| 3535 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3536 | } |
| 3537 | |
| 3538 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3539 | { |
| 3540 | struct alc_spec *spec = codec->spec; |
| 3541 | int i; |
| 3542 | |
| 3543 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3544 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3545 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3546 | snd_hda_codec_write(codec, nid, 0, |
| 3547 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3548 | i <= AUTO_PIN_FRONT_MIC ? |
| 3549 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3550 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3551 | snd_hda_codec_write(codec, nid, 0, |
| 3552 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3553 | AMP_OUT_MUTE); |
| 3554 | } |
| 3555 | } |
| 3556 | } |
| 3557 | |
| 3558 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3559 | /* return 1 if successful, 0 if the proper config is not found, |
| 3560 | * or a negative error code |
| 3561 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3562 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3563 | { |
| 3564 | struct alc_spec *spec = codec->spec; |
| 3565 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3566 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3567 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3568 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3569 | alc880_ignore); |
| 3570 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3571 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3572 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3573 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3574 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3575 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3576 | if (err < 0) |
| 3577 | return err; |
| 3578 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3579 | if (err < 0) |
| 3580 | return err; |
| 3581 | err = alc880_auto_create_extra_out(spec, |
| 3582 | spec->autocfg.speaker_pins[0], |
| 3583 | "Speaker"); |
| 3584 | if (err < 0) |
| 3585 | return err; |
| 3586 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3587 | "Headphone"); |
| 3588 | if (err < 0) |
| 3589 | return err; |
| 3590 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3591 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3592 | return err; |
| 3593 | |
| 3594 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3595 | |
| 3596 | if (spec->autocfg.dig_out_pin) |
| 3597 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3598 | if (spec->autocfg.dig_in_pin) |
| 3599 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3600 | |
| 3601 | if (spec->kctl_alloc) |
| 3602 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3603 | |
| 3604 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3605 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3606 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3607 | spec->input_mux = &spec->private_imux; |
| 3608 | |
| 3609 | return 1; |
| 3610 | } |
| 3611 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3612 | /* additional initialization for auto-configuration model */ |
| 3613 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3614 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3615 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3616 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3617 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3618 | } |
| 3619 | |
| 3620 | /* |
| 3621 | * OK, here we have finally the patch for ALC880 |
| 3622 | */ |
| 3623 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3624 | static int patch_alc880(struct hda_codec *codec) |
| 3625 | { |
| 3626 | struct alc_spec *spec; |
| 3627 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3628 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3629 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3630 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3631 | if (spec == NULL) |
| 3632 | return -ENOMEM; |
| 3633 | |
| 3634 | codec->spec = spec; |
| 3635 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3636 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3637 | alc880_models, |
| 3638 | alc880_cfg_tbl); |
| 3639 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3640 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3641 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3642 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3643 | } |
| 3644 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3645 | if (board_config == ALC880_AUTO) { |
| 3646 | /* automatic parse from the BIOS config */ |
| 3647 | err = alc880_parse_auto_config(codec); |
| 3648 | if (err < 0) { |
| 3649 | alc_free(codec); |
| 3650 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3651 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3652 | printk(KERN_INFO |
| 3653 | "hda_codec: Cannot set up configuration " |
| 3654 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3655 | board_config = ALC880_3ST; |
| 3656 | } |
| 3657 | } |
| 3658 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3659 | if (board_config != ALC880_AUTO) |
| 3660 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3661 | |
| 3662 | spec->stream_name_analog = "ALC880 Analog"; |
| 3663 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3664 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3665 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3666 | |
| 3667 | spec->stream_name_digital = "ALC880 Digital"; |
| 3668 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3669 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3670 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3671 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3672 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3673 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3674 | /* get type */ |
| 3675 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3676 | if (wcap != AC_WID_AUD_IN) { |
| 3677 | spec->adc_nids = alc880_adc_nids_alt; |
| 3678 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3679 | spec->mixers[spec->num_mixers] = |
| 3680 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3681 | spec->num_mixers++; |
| 3682 | } else { |
| 3683 | spec->adc_nids = alc880_adc_nids; |
| 3684 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3685 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3686 | spec->num_mixers++; |
| 3687 | } |
| 3688 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3689 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3690 | spec->vmaster_nid = 0x0c; |
| 3691 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3692 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3693 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3694 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3695 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3696 | if (!spec->loopback.amplist) |
| 3697 | spec->loopback.amplist = alc880_loopbacks; |
| 3698 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3699 | |
| 3700 | return 0; |
| 3701 | } |
| 3702 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3703 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3704 | /* |
| 3705 | * ALC260 support |
| 3706 | */ |
| 3707 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3708 | static hda_nid_t alc260_dac_nids[1] = { |
| 3709 | /* front */ |
| 3710 | 0x02, |
| 3711 | }; |
| 3712 | |
| 3713 | static hda_nid_t alc260_adc_nids[1] = { |
| 3714 | /* ADC0 */ |
| 3715 | 0x04, |
| 3716 | }; |
| 3717 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3718 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3719 | /* ADC1 */ |
| 3720 | 0x05, |
| 3721 | }; |
| 3722 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3723 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3724 | /* ADC1, 0 */ |
| 3725 | 0x05, 0x04 |
| 3726 | }; |
| 3727 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3728 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3729 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3730 | */ |
| 3731 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3732 | /* ADC0, ADC1 */ |
| 3733 | 0x04, 0x05 |
| 3734 | }; |
| 3735 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3736 | #define ALC260_DIGOUT_NID 0x03 |
| 3737 | #define ALC260_DIGIN_NID 0x06 |
| 3738 | |
| 3739 | static struct hda_input_mux alc260_capture_source = { |
| 3740 | .num_items = 4, |
| 3741 | .items = { |
| 3742 | { "Mic", 0x0 }, |
| 3743 | { "Front Mic", 0x1 }, |
| 3744 | { "Line", 0x2 }, |
| 3745 | { "CD", 0x4 }, |
| 3746 | }, |
| 3747 | }; |
| 3748 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3749 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3750 | * headphone jack and the internal CD lines since these are the only pins at |
| 3751 | * which audio can appear. For flexibility, also allow the option of |
| 3752 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3753 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3754 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3755 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3756 | { |
| 3757 | .num_items = 3, |
| 3758 | .items = { |
| 3759 | { "Mic/Line", 0x0 }, |
| 3760 | { "CD", 0x4 }, |
| 3761 | { "Headphone", 0x2 }, |
| 3762 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3763 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3764 | { |
| 3765 | .num_items = 4, |
| 3766 | .items = { |
| 3767 | { "Mic/Line", 0x0 }, |
| 3768 | { "CD", 0x4 }, |
| 3769 | { "Headphone", 0x2 }, |
| 3770 | { "Mixer", 0x5 }, |
| 3771 | }, |
| 3772 | }, |
| 3773 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3774 | }; |
| 3775 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3776 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3777 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3778 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3779 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3780 | { |
| 3781 | .num_items = 4, |
| 3782 | .items = { |
| 3783 | { "Mic", 0x0 }, |
| 3784 | { "Line", 0x2 }, |
| 3785 | { "CD", 0x4 }, |
| 3786 | { "Headphone", 0x5 }, |
| 3787 | }, |
| 3788 | }, |
| 3789 | { |
| 3790 | .num_items = 5, |
| 3791 | .items = { |
| 3792 | { "Mic", 0x0 }, |
| 3793 | { "Line", 0x2 }, |
| 3794 | { "CD", 0x4 }, |
| 3795 | { "Headphone", 0x6 }, |
| 3796 | { "Mixer", 0x5 }, |
| 3797 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3798 | }, |
| 3799 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3800 | /* |
| 3801 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3802 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3803 | * element which allows changing the channel mode, so the verb list is |
| 3804 | * never used. |
| 3805 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3806 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3807 | { 2, NULL }, |
| 3808 | }; |
| 3809 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3810 | |
| 3811 | /* Mixer combinations |
| 3812 | * |
| 3813 | * basic: base_output + input + pc_beep + capture |
| 3814 | * HP: base_output + input + capture_alt |
| 3815 | * HP_3013: hp_3013 + input + capture |
| 3816 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3817 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3818 | */ |
| 3819 | |
| 3820 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3821 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3822 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3823 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3824 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3825 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3826 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3827 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3828 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3829 | |
| 3830 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3831 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3832 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3833 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3834 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3836 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3837 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3838 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3839 | { } /* end */ |
| 3840 | }; |
| 3841 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3842 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3843 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3844 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3845 | { } /* end */ |
| 3846 | }; |
| 3847 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3848 | /* update HP, line and mono out pins according to the master switch */ |
| 3849 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 3850 | hda_nid_t hp, hda_nid_t line, |
| 3851 | hda_nid_t mono) |
| 3852 | { |
| 3853 | struct alc_spec *spec = codec->spec; |
| 3854 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 3855 | /* change HP and line-out pins */ |
| 3856 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3857 | val); |
| 3858 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3859 | val); |
| 3860 | /* mono (speaker) depending on the HP jack sense */ |
| 3861 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 3862 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3863 | val); |
| 3864 | } |
| 3865 | |
| 3866 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 3867 | struct snd_ctl_elem_value *ucontrol) |
| 3868 | { |
| 3869 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3870 | struct alc_spec *spec = codec->spec; |
| 3871 | *ucontrol->value.integer.value = spec->master_sw; |
| 3872 | return 0; |
| 3873 | } |
| 3874 | |
| 3875 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 3876 | struct snd_ctl_elem_value *ucontrol) |
| 3877 | { |
| 3878 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3879 | struct alc_spec *spec = codec->spec; |
| 3880 | int val = !!*ucontrol->value.integer.value; |
| 3881 | hda_nid_t hp, line, mono; |
| 3882 | |
| 3883 | if (val == spec->master_sw) |
| 3884 | return 0; |
| 3885 | spec->master_sw = val; |
| 3886 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 3887 | line = (kcontrol->private_value >> 8) & 0xff; |
| 3888 | mono = kcontrol->private_value & 0xff; |
| 3889 | alc260_hp_master_update(codec, hp, line, mono); |
| 3890 | return 1; |
| 3891 | } |
| 3892 | |
| 3893 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 3894 | { |
| 3895 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3896 | .name = "Master Playback Switch", |
| 3897 | .info = snd_ctl_boolean_mono_info, |
| 3898 | .get = alc260_hp_master_sw_get, |
| 3899 | .put = alc260_hp_master_sw_put, |
| 3900 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 3901 | }, |
| 3902 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3903 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 3904 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3905 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3906 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3907 | HDA_OUTPUT), |
| 3908 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3909 | { } /* end */ |
| 3910 | }; |
| 3911 | |
| 3912 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 3913 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3914 | {}, |
| 3915 | }; |
| 3916 | |
| 3917 | static void alc260_hp_automute(struct hda_codec *codec) |
| 3918 | { |
| 3919 | struct alc_spec *spec = codec->spec; |
| 3920 | unsigned int present; |
| 3921 | |
| 3922 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 3923 | AC_VERB_GET_PIN_SENSE, 0); |
| 3924 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3925 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 3926 | } |
| 3927 | |
| 3928 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3929 | { |
| 3930 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3931 | alc260_hp_automute(codec); |
| 3932 | } |
| 3933 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3934 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3935 | { |
| 3936 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3937 | .name = "Master Playback Switch", |
| 3938 | .info = snd_ctl_boolean_mono_info, |
| 3939 | .get = alc260_hp_master_sw_get, |
| 3940 | .put = alc260_hp_master_sw_put, |
| 3941 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 3942 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3943 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3944 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3945 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3946 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3947 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3948 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 3949 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3950 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3951 | { } /* end */ |
| 3952 | }; |
| 3953 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3954 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 3955 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3956 | {}, |
| 3957 | }; |
| 3958 | |
| 3959 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 3960 | { |
| 3961 | struct alc_spec *spec = codec->spec; |
| 3962 | unsigned int present; |
| 3963 | |
| 3964 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 3965 | AC_VERB_GET_PIN_SENSE, 0); |
| 3966 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3967 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 3968 | } |
| 3969 | |
| 3970 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 3971 | unsigned int res) |
| 3972 | { |
| 3973 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3974 | alc260_hp_3013_automute(codec); |
| 3975 | } |
| 3976 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3977 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3978 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3979 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3980 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3981 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3982 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3983 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3984 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3985 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3986 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3987 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3988 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3989 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3990 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 3991 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3992 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3993 | { } /* end */ |
| 3994 | }; |
| 3995 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3996 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3997 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3998 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3999 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4000 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4001 | * revisions available in early 2006. Therefore for now allow the |
| 4002 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4003 | * that the lack of mic bias for this NID is intentional we could change the |
| 4004 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4005 | * |
| 4006 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4007 | * don't appear to make the mic bias available from the "line" jack, even |
| 4008 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4009 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4010 | * and the output jack. If this turns out to be the case for all such |
| 4011 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4012 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4013 | * |
| 4014 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4015 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4016 | * controls for such models. On models without a "mono speaker" the control |
| 4017 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4018 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4019 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4020 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4021 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4022 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4023 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4024 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4025 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4026 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4027 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4028 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4029 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4030 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4031 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4032 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4033 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4034 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4035 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4036 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4037 | { } /* end */ |
| 4038 | }; |
| 4039 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4040 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4041 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4042 | */ |
| 4043 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4044 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4045 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4046 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4047 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4048 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4049 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4050 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4051 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4052 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4053 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4054 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4055 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4056 | { } /* end */ |
| 4057 | }; |
| 4058 | |
| 4059 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4060 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4061 | */ |
| 4062 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4063 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4064 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4065 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4066 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4067 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4068 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4069 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4070 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4071 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4072 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4073 | { } /* end */ |
| 4074 | }; |
| 4075 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4076 | /* capture mixer elements */ |
| 4077 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4078 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4079 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4080 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4081 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4082 | { |
| 4083 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4084 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4085 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4086 | */ |
| 4087 | /* .name = "Capture Source", */ |
| 4088 | .name = "Input Source", |
| 4089 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4090 | .info = alc_mux_enum_info, |
| 4091 | .get = alc_mux_enum_get, |
| 4092 | .put = alc_mux_enum_put, |
| 4093 | }, |
| 4094 | { } /* end */ |
| 4095 | }; |
| 4096 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4097 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4098 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4099 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4100 | { |
| 4101 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4102 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4103 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4104 | */ |
| 4105 | /* .name = "Capture Source", */ |
| 4106 | .name = "Input Source", |
| 4107 | .count = 1, |
| 4108 | .info = alc_mux_enum_info, |
| 4109 | .get = alc_mux_enum_get, |
| 4110 | .put = alc_mux_enum_put, |
| 4111 | }, |
| 4112 | { } /* end */ |
| 4113 | }; |
| 4114 | |
| 4115 | /* |
| 4116 | * initialization verbs |
| 4117 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4118 | static struct hda_verb alc260_init_verbs[] = { |
| 4119 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4120 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4121 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4122 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4123 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4124 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4125 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4126 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4127 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4128 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4129 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4130 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4131 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4132 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4133 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4134 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4135 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4136 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4137 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4138 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4139 | /* set connection select to line in (default select for this ADC) */ |
| 4140 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4141 | /* mute capture amp left and right */ |
| 4142 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4143 | /* set connection select to line in (default select for this ADC) */ |
| 4144 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4145 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4146 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4147 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4148 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4149 | /* set vol=0 HP mixer amp left and right */ |
| 4150 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4151 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4152 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4153 | /* set vol=0 Mono mixer amp left and right */ |
| 4154 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4155 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4156 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4157 | /* unmute LINE-2 out pin */ |
| 4158 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4159 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4160 | * Line In 2 = 0x03 |
| 4161 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4162 | /* mute analog inputs */ |
| 4163 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4164 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4165 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4166 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4167 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4168 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4169 | /* mute Front out path */ |
| 4170 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4171 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4172 | /* mute Headphone out path */ |
| 4173 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4174 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4175 | /* mute Mono out path */ |
| 4176 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4177 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4178 | { } |
| 4179 | }; |
| 4180 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4181 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4182 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4183 | /* Headphone and output */ |
| 4184 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4185 | /* mono output */ |
| 4186 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4187 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4188 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4189 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4190 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4191 | /* Line In pin widget for input */ |
| 4192 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4193 | /* Line-2 pin widget for output */ |
| 4194 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4195 | /* CD pin widget for input */ |
| 4196 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4197 | /* unmute amp left and right */ |
| 4198 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4199 | /* set connection select to line in (default select for this ADC) */ |
| 4200 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4201 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4202 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4203 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4204 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4205 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4206 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4207 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4208 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4209 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4210 | * Line In 2 = 0x03 |
| 4211 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4212 | /* mute analog inputs */ |
| 4213 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4214 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4215 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4216 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4217 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4218 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4219 | /* Unmute Front out path */ |
| 4220 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4221 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4222 | /* Unmute Headphone out path */ |
| 4223 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4224 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4225 | /* Unmute Mono out path */ |
| 4226 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4227 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4228 | { } |
| 4229 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4230 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4231 | |
| 4232 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4233 | /* Line out and output */ |
| 4234 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4235 | /* mono output */ |
| 4236 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4237 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4238 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4239 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4240 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4241 | /* Line In pin widget for input */ |
| 4242 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4243 | /* Headphone pin widget for output */ |
| 4244 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4245 | /* CD pin widget for input */ |
| 4246 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4247 | /* unmute amp left and right */ |
| 4248 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4249 | /* set connection select to line in (default select for this ADC) */ |
| 4250 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4251 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4252 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4253 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4254 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4255 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4256 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4257 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4258 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4259 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4260 | * Line In 2 = 0x03 |
| 4261 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4262 | /* mute analog inputs */ |
| 4263 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4264 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4265 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4266 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4267 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4268 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4269 | /* Unmute Front out path */ |
| 4270 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4271 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4272 | /* Unmute Headphone out path */ |
| 4273 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4274 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4275 | /* Unmute Mono out path */ |
| 4276 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4277 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4278 | { } |
| 4279 | }; |
| 4280 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4281 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4282 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4283 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4284 | */ |
| 4285 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4286 | /* Disable all GPIOs */ |
| 4287 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4288 | /* Internal speaker is connected to headphone pin */ |
| 4289 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4290 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4291 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4292 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4293 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4294 | /* Ensure all other unused pins are disabled and muted. */ |
| 4295 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4296 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4297 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4298 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4299 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4300 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4301 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4302 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4303 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4304 | /* Disable digital (SPDIF) pins */ |
| 4305 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4306 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4307 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4308 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4309 | * when acting as an output. |
| 4310 | */ |
| 4311 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4312 | |
| 4313 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4314 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4315 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4316 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4317 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4318 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4319 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4320 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4321 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4322 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4323 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4324 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4325 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4326 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4327 | * If the pin mode is changed by the user the pin mode control will |
| 4328 | * take care of enabling the pin's input/output buffers as needed. |
| 4329 | * Therefore there's no need to enable the input buffer at this |
| 4330 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4331 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4332 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4333 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4334 | * mixer ctrl) |
| 4335 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4336 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4337 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4338 | /* Mute capture amp left and right */ |
| 4339 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4340 | /* Set ADC connection select to match default mixer setting - line |
| 4341 | * in (on mic1 pin) |
| 4342 | */ |
| 4343 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4344 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4345 | /* Do the same for the second ADC: mute capture input amp and |
| 4346 | * set ADC connection to line in (on mic1 pin) |
| 4347 | */ |
| 4348 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4349 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4350 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4351 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4352 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4353 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4354 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4355 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4356 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4357 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4358 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4359 | {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] | 4360 | |
| 4361 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4362 | }; |
| 4363 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4364 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4365 | * similar laptops (adapted from Fujitsu init verbs). |
| 4366 | */ |
| 4367 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4368 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4369 | * the headphone jack. Turn this on and rely on the standard mute |
| 4370 | * methods whenever the user wants to turn these outputs off. |
| 4371 | */ |
| 4372 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4373 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4374 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4375 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4376 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4377 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4378 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4379 | /* Line In jack is connected to Line1 pin */ |
| 4380 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4381 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4382 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4383 | /* Ensure all other unused pins are disabled and muted. */ |
| 4384 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4385 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4386 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4387 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4388 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4389 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4390 | /* Disable digital (SPDIF) pins */ |
| 4391 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4392 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4393 | |
| 4394 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4395 | * bus when acting as outputs. |
| 4396 | */ |
| 4397 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4398 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4399 | |
| 4400 | /* Start with output sum widgets muted and their output gains at min */ |
| 4401 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4402 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4403 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4404 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4405 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4406 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4407 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4408 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4409 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4410 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4411 | /* Unmute Line-out pin widget amp left and right |
| 4412 | * (no equiv mixer ctrl) |
| 4413 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4414 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4415 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4416 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4417 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4418 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4419 | * will take care of enabling the pin's input/output buffers as needed. |
| 4420 | * Therefore there's no need to enable the input buffer at this |
| 4421 | * stage. |
| 4422 | */ |
| 4423 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4424 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4425 | |
| 4426 | /* Mute capture amp left and right */ |
| 4427 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4428 | /* Set ADC connection select to match default mixer setting - mic |
| 4429 | * (on mic1 pin) |
| 4430 | */ |
| 4431 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4432 | |
| 4433 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4434 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4435 | */ |
| 4436 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4437 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4438 | |
| 4439 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4440 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4441 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4442 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4443 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4444 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4445 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4446 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4447 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4448 | |
| 4449 | { } |
| 4450 | }; |
| 4451 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4452 | static struct hda_verb alc260_will_verbs[] = { |
| 4453 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4454 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4455 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4456 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4457 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4458 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4459 | {} |
| 4460 | }; |
| 4461 | |
| 4462 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4463 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4464 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4465 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4466 | |
| 4467 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4468 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4469 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4470 | |
| 4471 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4472 | {} |
| 4473 | }; |
| 4474 | |
| 4475 | /* toggle speaker-output according to the hp-jack state */ |
| 4476 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4477 | { |
| 4478 | unsigned int present; |
| 4479 | |
| 4480 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4481 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4482 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4483 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4484 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4485 | AC_VERB_SET_GPIO_DATA, 1); |
| 4486 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4487 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4488 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4489 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4490 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4491 | AC_VERB_SET_GPIO_DATA, 0); |
| 4492 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4493 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4494 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4495 | } |
| 4496 | } |
| 4497 | |
| 4498 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4499 | unsigned int res) |
| 4500 | { |
| 4501 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4502 | alc260_replacer_672v_automute(codec); |
| 4503 | } |
| 4504 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4505 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4506 | * configuration. |
| 4507 | */ |
| 4508 | #ifdef CONFIG_SND_DEBUG |
| 4509 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4510 | 0x02, |
| 4511 | }; |
| 4512 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4513 | 0x04, 0x05, |
| 4514 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4515 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4516 | * the signal assignments are different. This assumes that the first ADC |
| 4517 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4518 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4519 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4520 | { |
| 4521 | .num_items = 7, |
| 4522 | .items = { |
| 4523 | { "MIC1 pin", 0x0 }, |
| 4524 | { "MIC2 pin", 0x1 }, |
| 4525 | { "LINE1 pin", 0x2 }, |
| 4526 | { "LINE2 pin", 0x3 }, |
| 4527 | { "CD pin", 0x4 }, |
| 4528 | { "LINE-OUT pin", 0x5 }, |
| 4529 | { "HP-OUT pin", 0x6 }, |
| 4530 | }, |
| 4531 | }, |
| 4532 | { |
| 4533 | .num_items = 8, |
| 4534 | .items = { |
| 4535 | { "MIC1 pin", 0x0 }, |
| 4536 | { "MIC2 pin", 0x1 }, |
| 4537 | { "LINE1 pin", 0x2 }, |
| 4538 | { "LINE2 pin", 0x3 }, |
| 4539 | { "CD pin", 0x4 }, |
| 4540 | { "Mixer", 0x5 }, |
| 4541 | { "LINE-OUT pin", 0x6 }, |
| 4542 | { "HP-OUT pin", 0x7 }, |
| 4543 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4544 | }, |
| 4545 | }; |
| 4546 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4547 | /* Output driver widgets */ |
| 4548 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4549 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4550 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4551 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4552 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4553 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4554 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4555 | /* Modes for retasking pin widgets |
| 4556 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4557 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4558 | * mention this restriction. At this stage it's not clear whether |
| 4559 | * this behaviour is intentional or is a hardware bug in chip |
| 4560 | * revisions available at least up until early 2006. Therefore for |
| 4561 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4562 | * choices, but if it turns out that the lack of mic bias for these |
| 4563 | * NIDs is intentional we could change their modes from |
| 4564 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4565 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4566 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4567 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4568 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4569 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4570 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4571 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4572 | |
| 4573 | /* Loopback mixer controls */ |
| 4574 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4575 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4576 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4577 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4578 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4579 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4580 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4581 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4582 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4583 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4584 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4585 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4586 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4587 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4588 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4589 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4590 | |
| 4591 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4592 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4593 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4594 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4595 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4596 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4597 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4598 | * is ambigious as to which NID is which; testing on laptops which |
| 4599 | * make this output available should provide clarification. |
| 4600 | */ |
| 4601 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4602 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4603 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4604 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4605 | * this output to turn on an external amplifier. |
| 4606 | */ |
| 4607 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4608 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4609 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4610 | { } /* end */ |
| 4611 | }; |
| 4612 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4613 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4614 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4615 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4616 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4617 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4618 | /* Enable retasking pins as output, initially without power amp */ |
| 4619 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4620 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4621 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4622 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4623 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4624 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4625 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4626 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4627 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4628 | * payload also sets the generation to 0, output to be in "consumer" |
| 4629 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4630 | * control. |
| 4631 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4632 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4633 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4634 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4635 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4636 | * OUT1 sum bus when acting as an output. |
| 4637 | */ |
| 4638 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4639 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4640 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4641 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4642 | |
| 4643 | /* Start with output sum widgets muted and their output gains at min */ |
| 4644 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4645 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4646 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4647 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4648 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4649 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4650 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4651 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4652 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4653 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4654 | /* Unmute retasking pin widget output buffers since the default |
| 4655 | * state appears to be output. As the pin mode is changed by the |
| 4656 | * user the pin mode control will take care of enabling the pin's |
| 4657 | * input/output buffers as needed. |
| 4658 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4659 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4660 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4661 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4662 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4663 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4664 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4665 | /* Also unmute the mono-out pin widget */ |
| 4666 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4667 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4668 | /* Mute capture amp left and right */ |
| 4669 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4670 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4671 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4672 | */ |
| 4673 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4674 | |
| 4675 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4676 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4677 | */ |
| 4678 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4679 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4680 | |
| 4681 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4682 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4683 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4684 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4685 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4686 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4687 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4688 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4689 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4690 | |
| 4691 | { } |
| 4692 | }; |
| 4693 | #endif |
| 4694 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4695 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4696 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4697 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4698 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4699 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4700 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4701 | /* |
| 4702 | * for BIOS auto-configuration |
| 4703 | */ |
| 4704 | |
| 4705 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4706 | const char *pfx) |
| 4707 | { |
| 4708 | hda_nid_t nid_vol; |
| 4709 | unsigned long vol_val, sw_val; |
| 4710 | char name[32]; |
| 4711 | int err; |
| 4712 | |
| 4713 | if (nid >= 0x0f && nid < 0x11) { |
| 4714 | nid_vol = nid - 0x7; |
| 4715 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4716 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4717 | } else if (nid == 0x11) { |
| 4718 | nid_vol = nid - 0x7; |
| 4719 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4720 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4721 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4722 | nid_vol = 0x08; |
| 4723 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4724 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4725 | } else |
| 4726 | return 0; /* N/A */ |
| 4727 | |
| 4728 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4729 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4730 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4731 | return err; |
| 4732 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4733 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4734 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4735 | return err; |
| 4736 | return 1; |
| 4737 | } |
| 4738 | |
| 4739 | /* add playback controls from the parsed DAC table */ |
| 4740 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4741 | const struct auto_pin_cfg *cfg) |
| 4742 | { |
| 4743 | hda_nid_t nid; |
| 4744 | int err; |
| 4745 | |
| 4746 | spec->multiout.num_dacs = 1; |
| 4747 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4748 | spec->multiout.dac_nids[0] = 0x02; |
| 4749 | |
| 4750 | nid = cfg->line_out_pins[0]; |
| 4751 | if (nid) { |
| 4752 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4753 | if (err < 0) |
| 4754 | return err; |
| 4755 | } |
| 4756 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4757 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4758 | if (nid) { |
| 4759 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4760 | if (err < 0) |
| 4761 | return err; |
| 4762 | } |
| 4763 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4764 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4765 | if (nid) { |
| 4766 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4767 | if (err < 0) |
| 4768 | return err; |
| 4769 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4770 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4771 | } |
| 4772 | |
| 4773 | /* create playback/capture controls for input pins */ |
| 4774 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4775 | const struct auto_pin_cfg *cfg) |
| 4776 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4777 | struct hda_input_mux *imux = &spec->private_imux; |
| 4778 | int i, err, idx; |
| 4779 | |
| 4780 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4781 | if (cfg->input_pins[i] >= 0x12) { |
| 4782 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4783 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4784 | auto_pin_cfg_labels[i], idx, |
| 4785 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4786 | if (err < 0) |
| 4787 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4788 | imux->items[imux->num_items].label = |
| 4789 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4790 | imux->items[imux->num_items].index = idx; |
| 4791 | imux->num_items++; |
| 4792 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4793 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4794 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4795 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4796 | auto_pin_cfg_labels[i], idx, |
| 4797 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4798 | if (err < 0) |
| 4799 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4800 | imux->items[imux->num_items].label = |
| 4801 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4802 | imux->items[imux->num_items].index = idx; |
| 4803 | imux->num_items++; |
| 4804 | } |
| 4805 | } |
| 4806 | return 0; |
| 4807 | } |
| 4808 | |
| 4809 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4810 | hda_nid_t nid, int pin_type, |
| 4811 | int sel_idx) |
| 4812 | { |
| 4813 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4814 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4815 | pin_type); |
| 4816 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4817 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4818 | /* need the manual connection? */ |
| 4819 | if (nid >= 0x12) { |
| 4820 | int idx = nid - 0x12; |
| 4821 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4822 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4823 | } |
| 4824 | } |
| 4825 | |
| 4826 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4827 | { |
| 4828 | struct alc_spec *spec = codec->spec; |
| 4829 | hda_nid_t nid; |
| 4830 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4831 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4832 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4833 | if (nid) { |
| 4834 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4835 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4836 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4837 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4838 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4839 | if (nid) |
| 4840 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4841 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4842 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4843 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4844 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4845 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4846 | |
| 4847 | #define ALC260_PIN_CD_NID 0x16 |
| 4848 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4849 | { |
| 4850 | struct alc_spec *spec = codec->spec; |
| 4851 | int i; |
| 4852 | |
| 4853 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4854 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4855 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4856 | snd_hda_codec_write(codec, nid, 0, |
| 4857 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4858 | i <= AUTO_PIN_FRONT_MIC ? |
| 4859 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4860 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4861 | snd_hda_codec_write(codec, nid, 0, |
| 4862 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4863 | AMP_OUT_MUTE); |
| 4864 | } |
| 4865 | } |
| 4866 | } |
| 4867 | |
| 4868 | /* |
| 4869 | * generic initialization of ADC, input mixers and output mixers |
| 4870 | */ |
| 4871 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4872 | /* |
| 4873 | * Unmute ADC0-1 and set the default input to mic-in |
| 4874 | */ |
| 4875 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4876 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4877 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4878 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4879 | |
| 4880 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4881 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4882 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4883 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4884 | */ |
| 4885 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4886 | /* mute analog inputs */ |
| 4887 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4888 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4889 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4890 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4891 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4892 | |
| 4893 | /* |
| 4894 | * Set up output mixers (0x08 - 0x0a) |
| 4895 | */ |
| 4896 | /* set vol=0 to output mixers */ |
| 4897 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4898 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4899 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4900 | /* set up input amps for analog loopback */ |
| 4901 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4902 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4903 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4904 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4905 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4906 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4907 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4908 | |
| 4909 | { } |
| 4910 | }; |
| 4911 | |
| 4912 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4913 | { |
| 4914 | struct alc_spec *spec = codec->spec; |
| 4915 | unsigned int wcap; |
| 4916 | int err; |
| 4917 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4918 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4919 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4920 | alc260_ignore); |
| 4921 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4922 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4923 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4924 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4925 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4926 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4927 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4928 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4929 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4930 | return err; |
| 4931 | |
| 4932 | spec->multiout.max_channels = 2; |
| 4933 | |
| 4934 | if (spec->autocfg.dig_out_pin) |
| 4935 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4936 | if (spec->kctl_alloc) |
| 4937 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4938 | |
| 4939 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4940 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4941 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4942 | spec->input_mux = &spec->private_imux; |
| 4943 | |
| 4944 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4945 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4946 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4947 | if (wcap != AC_WID_AUD_IN) { |
| 4948 | spec->adc_nids = alc260_adc_nids_alt; |
| 4949 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4950 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4951 | } else { |
| 4952 | spec->adc_nids = alc260_adc_nids; |
| 4953 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4954 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4955 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4956 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4957 | |
| 4958 | return 1; |
| 4959 | } |
| 4960 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4961 | /* additional initialization for auto-configuration model */ |
| 4962 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4963 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4964 | alc260_auto_init_multi_out(codec); |
| 4965 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4966 | } |
| 4967 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4968 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4969 | static struct hda_amp_list alc260_loopbacks[] = { |
| 4970 | { 0x07, HDA_INPUT, 0 }, |
| 4971 | { 0x07, HDA_INPUT, 1 }, |
| 4972 | { 0x07, HDA_INPUT, 2 }, |
| 4973 | { 0x07, HDA_INPUT, 3 }, |
| 4974 | { 0x07, HDA_INPUT, 4 }, |
| 4975 | { } /* end */ |
| 4976 | }; |
| 4977 | #endif |
| 4978 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4979 | /* |
| 4980 | * ALC260 configurations |
| 4981 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4982 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4983 | [ALC260_BASIC] = "basic", |
| 4984 | [ALC260_HP] = "hp", |
| 4985 | [ALC260_HP_3013] = "hp-3013", |
| 4986 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4987 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4988 | [ALC260_WILL] = "will", |
| 4989 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4990 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4991 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4992 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4993 | [ALC260_AUTO] = "auto", |
| 4994 | }; |
| 4995 | |
| 4996 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4997 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4998 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 4999 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5000 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5001 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 5002 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 5003 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 5004 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5005 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5006 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5007 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5008 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5009 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5010 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5011 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5012 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5013 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5014 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5015 | {} |
| 5016 | }; |
| 5017 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5018 | static struct alc_config_preset alc260_presets[] = { |
| 5019 | [ALC260_BASIC] = { |
| 5020 | .mixers = { alc260_base_output_mixer, |
| 5021 | alc260_input_mixer, |
| 5022 | alc260_pc_beep_mixer, |
| 5023 | alc260_capture_mixer }, |
| 5024 | .init_verbs = { alc260_init_verbs }, |
| 5025 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5026 | .dac_nids = alc260_dac_nids, |
| 5027 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5028 | .adc_nids = alc260_adc_nids, |
| 5029 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5030 | .channel_mode = alc260_modes, |
| 5031 | .input_mux = &alc260_capture_source, |
| 5032 | }, |
| 5033 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5034 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5035 | alc260_input_mixer, |
| 5036 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5037 | .init_verbs = { alc260_init_verbs, |
| 5038 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5039 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5040 | .dac_nids = alc260_dac_nids, |
| 5041 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5042 | .adc_nids = alc260_hp_adc_nids, |
| 5043 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5044 | .channel_mode = alc260_modes, |
| 5045 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5046 | .unsol_event = alc260_hp_unsol_event, |
| 5047 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5048 | }, |
| 5049 | [ALC260_HP_3013] = { |
| 5050 | .mixers = { alc260_hp_3013_mixer, |
| 5051 | alc260_input_mixer, |
| 5052 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5053 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5054 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5055 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5056 | .dac_nids = alc260_dac_nids, |
| 5057 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5058 | .adc_nids = alc260_hp_adc_nids, |
| 5059 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5060 | .channel_mode = alc260_modes, |
| 5061 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5062 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5063 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5064 | }, |
| 5065 | [ALC260_FUJITSU_S702X] = { |
| 5066 | .mixers = { alc260_fujitsu_mixer, |
| 5067 | alc260_capture_mixer }, |
| 5068 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5069 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5070 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5071 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5072 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5073 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5074 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5075 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5076 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5077 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5078 | [ALC260_ACER] = { |
| 5079 | .mixers = { alc260_acer_mixer, |
| 5080 | alc260_capture_mixer }, |
| 5081 | .init_verbs = { alc260_acer_init_verbs }, |
| 5082 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5083 | .dac_nids = alc260_dac_nids, |
| 5084 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5085 | .adc_nids = alc260_dual_adc_nids, |
| 5086 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5087 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5088 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5089 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5090 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5091 | [ALC260_WILL] = { |
| 5092 | .mixers = { alc260_will_mixer, |
| 5093 | alc260_capture_mixer }, |
| 5094 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5095 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5096 | .dac_nids = alc260_dac_nids, |
| 5097 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5098 | .adc_nids = alc260_adc_nids, |
| 5099 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5100 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5101 | .channel_mode = alc260_modes, |
| 5102 | .input_mux = &alc260_capture_source, |
| 5103 | }, |
| 5104 | [ALC260_REPLACER_672V] = { |
| 5105 | .mixers = { alc260_replacer_672v_mixer, |
| 5106 | alc260_capture_mixer }, |
| 5107 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5108 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5109 | .dac_nids = alc260_dac_nids, |
| 5110 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5111 | .adc_nids = alc260_adc_nids, |
| 5112 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5113 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5114 | .channel_mode = alc260_modes, |
| 5115 | .input_mux = &alc260_capture_source, |
| 5116 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5117 | .init_hook = alc260_replacer_672v_automute, |
| 5118 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5119 | #ifdef CONFIG_SND_DEBUG |
| 5120 | [ALC260_TEST] = { |
| 5121 | .mixers = { alc260_test_mixer, |
| 5122 | alc260_capture_mixer }, |
| 5123 | .init_verbs = { alc260_test_init_verbs }, |
| 5124 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5125 | .dac_nids = alc260_test_dac_nids, |
| 5126 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5127 | .adc_nids = alc260_test_adc_nids, |
| 5128 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5129 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5130 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5131 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5132 | }, |
| 5133 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5134 | }; |
| 5135 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5136 | static int patch_alc260(struct hda_codec *codec) |
| 5137 | { |
| 5138 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5139 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5140 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5141 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5142 | if (spec == NULL) |
| 5143 | return -ENOMEM; |
| 5144 | |
| 5145 | codec->spec = spec; |
| 5146 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5147 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5148 | alc260_models, |
| 5149 | alc260_cfg_tbl); |
| 5150 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5151 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5152 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5153 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5154 | } |
| 5155 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5156 | if (board_config == ALC260_AUTO) { |
| 5157 | /* automatic parse from the BIOS config */ |
| 5158 | err = alc260_parse_auto_config(codec); |
| 5159 | if (err < 0) { |
| 5160 | alc_free(codec); |
| 5161 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5162 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5163 | printk(KERN_INFO |
| 5164 | "hda_codec: Cannot set up configuration " |
| 5165 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5166 | board_config = ALC260_BASIC; |
| 5167 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5168 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5169 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5170 | if (board_config != ALC260_AUTO) |
| 5171 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5172 | |
| 5173 | spec->stream_name_analog = "ALC260 Analog"; |
| 5174 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5175 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5176 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5177 | spec->stream_name_digital = "ALC260 Digital"; |
| 5178 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5179 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5180 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5181 | spec->vmaster_nid = 0x08; |
| 5182 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5183 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5184 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5185 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5186 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5187 | if (!spec->loopback.amplist) |
| 5188 | spec->loopback.amplist = alc260_loopbacks; |
| 5189 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5190 | |
| 5191 | return 0; |
| 5192 | } |
| 5193 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5194 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5195 | /* |
| 5196 | * ALC882 support |
| 5197 | * |
| 5198 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5199 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5200 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5201 | * 6-channel independent captures. |
| 5202 | * |
| 5203 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5204 | * driver yet). |
| 5205 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5206 | #define ALC882_DIGOUT_NID 0x06 |
| 5207 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5208 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5209 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5210 | { 8, NULL } |
| 5211 | }; |
| 5212 | |
| 5213 | static hda_nid_t alc882_dac_nids[4] = { |
| 5214 | /* front, rear, clfe, rear_surr */ |
| 5215 | 0x02, 0x03, 0x04, 0x05 |
| 5216 | }; |
| 5217 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5218 | /* identical with ALC880 */ |
| 5219 | #define alc882_adc_nids alc880_adc_nids |
| 5220 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5221 | |
| 5222 | /* input MUX */ |
| 5223 | /* FIXME: should be a matrix-type input source selection */ |
| 5224 | |
| 5225 | static struct hda_input_mux alc882_capture_source = { |
| 5226 | .num_items = 4, |
| 5227 | .items = { |
| 5228 | { "Mic", 0x0 }, |
| 5229 | { "Front Mic", 0x1 }, |
| 5230 | { "Line", 0x2 }, |
| 5231 | { "CD", 0x4 }, |
| 5232 | }, |
| 5233 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5234 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5235 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5236 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5237 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5238 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5239 | { |
| 5240 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5241 | struct alc_spec *spec = codec->spec; |
| 5242 | const struct hda_input_mux *imux = spec->input_mux; |
| 5243 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 5244 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
Takashi Iwai | cced83b | 2008-02-22 18:45:30 +0100 | [diff] [blame] | 5245 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5246 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5247 | unsigned int i, idx; |
| 5248 | |
Takashi Iwai | cced83b | 2008-02-22 18:45:30 +0100 | [diff] [blame] | 5249 | if (spec->num_adc_nids < 3) |
| 5250 | nid = capture_mixers[adc_idx + 1]; |
| 5251 | else |
| 5252 | nid = capture_mixers[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5253 | idx = ucontrol->value.enumerated.item[0]; |
| 5254 | if (idx >= imux->num_items) |
| 5255 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5256 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5257 | return 0; |
| 5258 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5259 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5260 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5261 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5262 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5263 | } |
| 5264 | *cur_val = idx; |
| 5265 | return 1; |
| 5266 | } |
| 5267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5268 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5269 | * 2ch mode |
| 5270 | */ |
| 5271 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5272 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5273 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5274 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5275 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5276 | { } /* end */ |
| 5277 | }; |
| 5278 | |
| 5279 | /* |
| 5280 | * 6ch mode |
| 5281 | */ |
| 5282 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5283 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5284 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5285 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5286 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5287 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5288 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5289 | { } /* end */ |
| 5290 | }; |
| 5291 | |
| 5292 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5293 | { 2, alc882_3ST_ch2_init }, |
| 5294 | { 6, alc882_3ST_ch6_init }, |
| 5295 | }; |
| 5296 | |
| 5297 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5298 | * 6ch mode |
| 5299 | */ |
| 5300 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5301 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5302 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5303 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5304 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5305 | { } /* end */ |
| 5306 | }; |
| 5307 | |
| 5308 | /* |
| 5309 | * 8ch mode |
| 5310 | */ |
| 5311 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5312 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5313 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5314 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5315 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5316 | { } /* end */ |
| 5317 | }; |
| 5318 | |
| 5319 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5320 | { 6, alc882_sixstack_ch6_init }, |
| 5321 | { 8, alc882_sixstack_ch8_init }, |
| 5322 | }; |
| 5323 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5324 | /* |
| 5325 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5326 | */ |
| 5327 | |
| 5328 | /* |
| 5329 | * 2ch mode |
| 5330 | */ |
| 5331 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5332 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5333 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5334 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5335 | { } /* end */ |
| 5336 | }; |
| 5337 | |
| 5338 | /* |
| 5339 | * 6ch mode |
| 5340 | */ |
| 5341 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5342 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5343 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5344 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5345 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5346 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5347 | { } /* end */ |
| 5348 | }; |
| 5349 | |
| 5350 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5351 | { 2, alc885_mbp_ch2_init }, |
| 5352 | { 6, alc885_mbp_ch6_init }, |
| 5353 | }; |
| 5354 | |
| 5355 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5356 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5357 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5358 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5359 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5360 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5361 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5362 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5363 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5364 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5365 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5366 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5367 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5368 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5369 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5370 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5371 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5372 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5373 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5374 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5375 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5376 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5377 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5378 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5379 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5380 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5381 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5382 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5383 | { } /* end */ |
| 5384 | }; |
| 5385 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5386 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5387 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5388 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5389 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5390 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5391 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5392 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5393 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5394 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5395 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5396 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5397 | { } /* end */ |
| 5398 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5399 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5400 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5401 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5402 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5403 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5404 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5405 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5406 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5407 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5408 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5409 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5410 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5411 | { } /* end */ |
| 5412 | }; |
| 5413 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5414 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5415 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5416 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5417 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5418 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5419 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5420 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5421 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5422 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5423 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5424 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5425 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5426 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5427 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5428 | { } /* end */ |
| 5429 | }; |
| 5430 | |
| 5431 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5432 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5433 | */ |
| 5434 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5435 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5436 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5437 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5438 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5439 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5440 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5441 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5442 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5443 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5444 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5445 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5446 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5447 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5448 | { } /* end */ |
| 5449 | }; |
| 5450 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5451 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5452 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5453 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5454 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5455 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5456 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5457 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5458 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5459 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5460 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5461 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5462 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5463 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5464 | { } /* end */ |
| 5465 | }; |
| 5466 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5467 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5468 | { |
| 5469 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5470 | .name = "Channel Mode", |
| 5471 | .info = alc_ch_mode_info, |
| 5472 | .get = alc_ch_mode_get, |
| 5473 | .put = alc_ch_mode_put, |
| 5474 | }, |
| 5475 | { } /* end */ |
| 5476 | }; |
| 5477 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5478 | static struct hda_verb alc882_init_verbs[] = { |
| 5479 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5480 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5481 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5482 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5483 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5484 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5485 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5486 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5487 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5488 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5489 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5490 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5491 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5492 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5493 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5494 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5495 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5496 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5497 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5498 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5499 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5500 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5501 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5502 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5503 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5504 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5505 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5506 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5507 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5508 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5509 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5510 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5511 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5512 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5513 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5514 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5515 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5516 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5517 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5518 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5519 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5520 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5521 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5522 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5523 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5524 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5525 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5526 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5527 | |
| 5528 | /* FIXME: use matrix-type input source selection */ |
| 5529 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5530 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5531 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5532 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5533 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5534 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5535 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5536 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5537 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5538 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5539 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5540 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5541 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5542 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5543 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5544 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5545 | /* ADC1: mute amp left and right */ |
| 5546 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5547 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5548 | /* ADC2: mute amp left and right */ |
| 5549 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5550 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5551 | /* ADC3: mute amp left and right */ |
| 5552 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5553 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5554 | |
| 5555 | { } |
| 5556 | }; |
| 5557 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5558 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5559 | /* change to EAPD mode */ |
| 5560 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5561 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5562 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5563 | }; |
| 5564 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5565 | /* Mac Pro test */ |
| 5566 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5567 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5568 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5569 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5570 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5571 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5572 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5573 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5574 | { } /* end */ |
| 5575 | }; |
| 5576 | |
| 5577 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5578 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5579 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5580 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5581 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5582 | /* Front Pin: output 0 (0x0c) */ |
| 5583 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5584 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5585 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5586 | /* Front Mic pin: input vref at 80% */ |
| 5587 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5588 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5589 | /* Speaker: output */ |
| 5590 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5591 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5592 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5593 | /* Headphone output (output 0 - 0x0c) */ |
| 5594 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5595 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5596 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5597 | |
| 5598 | /* FIXME: use matrix-type input source selection */ |
| 5599 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5600 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5601 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5602 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5603 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5604 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5605 | /* Input mixer2 */ |
| 5606 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5607 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5608 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5609 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5610 | /* Input mixer3 */ |
| 5611 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5612 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5613 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5614 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5615 | /* ADC1: mute amp left and right */ |
| 5616 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5617 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5618 | /* ADC2: mute amp left and right */ |
| 5619 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5620 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5621 | /* ADC3: mute amp left and right */ |
| 5622 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5623 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5624 | |
| 5625 | { } |
| 5626 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5627 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5628 | /* Macbook Pro rev3 */ |
| 5629 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5630 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5631 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5632 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5633 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5634 | /* Rear mixer */ |
| 5635 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5636 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5637 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5638 | /* Front Pin: output 0 (0x0c) */ |
| 5639 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5640 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5641 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5642 | /* HP Pin: output 0 (0x0d) */ |
| 5643 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5644 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5645 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5646 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5647 | /* Mic (rear) pin: input vref at 80% */ |
| 5648 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5649 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5650 | /* Front Mic pin: input vref at 80% */ |
| 5651 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5652 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5653 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5654 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5655 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5656 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5657 | |
| 5658 | /* FIXME: use matrix-type input source selection */ |
| 5659 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5660 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5661 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5662 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5663 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5664 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5665 | /* Input mixer2 */ |
| 5666 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5667 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5668 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5669 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5670 | /* Input mixer3 */ |
| 5671 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5675 | /* ADC1: mute amp left and right */ |
| 5676 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5677 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5678 | /* ADC2: mute amp left and right */ |
| 5679 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5680 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5681 | /* ADC3: mute amp left and right */ |
| 5682 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5683 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5684 | |
| 5685 | { } |
| 5686 | }; |
| 5687 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5688 | /* iMac 24 mixer. */ |
| 5689 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5690 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5691 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5692 | { } /* end */ |
| 5693 | }; |
| 5694 | |
| 5695 | /* iMac 24 init verbs. */ |
| 5696 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5697 | /* Internal speakers: output 0 (0x0c) */ |
| 5698 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5699 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5700 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5701 | /* Internal speakers: output 0 (0x0c) */ |
| 5702 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5703 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5704 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5705 | /* Headphone: output 0 (0x0c) */ |
| 5706 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5707 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5708 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5709 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5710 | /* Front Mic: input vref at 80% */ |
| 5711 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5712 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5713 | { } |
| 5714 | }; |
| 5715 | |
| 5716 | /* Toggle speaker-output according to the hp-jack state */ |
| 5717 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5718 | { |
| 5719 | unsigned int present; |
| 5720 | |
| 5721 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5722 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5723 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5724 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5725 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5726 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5727 | } |
| 5728 | |
| 5729 | /* Processes unsolicited events. */ |
| 5730 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5731 | unsigned int res) |
| 5732 | { |
| 5733 | /* Headphone insertion or removal. */ |
| 5734 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5735 | alc885_imac24_automute(codec); |
| 5736 | } |
| 5737 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5738 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5739 | { |
| 5740 | unsigned int present; |
| 5741 | |
| 5742 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5743 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5744 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5745 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5746 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5747 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5748 | |
| 5749 | } |
| 5750 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5751 | unsigned int res) |
| 5752 | { |
| 5753 | /* Headphone insertion or removal. */ |
| 5754 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5755 | alc885_mbp3_automute(codec); |
| 5756 | } |
| 5757 | |
| 5758 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5759 | static struct hda_verb alc882_targa_verbs[] = { |
| 5760 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5761 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5762 | |
| 5763 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5764 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5765 | |
| 5766 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5767 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5768 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5769 | |
| 5770 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5771 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5772 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5773 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5774 | { } /* end */ |
| 5775 | }; |
| 5776 | |
| 5777 | /* toggle speaker-output according to the hp-jack state */ |
| 5778 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5779 | { |
| 5780 | unsigned int present; |
| 5781 | |
| 5782 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5783 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5784 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5785 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5786 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5787 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5788 | } |
| 5789 | |
| 5790 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5791 | { |
| 5792 | /* Looks like the unsol event is incompatible with the standard |
| 5793 | * definition. 4bit tag is placed at 26 bit! |
| 5794 | */ |
| 5795 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5796 | alc882_targa_automute(codec); |
| 5797 | } |
| 5798 | } |
| 5799 | |
| 5800 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5801 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5802 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5803 | |
| 5804 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5805 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5806 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5807 | |
| 5808 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5809 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5810 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5811 | |
| 5812 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5813 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5814 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5815 | { } /* end */ |
| 5816 | }; |
| 5817 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5818 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5819 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5820 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5821 | |
| 5822 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5824 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5825 | |
| 5826 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5827 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5828 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5829 | |
| 5830 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5831 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5832 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5833 | { } /* end */ |
| 5834 | }; |
| 5835 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5836 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5837 | { |
| 5838 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5839 | |
| 5840 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5841 | AC_VERB_GET_GPIO_DATA, 0); |
| 5842 | |
| 5843 | if (!muted) |
| 5844 | gpiostate |= (1 << pin); |
| 5845 | else |
| 5846 | gpiostate &= ~(1 << pin); |
| 5847 | |
| 5848 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5849 | AC_VERB_GET_GPIO_MASK, 0); |
| 5850 | gpiomask |= (1 << pin); |
| 5851 | |
| 5852 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5853 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5854 | gpiodir |= (1 << pin); |
| 5855 | |
| 5856 | |
| 5857 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5858 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5859 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5860 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5861 | |
| 5862 | msleep(1); |
| 5863 | |
| 5864 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5865 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5866 | } |
| 5867 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5868 | /* set up GPIO at initialization */ |
| 5869 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5870 | { |
| 5871 | alc882_gpio_mute(codec, 0, 0); |
| 5872 | alc882_gpio_mute(codec, 1, 0); |
| 5873 | } |
| 5874 | |
| 5875 | /* set up GPIO and update auto-muting at initialization */ |
| 5876 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5877 | { |
| 5878 | alc885_macpro_init_hook(codec); |
| 5879 | alc885_imac24_automute(codec); |
| 5880 | } |
| 5881 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5882 | /* |
| 5883 | * generic initialization of ADC, input mixers and output mixers |
| 5884 | */ |
| 5885 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5886 | /* |
| 5887 | * Unmute ADC0-2 and set the default input to mic-in |
| 5888 | */ |
| 5889 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5890 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5891 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5892 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5893 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5894 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5895 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5896 | /* 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] | 5897 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5898 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5899 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5900 | */ |
| 5901 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5902 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5903 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5904 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5905 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5906 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5907 | |
| 5908 | /* |
| 5909 | * Set up output mixers (0x0c - 0x0f) |
| 5910 | */ |
| 5911 | /* set vol=0 to output mixers */ |
| 5912 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5913 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5914 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5915 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5916 | /* set up input amps for analog loopback */ |
| 5917 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5918 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5919 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5920 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5921 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5923 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5924 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5925 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5926 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5927 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5928 | |
| 5929 | /* FIXME: use matrix-type input source selection */ |
| 5930 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5931 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5932 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5933 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5934 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5935 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5936 | /* Input mixer2 */ |
| 5937 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5938 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5939 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5940 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5941 | /* Input mixer3 */ |
| 5942 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5943 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5944 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5945 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5946 | |
| 5947 | { } |
| 5948 | }; |
| 5949 | |
| 5950 | /* capture mixer elements */ |
| 5951 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5952 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5953 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5954 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5955 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5956 | { |
| 5957 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5958 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5959 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5960 | */ |
| 5961 | /* .name = "Capture Source", */ |
| 5962 | .name = "Input Source", |
| 5963 | .count = 2, |
| 5964 | .info = alc882_mux_enum_info, |
| 5965 | .get = alc882_mux_enum_get, |
| 5966 | .put = alc882_mux_enum_put, |
| 5967 | }, |
| 5968 | { } /* end */ |
| 5969 | }; |
| 5970 | |
| 5971 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5972 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5973 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5974 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5975 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5976 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5977 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5978 | { |
| 5979 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5980 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5981 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5982 | */ |
| 5983 | /* .name = "Capture Source", */ |
| 5984 | .name = "Input Source", |
| 5985 | .count = 3, |
| 5986 | .info = alc882_mux_enum_info, |
| 5987 | .get = alc882_mux_enum_get, |
| 5988 | .put = alc882_mux_enum_put, |
| 5989 | }, |
| 5990 | { } /* end */ |
| 5991 | }; |
| 5992 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5993 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5994 | #define alc882_loopbacks alc880_loopbacks |
| 5995 | #endif |
| 5996 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5997 | /* pcm configuration: identiacal with ALC880 */ |
| 5998 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 5999 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6000 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6001 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6002 | |
| 6003 | /* |
| 6004 | * configuration and preset |
| 6005 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6006 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6007 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6008 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6009 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6010 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6011 | [ALC882_TARGA] = "targa", |
| 6012 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6013 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6014 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6015 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6016 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6017 | [ALC882_AUTO] = "auto", |
| 6018 | }; |
| 6019 | |
| 6020 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6021 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6022 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6023 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6024 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6025 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6026 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6027 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6028 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6029 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6030 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6031 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6032 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6033 | {} |
| 6034 | }; |
| 6035 | |
| 6036 | static struct alc_config_preset alc882_presets[] = { |
| 6037 | [ALC882_3ST_DIG] = { |
| 6038 | .mixers = { alc882_base_mixer }, |
| 6039 | .init_verbs = { alc882_init_verbs }, |
| 6040 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6041 | .dac_nids = alc882_dac_nids, |
| 6042 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6043 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6044 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6045 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6046 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6047 | .input_mux = &alc882_capture_source, |
| 6048 | }, |
| 6049 | [ALC882_6ST_DIG] = { |
| 6050 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6051 | .init_verbs = { alc882_init_verbs }, |
| 6052 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6053 | .dac_nids = alc882_dac_nids, |
| 6054 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6055 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6056 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6057 | .channel_mode = alc882_sixstack_modes, |
| 6058 | .input_mux = &alc882_capture_source, |
| 6059 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6060 | [ALC882_ARIMA] = { |
| 6061 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6062 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6063 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6064 | .dac_nids = alc882_dac_nids, |
| 6065 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6066 | .channel_mode = alc882_sixstack_modes, |
| 6067 | .input_mux = &alc882_capture_source, |
| 6068 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6069 | [ALC882_W2JC] = { |
| 6070 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6071 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6072 | alc880_gpio1_init_verbs }, |
| 6073 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6074 | .dac_nids = alc882_dac_nids, |
| 6075 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6076 | .channel_mode = alc880_threestack_modes, |
| 6077 | .need_dac_fix = 1, |
| 6078 | .input_mux = &alc882_capture_source, |
| 6079 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6080 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6081 | [ALC885_MBP3] = { |
| 6082 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6083 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6084 | alc880_gpio1_init_verbs }, |
| 6085 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6086 | .dac_nids = alc882_dac_nids, |
| 6087 | .channel_mode = alc885_mbp_6ch_modes, |
| 6088 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6089 | .input_mux = &alc882_capture_source, |
| 6090 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6091 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6092 | .unsol_event = alc885_mbp3_unsol_event, |
| 6093 | .init_hook = alc885_mbp3_automute, |
| 6094 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6095 | [ALC885_MACPRO] = { |
| 6096 | .mixers = { alc882_macpro_mixer }, |
| 6097 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6098 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6099 | .dac_nids = alc882_dac_nids, |
| 6100 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6101 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6102 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6103 | .channel_mode = alc882_ch_modes, |
| 6104 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6105 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6106 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6107 | [ALC885_IMAC24] = { |
| 6108 | .mixers = { alc885_imac24_mixer }, |
| 6109 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6110 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6111 | .dac_nids = alc882_dac_nids, |
| 6112 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6113 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6114 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6115 | .channel_mode = alc882_ch_modes, |
| 6116 | .input_mux = &alc882_capture_source, |
| 6117 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6118 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6119 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6120 | [ALC882_TARGA] = { |
| 6121 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6122 | alc882_capture_mixer }, |
| 6123 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6124 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6125 | .dac_nids = alc882_dac_nids, |
| 6126 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6127 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6128 | .adc_nids = alc882_adc_nids, |
| 6129 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6130 | .channel_mode = alc882_3ST_6ch_modes, |
| 6131 | .need_dac_fix = 1, |
| 6132 | .input_mux = &alc882_capture_source, |
| 6133 | .unsol_event = alc882_targa_unsol_event, |
| 6134 | .init_hook = alc882_targa_automute, |
| 6135 | }, |
| 6136 | [ALC882_ASUS_A7J] = { |
| 6137 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6138 | alc882_capture_mixer }, |
| 6139 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6140 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6141 | .dac_nids = alc882_dac_nids, |
| 6142 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6143 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6144 | .adc_nids = alc882_adc_nids, |
| 6145 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6146 | .channel_mode = alc882_3ST_6ch_modes, |
| 6147 | .need_dac_fix = 1, |
| 6148 | .input_mux = &alc882_capture_source, |
| 6149 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6150 | [ALC882_ASUS_A7M] = { |
| 6151 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6152 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6153 | alc880_gpio1_init_verbs, |
| 6154 | alc882_asus_a7m_verbs }, |
| 6155 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6156 | .dac_nids = alc882_dac_nids, |
| 6157 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6158 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6159 | .channel_mode = alc880_threestack_modes, |
| 6160 | .need_dac_fix = 1, |
| 6161 | .input_mux = &alc882_capture_source, |
| 6162 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6163 | }; |
| 6164 | |
| 6165 | |
| 6166 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6167 | * Pin config fixes |
| 6168 | */ |
| 6169 | enum { |
| 6170 | PINFIX_ABIT_AW9D_MAX |
| 6171 | }; |
| 6172 | |
| 6173 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6174 | { 0x15, 0x01080104 }, /* side */ |
| 6175 | { 0x16, 0x01011012 }, /* rear */ |
| 6176 | { 0x17, 0x01016011 }, /* clfe */ |
| 6177 | { } |
| 6178 | }; |
| 6179 | |
| 6180 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6181 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6182 | }; |
| 6183 | |
| 6184 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6185 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6186 | {} |
| 6187 | }; |
| 6188 | |
| 6189 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6190 | * BIOS auto configuration |
| 6191 | */ |
| 6192 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6193 | hda_nid_t nid, int pin_type, |
| 6194 | int dac_idx) |
| 6195 | { |
| 6196 | /* set as output */ |
| 6197 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6198 | int idx; |
| 6199 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6200 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6201 | idx = 4; |
| 6202 | else |
| 6203 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 6204 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6205 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6206 | pin_type); |
| 6207 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 6208 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6209 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6210 | |
| 6211 | } |
| 6212 | |
| 6213 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6214 | { |
| 6215 | struct alc_spec *spec = codec->spec; |
| 6216 | int i; |
| 6217 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6218 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6219 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6220 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6221 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6222 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6223 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6224 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6225 | } |
| 6226 | } |
| 6227 | |
| 6228 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6229 | { |
| 6230 | struct alc_spec *spec = codec->spec; |
| 6231 | hda_nid_t pin; |
| 6232 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6233 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6234 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6235 | /* use dac 0 */ |
| 6236 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6237 | } |
| 6238 | |
| 6239 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6240 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6241 | |
| 6242 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6243 | { |
| 6244 | struct alc_spec *spec = codec->spec; |
| 6245 | int i; |
| 6246 | |
| 6247 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6248 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6249 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6250 | snd_hda_codec_write(codec, nid, 0, |
| 6251 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6252 | i <= AUTO_PIN_FRONT_MIC ? |
| 6253 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6254 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6255 | snd_hda_codec_write(codec, nid, 0, |
| 6256 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6257 | AMP_OUT_MUTE); |
| 6258 | } |
| 6259 | } |
| 6260 | } |
| 6261 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6262 | /* add mic boosts if needed */ |
| 6263 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6264 | { |
| 6265 | struct alc_spec *spec = codec->spec; |
| 6266 | int err; |
| 6267 | hda_nid_t nid; |
| 6268 | |
| 6269 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6270 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6271 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6272 | "Mic Boost", |
| 6273 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6274 | if (err < 0) |
| 6275 | return err; |
| 6276 | } |
| 6277 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6278 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6279 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6280 | "Front Mic Boost", |
| 6281 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6282 | if (err < 0) |
| 6283 | return err; |
| 6284 | } |
| 6285 | return 0; |
| 6286 | } |
| 6287 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6288 | /* almost identical with ALC880 parser... */ |
| 6289 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6290 | { |
| 6291 | struct alc_spec *spec = codec->spec; |
| 6292 | int err = alc880_parse_auto_config(codec); |
| 6293 | |
| 6294 | if (err < 0) |
| 6295 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6296 | else if (!err) |
| 6297 | return 0; /* no config found */ |
| 6298 | |
| 6299 | err = alc_auto_add_mic_boost(codec); |
| 6300 | if (err < 0) |
| 6301 | return err; |
| 6302 | |
| 6303 | /* hack - override the init verbs */ |
| 6304 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6305 | |
| 6306 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6307 | } |
| 6308 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6309 | /* additional initialization for auto-configuration model */ |
| 6310 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6311 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6312 | alc882_auto_init_multi_out(codec); |
| 6313 | alc882_auto_init_hp_out(codec); |
| 6314 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6315 | } |
| 6316 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6317 | static int patch_alc882(struct hda_codec *codec) |
| 6318 | { |
| 6319 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6320 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6321 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6322 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6323 | if (spec == NULL) |
| 6324 | return -ENOMEM; |
| 6325 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6326 | codec->spec = spec; |
| 6327 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6328 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6329 | alc882_models, |
| 6330 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6331 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6332 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6333 | /* Pick up systems that don't supply PCI SSID */ |
| 6334 | switch (codec->subsystem_id) { |
| 6335 | case 0x106b0c00: /* Mac Pro */ |
| 6336 | board_config = ALC885_MACPRO; |
| 6337 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6338 | case 0x106b1000: /* iMac 24 */ |
| 6339 | board_config = ALC885_IMAC24; |
| 6340 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame] | 6341 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6342 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6343 | board_config = ALC885_MBP3; |
| 6344 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6345 | default: |
| 6346 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6347 | "trying auto-probe from BIOS...\n"); |
| 6348 | board_config = ALC882_AUTO; |
| 6349 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6350 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6351 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6352 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6353 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6354 | if (board_config == ALC882_AUTO) { |
| 6355 | /* automatic parse from the BIOS config */ |
| 6356 | err = alc882_parse_auto_config(codec); |
| 6357 | if (err < 0) { |
| 6358 | alc_free(codec); |
| 6359 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6360 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6361 | printk(KERN_INFO |
| 6362 | "hda_codec: Cannot set up configuration " |
| 6363 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6364 | board_config = ALC882_3ST_DIG; |
| 6365 | } |
| 6366 | } |
| 6367 | |
| 6368 | if (board_config != ALC882_AUTO) |
| 6369 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6370 | |
| 6371 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6372 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6373 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6374 | /* FIXME: setup DAC5 */ |
| 6375 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6376 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6377 | |
| 6378 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6379 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6380 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6381 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6382 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6383 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6384 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6385 | /* get type */ |
| 6386 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6387 | if (wcap != AC_WID_AUD_IN) { |
| 6388 | spec->adc_nids = alc882_adc_nids_alt; |
| 6389 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6390 | spec->mixers[spec->num_mixers] = |
| 6391 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6392 | spec->num_mixers++; |
| 6393 | } else { |
| 6394 | spec->adc_nids = alc882_adc_nids; |
| 6395 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 6396 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6397 | spec->num_mixers++; |
| 6398 | } |
| 6399 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6400 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6401 | spec->vmaster_nid = 0x0c; |
| 6402 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6403 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6404 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6405 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6406 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6407 | if (!spec->loopback.amplist) |
| 6408 | spec->loopback.amplist = alc882_loopbacks; |
| 6409 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6410 | |
| 6411 | return 0; |
| 6412 | } |
| 6413 | |
| 6414 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6415 | * ALC883 support |
| 6416 | * |
| 6417 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6418 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6419 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6420 | * 6-channel independent captures. |
| 6421 | * |
| 6422 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6423 | * driver yet). |
| 6424 | */ |
| 6425 | #define ALC883_DIGOUT_NID 0x06 |
| 6426 | #define ALC883_DIGIN_NID 0x0a |
| 6427 | |
| 6428 | static hda_nid_t alc883_dac_nids[4] = { |
| 6429 | /* front, rear, clfe, rear_surr */ |
| 6430 | 0x02, 0x04, 0x03, 0x05 |
| 6431 | }; |
| 6432 | |
| 6433 | static hda_nid_t alc883_adc_nids[2] = { |
| 6434 | /* ADC1-2 */ |
| 6435 | 0x08, 0x09, |
| 6436 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6437 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6438 | /* input MUX */ |
| 6439 | /* FIXME: should be a matrix-type input source selection */ |
| 6440 | |
| 6441 | static struct hda_input_mux alc883_capture_source = { |
| 6442 | .num_items = 4, |
| 6443 | .items = { |
| 6444 | { "Mic", 0x0 }, |
| 6445 | { "Front Mic", 0x1 }, |
| 6446 | { "Line", 0x2 }, |
| 6447 | { "CD", 0x4 }, |
| 6448 | }, |
| 6449 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6450 | |
| 6451 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6452 | .num_items = 2, |
| 6453 | .items = { |
| 6454 | { "Mic", 0x1 }, |
| 6455 | { "Line", 0x2 }, |
| 6456 | }, |
| 6457 | }; |
| 6458 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6459 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6460 | .num_items = 4, |
| 6461 | .items = { |
| 6462 | { "Mic", 0x0 }, |
| 6463 | { "iMic", 0x1 }, |
| 6464 | { "Line", 0x2 }, |
| 6465 | { "CD", 0x4 }, |
| 6466 | }, |
| 6467 | }; |
| 6468 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6469 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6470 | #define alc883_mux_enum_get alc_mux_enum_get |
| 6471 | |
| 6472 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 6473 | struct snd_ctl_elem_value *ucontrol) |
| 6474 | { |
| 6475 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6476 | struct alc_spec *spec = codec->spec; |
| 6477 | const struct hda_input_mux *imux = spec->input_mux; |
| 6478 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 614ca92 | 2008-02-22 18:44:21 +0100 | [diff] [blame] | 6479 | static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6480 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 6481 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 6482 | unsigned int i, idx; |
| 6483 | |
| 6484 | idx = ucontrol->value.enumerated.item[0]; |
| 6485 | if (idx >= imux->num_items) |
| 6486 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6487 | if (*cur_val == idx) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6488 | return 0; |
| 6489 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6490 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 6491 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6492 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6493 | HDA_AMP_MUTE, v); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6494 | } |
| 6495 | *cur_val = idx; |
| 6496 | return 1; |
| 6497 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6498 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6499 | /* |
| 6500 | * 2ch mode |
| 6501 | */ |
| 6502 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6503 | { 2, NULL } |
| 6504 | }; |
| 6505 | |
| 6506 | /* |
| 6507 | * 2ch mode |
| 6508 | */ |
| 6509 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6510 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6511 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6512 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6513 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6514 | { } /* end */ |
| 6515 | }; |
| 6516 | |
| 6517 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6518 | * 4ch mode |
| 6519 | */ |
| 6520 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6521 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6522 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6523 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6524 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6525 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6526 | { } /* end */ |
| 6527 | }; |
| 6528 | |
| 6529 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6530 | * 6ch mode |
| 6531 | */ |
| 6532 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6533 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6534 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6535 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6536 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6537 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6538 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6539 | { } /* end */ |
| 6540 | }; |
| 6541 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6542 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6543 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6544 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6545 | { 6, alc883_3ST_ch6_init }, |
| 6546 | }; |
| 6547 | |
| 6548 | /* |
| 6549 | * 6ch mode |
| 6550 | */ |
| 6551 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6552 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6553 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6554 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6555 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6556 | { } /* end */ |
| 6557 | }; |
| 6558 | |
| 6559 | /* |
| 6560 | * 8ch mode |
| 6561 | */ |
| 6562 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6563 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6564 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6565 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6566 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6567 | { } /* end */ |
| 6568 | }; |
| 6569 | |
| 6570 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6571 | { 6, alc883_sixstack_ch6_init }, |
| 6572 | { 8, alc883_sixstack_ch8_init }, |
| 6573 | }; |
| 6574 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6575 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6576 | /* eanable EAPD on medion laptop */ |
| 6577 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6578 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6579 | { } |
| 6580 | }; |
| 6581 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6582 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6583 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6584 | */ |
| 6585 | |
| 6586 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6587 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6588 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6589 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6590 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6591 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6592 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6593 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6594 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6595 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6596 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6597 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6598 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6599 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6600 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6601 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6602 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6603 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6604 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6605 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6606 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6607 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6608 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6609 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6610 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6611 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6612 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6613 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6614 | { |
| 6615 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6616 | /* .name = "Capture Source", */ |
| 6617 | .name = "Input Source", |
| 6618 | .count = 2, |
| 6619 | .info = alc883_mux_enum_info, |
| 6620 | .get = alc883_mux_enum_get, |
| 6621 | .put = alc883_mux_enum_put, |
| 6622 | }, |
| 6623 | { } /* end */ |
| 6624 | }; |
| 6625 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6626 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6627 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6628 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6629 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6630 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6631 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6632 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6633 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6634 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6635 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6636 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6637 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6638 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6639 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6640 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6641 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6642 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6643 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6644 | { |
| 6645 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6646 | /* .name = "Capture Source", */ |
| 6647 | .name = "Input Source", |
| 6648 | .count = 2, |
| 6649 | .info = alc883_mux_enum_info, |
| 6650 | .get = alc883_mux_enum_get, |
| 6651 | .put = alc883_mux_enum_put, |
| 6652 | }, |
| 6653 | { } /* end */ |
| 6654 | }; |
| 6655 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6656 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6657 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6658 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6659 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6660 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6661 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6662 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6663 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6664 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6665 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6666 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6667 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6668 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6669 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6670 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6671 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6672 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6673 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6674 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6675 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6676 | { |
| 6677 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6678 | /* .name = "Capture Source", */ |
| 6679 | .name = "Input Source", |
| 6680 | .count = 2, |
| 6681 | .info = alc883_mux_enum_info, |
| 6682 | .get = alc883_mux_enum_get, |
| 6683 | .put = alc883_mux_enum_put, |
| 6684 | }, |
| 6685 | { } /* end */ |
| 6686 | }; |
| 6687 | |
| 6688 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6689 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6690 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6691 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6692 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6693 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6694 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6695 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6696 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6697 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6698 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6699 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6700 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6701 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6702 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6703 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6704 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6705 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6706 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6707 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6708 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6709 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6710 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6711 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6712 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6713 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6714 | { |
| 6715 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6716 | /* .name = "Capture Source", */ |
| 6717 | .name = "Input Source", |
| 6718 | .count = 2, |
| 6719 | .info = alc883_mux_enum_info, |
| 6720 | .get = alc883_mux_enum_get, |
| 6721 | .put = alc883_mux_enum_put, |
| 6722 | }, |
| 6723 | { } /* end */ |
| 6724 | }; |
| 6725 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6726 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6727 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6728 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6729 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6730 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6731 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6732 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6733 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6734 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6735 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6736 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6737 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6738 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6739 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6740 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6741 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6742 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6743 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6744 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6745 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6746 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6747 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6748 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6749 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6750 | |
| 6751 | { |
| 6752 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6753 | /* .name = "Capture Source", */ |
| 6754 | .name = "Input Source", |
| 6755 | .count = 1, |
| 6756 | .info = alc883_mux_enum_info, |
| 6757 | .get = alc883_mux_enum_get, |
| 6758 | .put = alc883_mux_enum_put, |
| 6759 | }, |
| 6760 | { } /* end */ |
| 6761 | }; |
| 6762 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6763 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6764 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6765 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6766 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6767 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6768 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6769 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6770 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6771 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6772 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6773 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6774 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6775 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6776 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6777 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6778 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6779 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6780 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6781 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6782 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6783 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6784 | { |
| 6785 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6786 | /* .name = "Capture Source", */ |
| 6787 | .name = "Input Source", |
| 6788 | .count = 2, |
| 6789 | .info = alc883_mux_enum_info, |
| 6790 | .get = alc883_mux_enum_get, |
| 6791 | .put = alc883_mux_enum_put, |
| 6792 | }, |
| 6793 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6794 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6795 | |
| 6796 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6797 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6798 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6799 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6800 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6801 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6802 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6803 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6804 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6805 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6806 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6807 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6808 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6809 | { |
| 6810 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6811 | /* .name = "Capture Source", */ |
| 6812 | .name = "Input Source", |
| 6813 | .count = 2, |
| 6814 | .info = alc883_mux_enum_info, |
| 6815 | .get = alc883_mux_enum_get, |
| 6816 | .put = alc883_mux_enum_put, |
| 6817 | }, |
| 6818 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6819 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6820 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6821 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6822 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6823 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6824 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6825 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6826 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6828 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6829 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6830 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6831 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6832 | { |
| 6833 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6834 | /* .name = "Capture Source", */ |
| 6835 | .name = "Input Source", |
| 6836 | .count = 1, |
| 6837 | .info = alc883_mux_enum_info, |
| 6838 | .get = alc883_mux_enum_get, |
| 6839 | .put = alc883_mux_enum_put, |
| 6840 | }, |
| 6841 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6842 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6843 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6844 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6845 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6846 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6847 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6848 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6849 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6851 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6852 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6853 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6854 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6855 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6856 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6857 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6858 | { |
| 6859 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6860 | /* .name = "Capture Source", */ |
| 6861 | .name = "Input Source", |
| 6862 | .count = 2, |
| 6863 | .info = alc883_mux_enum_info, |
| 6864 | .get = alc883_mux_enum_get, |
| 6865 | .put = alc883_mux_enum_put, |
| 6866 | }, |
| 6867 | { } /* end */ |
| 6868 | }; |
| 6869 | |
| 6870 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6871 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6872 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6873 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6874 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6875 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6876 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6877 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6878 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6879 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6880 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6881 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6882 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6883 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6884 | { |
| 6885 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6886 | /* .name = "Capture Source", */ |
| 6887 | .name = "Input Source", |
| 6888 | .count = 2, |
| 6889 | .info = alc883_mux_enum_info, |
| 6890 | .get = alc883_mux_enum_get, |
| 6891 | .put = alc883_mux_enum_put, |
| 6892 | }, |
| 6893 | { } /* end */ |
| 6894 | }; |
| 6895 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6896 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6897 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6898 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6899 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6900 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6901 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6902 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6903 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6904 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6905 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6906 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6907 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6908 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6909 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6910 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6911 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6913 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6914 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6915 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6916 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6917 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6918 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6919 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6920 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6921 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6922 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6923 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6924 | { |
| 6925 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6926 | /* .name = "Capture Source", */ |
| 6927 | .name = "Input Source", |
| 6928 | .count = 2, |
| 6929 | .info = alc883_mux_enum_info, |
| 6930 | .get = alc883_mux_enum_get, |
| 6931 | .put = alc883_mux_enum_put, |
| 6932 | }, |
| 6933 | { } /* end */ |
| 6934 | }; |
| 6935 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6936 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6937 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6938 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6939 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6940 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6941 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6942 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6943 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6944 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6945 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6946 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6947 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6948 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6949 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6950 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6951 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6952 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6953 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6954 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6955 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6956 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6957 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6958 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6959 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6960 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6961 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6962 | { |
| 6963 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6964 | /* .name = "Capture Source", */ |
| 6965 | .name = "Input Source", |
| 6966 | .count = 2, |
| 6967 | .info = alc883_mux_enum_info, |
| 6968 | .get = alc883_mux_enum_get, |
| 6969 | .put = alc883_mux_enum_put, |
| 6970 | }, |
| 6971 | { } /* end */ |
| 6972 | }; |
| 6973 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 6974 | static struct snd_kcontrol_new alc888_6st_dell_mixer[] = { |
| 6975 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6976 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6977 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6978 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6979 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6980 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6981 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6982 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6983 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6984 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6985 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6986 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6987 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6988 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6989 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6990 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6991 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6992 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6993 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6994 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6995 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6996 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6997 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6998 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6999 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7000 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7001 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7002 | { |
| 7003 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7004 | /* .name = "Capture Source", */ |
| 7005 | .name = "Input Source", |
| 7006 | .count = 2, |
| 7007 | .info = alc883_mux_enum_info, |
| 7008 | .get = alc883_mux_enum_get, |
| 7009 | .put = alc883_mux_enum_put, |
| 7010 | }, |
| 7011 | { } /* end */ |
| 7012 | }; |
| 7013 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7014 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7015 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7016 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7017 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7018 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7019 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7021 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7022 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7023 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7024 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7025 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7026 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7027 | { |
| 7028 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7029 | /* .name = "Capture Source", */ |
| 7030 | .name = "Input Source", |
| 7031 | .count = 2, |
| 7032 | .info = alc883_mux_enum_info, |
| 7033 | .get = alc883_mux_enum_get, |
| 7034 | .put = alc883_mux_enum_put, |
| 7035 | }, |
| 7036 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7037 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7038 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7039 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7040 | { |
| 7041 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7042 | .name = "Channel Mode", |
| 7043 | .info = alc_ch_mode_info, |
| 7044 | .get = alc_ch_mode_get, |
| 7045 | .put = alc_ch_mode_put, |
| 7046 | }, |
| 7047 | { } /* end */ |
| 7048 | }; |
| 7049 | |
| 7050 | static struct hda_verb alc883_init_verbs[] = { |
| 7051 | /* ADC1: mute amp left and right */ |
| 7052 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7053 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7054 | /* ADC2: mute amp left and right */ |
| 7055 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7056 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7057 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7058 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7059 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7060 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7061 | /* Rear mixer */ |
| 7062 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7063 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7064 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7065 | /* CLFE mixer */ |
| 7066 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7067 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7068 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7069 | /* Side mixer */ |
| 7070 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7071 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7072 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7073 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7074 | /* mute analog input loopbacks */ |
| 7075 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7076 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7077 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7078 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7079 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7080 | |
| 7081 | /* Front Pin: output 0 (0x0c) */ |
| 7082 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7083 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7084 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7085 | /* Rear Pin: output 1 (0x0d) */ |
| 7086 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7087 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7088 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7089 | /* CLFE Pin: output 2 (0x0e) */ |
| 7090 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7091 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7092 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7093 | /* Side Pin: output 3 (0x0f) */ |
| 7094 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7095 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7096 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7097 | /* Mic (rear) pin: input vref at 80% */ |
| 7098 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7099 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7100 | /* Front Mic pin: input vref at 80% */ |
| 7101 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7102 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7103 | /* Line In pin: input */ |
| 7104 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7105 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7106 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7107 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7108 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7109 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7110 | /* CD pin widget for input */ |
| 7111 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7112 | |
| 7113 | /* FIXME: use matrix-type input source selection */ |
| 7114 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7115 | /* Input mixer2 */ |
| 7116 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7117 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7118 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7119 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7120 | /* Input mixer3 */ |
| 7121 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7122 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7123 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7124 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7125 | { } |
| 7126 | }; |
| 7127 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7128 | /* toggle speaker-output according to the hp-jack state */ |
| 7129 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7130 | { |
| 7131 | unsigned int present; |
| 7132 | |
| 7133 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7134 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7135 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7136 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7137 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7138 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7139 | } |
| 7140 | |
| 7141 | /* auto-toggle front mic */ |
| 7142 | /* |
| 7143 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7144 | { |
| 7145 | unsigned int present; |
| 7146 | unsigned char bits; |
| 7147 | |
| 7148 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7149 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7150 | bits = present ? HDA_AMP_MUTE : 0; |
| 7151 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7152 | } |
| 7153 | */ |
| 7154 | |
| 7155 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7156 | { |
| 7157 | alc883_mitac_hp_automute(codec); |
| 7158 | /* alc883_mitac_mic_automute(codec); */ |
| 7159 | } |
| 7160 | |
| 7161 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7162 | unsigned int res) |
| 7163 | { |
| 7164 | switch (res >> 26) { |
| 7165 | case ALC880_HP_EVENT: |
| 7166 | alc883_mitac_hp_automute(codec); |
| 7167 | break; |
| 7168 | case ALC880_MIC_EVENT: |
| 7169 | /* alc883_mitac_mic_automute(codec); */ |
| 7170 | break; |
| 7171 | } |
| 7172 | } |
| 7173 | |
| 7174 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7175 | /* HP */ |
| 7176 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7177 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7178 | /* Subwoofer */ |
| 7179 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7180 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7181 | |
| 7182 | /* enable unsolicited event */ |
| 7183 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7184 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7185 | |
| 7186 | { } /* end */ |
| 7187 | }; |
| 7188 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7189 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7190 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7191 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7192 | |
| 7193 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7194 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7195 | |
| 7196 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7197 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7198 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7199 | |
| 7200 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7201 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7202 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7203 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7204 | |
| 7205 | { } /* end */ |
| 7206 | }; |
| 7207 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7208 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7209 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7210 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7211 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7212 | { } /* end */ |
| 7213 | }; |
| 7214 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7215 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7216 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7217 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7218 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7219 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7220 | { } /* end */ |
| 7221 | }; |
| 7222 | |
| 7223 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7226 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7227 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7228 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7229 | { } /* end */ |
| 7230 | }; |
| 7231 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7232 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7233 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7234 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7235 | |
| 7236 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7237 | |
| 7238 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7239 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7240 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7241 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7242 | { } /* end */ |
| 7243 | }; |
| 7244 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7245 | static struct hda_verb alc888_6st_hp_verbs[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7246 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7247 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ |
| 7248 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ |
| 7249 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 7250 | { } |
| 7251 | }; |
| 7252 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7253 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7254 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7255 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7256 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
| 7257 | { } |
| 7258 | }; |
| 7259 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7260 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 7261 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7262 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */ |
| 7263 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */ |
| 7264 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 7265 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7266 | { } |
| 7267 | }; |
| 7268 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7269 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7270 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7271 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7272 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7273 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7274 | { } |
| 7275 | }; |
| 7276 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7277 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7278 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7279 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7280 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7281 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7282 | { } |
| 7283 | }; |
| 7284 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7285 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7286 | { 2, alc888_3st_hp_2ch_init }, |
| 7287 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7288 | }; |
| 7289 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7290 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7291 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7292 | { |
| 7293 | unsigned int present; |
| 7294 | |
| 7295 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7296 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7297 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7298 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7299 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7300 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7301 | } |
| 7302 | |
| 7303 | /* toggle RCA according to the front-jack state */ |
| 7304 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7305 | { |
| 7306 | unsigned int present; |
| 7307 | |
| 7308 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7309 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7310 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7311 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7312 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7313 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7314 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7315 | unsigned int res) |
| 7316 | { |
| 7317 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7318 | alc888_lenovo_ms7195_front_automute(codec); |
| 7319 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7320 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7321 | } |
| 7322 | |
| 7323 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7325 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7326 | |
| 7327 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7328 | |
| 7329 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7330 | { } /* end */ |
| 7331 | }; |
| 7332 | |
| 7333 | /* toggle speaker-output according to the hp-jack state */ |
| 7334 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7335 | { |
| 7336 | unsigned int present; |
| 7337 | |
| 7338 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7339 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7340 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7341 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7342 | } |
| 7343 | |
| 7344 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7345 | unsigned int res) |
| 7346 | { |
| 7347 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7348 | alc883_medion_md2_automute(codec); |
| 7349 | } |
| 7350 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7351 | /* toggle speaker-output according to the hp-jack state */ |
| 7352 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7353 | { |
| 7354 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7355 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7356 | |
| 7357 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7358 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7359 | bits = present ? HDA_AMP_MUTE : 0; |
| 7360 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7361 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7362 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7363 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7364 | } |
| 7365 | |
| 7366 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7367 | { |
| 7368 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7369 | alc883_tagra_automute(codec); |
| 7370 | } |
| 7371 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7372 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7373 | { |
| 7374 | unsigned int present; |
| 7375 | unsigned char bits; |
| 7376 | |
| 7377 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7378 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7379 | bits = present ? 0x80 : 0; |
| 7380 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7381 | 0x80, bits); |
| 7382 | } |
| 7383 | |
| 7384 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7385 | unsigned int res) |
| 7386 | { |
| 7387 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7388 | alc883_haier_w66_automute(codec); |
| 7389 | } |
| 7390 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7391 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7392 | { |
| 7393 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7394 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7395 | |
| 7396 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7397 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7398 | bits = present ? HDA_AMP_MUTE : 0; |
| 7399 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7400 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7401 | } |
| 7402 | |
| 7403 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7404 | { |
| 7405 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7406 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7407 | |
| 7408 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7409 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7410 | bits = present ? HDA_AMP_MUTE : 0; |
| 7411 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7412 | HDA_AMP_MUTE, bits); |
| 7413 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7414 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7415 | } |
| 7416 | |
| 7417 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7418 | unsigned int res) |
| 7419 | { |
| 7420 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7421 | alc883_lenovo_101e_all_automute(codec); |
| 7422 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7423 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7424 | } |
| 7425 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7426 | /* toggle speaker-output according to the hp-jack state */ |
| 7427 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7428 | { |
| 7429 | unsigned int present; |
| 7430 | |
| 7431 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7432 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7433 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7434 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7435 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7436 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7437 | } |
| 7438 | |
| 7439 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7440 | unsigned int res) |
| 7441 | { |
| 7442 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7443 | alc883_acer_aspire_automute(codec); |
| 7444 | } |
| 7445 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7446 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7447 | /* HP Pin: output 0 (0x0c) */ |
| 7448 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7449 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7450 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7451 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7452 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7453 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7454 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7455 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7456 | /* eanable EAPD on medion laptop */ |
| 7457 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7458 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7459 | /* enable unsolicited event */ |
| 7460 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7461 | { } |
| 7462 | }; |
| 7463 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7464 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7465 | { |
| 7466 | unsigned int present; |
| 7467 | |
| 7468 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7469 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7470 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7471 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7472 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7473 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7474 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7475 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7476 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7477 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7478 | } |
| 7479 | |
| 7480 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7481 | unsigned int res) |
| 7482 | { |
| 7483 | switch (res >> 26) { |
| 7484 | case ALC880_HP_EVENT: |
| 7485 | printk("hp_event\n"); |
| 7486 | alc888_6st_dell_front_automute(codec); |
| 7487 | break; |
| 7488 | } |
| 7489 | } |
| 7490 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7491 | /* |
| 7492 | * generic initialization of ADC, input mixers and output mixers |
| 7493 | */ |
| 7494 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7495 | /* |
| 7496 | * Unmute ADC0-2 and set the default input to mic-in |
| 7497 | */ |
| 7498 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7499 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7500 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7501 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7502 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7503 | /* 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] | 7504 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7505 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7506 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7507 | */ |
| 7508 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7509 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7510 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7511 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7512 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7513 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7514 | |
| 7515 | /* |
| 7516 | * Set up output mixers (0x0c - 0x0f) |
| 7517 | */ |
| 7518 | /* set vol=0 to output mixers */ |
| 7519 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7520 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7521 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7522 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7523 | /* set up input amps for analog loopback */ |
| 7524 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7525 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7526 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7527 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7528 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7529 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7530 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7531 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7532 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7533 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7534 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7535 | |
| 7536 | /* FIXME: use matrix-type input source selection */ |
| 7537 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7538 | /* Input mixer1 */ |
| 7539 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7540 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7541 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7542 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7543 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7544 | /* Input mixer2 */ |
| 7545 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7546 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7547 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7548 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7549 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7550 | |
| 7551 | { } |
| 7552 | }; |
| 7553 | |
| 7554 | /* capture mixer elements */ |
| 7555 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7556 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7557 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7558 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7559 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7560 | { |
| 7561 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7562 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7563 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7564 | */ |
| 7565 | /* .name = "Capture Source", */ |
| 7566 | .name = "Input Source", |
| 7567 | .count = 2, |
| 7568 | .info = alc882_mux_enum_info, |
| 7569 | .get = alc882_mux_enum_get, |
| 7570 | .put = alc882_mux_enum_put, |
| 7571 | }, |
| 7572 | { } /* end */ |
| 7573 | }; |
| 7574 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7575 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7576 | #define alc883_loopbacks alc880_loopbacks |
| 7577 | #endif |
| 7578 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7579 | /* pcm configuration: identiacal with ALC880 */ |
| 7580 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7581 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7582 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7583 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7584 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7585 | |
| 7586 | /* |
| 7587 | * configuration and preset |
| 7588 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7589 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7590 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7591 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7592 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7593 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7594 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7595 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7596 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7597 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7598 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7599 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7600 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7601 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7602 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7603 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7604 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7605 | [ALC888_6ST_HP] = "6stack-hp", |
| 7606 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7607 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7608 | [ALC883_MITAC] = "mitac", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7609 | [ALC883_AUTO] = "auto", |
| 7610 | }; |
| 7611 | |
| 7612 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7613 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7614 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7615 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7616 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7617 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7618 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7619 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7620 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7621 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 7622 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 7623 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7624 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7625 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7626 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7627 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7628 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7629 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7630 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7631 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
| 7632 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
| 7633 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7634 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7635 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7636 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7637 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7638 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7639 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7640 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7641 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7642 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7643 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7644 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7645 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7646 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7647 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7648 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
| 7649 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7650 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7651 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7652 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7653 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7654 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7655 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7656 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 7657 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7658 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7659 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7660 | {} |
| 7661 | }; |
| 7662 | |
| 7663 | static struct alc_config_preset alc883_presets[] = { |
| 7664 | [ALC883_3ST_2ch_DIG] = { |
| 7665 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7666 | .init_verbs = { alc883_init_verbs }, |
| 7667 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7668 | .dac_nids = alc883_dac_nids, |
| 7669 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7670 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7671 | .adc_nids = alc883_adc_nids, |
| 7672 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7673 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7674 | .channel_mode = alc883_3ST_2ch_modes, |
| 7675 | .input_mux = &alc883_capture_source, |
| 7676 | }, |
| 7677 | [ALC883_3ST_6ch_DIG] = { |
| 7678 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7679 | .init_verbs = { alc883_init_verbs }, |
| 7680 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7681 | .dac_nids = alc883_dac_nids, |
| 7682 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7683 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7684 | .adc_nids = alc883_adc_nids, |
| 7685 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7686 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7687 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7688 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7689 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7690 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7691 | [ALC883_3ST_6ch] = { |
| 7692 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7693 | .init_verbs = { alc883_init_verbs }, |
| 7694 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7695 | .dac_nids = alc883_dac_nids, |
| 7696 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7697 | .adc_nids = alc883_adc_nids, |
| 7698 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7699 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7700 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7701 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7702 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7703 | [ALC883_6ST_DIG] = { |
| 7704 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7705 | .init_verbs = { alc883_init_verbs }, |
| 7706 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7707 | .dac_nids = alc883_dac_nids, |
| 7708 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7709 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7710 | .adc_nids = alc883_adc_nids, |
| 7711 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7712 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7713 | .channel_mode = alc883_sixstack_modes, |
| 7714 | .input_mux = &alc883_capture_source, |
| 7715 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7716 | [ALC883_TARGA_DIG] = { |
| 7717 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7718 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7719 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7720 | .dac_nids = alc883_dac_nids, |
| 7721 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7722 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7723 | .adc_nids = alc883_adc_nids, |
| 7724 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7725 | .channel_mode = alc883_3ST_6ch_modes, |
| 7726 | .need_dac_fix = 1, |
| 7727 | .input_mux = &alc883_capture_source, |
| 7728 | .unsol_event = alc883_tagra_unsol_event, |
| 7729 | .init_hook = alc883_tagra_automute, |
| 7730 | }, |
| 7731 | [ALC883_TARGA_2ch_DIG] = { |
| 7732 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7733 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7734 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7735 | .dac_nids = alc883_dac_nids, |
| 7736 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7737 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7738 | .adc_nids = alc883_adc_nids, |
| 7739 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7740 | .channel_mode = alc883_3ST_2ch_modes, |
| 7741 | .input_mux = &alc883_capture_source, |
| 7742 | .unsol_event = alc883_tagra_unsol_event, |
| 7743 | .init_hook = alc883_tagra_automute, |
| 7744 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7745 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7746 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7747 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7748 | * and the headphone jack. Turn this on and rely on the |
| 7749 | * standard mute methods whenever the user wants to turn |
| 7750 | * these outputs off. |
| 7751 | */ |
| 7752 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7753 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7754 | .dac_nids = alc883_dac_nids, |
| 7755 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7756 | .adc_nids = alc883_adc_nids, |
| 7757 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7758 | .channel_mode = alc883_3ST_2ch_modes, |
| 7759 | .input_mux = &alc883_capture_source, |
| 7760 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7761 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7762 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7763 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7764 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7765 | .dac_nids = alc883_dac_nids, |
| 7766 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7767 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7768 | .adc_nids = alc883_adc_nids, |
| 7769 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7770 | .channel_mode = alc883_3ST_2ch_modes, |
| 7771 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7772 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7773 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7774 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7775 | [ALC883_MEDION] = { |
| 7776 | .mixers = { alc883_fivestack_mixer, |
| 7777 | alc883_chmode_mixer }, |
| 7778 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7779 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7780 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7781 | .dac_nids = alc883_dac_nids, |
| 7782 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7783 | .adc_nids = alc883_adc_nids, |
| 7784 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7785 | .channel_mode = alc883_sixstack_modes, |
| 7786 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7787 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7788 | [ALC883_MEDION_MD2] = { |
| 7789 | .mixers = { alc883_medion_md2_mixer}, |
| 7790 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7791 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7792 | .dac_nids = alc883_dac_nids, |
| 7793 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7794 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7795 | .adc_nids = alc883_adc_nids, |
| 7796 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7797 | .channel_mode = alc883_3ST_2ch_modes, |
| 7798 | .input_mux = &alc883_capture_source, |
| 7799 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7800 | .init_hook = alc883_medion_md2_automute, |
| 7801 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7802 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7803 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7804 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7805 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7806 | .dac_nids = alc883_dac_nids, |
| 7807 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7808 | .adc_nids = alc883_adc_nids, |
| 7809 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7810 | .channel_mode = alc883_3ST_2ch_modes, |
| 7811 | .input_mux = &alc883_capture_source, |
| 7812 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7813 | [ALC883_LENOVO_101E_2ch] = { |
| 7814 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7815 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7816 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7817 | .dac_nids = alc883_dac_nids, |
| 7818 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7819 | .adc_nids = alc883_adc_nids, |
| 7820 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7821 | .channel_mode = alc883_3ST_2ch_modes, |
| 7822 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7823 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7824 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7825 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7826 | [ALC883_LENOVO_NB0763] = { |
| 7827 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7828 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7829 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7830 | .dac_nids = alc883_dac_nids, |
| 7831 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7832 | .adc_nids = alc883_adc_nids, |
| 7833 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7834 | .channel_mode = alc883_3ST_2ch_modes, |
| 7835 | .need_dac_fix = 1, |
| 7836 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7837 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7838 | .init_hook = alc883_medion_md2_automute, |
| 7839 | }, |
| 7840 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7841 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7842 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7843 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7844 | .dac_nids = alc883_dac_nids, |
| 7845 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7846 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7847 | .adc_nids = alc883_adc_nids, |
| 7848 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7849 | .channel_mode = alc883_3ST_6ch_modes, |
| 7850 | .need_dac_fix = 1, |
| 7851 | .input_mux = &alc883_capture_source, |
| 7852 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7853 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7854 | }, |
| 7855 | [ALC883_HAIER_W66] = { |
| 7856 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7857 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7858 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7859 | .dac_nids = alc883_dac_nids, |
| 7860 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7861 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7862 | .adc_nids = alc883_adc_nids, |
| 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_haier_w66_unsol_event, |
| 7867 | .init_hook = alc883_haier_w66_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7868 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7869 | [ALC888_6ST_HP] = { |
| 7870 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
| 7871 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7872 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7873 | .dac_nids = alc883_dac_nids, |
| 7874 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7875 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7876 | .adc_nids = alc883_adc_nids, |
| 7877 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7878 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7879 | .channel_mode = alc883_sixstack_modes, |
| 7880 | .input_mux = &alc883_capture_source, |
| 7881 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7882 | [ALC888_3ST_HP] = { |
| 7883 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 7884 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7885 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7886 | .dac_nids = alc883_dac_nids, |
| 7887 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7888 | .adc_nids = alc883_adc_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7889 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 7890 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7891 | .need_dac_fix = 1, |
| 7892 | .input_mux = &alc883_capture_source, |
| 7893 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7894 | [ALC888_6ST_DELL] = { |
| 7895 | .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer }, |
| 7896 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 7897 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7898 | .dac_nids = alc883_dac_nids, |
| 7899 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7900 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7901 | .adc_nids = alc883_adc_nids, |
| 7902 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7903 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7904 | .channel_mode = alc883_sixstack_modes, |
| 7905 | .input_mux = &alc883_capture_source, |
| 7906 | .unsol_event = alc888_6st_dell_unsol_event, |
| 7907 | .init_hook = alc888_6st_dell_front_automute, |
| 7908 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7909 | [ALC883_MITAC] = { |
| 7910 | .mixers = { alc883_mitac_mixer }, |
| 7911 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 7912 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7913 | .dac_nids = alc883_dac_nids, |
| 7914 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7915 | .adc_nids = alc883_adc_nids, |
| 7916 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7917 | .channel_mode = alc883_3ST_2ch_modes, |
| 7918 | .input_mux = &alc883_capture_source, |
| 7919 | .unsol_event = alc883_mitac_unsol_event, |
| 7920 | .init_hook = alc883_mitac_automute, |
| 7921 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7922 | }; |
| 7923 | |
| 7924 | |
| 7925 | /* |
| 7926 | * BIOS auto configuration |
| 7927 | */ |
| 7928 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7929 | hda_nid_t nid, int pin_type, |
| 7930 | int dac_idx) |
| 7931 | { |
| 7932 | /* set as output */ |
| 7933 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7934 | int idx; |
| 7935 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7936 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7937 | idx = 4; |
| 7938 | else |
| 7939 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 7940 | |
| 7941 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7942 | pin_type); |
| 7943 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 7944 | AMP_OUT_UNMUTE); |
| 7945 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7946 | |
| 7947 | } |
| 7948 | |
| 7949 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 7950 | { |
| 7951 | struct alc_spec *spec = codec->spec; |
| 7952 | int i; |
| 7953 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7954 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7955 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7956 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7957 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7958 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7959 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7960 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7961 | } |
| 7962 | } |
| 7963 | |
| 7964 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 7965 | { |
| 7966 | struct alc_spec *spec = codec->spec; |
| 7967 | hda_nid_t pin; |
| 7968 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7969 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7970 | if (pin) /* connect to front */ |
| 7971 | /* use dac 0 */ |
| 7972 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 7973 | } |
| 7974 | |
| 7975 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7976 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 7977 | |
| 7978 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 7979 | { |
| 7980 | struct alc_spec *spec = codec->spec; |
| 7981 | int i; |
| 7982 | |
| 7983 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7984 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 7985 | if (alc883_is_input_pin(nid)) { |
| 7986 | snd_hda_codec_write(codec, nid, 0, |
| 7987 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7988 | (i <= AUTO_PIN_FRONT_MIC ? |
| 7989 | PIN_VREF80 : PIN_IN)); |
| 7990 | if (nid != ALC883_PIN_CD_NID) |
| 7991 | snd_hda_codec_write(codec, nid, 0, |
| 7992 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7993 | AMP_OUT_MUTE); |
| 7994 | } |
| 7995 | } |
| 7996 | } |
| 7997 | |
| 7998 | /* almost identical with ALC880 parser... */ |
| 7999 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8000 | { |
| 8001 | struct alc_spec *spec = codec->spec; |
| 8002 | int err = alc880_parse_auto_config(codec); |
| 8003 | |
| 8004 | if (err < 0) |
| 8005 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8006 | else if (!err) |
| 8007 | return 0; /* no config found */ |
| 8008 | |
| 8009 | err = alc_auto_add_mic_boost(codec); |
| 8010 | if (err < 0) |
| 8011 | return err; |
| 8012 | |
| 8013 | /* hack - override the init verbs */ |
| 8014 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8015 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8016 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8017 | |
| 8018 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8019 | } |
| 8020 | |
| 8021 | /* additional initialization for auto-configuration model */ |
| 8022 | static void alc883_auto_init(struct hda_codec *codec) |
| 8023 | { |
| 8024 | alc883_auto_init_multi_out(codec); |
| 8025 | alc883_auto_init_hp_out(codec); |
| 8026 | alc883_auto_init_analog_input(codec); |
| 8027 | } |
| 8028 | |
| 8029 | static int patch_alc883(struct hda_codec *codec) |
| 8030 | { |
| 8031 | struct alc_spec *spec; |
| 8032 | int err, board_config; |
| 8033 | |
| 8034 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8035 | if (spec == NULL) |
| 8036 | return -ENOMEM; |
| 8037 | |
| 8038 | codec->spec = spec; |
| 8039 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8040 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8041 | alc883_models, |
| 8042 | alc883_cfg_tbl); |
| 8043 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8044 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8045 | "trying auto-probe from BIOS...\n"); |
| 8046 | board_config = ALC883_AUTO; |
| 8047 | } |
| 8048 | |
| 8049 | if (board_config == ALC883_AUTO) { |
| 8050 | /* automatic parse from the BIOS config */ |
| 8051 | err = alc883_parse_auto_config(codec); |
| 8052 | if (err < 0) { |
| 8053 | alc_free(codec); |
| 8054 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8055 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8056 | printk(KERN_INFO |
| 8057 | "hda_codec: Cannot set up configuration " |
| 8058 | "from BIOS. Using base mode...\n"); |
| 8059 | board_config = ALC883_3ST_2ch_DIG; |
| 8060 | } |
| 8061 | } |
| 8062 | |
| 8063 | if (board_config != ALC883_AUTO) |
| 8064 | setup_preset(spec, &alc883_presets[board_config]); |
| 8065 | |
| 8066 | spec->stream_name_analog = "ALC883 Analog"; |
| 8067 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8068 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8069 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8070 | |
| 8071 | spec->stream_name_digital = "ALC883 Digital"; |
| 8072 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8073 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8074 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8075 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8076 | spec->adc_nids = alc883_adc_nids; |
| 8077 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8078 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8079 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8080 | spec->vmaster_nid = 0x0c; |
| 8081 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8082 | codec->patch_ops = alc_patch_ops; |
| 8083 | if (board_config == ALC883_AUTO) |
| 8084 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8085 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8086 | if (!spec->loopback.amplist) |
| 8087 | spec->loopback.amplist = alc883_loopbacks; |
| 8088 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8089 | |
| 8090 | return 0; |
| 8091 | } |
| 8092 | |
| 8093 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8094 | * ALC262 support |
| 8095 | */ |
| 8096 | |
| 8097 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8098 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8099 | |
| 8100 | #define alc262_dac_nids alc260_dac_nids |
| 8101 | #define alc262_adc_nids alc882_adc_nids |
| 8102 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 8103 | |
| 8104 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8105 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8106 | |
| 8107 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8108 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8109 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8110 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8111 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8112 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8113 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8114 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8115 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8116 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8117 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8118 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8119 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8120 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8121 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8122 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8123 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8124 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8125 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8126 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8127 | }; |
| 8128 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8129 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8131 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8132 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8133 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8134 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8135 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8137 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8138 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8139 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8140 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8141 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8142 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8143 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8144 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8145 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8146 | { } /* end */ |
| 8147 | }; |
| 8148 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8149 | /* update HP, line and mono-out pins according to the master switch */ |
| 8150 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8151 | { |
| 8152 | struct alc_spec *spec = codec->spec; |
| 8153 | int val = spec->master_sw; |
| 8154 | |
| 8155 | /* HP & line-out */ |
| 8156 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8157 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8158 | val ? PIN_HP : 0); |
| 8159 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8160 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8161 | val ? PIN_HP : 0); |
| 8162 | /* mono (speaker) depending on the HP jack sense */ |
| 8163 | val = val && !spec->jack_present; |
| 8164 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8165 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8166 | val ? PIN_OUT : 0); |
| 8167 | } |
| 8168 | |
| 8169 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8170 | { |
| 8171 | struct alc_spec *spec = codec->spec; |
| 8172 | unsigned int presence; |
| 8173 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8174 | AC_VERB_GET_PIN_SENSE, 0); |
| 8175 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8176 | alc262_hp_master_update(codec); |
| 8177 | } |
| 8178 | |
| 8179 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8180 | { |
| 8181 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8182 | return; |
| 8183 | alc262_hp_bpc_automute(codec); |
| 8184 | } |
| 8185 | |
| 8186 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8187 | { |
| 8188 | struct alc_spec *spec = codec->spec; |
| 8189 | unsigned int presence; |
| 8190 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8191 | AC_VERB_GET_PIN_SENSE, 0); |
| 8192 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8193 | alc262_hp_master_update(codec); |
| 8194 | } |
| 8195 | |
| 8196 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8197 | unsigned int res) |
| 8198 | { |
| 8199 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8200 | return; |
| 8201 | alc262_hp_wildwest_automute(codec); |
| 8202 | } |
| 8203 | |
| 8204 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8205 | struct snd_ctl_elem_value *ucontrol) |
| 8206 | { |
| 8207 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8208 | struct alc_spec *spec = codec->spec; |
| 8209 | *ucontrol->value.integer.value = spec->master_sw; |
| 8210 | return 0; |
| 8211 | } |
| 8212 | |
| 8213 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8214 | struct snd_ctl_elem_value *ucontrol) |
| 8215 | { |
| 8216 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8217 | struct alc_spec *spec = codec->spec; |
| 8218 | int val = !!*ucontrol->value.integer.value; |
| 8219 | |
| 8220 | if (val == spec->master_sw) |
| 8221 | return 0; |
| 8222 | spec->master_sw = val; |
| 8223 | alc262_hp_master_update(codec); |
| 8224 | return 1; |
| 8225 | } |
| 8226 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8227 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8228 | { |
| 8229 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8230 | .name = "Master Playback Switch", |
| 8231 | .info = snd_ctl_boolean_mono_info, |
| 8232 | .get = alc262_hp_master_sw_get, |
| 8233 | .put = alc262_hp_master_sw_put, |
| 8234 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8235 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8236 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8237 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8238 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8239 | HDA_OUTPUT), |
| 8240 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8241 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8242 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8243 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8244 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8245 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8246 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8247 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8248 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8249 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8250 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8251 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8252 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8253 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8254 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8255 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8256 | { } /* end */ |
| 8257 | }; |
| 8258 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8259 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8260 | { |
| 8261 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8262 | .name = "Master Playback Switch", |
| 8263 | .info = snd_ctl_boolean_mono_info, |
| 8264 | .get = alc262_hp_master_sw_get, |
| 8265 | .put = alc262_hp_master_sw_put, |
| 8266 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8267 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8268 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8269 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8270 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8271 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8272 | HDA_OUTPUT), |
| 8273 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8274 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8275 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8276 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8277 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8278 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8279 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8280 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8281 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8282 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8283 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8284 | { } /* end */ |
| 8285 | }; |
| 8286 | |
| 8287 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8288 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8289 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8290 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8291 | { } /* end */ |
| 8292 | }; |
| 8293 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8294 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8295 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8296 | { |
| 8297 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8298 | |
| 8299 | if (force || !spec->sense_updated) { |
| 8300 | unsigned int present; |
| 8301 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8302 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8303 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8304 | spec->sense_updated = 1; |
| 8305 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8306 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8307 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8308 | } |
| 8309 | |
| 8310 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8311 | unsigned int res) |
| 8312 | { |
| 8313 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8314 | return; |
| 8315 | alc262_hp_t5735_automute(codec, 1); |
| 8316 | } |
| 8317 | |
| 8318 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8319 | { |
| 8320 | alc262_hp_t5735_automute(codec, 1); |
| 8321 | } |
| 8322 | |
| 8323 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8324 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8325 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8326 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8327 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8328 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8329 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8330 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8331 | { } /* end */ |
| 8332 | }; |
| 8333 | |
| 8334 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8335 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8337 | |
| 8338 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8339 | { } |
| 8340 | }; |
| 8341 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8342 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8343 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8344 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8345 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8346 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8347 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8348 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8349 | { } /* end */ |
| 8350 | }; |
| 8351 | |
| 8352 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8353 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8354 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8355 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8356 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8357 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8358 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8359 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8360 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8361 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8362 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8363 | {} |
| 8364 | }; |
| 8365 | |
| 8366 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8367 | .num_items = 1, |
| 8368 | .items = { |
| 8369 | { "Line", 0x1 }, |
| 8370 | }, |
| 8371 | }; |
| 8372 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8373 | /* bind hp and internal speaker mute (with plug check) */ |
| 8374 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8375 | struct snd_ctl_elem_value *ucontrol) |
| 8376 | { |
| 8377 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8378 | long *valp = ucontrol->value.integer.value; |
| 8379 | int change; |
| 8380 | |
| 8381 | /* change hp mute */ |
| 8382 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8383 | HDA_AMP_MUTE, |
| 8384 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8385 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8386 | HDA_AMP_MUTE, |
| 8387 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8388 | if (change) { |
| 8389 | /* change speaker according to HP jack state */ |
| 8390 | struct alc_spec *spec = codec->spec; |
| 8391 | unsigned int mute; |
| 8392 | if (spec->jack_present) |
| 8393 | mute = HDA_AMP_MUTE; |
| 8394 | else |
| 8395 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8396 | HDA_OUTPUT, 0); |
| 8397 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8398 | HDA_AMP_MUTE, mute); |
| 8399 | } |
| 8400 | return change; |
| 8401 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8402 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8403 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8404 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8405 | { |
| 8406 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8407 | .name = "Master Playback Switch", |
| 8408 | .info = snd_hda_mixer_amp_switch_info, |
| 8409 | .get = snd_hda_mixer_amp_switch_get, |
| 8410 | .put = alc262_sony_master_sw_put, |
| 8411 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8412 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8413 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8414 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8415 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8416 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8417 | { } /* end */ |
| 8418 | }; |
| 8419 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8420 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8421 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8422 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8423 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8424 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8425 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8426 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8427 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8428 | { } /* end */ |
| 8429 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8430 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8431 | #define alc262_capture_mixer alc882_capture_mixer |
| 8432 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8433 | |
| 8434 | /* |
| 8435 | * generic initialization of ADC, input mixers and output mixers |
| 8436 | */ |
| 8437 | static struct hda_verb alc262_init_verbs[] = { |
| 8438 | /* |
| 8439 | * Unmute ADC0-2 and set the default input to mic-in |
| 8440 | */ |
| 8441 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8442 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8443 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8444 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8445 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8446 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8447 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8448 | /* 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] | 8449 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8450 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8451 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8452 | */ |
| 8453 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8454 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8455 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8456 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8457 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8458 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8459 | |
| 8460 | /* |
| 8461 | * Set up output mixers (0x0c - 0x0e) |
| 8462 | */ |
| 8463 | /* set vol=0 to output mixers */ |
| 8464 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8465 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8466 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8467 | /* set up input amps for analog loopback */ |
| 8468 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8469 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8470 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8471 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8472 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8473 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8474 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8475 | |
| 8476 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8477 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8478 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8479 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8480 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8481 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8482 | |
| 8483 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8484 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8485 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8486 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8487 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8488 | |
| 8489 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8490 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8491 | |
| 8492 | /* FIXME: use matrix-type input source selection */ |
| 8493 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8494 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8495 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8496 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8497 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8498 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8499 | /* Input mixer2 */ |
| 8500 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8501 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8502 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8503 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8504 | /* Input mixer3 */ |
| 8505 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8506 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8507 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8508 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8509 | |
| 8510 | { } |
| 8511 | }; |
| 8512 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8513 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8514 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8515 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8516 | {} |
| 8517 | }; |
| 8518 | |
| 8519 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8520 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8521 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8522 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8523 | |
| 8524 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8525 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8526 | {} |
| 8527 | }; |
| 8528 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8529 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8530 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8531 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8532 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8533 | |
| 8534 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8535 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8536 | }; |
| 8537 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8538 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8539 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8540 | { |
| 8541 | struct alc_spec *spec = codec->spec; |
| 8542 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8543 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8544 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8545 | /* need to execute and sync at first */ |
| 8546 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8547 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8548 | AC_VERB_GET_PIN_SENSE, 0); |
| 8549 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8550 | if (spec->jack_present) { |
| 8551 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8552 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8553 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8554 | } else { |
| 8555 | /* unmute internal speaker if necessary */ |
| 8556 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8557 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8558 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8559 | } |
| 8560 | } |
| 8561 | |
| 8562 | /* unsolicited event for HP jack sensing */ |
| 8563 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8564 | unsigned int res) |
| 8565 | { |
| 8566 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8567 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8568 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8569 | } |
| 8570 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8571 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8572 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8573 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8574 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8575 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8576 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8577 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8578 | AC_VERB_GET_PIN_SENSE, 0); |
| 8579 | present = (present & 0x80000000) != 0; |
| 8580 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8581 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8582 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8583 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8584 | } else { |
| 8585 | /* unmute internal speaker if necessary */ |
| 8586 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8587 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8588 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8589 | } |
| 8590 | } |
| 8591 | |
| 8592 | /* unsolicited event for HP jack sensing */ |
| 8593 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8594 | unsigned int res) |
| 8595 | { |
| 8596 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8597 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8598 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8599 | } |
| 8600 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8601 | /* |
| 8602 | * fujitsu model |
| 8603 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 8604 | */ |
| 8605 | |
| 8606 | #define ALC_HP_EVENT 0x37 |
| 8607 | |
| 8608 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8609 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8610 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8611 | {} |
| 8612 | }; |
| 8613 | |
| 8614 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8615 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8616 | .items = { |
| 8617 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8618 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8619 | { "CD", 0x4 }, |
| 8620 | }, |
| 8621 | }; |
| 8622 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8623 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8624 | .num_items = 5, |
| 8625 | .items = { |
| 8626 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8627 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8628 | { "Line", 0x2 }, |
| 8629 | { "CD", 0x4 }, |
| 8630 | { "AUX IN", 0x6 }, |
| 8631 | }, |
| 8632 | }; |
| 8633 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8634 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8635 | .num_items = 4, |
| 8636 | .items = { |
| 8637 | { "Mic", 0x0 }, |
| 8638 | { "Front Mic", 0x2 }, |
| 8639 | { "Line", 0x1 }, |
| 8640 | { "CD", 0x4 }, |
| 8641 | }, |
| 8642 | }; |
| 8643 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8644 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8645 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8646 | { |
| 8647 | struct alc_spec *spec = codec->spec; |
| 8648 | unsigned int mute; |
| 8649 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8650 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8651 | unsigned int present; |
| 8652 | /* need to execute and sync at first */ |
| 8653 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8654 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8655 | AC_VERB_GET_PIN_SENSE, 0); |
| 8656 | spec->jack_present = (present & 0x80000000) != 0; |
| 8657 | spec->sense_updated = 1; |
| 8658 | } |
| 8659 | if (spec->jack_present) { |
| 8660 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8661 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8662 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8663 | } else { |
| 8664 | /* unmute internal speaker if necessary */ |
| 8665 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8666 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8667 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8668 | } |
| 8669 | } |
| 8670 | |
| 8671 | /* unsolicited event for HP jack sensing */ |
| 8672 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8673 | unsigned int res) |
| 8674 | { |
| 8675 | if ((res >> 26) != ALC_HP_EVENT) |
| 8676 | return; |
| 8677 | alc262_fujitsu_automute(codec, 1); |
| 8678 | } |
| 8679 | |
| 8680 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8681 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8682 | .ops = &snd_hda_bind_vol, |
| 8683 | .values = { |
| 8684 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8685 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8686 | 0 |
| 8687 | }, |
| 8688 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8689 | |
| 8690 | /* bind hp and internal speaker mute (with plug check) */ |
| 8691 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8692 | struct snd_ctl_elem_value *ucontrol) |
| 8693 | { |
| 8694 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8695 | long *valp = ucontrol->value.integer.value; |
| 8696 | int change; |
| 8697 | |
| 8698 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8699 | HDA_AMP_MUTE, |
| 8700 | valp[0] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8701 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8702 | HDA_AMP_MUTE, |
| 8703 | valp[1] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8704 | if (change) |
| 8705 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8706 | return change; |
| 8707 | } |
| 8708 | |
| 8709 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8710 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8711 | { |
| 8712 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8713 | .name = "Master Playback Switch", |
| 8714 | .info = snd_hda_mixer_amp_switch_info, |
| 8715 | .get = snd_hda_mixer_amp_switch_get, |
| 8716 | .put = alc262_fujitsu_master_sw_put, |
| 8717 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8718 | }, |
| 8719 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8720 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8721 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8722 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8724 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8725 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8726 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8727 | { } /* end */ |
| 8728 | }; |
| 8729 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8730 | /* additional init verbs for Benq laptops */ |
| 8731 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8732 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8733 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8734 | {} |
| 8735 | }; |
| 8736 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8737 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8738 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8739 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8740 | |
| 8741 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8742 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8743 | {} |
| 8744 | }; |
| 8745 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8746 | /* Samsung Q1 Ultra Vista model setup */ |
| 8747 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
| 8748 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8749 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8750 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8751 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8752 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8753 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8754 | { } /* end */ |
| 8755 | }; |
| 8756 | |
| 8757 | static struct hda_verb alc262_ultra_verbs[] = { |
| 8758 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8759 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8760 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8761 | /* Mic is on Node 0x19 */ |
| 8762 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8763 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8764 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8765 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8766 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8767 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8768 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8769 | {} |
| 8770 | }; |
| 8771 | |
| 8772 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 8773 | .num_items = 1, |
| 8774 | .items = { |
| 8775 | { "Mic", 0x1 }, |
| 8776 | }, |
| 8777 | }; |
| 8778 | |
| 8779 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8780 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 8781 | { |
| 8782 | struct alc_spec *spec = codec->spec; |
| 8783 | unsigned int mute; |
| 8784 | unsigned int present; |
| 8785 | |
| 8786 | /* need to execute and sync at first */ |
| 8787 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8788 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8789 | AC_VERB_GET_PIN_SENSE, 0); |
| 8790 | spec->jack_present = (present & 0x80000000) != 0; |
| 8791 | if (spec->jack_present) { |
| 8792 | /* mute internal speaker */ |
| 8793 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8794 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8795 | } else { |
| 8796 | /* unmute internal speaker if necessary */ |
| 8797 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 8798 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8799 | HDA_AMP_MUTE, mute); |
| 8800 | } |
| 8801 | } |
| 8802 | |
| 8803 | /* unsolicited event for HP jack sensing */ |
| 8804 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 8805 | unsigned int res) |
| 8806 | { |
| 8807 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8808 | return; |
| 8809 | alc262_ultra_automute(codec); |
| 8810 | } |
| 8811 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8812 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8813 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8814 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8815 | { |
| 8816 | hda_nid_t nid; |
| 8817 | int err; |
| 8818 | |
| 8819 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 8820 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8821 | spec->multiout.dac_nids[0] = 2; |
| 8822 | |
| 8823 | nid = cfg->line_out_pins[0]; |
| 8824 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8825 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8826 | "Front Playback Volume", |
| 8827 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 8828 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8829 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8830 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8831 | "Front Playback Switch", |
| 8832 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 8833 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8834 | return err; |
| 8835 | } |
| 8836 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 8837 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8838 | if (nid) { |
| 8839 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8840 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8841 | "Speaker Playback Volume", |
| 8842 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8843 | HDA_OUTPUT)); |
| 8844 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8845 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8846 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8847 | "Speaker Playback Switch", |
| 8848 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8849 | HDA_OUTPUT)); |
| 8850 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8851 | return err; |
| 8852 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8853 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8854 | "Speaker Playback Switch", |
| 8855 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8856 | HDA_OUTPUT)); |
| 8857 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8858 | return err; |
| 8859 | } |
| 8860 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8861 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8862 | if (nid) { |
| 8863 | /* spec->multiout.hp_nid = 2; */ |
| 8864 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8865 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8866 | "Headphone Playback Volume", |
| 8867 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8868 | HDA_OUTPUT)); |
| 8869 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8870 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8871 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8872 | "Headphone Playback Switch", |
| 8873 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8874 | HDA_OUTPUT)); |
| 8875 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8876 | return err; |
| 8877 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8878 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8879 | "Headphone Playback Switch", |
| 8880 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8881 | HDA_OUTPUT)); |
| 8882 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8883 | return err; |
| 8884 | } |
| 8885 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8886 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8887 | } |
| 8888 | |
| 8889 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8890 | #define alc262_auto_create_analog_input_ctls \ |
| 8891 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8892 | |
| 8893 | /* |
| 8894 | * generic initialization of ADC, input mixers and output mixers |
| 8895 | */ |
| 8896 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 8897 | /* |
| 8898 | * Unmute ADC0-2 and set the default input to mic-in |
| 8899 | */ |
| 8900 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8901 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8902 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8903 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8904 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8905 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8906 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8907 | /* 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] | 8908 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8909 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8910 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8911 | */ |
| 8912 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8913 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8914 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8915 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8916 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8917 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8918 | |
| 8919 | /* |
| 8920 | * Set up output mixers (0x0c - 0x0f) |
| 8921 | */ |
| 8922 | /* set vol=0 to output mixers */ |
| 8923 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8924 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8925 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8926 | |
| 8927 | /* set up input amps for analog loopback */ |
| 8928 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8929 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8930 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8931 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8932 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8933 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8934 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8935 | |
| 8936 | /* FIXME: use matrix-type input source selection */ |
| 8937 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8938 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8939 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8940 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8941 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8942 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8943 | /* Input mixer2 */ |
| 8944 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8945 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8946 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8947 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8948 | /* Input mixer3 */ |
| 8949 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8950 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8951 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8952 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8953 | |
| 8954 | { } |
| 8955 | }; |
| 8956 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8957 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 8958 | /* |
| 8959 | * Unmute ADC0-2 and set the default input to mic-in |
| 8960 | */ |
| 8961 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8962 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8963 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8964 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8965 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8966 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8967 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8968 | /* 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] | 8969 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8970 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8971 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8972 | */ |
| 8973 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8974 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8975 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8976 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8977 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8978 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8979 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8980 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8981 | |
| 8982 | /* |
| 8983 | * Set up output mixers (0x0c - 0x0e) |
| 8984 | */ |
| 8985 | /* set vol=0 to output mixers */ |
| 8986 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8987 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8988 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8989 | |
| 8990 | /* set up input amps for analog loopback */ |
| 8991 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8992 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8993 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8994 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8995 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8996 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8997 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8998 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8999 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9000 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9001 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9002 | |
| 9003 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9004 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9005 | |
| 9006 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9007 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9008 | |
| 9009 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9010 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9011 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9012 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9013 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9014 | |
| 9015 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9016 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9017 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9018 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9019 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9020 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9021 | |
| 9022 | |
| 9023 | /* FIXME: use matrix-type input source selection */ |
| 9024 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9025 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9026 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9027 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9028 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9029 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9030 | /* Input mixer2 */ |
| 9031 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9032 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9033 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9034 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9035 | /* Input mixer3 */ |
| 9036 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9037 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9038 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9039 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9040 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9041 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9042 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9043 | { } |
| 9044 | }; |
| 9045 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9046 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9047 | /* |
| 9048 | * Unmute ADC0-2 and set the default input to mic-in |
| 9049 | */ |
| 9050 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9051 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9052 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9053 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9054 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9055 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9056 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9057 | /* 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] | 9058 | * mixer widget |
| 9059 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9060 | * panel mic (mic 2) |
| 9061 | */ |
| 9062 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9063 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9064 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9065 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9066 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9067 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9068 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9069 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9070 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9071 | /* |
| 9072 | * Set up output mixers (0x0c - 0x0e) |
| 9073 | */ |
| 9074 | /* set vol=0 to output mixers */ |
| 9075 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9076 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9077 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9078 | |
| 9079 | /* set up input amps for analog loopback */ |
| 9080 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9081 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9082 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9083 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9084 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9085 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9086 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9087 | |
| 9088 | |
| 9089 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9090 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9091 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9092 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9093 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9094 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9095 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9096 | |
| 9097 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9098 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9099 | |
| 9100 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9101 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9102 | |
| 9103 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9104 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9105 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9106 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9107 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9108 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9109 | |
| 9110 | /* FIXME: use matrix-type input source selection */ |
| 9111 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9112 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9113 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9114 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9115 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9116 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9117 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9118 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9119 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9120 | /* Input mixer2 */ |
| 9121 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9122 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9123 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9124 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9125 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9126 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9127 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9128 | /* Input mixer3 */ |
| 9129 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9130 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9131 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9132 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9133 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9134 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9135 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9136 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9137 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9138 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9139 | { } |
| 9140 | }; |
| 9141 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9142 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9143 | #define alc262_loopbacks alc880_loopbacks |
| 9144 | #endif |
| 9145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9146 | /* pcm configuration: identiacal with ALC880 */ |
| 9147 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9148 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9149 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9150 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9151 | |
| 9152 | /* |
| 9153 | * BIOS auto configuration |
| 9154 | */ |
| 9155 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9156 | { |
| 9157 | struct alc_spec *spec = codec->spec; |
| 9158 | int err; |
| 9159 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9160 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9161 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9162 | alc262_ignore); |
| 9163 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9164 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9165 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9166 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9167 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9168 | if (err < 0) |
| 9169 | return err; |
| 9170 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9171 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9172 | return err; |
| 9173 | |
| 9174 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9175 | |
| 9176 | if (spec->autocfg.dig_out_pin) |
| 9177 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9178 | if (spec->autocfg.dig_in_pin) |
| 9179 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9180 | |
| 9181 | if (spec->kctl_alloc) |
| 9182 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9183 | |
| 9184 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9185 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9186 | spec->input_mux = &spec->private_imux; |
| 9187 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9188 | err = alc_auto_add_mic_boost(codec); |
| 9189 | if (err < 0) |
| 9190 | return err; |
| 9191 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9192 | return 1; |
| 9193 | } |
| 9194 | |
| 9195 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9196 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9197 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 9198 | |
| 9199 | |
| 9200 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9201 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9202 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9203 | alc262_auto_init_multi_out(codec); |
| 9204 | alc262_auto_init_hp_out(codec); |
| 9205 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9206 | } |
| 9207 | |
| 9208 | /* |
| 9209 | * configuration and preset |
| 9210 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9211 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9212 | [ALC262_BASIC] = "basic", |
| 9213 | [ALC262_HIPPO] = "hippo", |
| 9214 | [ALC262_HIPPO_1] = "hippo_1", |
| 9215 | [ALC262_FUJITSU] = "fujitsu", |
| 9216 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9217 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9218 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9219 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9220 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9221 | [ALC262_BENQ_T31] = "benq-t31", |
| 9222 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9223 | [ALC262_ULTRA] = "ultra", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9224 | [ALC262_AUTO] = "auto", |
| 9225 | }; |
| 9226 | |
| 9227 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9228 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 9229 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9230 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9231 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9232 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9233 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9234 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9235 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9236 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9237 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9238 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9239 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9240 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9241 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9242 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9243 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9244 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9245 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9246 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9247 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9248 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9249 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9250 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9251 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9252 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9253 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9254 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9255 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9256 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9257 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9258 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9259 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9260 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9261 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9262 | {} |
| 9263 | }; |
| 9264 | |
| 9265 | static struct alc_config_preset alc262_presets[] = { |
| 9266 | [ALC262_BASIC] = { |
| 9267 | .mixers = { alc262_base_mixer }, |
| 9268 | .init_verbs = { alc262_init_verbs }, |
| 9269 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9270 | .dac_nids = alc262_dac_nids, |
| 9271 | .hp_nid = 0x03, |
| 9272 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9273 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9274 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9275 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9276 | [ALC262_HIPPO] = { |
| 9277 | .mixers = { alc262_base_mixer }, |
| 9278 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9279 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9280 | .dac_nids = alc262_dac_nids, |
| 9281 | .hp_nid = 0x03, |
| 9282 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9283 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9284 | .channel_mode = alc262_modes, |
| 9285 | .input_mux = &alc262_capture_source, |
| 9286 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9287 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9288 | }, |
| 9289 | [ALC262_HIPPO_1] = { |
| 9290 | .mixers = { alc262_hippo1_mixer }, |
| 9291 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9292 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9293 | .dac_nids = alc262_dac_nids, |
| 9294 | .hp_nid = 0x02, |
| 9295 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9296 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9297 | .channel_mode = alc262_modes, |
| 9298 | .input_mux = &alc262_capture_source, |
| 9299 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9300 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9301 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9302 | [ALC262_FUJITSU] = { |
| 9303 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9304 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9305 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9306 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9307 | .dac_nids = alc262_dac_nids, |
| 9308 | .hp_nid = 0x03, |
| 9309 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9310 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9311 | .channel_mode = alc262_modes, |
| 9312 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9313 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9314 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9315 | [ALC262_HP_BPC] = { |
| 9316 | .mixers = { alc262_HP_BPC_mixer }, |
| 9317 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9318 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9319 | .dac_nids = alc262_dac_nids, |
| 9320 | .hp_nid = 0x03, |
| 9321 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9322 | .channel_mode = alc262_modes, |
| 9323 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9324 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 9325 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9326 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9327 | [ALC262_HP_BPC_D7000_WF] = { |
| 9328 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9329 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9330 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9331 | .dac_nids = alc262_dac_nids, |
| 9332 | .hp_nid = 0x03, |
| 9333 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9334 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9335 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9336 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9337 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9338 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9339 | [ALC262_HP_BPC_D7000_WL] = { |
| 9340 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9341 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9342 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9343 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9344 | .dac_nids = alc262_dac_nids, |
| 9345 | .hp_nid = 0x03, |
| 9346 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9347 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9348 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9349 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9350 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9351 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9352 | [ALC262_HP_TC_T5735] = { |
| 9353 | .mixers = { alc262_hp_t5735_mixer }, |
| 9354 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9355 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9356 | .dac_nids = alc262_dac_nids, |
| 9357 | .hp_nid = 0x03, |
| 9358 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9359 | .channel_mode = alc262_modes, |
| 9360 | .input_mux = &alc262_capture_source, |
| 9361 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9362 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9363 | }, |
| 9364 | [ALC262_HP_RP5700] = { |
| 9365 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9366 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9367 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9368 | .dac_nids = alc262_dac_nids, |
| 9369 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9370 | .channel_mode = alc262_modes, |
| 9371 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9372 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9373 | [ALC262_BENQ_ED8] = { |
| 9374 | .mixers = { alc262_base_mixer }, |
| 9375 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9376 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9377 | .dac_nids = alc262_dac_nids, |
| 9378 | .hp_nid = 0x03, |
| 9379 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9380 | .channel_mode = alc262_modes, |
| 9381 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9382 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9383 | [ALC262_SONY_ASSAMD] = { |
| 9384 | .mixers = { alc262_sony_mixer }, |
| 9385 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9386 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9387 | .dac_nids = alc262_dac_nids, |
| 9388 | .hp_nid = 0x02, |
| 9389 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9390 | .channel_mode = alc262_modes, |
| 9391 | .input_mux = &alc262_capture_source, |
| 9392 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9393 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9394 | }, |
| 9395 | [ALC262_BENQ_T31] = { |
| 9396 | .mixers = { alc262_benq_t31_mixer }, |
| 9397 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9398 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9399 | .dac_nids = alc262_dac_nids, |
| 9400 | .hp_nid = 0x03, |
| 9401 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9402 | .channel_mode = alc262_modes, |
| 9403 | .input_mux = &alc262_capture_source, |
| 9404 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9405 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9406 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9407 | [ALC262_ULTRA] = { |
| 9408 | .mixers = { alc262_ultra_mixer }, |
| 9409 | .init_verbs = { alc262_init_verbs, alc262_ultra_verbs }, |
| 9410 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9411 | .dac_nids = alc262_dac_nids, |
| 9412 | .hp_nid = 0x03, |
| 9413 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9414 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9415 | .channel_mode = alc262_modes, |
| 9416 | .input_mux = &alc262_ultra_capture_source, |
| 9417 | .unsol_event = alc262_ultra_unsol_event, |
| 9418 | .init_hook = alc262_ultra_automute, |
| 9419 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9420 | }; |
| 9421 | |
| 9422 | static int patch_alc262(struct hda_codec *codec) |
| 9423 | { |
| 9424 | struct alc_spec *spec; |
| 9425 | int board_config; |
| 9426 | int err; |
| 9427 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9428 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9429 | if (spec == NULL) |
| 9430 | return -ENOMEM; |
| 9431 | |
| 9432 | codec->spec = spec; |
| 9433 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9434 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9435 | * under-run |
| 9436 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9437 | { |
| 9438 | int tmp; |
| 9439 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9440 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9441 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9442 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9443 | } |
| 9444 | #endif |
| 9445 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9446 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9447 | alc262_models, |
| 9448 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9449 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9450 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9451 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9452 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9453 | board_config = ALC262_AUTO; |
| 9454 | } |
| 9455 | |
| 9456 | if (board_config == ALC262_AUTO) { |
| 9457 | /* automatic parse from the BIOS config */ |
| 9458 | err = alc262_parse_auto_config(codec); |
| 9459 | if (err < 0) { |
| 9460 | alc_free(codec); |
| 9461 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9462 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9463 | printk(KERN_INFO |
| 9464 | "hda_codec: Cannot set up configuration " |
| 9465 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9466 | board_config = ALC262_BASIC; |
| 9467 | } |
| 9468 | } |
| 9469 | |
| 9470 | if (board_config != ALC262_AUTO) |
| 9471 | setup_preset(spec, &alc262_presets[board_config]); |
| 9472 | |
| 9473 | spec->stream_name_analog = "ALC262 Analog"; |
| 9474 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9475 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9476 | |
| 9477 | spec->stream_name_digital = "ALC262 Digital"; |
| 9478 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9479 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9480 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9481 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9482 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9483 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9484 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9485 | /* get type */ |
| 9486 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9487 | if (wcap != AC_WID_AUD_IN) { |
| 9488 | spec->adc_nids = alc262_adc_nids_alt; |
| 9489 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9490 | spec->mixers[spec->num_mixers] = |
| 9491 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9492 | spec->num_mixers++; |
| 9493 | } else { |
| 9494 | spec->adc_nids = alc262_adc_nids; |
| 9495 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 9496 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9497 | spec->num_mixers++; |
| 9498 | } |
| 9499 | } |
| 9500 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9501 | spec->vmaster_nid = 0x0c; |
| 9502 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9503 | codec->patch_ops = alc_patch_ops; |
| 9504 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9505 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9506 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9507 | if (!spec->loopback.amplist) |
| 9508 | spec->loopback.amplist = alc262_loopbacks; |
| 9509 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9510 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9511 | return 0; |
| 9512 | } |
| 9513 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9514 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9515 | * ALC268 channel source setting (2 channel) |
| 9516 | */ |
| 9517 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9518 | #define alc268_modes alc260_modes |
| 9519 | |
| 9520 | static hda_nid_t alc268_dac_nids[2] = { |
| 9521 | /* front, hp */ |
| 9522 | 0x02, 0x03 |
| 9523 | }; |
| 9524 | |
| 9525 | static hda_nid_t alc268_adc_nids[2] = { |
| 9526 | /* ADC0-1 */ |
| 9527 | 0x08, 0x07 |
| 9528 | }; |
| 9529 | |
| 9530 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9531 | /* ADC0 */ |
| 9532 | 0x08 |
| 9533 | }; |
| 9534 | |
| 9535 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9536 | /* output mixer control */ |
| 9537 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9538 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9539 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9540 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9541 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9542 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9543 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9544 | { } |
| 9545 | }; |
| 9546 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9547 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9548 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9549 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9550 | { } |
| 9551 | }; |
| 9552 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9553 | /* Toshiba specific */ |
| 9554 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9555 | |
| 9556 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9557 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9558 | { } /* end */ |
| 9559 | }; |
| 9560 | |
| 9561 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9562 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9563 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9564 | .ops = &snd_hda_bind_vol, |
| 9565 | .values = { |
| 9566 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9567 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9568 | 0 |
| 9569 | }, |
| 9570 | }; |
| 9571 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9572 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9573 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9574 | { |
| 9575 | struct alc_spec *spec = codec->spec; |
| 9576 | unsigned int mute; |
| 9577 | |
| 9578 | if (force || !spec->sense_updated) { |
| 9579 | unsigned int present; |
| 9580 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9581 | AC_VERB_GET_PIN_SENSE, 0); |
| 9582 | spec->jack_present = (present & 0x80000000) != 0; |
| 9583 | spec->sense_updated = 1; |
| 9584 | } |
| 9585 | if (spec->jack_present) |
| 9586 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9587 | else /* unmute internal speaker if necessary */ |
| 9588 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9589 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9590 | HDA_AMP_MUTE, mute); |
| 9591 | } |
| 9592 | |
| 9593 | |
| 9594 | /* bind hp and internal speaker mute (with plug check) */ |
| 9595 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9596 | struct snd_ctl_elem_value *ucontrol) |
| 9597 | { |
| 9598 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9599 | long *valp = ucontrol->value.integer.value; |
| 9600 | int change; |
| 9601 | |
| 9602 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9603 | HDA_AMP_MUTE, |
| 9604 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9605 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9606 | HDA_AMP_MUTE, |
| 9607 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9608 | if (change) |
| 9609 | alc268_acer_automute(codec, 0); |
| 9610 | return change; |
| 9611 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9612 | |
| 9613 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9614 | /* output mixer control */ |
| 9615 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9616 | { |
| 9617 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9618 | .name = "Master Playback Switch", |
| 9619 | .info = snd_hda_mixer_amp_switch_info, |
| 9620 | .get = snd_hda_mixer_amp_switch_get, |
| 9621 | .put = alc268_acer_master_sw_put, |
| 9622 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9623 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9624 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9625 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9626 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9627 | { } |
| 9628 | }; |
| 9629 | |
| 9630 | static struct hda_verb alc268_acer_verbs[] = { |
| 9631 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9632 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9633 | |
| 9634 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9635 | { } |
| 9636 | }; |
| 9637 | |
| 9638 | /* unsolicited event for HP jack sensing */ |
| 9639 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9640 | unsigned int res) |
| 9641 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9642 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9643 | return; |
| 9644 | alc268_toshiba_automute(codec); |
| 9645 | } |
| 9646 | |
| 9647 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9648 | unsigned int res) |
| 9649 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9650 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9651 | return; |
| 9652 | alc268_acer_automute(codec, 1); |
| 9653 | } |
| 9654 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9655 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9656 | { |
| 9657 | alc268_acer_automute(codec, 1); |
| 9658 | } |
| 9659 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9660 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 9661 | /* output mixer control */ |
| 9662 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9663 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9664 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9665 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9666 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9667 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9668 | { } |
| 9669 | }; |
| 9670 | |
| 9671 | static struct hda_verb alc268_dell_verbs[] = { |
| 9672 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9673 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9674 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9675 | { } |
| 9676 | }; |
| 9677 | |
| 9678 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9679 | static void alc268_dell_automute(struct hda_codec *codec) |
| 9680 | { |
| 9681 | unsigned int present; |
| 9682 | unsigned int mute; |
| 9683 | |
| 9684 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 9685 | if (present & 0x80000000) |
| 9686 | mute = HDA_AMP_MUTE; |
| 9687 | else |
| 9688 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 9689 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9690 | HDA_AMP_MUTE, mute); |
| 9691 | } |
| 9692 | |
| 9693 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 9694 | unsigned int res) |
| 9695 | { |
| 9696 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9697 | return; |
| 9698 | alc268_dell_automute(codec); |
| 9699 | } |
| 9700 | |
| 9701 | #define alc268_dell_init_hook alc268_dell_automute |
| 9702 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9703 | /* |
| 9704 | * generic initialization of ADC, input mixers and output mixers |
| 9705 | */ |
| 9706 | static struct hda_verb alc268_base_init_verbs[] = { |
| 9707 | /* Unmute DAC0-1 and set vol = 0 */ |
| 9708 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9709 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9710 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9711 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9712 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9713 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9714 | |
| 9715 | /* |
| 9716 | * Set up output mixers (0x0c - 0x0e) |
| 9717 | */ |
| 9718 | /* set vol=0 to output mixers */ |
| 9719 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9720 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9721 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9722 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9723 | |
| 9724 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9725 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9726 | |
| 9727 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9728 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9729 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9730 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9731 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9732 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9733 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9734 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9735 | |
| 9736 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9737 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9738 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9739 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9740 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9741 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9742 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9743 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9744 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9745 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 9746 | |
| 9747 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9748 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9749 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9750 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9751 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9752 | { } |
| 9753 | }; |
| 9754 | |
| 9755 | /* |
| 9756 | * generic initialization of ADC, input mixers and output mixers |
| 9757 | */ |
| 9758 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 9759 | /* set output DAC */ |
| 9760 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9761 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9762 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9763 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9764 | |
| 9765 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9766 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9767 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9768 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9769 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9770 | |
| 9771 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9772 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9773 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9774 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9775 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9776 | |
| 9777 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9778 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9779 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9780 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9781 | |
| 9782 | /* set PCBEEP vol = 0 */ |
| 9783 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, |
| 9784 | |
| 9785 | { } |
| 9786 | }; |
| 9787 | |
| 9788 | #define alc268_mux_enum_info alc_mux_enum_info |
| 9789 | #define alc268_mux_enum_get alc_mux_enum_get |
| 9790 | |
| 9791 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9792 | struct snd_ctl_elem_value *ucontrol) |
| 9793 | { |
| 9794 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9795 | struct alc_spec *spec = codec->spec; |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9796 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9797 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 9798 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; |
| 9799 | hda_nid_t nid = capture_mixers[adc_idx]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9800 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9801 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
| 9802 | nid, |
| 9803 | &spec->cur_mux[adc_idx]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9804 | } |
| 9805 | |
| 9806 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 9807 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9808 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9809 | { |
| 9810 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9811 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9812 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9813 | */ |
| 9814 | /* .name = "Capture Source", */ |
| 9815 | .name = "Input Source", |
| 9816 | .count = 1, |
| 9817 | .info = alc268_mux_enum_info, |
| 9818 | .get = alc268_mux_enum_get, |
| 9819 | .put = alc268_mux_enum_put, |
| 9820 | }, |
| 9821 | { } /* end */ |
| 9822 | }; |
| 9823 | |
| 9824 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 9825 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9826 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9827 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9828 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9829 | { |
| 9830 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9831 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9832 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9833 | */ |
| 9834 | /* .name = "Capture Source", */ |
| 9835 | .name = "Input Source", |
| 9836 | .count = 2, |
| 9837 | .info = alc268_mux_enum_info, |
| 9838 | .get = alc268_mux_enum_get, |
| 9839 | .put = alc268_mux_enum_put, |
| 9840 | }, |
| 9841 | { } /* end */ |
| 9842 | }; |
| 9843 | |
| 9844 | static struct hda_input_mux alc268_capture_source = { |
| 9845 | .num_items = 4, |
| 9846 | .items = { |
| 9847 | { "Mic", 0x0 }, |
| 9848 | { "Front Mic", 0x1 }, |
| 9849 | { "Line", 0x2 }, |
| 9850 | { "CD", 0x3 }, |
| 9851 | }, |
| 9852 | }; |
| 9853 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9854 | #ifdef CONFIG_SND_DEBUG |
| 9855 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9856 | /* Volume widgets */ |
| 9857 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9858 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9859 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9860 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9861 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 9862 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 9863 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 9864 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 9865 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 9866 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 9867 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 9868 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 9869 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 9870 | /* The below appears problematic on some hardwares */ |
| 9871 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9872 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9873 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 9874 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 9875 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 9876 | |
| 9877 | /* Modes for retasking pin widgets */ |
| 9878 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 9879 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 9880 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 9881 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 9882 | |
| 9883 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 9884 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 9885 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 9886 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 9887 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 9888 | |
| 9889 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 9890 | * The ALC268 does not have an SPDIF input. |
| 9891 | */ |
| 9892 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 9893 | |
| 9894 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 9895 | * this output to turn on an external amplifier. |
| 9896 | */ |
| 9897 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 9898 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 9899 | |
| 9900 | { } /* end */ |
| 9901 | }; |
| 9902 | #endif |
| 9903 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9904 | /* create input playback/capture controls for the given pin */ |
| 9905 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 9906 | const char *ctlname, int idx) |
| 9907 | { |
| 9908 | char name[32]; |
| 9909 | int err; |
| 9910 | |
| 9911 | sprintf(name, "%s Playback Volume", ctlname); |
| 9912 | if (nid == 0x14) { |
| 9913 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9914 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 9915 | HDA_OUTPUT)); |
| 9916 | if (err < 0) |
| 9917 | return err; |
| 9918 | } else if (nid == 0x15) { |
| 9919 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9920 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 9921 | HDA_OUTPUT)); |
| 9922 | if (err < 0) |
| 9923 | return err; |
| 9924 | } else |
| 9925 | return -1; |
| 9926 | sprintf(name, "%s Playback Switch", ctlname); |
| 9927 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 9928 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 9929 | if (err < 0) |
| 9930 | return err; |
| 9931 | return 0; |
| 9932 | } |
| 9933 | |
| 9934 | /* add playback controls from the parsed DAC table */ |
| 9935 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9936 | const struct auto_pin_cfg *cfg) |
| 9937 | { |
| 9938 | hda_nid_t nid; |
| 9939 | int err; |
| 9940 | |
| 9941 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 9942 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9943 | spec->multiout.dac_nids[0] = 2; |
| 9944 | spec->multiout.dac_nids[1] = 3; |
| 9945 | |
| 9946 | nid = cfg->line_out_pins[0]; |
| 9947 | if (nid) |
| 9948 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 9949 | |
| 9950 | nid = cfg->speaker_pins[0]; |
| 9951 | if (nid == 0x1d) { |
| 9952 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9953 | "Speaker Playback Volume", |
| 9954 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9955 | if (err < 0) |
| 9956 | return err; |
| 9957 | } |
| 9958 | nid = cfg->hp_pins[0]; |
| 9959 | if (nid) |
| 9960 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 9961 | |
| 9962 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 9963 | if (nid == 0x16) { |
| 9964 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9965 | "Mono Playback Switch", |
| 9966 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 9967 | if (err < 0) |
| 9968 | return err; |
| 9969 | } |
| 9970 | return 0; |
| 9971 | } |
| 9972 | |
| 9973 | /* create playback/capture controls for input pins */ |
| 9974 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 9975 | const struct auto_pin_cfg *cfg) |
| 9976 | { |
| 9977 | struct hda_input_mux *imux = &spec->private_imux; |
| 9978 | int i, idx1; |
| 9979 | |
| 9980 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9981 | switch(cfg->input_pins[i]) { |
| 9982 | case 0x18: |
| 9983 | idx1 = 0; /* Mic 1 */ |
| 9984 | break; |
| 9985 | case 0x19: |
| 9986 | idx1 = 1; /* Mic 2 */ |
| 9987 | break; |
| 9988 | case 0x1a: |
| 9989 | idx1 = 2; /* Line In */ |
| 9990 | break; |
| 9991 | case 0x1c: |
| 9992 | idx1 = 3; /* CD */ |
| 9993 | break; |
| 9994 | default: |
| 9995 | continue; |
| 9996 | } |
| 9997 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 9998 | imux->items[imux->num_items].index = idx1; |
| 9999 | imux->num_items++; |
| 10000 | } |
| 10001 | return 0; |
| 10002 | } |
| 10003 | |
| 10004 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 10005 | { |
| 10006 | struct alc_spec *spec = codec->spec; |
| 10007 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10008 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10009 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10010 | unsigned int dac_vol1, dac_vol2; |
| 10011 | |
| 10012 | if (speaker_nid) { |
| 10013 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 10014 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 10015 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10016 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10017 | AMP_IN_UNMUTE(1)); |
| 10018 | snd_hda_codec_write(codec, 0x10, 0, |
| 10019 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10020 | AMP_IN_UNMUTE(1)); |
| 10021 | } else { |
| 10022 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10023 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10024 | snd_hda_codec_write(codec, 0x10, 0, |
| 10025 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10026 | } |
| 10027 | |
| 10028 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 10029 | if (line_nid == 0x14) |
| 10030 | dac_vol2 = AMP_OUT_ZERO; |
| 10031 | else if (line_nid == 0x15) |
| 10032 | dac_vol1 = AMP_OUT_ZERO; |
| 10033 | if (hp_nid == 0x14) |
| 10034 | dac_vol2 = AMP_OUT_ZERO; |
| 10035 | else if (hp_nid == 0x15) |
| 10036 | dac_vol1 = AMP_OUT_ZERO; |
| 10037 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10038 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10039 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10040 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10041 | |
| 10042 | snd_hda_codec_write(codec, 0x02, 0, |
| 10043 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10044 | snd_hda_codec_write(codec, 0x03, 0, |
| 10045 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10046 | } |
| 10047 | |
| 10048 | /* pcm configuration: identiacal with ALC880 */ |
| 10049 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10050 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10051 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10052 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10053 | |
| 10054 | /* |
| 10055 | * BIOS auto configuration |
| 10056 | */ |
| 10057 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10058 | { |
| 10059 | struct alc_spec *spec = codec->spec; |
| 10060 | int err; |
| 10061 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10062 | |
| 10063 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10064 | alc268_ignore); |
| 10065 | if (err < 0) |
| 10066 | return err; |
| 10067 | if (!spec->autocfg.line_outs) |
| 10068 | return 0; /* can't find valid BIOS pin config */ |
| 10069 | |
| 10070 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10071 | if (err < 0) |
| 10072 | return err; |
| 10073 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10074 | if (err < 0) |
| 10075 | return err; |
| 10076 | |
| 10077 | spec->multiout.max_channels = 2; |
| 10078 | |
| 10079 | /* digital only support output */ |
| 10080 | if (spec->autocfg.dig_out_pin) |
| 10081 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10082 | |
| 10083 | if (spec->kctl_alloc) |
| 10084 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10085 | |
| 10086 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10087 | spec->num_mux_defs = 1; |
| 10088 | spec->input_mux = &spec->private_imux; |
| 10089 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10090 | err = alc_auto_add_mic_boost(codec); |
| 10091 | if (err < 0) |
| 10092 | return err; |
| 10093 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10094 | return 1; |
| 10095 | } |
| 10096 | |
| 10097 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10098 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10099 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10100 | |
| 10101 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10102 | static void alc268_auto_init(struct hda_codec *codec) |
| 10103 | { |
| 10104 | alc268_auto_init_multi_out(codec); |
| 10105 | alc268_auto_init_hp_out(codec); |
| 10106 | alc268_auto_init_mono_speaker_out(codec); |
| 10107 | alc268_auto_init_analog_input(codec); |
| 10108 | } |
| 10109 | |
| 10110 | /* |
| 10111 | * configuration and preset |
| 10112 | */ |
| 10113 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 10114 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10115 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10116 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10117 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10118 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10119 | #ifdef CONFIG_SND_DEBUG |
| 10120 | [ALC268_TEST] = "test", |
| 10121 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10122 | [ALC268_AUTO] = "auto", |
| 10123 | }; |
| 10124 | |
| 10125 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10126 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10127 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10128 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10129 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10130 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10131 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10132 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10133 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10134 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10135 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10136 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10137 | {} |
| 10138 | }; |
| 10139 | |
| 10140 | static struct alc_config_preset alc268_presets[] = { |
| 10141 | [ALC268_3ST] = { |
| 10142 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 10143 | .init_verbs = { alc268_base_init_verbs }, |
| 10144 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10145 | .dac_nids = alc268_dac_nids, |
| 10146 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10147 | .adc_nids = alc268_adc_nids_alt, |
| 10148 | .hp_nid = 0x03, |
| 10149 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10150 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10151 | .channel_mode = alc268_modes, |
| 10152 | .input_mux = &alc268_capture_source, |
| 10153 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10154 | [ALC268_TOSHIBA] = { |
| 10155 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10156 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10157 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10158 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10159 | .dac_nids = alc268_dac_nids, |
| 10160 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10161 | .adc_nids = alc268_adc_nids_alt, |
| 10162 | .hp_nid = 0x03, |
| 10163 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10164 | .channel_mode = alc268_modes, |
| 10165 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10166 | .unsol_event = alc268_toshiba_unsol_event, |
| 10167 | .init_hook = alc268_toshiba_automute, |
| 10168 | }, |
| 10169 | [ALC268_ACER] = { |
| 10170 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer }, |
| 10171 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10172 | alc268_acer_verbs }, |
| 10173 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10174 | .dac_nids = alc268_dac_nids, |
| 10175 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10176 | .adc_nids = alc268_adc_nids_alt, |
| 10177 | .hp_nid = 0x02, |
| 10178 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10179 | .channel_mode = alc268_modes, |
| 10180 | .input_mux = &alc268_capture_source, |
| 10181 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10182 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10183 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10184 | [ALC268_DELL] = { |
| 10185 | .mixers = { alc268_dell_mixer }, |
| 10186 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10187 | alc268_dell_verbs }, |
| 10188 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10189 | .dac_nids = alc268_dac_nids, |
| 10190 | .hp_nid = 0x02, |
| 10191 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10192 | .channel_mode = alc268_modes, |
| 10193 | .unsol_event = alc268_dell_unsol_event, |
| 10194 | .init_hook = alc268_dell_init_hook, |
| 10195 | .input_mux = &alc268_capture_source, |
| 10196 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10197 | [ALC268_ZEPTO] = { |
| 10198 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 10199 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10200 | alc268_toshiba_verbs }, |
| 10201 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10202 | .dac_nids = alc268_dac_nids, |
| 10203 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10204 | .adc_nids = alc268_adc_nids_alt, |
| 10205 | .hp_nid = 0x03, |
| 10206 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10207 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10208 | .channel_mode = alc268_modes, |
| 10209 | .input_mux = &alc268_capture_source, |
| 10210 | .unsol_event = alc268_toshiba_unsol_event, |
| 10211 | .init_hook = alc268_toshiba_automute |
| 10212 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10213 | #ifdef CONFIG_SND_DEBUG |
| 10214 | [ALC268_TEST] = { |
| 10215 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10216 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10217 | alc268_volume_init_verbs }, |
| 10218 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10219 | .dac_nids = alc268_dac_nids, |
| 10220 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10221 | .adc_nids = alc268_adc_nids_alt, |
| 10222 | .hp_nid = 0x03, |
| 10223 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10224 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10225 | .channel_mode = alc268_modes, |
| 10226 | .input_mux = &alc268_capture_source, |
| 10227 | }, |
| 10228 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10229 | }; |
| 10230 | |
| 10231 | static int patch_alc268(struct hda_codec *codec) |
| 10232 | { |
| 10233 | struct alc_spec *spec; |
| 10234 | int board_config; |
| 10235 | int err; |
| 10236 | |
| 10237 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10238 | if (spec == NULL) |
| 10239 | return -ENOMEM; |
| 10240 | |
| 10241 | codec->spec = spec; |
| 10242 | |
| 10243 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10244 | alc268_models, |
| 10245 | alc268_cfg_tbl); |
| 10246 | |
| 10247 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10248 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10249 | "trying auto-probe from BIOS...\n"); |
| 10250 | board_config = ALC268_AUTO; |
| 10251 | } |
| 10252 | |
| 10253 | if (board_config == ALC268_AUTO) { |
| 10254 | /* automatic parse from the BIOS config */ |
| 10255 | err = alc268_parse_auto_config(codec); |
| 10256 | if (err < 0) { |
| 10257 | alc_free(codec); |
| 10258 | return err; |
| 10259 | } else if (!err) { |
| 10260 | printk(KERN_INFO |
| 10261 | "hda_codec: Cannot set up configuration " |
| 10262 | "from BIOS. Using base mode...\n"); |
| 10263 | board_config = ALC268_3ST; |
| 10264 | } |
| 10265 | } |
| 10266 | |
| 10267 | if (board_config != ALC268_AUTO) |
| 10268 | setup_preset(spec, &alc268_presets[board_config]); |
| 10269 | |
| 10270 | spec->stream_name_analog = "ALC268 Analog"; |
| 10271 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10272 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10273 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10274 | |
| 10275 | spec->stream_name_digital = "ALC268 Digital"; |
| 10276 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10277 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10278 | if (!spec->adc_nids && spec->input_mux) { |
| 10279 | /* check whether NID 0x07 is valid */ |
| 10280 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10281 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10282 | /* get type */ |
| 10283 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 10284 | if (wcap != AC_WID_AUD_IN) { |
| 10285 | spec->adc_nids = alc268_adc_nids_alt; |
| 10286 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10287 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10288 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10289 | spec->num_mixers++; |
| 10290 | } else { |
| 10291 | spec->adc_nids = alc268_adc_nids; |
| 10292 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10293 | spec->mixers[spec->num_mixers] = |
| 10294 | alc268_capture_mixer; |
| 10295 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10296 | } |
| 10297 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10298 | |
| 10299 | spec->vmaster_nid = 0x02; |
| 10300 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10301 | codec->patch_ops = alc_patch_ops; |
| 10302 | if (board_config == ALC268_AUTO) |
| 10303 | spec->init_hook = alc268_auto_init; |
| 10304 | |
| 10305 | return 0; |
| 10306 | } |
| 10307 | |
| 10308 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10309 | * ALC269 channel source setting (2 channel) |
| 10310 | */ |
| 10311 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10312 | |
| 10313 | #define alc269_dac_nids alc260_dac_nids |
| 10314 | |
| 10315 | static hda_nid_t alc269_adc_nids[1] = { |
| 10316 | /* ADC1 */ |
| 10317 | 0x07, |
| 10318 | }; |
| 10319 | |
| 10320 | #define alc269_modes alc260_modes |
| 10321 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10322 | |
| 10323 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10324 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10325 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10326 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10327 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10328 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10329 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10330 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10331 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10332 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10333 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10334 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10335 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10336 | { } /* end */ |
| 10337 | }; |
| 10338 | |
| 10339 | /* capture mixer elements */ |
| 10340 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10341 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10342 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10343 | { |
| 10344 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10345 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10346 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10347 | */ |
| 10348 | /* .name = "Capture Source", */ |
| 10349 | .name = "Input Source", |
| 10350 | .count = 1, |
| 10351 | .info = alc_mux_enum_info, |
| 10352 | .get = alc_mux_enum_get, |
| 10353 | .put = alc_mux_enum_put, |
| 10354 | }, |
| 10355 | { } /* end */ |
| 10356 | }; |
| 10357 | |
| 10358 | /* |
| 10359 | * generic initialization of ADC, input mixers and output mixers |
| 10360 | */ |
| 10361 | static struct hda_verb alc269_init_verbs[] = { |
| 10362 | /* |
| 10363 | * Unmute ADC0 and set the default input to mic-in |
| 10364 | */ |
| 10365 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10366 | |
| 10367 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 10368 | * analog-loopback mixer widget |
| 10369 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10370 | * front panel mic (mic 2) |
| 10371 | */ |
| 10372 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10373 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10374 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10375 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10376 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10377 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10378 | |
| 10379 | /* |
| 10380 | * Set up output mixers (0x0c - 0x0e) |
| 10381 | */ |
| 10382 | /* set vol=0 to output mixers */ |
| 10383 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10384 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10385 | |
| 10386 | /* set up input amps for analog loopback */ |
| 10387 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10388 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10389 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10390 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10391 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10392 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10393 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10394 | |
| 10395 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10396 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10397 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10398 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10399 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10400 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10401 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10402 | |
| 10403 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10404 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10405 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10406 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10407 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10408 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10409 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10410 | |
| 10411 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10412 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10413 | |
| 10414 | /* FIXME: use matrix-type input source selection */ |
| 10415 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10416 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10417 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10418 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10419 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10420 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10421 | |
| 10422 | /* set EAPD */ |
| 10423 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10424 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10425 | { } |
| 10426 | }; |
| 10427 | |
| 10428 | /* add playback controls from the parsed DAC table */ |
| 10429 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10430 | const struct auto_pin_cfg *cfg) |
| 10431 | { |
| 10432 | hda_nid_t nid; |
| 10433 | int err; |
| 10434 | |
| 10435 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10436 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10437 | spec->multiout.dac_nids[0] = 2; |
| 10438 | |
| 10439 | nid = cfg->line_out_pins[0]; |
| 10440 | if (nid) { |
| 10441 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10442 | "Front Playback Volume", |
| 10443 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10444 | if (err < 0) |
| 10445 | return err; |
| 10446 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10447 | "Front Playback Switch", |
| 10448 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10449 | if (err < 0) |
| 10450 | return err; |
| 10451 | } |
| 10452 | |
| 10453 | nid = cfg->speaker_pins[0]; |
| 10454 | if (nid) { |
| 10455 | if (!cfg->line_out_pins[0]) { |
| 10456 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10457 | "Speaker Playback Volume", |
| 10458 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10459 | HDA_OUTPUT)); |
| 10460 | if (err < 0) |
| 10461 | return err; |
| 10462 | } |
| 10463 | if (nid == 0x16) { |
| 10464 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10465 | "Speaker Playback Switch", |
| 10466 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10467 | HDA_OUTPUT)); |
| 10468 | if (err < 0) |
| 10469 | return err; |
| 10470 | } else { |
| 10471 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10472 | "Speaker Playback Switch", |
| 10473 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10474 | HDA_OUTPUT)); |
| 10475 | if (err < 0) |
| 10476 | return err; |
| 10477 | } |
| 10478 | } |
| 10479 | nid = cfg->hp_pins[0]; |
| 10480 | if (nid) { |
| 10481 | /* spec->multiout.hp_nid = 2; */ |
| 10482 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10483 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10484 | "Headphone Playback Volume", |
| 10485 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10486 | HDA_OUTPUT)); |
| 10487 | if (err < 0) |
| 10488 | return err; |
| 10489 | } |
| 10490 | if (nid == 0x16) { |
| 10491 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10492 | "Headphone Playback Switch", |
| 10493 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10494 | HDA_OUTPUT)); |
| 10495 | if (err < 0) |
| 10496 | return err; |
| 10497 | } else { |
| 10498 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10499 | "Headphone Playback Switch", |
| 10500 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10501 | HDA_OUTPUT)); |
| 10502 | if (err < 0) |
| 10503 | return err; |
| 10504 | } |
| 10505 | } |
| 10506 | return 0; |
| 10507 | } |
| 10508 | |
| 10509 | #define alc269_auto_create_analog_input_ctls \ |
| 10510 | alc880_auto_create_analog_input_ctls |
| 10511 | |
| 10512 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10513 | #define alc269_loopbacks alc880_loopbacks |
| 10514 | #endif |
| 10515 | |
| 10516 | /* pcm configuration: identiacal with ALC880 */ |
| 10517 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10518 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10519 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10520 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10521 | |
| 10522 | /* |
| 10523 | * BIOS auto configuration |
| 10524 | */ |
| 10525 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10526 | { |
| 10527 | struct alc_spec *spec = codec->spec; |
| 10528 | int err; |
| 10529 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10530 | |
| 10531 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10532 | alc269_ignore); |
| 10533 | if (err < 0) |
| 10534 | return err; |
| 10535 | |
| 10536 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10537 | if (err < 0) |
| 10538 | return err; |
| 10539 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10540 | if (err < 0) |
| 10541 | return err; |
| 10542 | |
| 10543 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10544 | |
| 10545 | if (spec->autocfg.dig_out_pin) |
| 10546 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10547 | |
| 10548 | if (spec->kctl_alloc) |
| 10549 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10550 | |
| 10551 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10552 | spec->num_mux_defs = 1; |
| 10553 | spec->input_mux = &spec->private_imux; |
| 10554 | |
| 10555 | err = alc_auto_add_mic_boost(codec); |
| 10556 | if (err < 0) |
| 10557 | return err; |
| 10558 | |
| 10559 | return 1; |
| 10560 | } |
| 10561 | |
| 10562 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10563 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10564 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10565 | |
| 10566 | |
| 10567 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10568 | static void alc269_auto_init(struct hda_codec *codec) |
| 10569 | { |
| 10570 | alc269_auto_init_multi_out(codec); |
| 10571 | alc269_auto_init_hp_out(codec); |
| 10572 | alc269_auto_init_analog_input(codec); |
| 10573 | } |
| 10574 | |
| 10575 | /* |
| 10576 | * configuration and preset |
| 10577 | */ |
| 10578 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 10579 | [ALC269_BASIC] = "basic", |
| 10580 | }; |
| 10581 | |
| 10582 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 10583 | {} |
| 10584 | }; |
| 10585 | |
| 10586 | static struct alc_config_preset alc269_presets[] = { |
| 10587 | [ALC269_BASIC] = { |
| 10588 | .mixers = { alc269_base_mixer }, |
| 10589 | .init_verbs = { alc269_init_verbs }, |
| 10590 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 10591 | .dac_nids = alc269_dac_nids, |
| 10592 | .hp_nid = 0x03, |
| 10593 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 10594 | .channel_mode = alc269_modes, |
| 10595 | .input_mux = &alc269_capture_source, |
| 10596 | }, |
| 10597 | }; |
| 10598 | |
| 10599 | static int patch_alc269(struct hda_codec *codec) |
| 10600 | { |
| 10601 | struct alc_spec *spec; |
| 10602 | int board_config; |
| 10603 | int err; |
| 10604 | |
| 10605 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10606 | if (spec == NULL) |
| 10607 | return -ENOMEM; |
| 10608 | |
| 10609 | codec->spec = spec; |
| 10610 | |
| 10611 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 10612 | alc269_models, |
| 10613 | alc269_cfg_tbl); |
| 10614 | |
| 10615 | if (board_config < 0) { |
| 10616 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 10617 | "trying auto-probe from BIOS...\n"); |
| 10618 | board_config = ALC269_AUTO; |
| 10619 | } |
| 10620 | |
| 10621 | if (board_config == ALC269_AUTO) { |
| 10622 | /* automatic parse from the BIOS config */ |
| 10623 | err = alc269_parse_auto_config(codec); |
| 10624 | if (err < 0) { |
| 10625 | alc_free(codec); |
| 10626 | return err; |
| 10627 | } else if (!err) { |
| 10628 | printk(KERN_INFO |
| 10629 | "hda_codec: Cannot set up configuration " |
| 10630 | "from BIOS. Using base mode...\n"); |
| 10631 | board_config = ALC269_BASIC; |
| 10632 | } |
| 10633 | } |
| 10634 | |
| 10635 | if (board_config != ALC269_AUTO) |
| 10636 | setup_preset(spec, &alc269_presets[board_config]); |
| 10637 | |
| 10638 | spec->stream_name_analog = "ALC269 Analog"; |
| 10639 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 10640 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 10641 | |
| 10642 | spec->stream_name_digital = "ALC269 Digital"; |
| 10643 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 10644 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 10645 | |
| 10646 | spec->adc_nids = alc269_adc_nids; |
| 10647 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 10648 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 10649 | spec->num_mixers++; |
| 10650 | |
| 10651 | codec->patch_ops = alc_patch_ops; |
| 10652 | if (board_config == ALC269_AUTO) |
| 10653 | spec->init_hook = alc269_auto_init; |
| 10654 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10655 | if (!spec->loopback.amplist) |
| 10656 | spec->loopback.amplist = alc269_loopbacks; |
| 10657 | #endif |
| 10658 | |
| 10659 | return 0; |
| 10660 | } |
| 10661 | |
| 10662 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10663 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 10664 | */ |
| 10665 | |
| 10666 | /* |
| 10667 | * set the path ways for 2 channel output |
| 10668 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 10669 | */ |
| 10670 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 10671 | /* set pin widget 1Ah (line in) for input */ |
| 10672 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10673 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10674 | * the vref |
| 10675 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10676 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10677 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10678 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10679 | #if 0 |
| 10680 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10681 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10682 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10683 | { } /* end */ |
| 10684 | }; |
| 10685 | /* |
| 10686 | * 6ch mode |
| 10687 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 10688 | */ |
| 10689 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 10690 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10691 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10692 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10693 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10694 | |
| 10695 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10696 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10697 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10698 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10699 | #if 0 |
| 10700 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10701 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10702 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10703 | { } /* end */ |
| 10704 | }; |
| 10705 | |
| 10706 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 10707 | { 2, alc861_threestack_ch2_init }, |
| 10708 | { 6, alc861_threestack_ch6_init }, |
| 10709 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10710 | /* Set mic1 as input and unmute the mixer */ |
| 10711 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 10712 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10713 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10714 | { } /* end */ |
| 10715 | }; |
| 10716 | /* Set mic1 as output and mute mixer */ |
| 10717 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 10718 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10719 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10720 | { } /* end */ |
| 10721 | }; |
| 10722 | |
| 10723 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 10724 | { 2, alc861_uniwill_m31_ch2_init }, |
| 10725 | { 4, alc861_uniwill_m31_ch4_init }, |
| 10726 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10727 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10728 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 10729 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 10730 | /* set pin widget 1Ah (line in) for input */ |
| 10731 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10732 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10733 | * the vref |
| 10734 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10735 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10736 | |
| 10737 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10738 | #if 0 |
| 10739 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10740 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10741 | #endif |
| 10742 | { } /* end */ |
| 10743 | }; |
| 10744 | /* Set mic1 nad line-in as output and mute mixer */ |
| 10745 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 10746 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10747 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10748 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10749 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10750 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10751 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10752 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10753 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10754 | |
| 10755 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10756 | #if 0 |
| 10757 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10758 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10759 | #endif |
| 10760 | { } /* end */ |
| 10761 | }; |
| 10762 | |
| 10763 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 10764 | { 2, alc861_asus_ch2_init }, |
| 10765 | { 6, alc861_asus_ch6_init }, |
| 10766 | }; |
| 10767 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10768 | /* patch-ALC861 */ |
| 10769 | |
| 10770 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 10771 | /* output mixer control */ |
| 10772 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10773 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10774 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10775 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10776 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10777 | |
| 10778 | /*Input mixer control */ |
| 10779 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10780 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10781 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10782 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10783 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10784 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10785 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10786 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10787 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10788 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10789 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10790 | /* Capture mixer control */ |
| 10791 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10792 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10793 | { |
| 10794 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10795 | .name = "Capture Source", |
| 10796 | .count = 1, |
| 10797 | .info = alc_mux_enum_info, |
| 10798 | .get = alc_mux_enum_get, |
| 10799 | .put = alc_mux_enum_put, |
| 10800 | }, |
| 10801 | { } /* end */ |
| 10802 | }; |
| 10803 | |
| 10804 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 10805 | /* output mixer control */ |
| 10806 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10807 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10808 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10809 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10810 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10811 | |
| 10812 | /* Input mixer control */ |
| 10813 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10814 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10815 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10816 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10817 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10818 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10821 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10822 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10823 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10824 | /* Capture mixer control */ |
| 10825 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10826 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10827 | { |
| 10828 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10829 | .name = "Capture Source", |
| 10830 | .count = 1, |
| 10831 | .info = alc_mux_enum_info, |
| 10832 | .get = alc_mux_enum_get, |
| 10833 | .put = alc_mux_enum_put, |
| 10834 | }, |
| 10835 | { |
| 10836 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10837 | .name = "Channel Mode", |
| 10838 | .info = alc_ch_mode_info, |
| 10839 | .get = alc_ch_mode_get, |
| 10840 | .put = alc_ch_mode_put, |
| 10841 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 10842 | }, |
| 10843 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10844 | }; |
| 10845 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10846 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10847 | /* output mixer control */ |
| 10848 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10849 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10850 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10851 | |
| 10852 | /*Capture mixer control */ |
| 10853 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10854 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10855 | { |
| 10856 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10857 | .name = "Capture Source", |
| 10858 | .count = 1, |
| 10859 | .info = alc_mux_enum_info, |
| 10860 | .get = alc_mux_enum_get, |
| 10861 | .put = alc_mux_enum_put, |
| 10862 | }, |
| 10863 | |
| 10864 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10865 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10866 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10867 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 10868 | /* output mixer control */ |
| 10869 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10870 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10871 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10872 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10873 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10874 | |
| 10875 | /* Input mixer control */ |
| 10876 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10877 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10878 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10879 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10880 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10881 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10882 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10883 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10884 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10885 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10886 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10887 | /* Capture mixer control */ |
| 10888 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10889 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10890 | { |
| 10891 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10892 | .name = "Capture Source", |
| 10893 | .count = 1, |
| 10894 | .info = alc_mux_enum_info, |
| 10895 | .get = alc_mux_enum_get, |
| 10896 | .put = alc_mux_enum_put, |
| 10897 | }, |
| 10898 | { |
| 10899 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10900 | .name = "Channel Mode", |
| 10901 | .info = alc_ch_mode_info, |
| 10902 | .get = alc_ch_mode_get, |
| 10903 | .put = alc_ch_mode_put, |
| 10904 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 10905 | }, |
| 10906 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10907 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10908 | |
| 10909 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 10910 | /* output mixer control */ |
| 10911 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10912 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10913 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10914 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10915 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10916 | |
| 10917 | /* Input mixer control */ |
| 10918 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10919 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10920 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10921 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10922 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10923 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10924 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10925 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10926 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10927 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 10928 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10929 | /* Capture mixer control */ |
| 10930 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10931 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10932 | { |
| 10933 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10934 | .name = "Capture Source", |
| 10935 | .count = 1, |
| 10936 | .info = alc_mux_enum_info, |
| 10937 | .get = alc_mux_enum_get, |
| 10938 | .put = alc_mux_enum_put, |
| 10939 | }, |
| 10940 | { |
| 10941 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10942 | .name = "Channel Mode", |
| 10943 | .info = alc_ch_mode_info, |
| 10944 | .get = alc_ch_mode_get, |
| 10945 | .put = alc_ch_mode_put, |
| 10946 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 10947 | }, |
| 10948 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10949 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10950 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10951 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10952 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10953 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10954 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10955 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10956 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10957 | { } |
| 10958 | }; |
| 10959 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10960 | /* |
| 10961 | * generic initialization of ADC, input mixers and output mixers |
| 10962 | */ |
| 10963 | static struct hda_verb alc861_base_init_verbs[] = { |
| 10964 | /* |
| 10965 | * Unmute ADC0 and set the default input to mic-in |
| 10966 | */ |
| 10967 | /* port-A for surround (rear panel) */ |
| 10968 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10969 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10970 | /* port-B for mic-in (rear panel) with vref */ |
| 10971 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10972 | /* port-C for line-in (rear panel) */ |
| 10973 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10974 | /* port-D for Front */ |
| 10975 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10976 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10977 | /* port-E for HP out (front panel) */ |
| 10978 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 10979 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10980 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10981 | /* port-F for mic-in (front panel) with vref */ |
| 10982 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10983 | /* port-G for CLFE (rear panel) */ |
| 10984 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10985 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10986 | /* port-H for side (rear panel) */ |
| 10987 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10988 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10989 | /* CD-in */ |
| 10990 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10991 | /* route front mic to ADC1*/ |
| 10992 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10993 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10994 | |
| 10995 | /* Unmute DAC0~3 & spdif out*/ |
| 10996 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10997 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10998 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10999 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11000 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11001 | |
| 11002 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11003 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11004 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11005 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11006 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11007 | |
| 11008 | /* Unmute Stereo Mixer 15 */ |
| 11009 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11010 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11011 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11012 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11013 | |
| 11014 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11015 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11016 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11017 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11018 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11019 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11020 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11021 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11022 | /* hp used DAC 3 (Front) */ |
| 11023 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11024 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11025 | |
| 11026 | { } |
| 11027 | }; |
| 11028 | |
| 11029 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 11030 | /* |
| 11031 | * Unmute ADC0 and set the default input to mic-in |
| 11032 | */ |
| 11033 | /* port-A for surround (rear panel) */ |
| 11034 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11035 | /* port-B for mic-in (rear panel) with vref */ |
| 11036 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11037 | /* port-C for line-in (rear panel) */ |
| 11038 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11039 | /* port-D for Front */ |
| 11040 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11041 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11042 | /* port-E for HP out (front panel) */ |
| 11043 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11044 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11045 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11046 | /* port-F for mic-in (front panel) with vref */ |
| 11047 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11048 | /* port-G for CLFE (rear panel) */ |
| 11049 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11050 | /* port-H for side (rear panel) */ |
| 11051 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11052 | /* CD-in */ |
| 11053 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11054 | /* route front mic to ADC1*/ |
| 11055 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11056 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11057 | /* Unmute DAC0~3 & spdif out*/ |
| 11058 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11059 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11060 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11061 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11062 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11063 | |
| 11064 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11065 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11066 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11067 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11068 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11069 | |
| 11070 | /* Unmute Stereo Mixer 15 */ |
| 11071 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11072 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11073 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11074 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11075 | |
| 11076 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11077 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11078 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11079 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11080 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11081 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11082 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11083 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11084 | /* hp used DAC 3 (Front) */ |
| 11085 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11086 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11087 | { } |
| 11088 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11089 | |
| 11090 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11091 | /* |
| 11092 | * Unmute ADC0 and set the default input to mic-in |
| 11093 | */ |
| 11094 | /* port-A for surround (rear panel) */ |
| 11095 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11096 | /* port-B for mic-in (rear panel) with vref */ |
| 11097 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11098 | /* port-C for line-in (rear panel) */ |
| 11099 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11100 | /* port-D for Front */ |
| 11101 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11102 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11103 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11104 | /* this has to be set to VREF80 */ |
| 11105 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11106 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11107 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11108 | /* port-F for mic-in (front panel) with vref */ |
| 11109 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11110 | /* port-G for CLFE (rear panel) */ |
| 11111 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11112 | /* port-H for side (rear panel) */ |
| 11113 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11114 | /* CD-in */ |
| 11115 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11116 | /* route front mic to ADC1*/ |
| 11117 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11118 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11119 | /* Unmute DAC0~3 & spdif out*/ |
| 11120 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11121 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11122 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11123 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11124 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11125 | |
| 11126 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11127 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11128 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11129 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11130 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11131 | |
| 11132 | /* Unmute Stereo Mixer 15 */ |
| 11133 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11134 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11135 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11136 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11137 | |
| 11138 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11139 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11140 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11141 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11142 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11143 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11144 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11145 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11146 | /* hp used DAC 3 (Front) */ |
| 11147 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11148 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11149 | { } |
| 11150 | }; |
| 11151 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11152 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 11153 | /* |
| 11154 | * Unmute ADC0 and set the default input to mic-in |
| 11155 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11156 | /* port-A for surround (rear panel) |
| 11157 | * according to codec#0 this is the HP jack |
| 11158 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11159 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 11160 | /* route front PCM to HP */ |
| 11161 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11162 | /* port-B for mic-in (rear panel) with vref */ |
| 11163 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11164 | /* port-C for line-in (rear panel) */ |
| 11165 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11166 | /* port-D for Front */ |
| 11167 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11168 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11169 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11170 | /* this has to be set to VREF80 */ |
| 11171 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11172 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11173 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11174 | /* port-F for mic-in (front panel) with vref */ |
| 11175 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11176 | /* port-G for CLFE (rear panel) */ |
| 11177 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11178 | /* port-H for side (rear panel) */ |
| 11179 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11180 | /* CD-in */ |
| 11181 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11182 | /* route front mic to ADC1*/ |
| 11183 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11184 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11185 | /* Unmute DAC0~3 & spdif out*/ |
| 11186 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11187 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11188 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11189 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11190 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11191 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11192 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11193 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11194 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11195 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11196 | |
| 11197 | /* Unmute Stereo Mixer 15 */ |
| 11198 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11199 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11200 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11201 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11202 | |
| 11203 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11204 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11205 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11206 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11207 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11208 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11209 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11210 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11211 | /* hp used DAC 3 (Front) */ |
| 11212 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11213 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11214 | { } |
| 11215 | }; |
| 11216 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11217 | /* additional init verbs for ASUS laptops */ |
| 11218 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 11219 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 11220 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 11221 | { } |
| 11222 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11223 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11224 | /* |
| 11225 | * generic initialization of ADC, input mixers and output mixers |
| 11226 | */ |
| 11227 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 11228 | /* |
| 11229 | * Unmute ADC0 and set the default input to mic-in |
| 11230 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11231 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11232 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11233 | |
| 11234 | /* Unmute DAC0~3 & spdif out*/ |
| 11235 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11236 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11237 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11238 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11239 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11240 | |
| 11241 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11242 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11243 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11244 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11245 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11246 | |
| 11247 | /* Unmute Stereo Mixer 15 */ |
| 11248 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11249 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11250 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11251 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 11252 | |
| 11253 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11254 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11255 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11256 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11257 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11258 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11259 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11260 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11261 | |
| 11262 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11263 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11264 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11265 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11266 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11267 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11268 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11269 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11270 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11271 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11272 | |
| 11273 | { } |
| 11274 | }; |
| 11275 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11276 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11277 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11278 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11279 | { } |
| 11280 | }; |
| 11281 | |
| 11282 | /* toggle speaker-output according to the hp-jack state */ |
| 11283 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11284 | { |
| 11285 | unsigned int present; |
| 11286 | |
| 11287 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11288 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11289 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11290 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11291 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11292 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11293 | } |
| 11294 | |
| 11295 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11296 | unsigned int res) |
| 11297 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11298 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11299 | alc861_toshiba_automute(codec); |
| 11300 | } |
| 11301 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11302 | /* pcm configuration: identiacal with ALC880 */ |
| 11303 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11304 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11305 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11306 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11307 | |
| 11308 | |
| 11309 | #define ALC861_DIGOUT_NID 0x07 |
| 11310 | |
| 11311 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11312 | { 8, NULL } |
| 11313 | }; |
| 11314 | |
| 11315 | static hda_nid_t alc861_dac_nids[4] = { |
| 11316 | /* front, surround, clfe, side */ |
| 11317 | 0x03, 0x06, 0x05, 0x04 |
| 11318 | }; |
| 11319 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11320 | static hda_nid_t alc660_dac_nids[3] = { |
| 11321 | /* front, clfe, surround */ |
| 11322 | 0x03, 0x05, 0x06 |
| 11323 | }; |
| 11324 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11325 | static hda_nid_t alc861_adc_nids[1] = { |
| 11326 | /* ADC0-2 */ |
| 11327 | 0x08, |
| 11328 | }; |
| 11329 | |
| 11330 | static struct hda_input_mux alc861_capture_source = { |
| 11331 | .num_items = 5, |
| 11332 | .items = { |
| 11333 | { "Mic", 0x0 }, |
| 11334 | { "Front Mic", 0x3 }, |
| 11335 | { "Line", 0x1 }, |
| 11336 | { "CD", 0x4 }, |
| 11337 | { "Mixer", 0x5 }, |
| 11338 | }, |
| 11339 | }; |
| 11340 | |
| 11341 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11342 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11343 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11344 | { |
| 11345 | int i; |
| 11346 | hda_nid_t nid; |
| 11347 | |
| 11348 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11349 | for (i = 0; i < cfg->line_outs; i++) { |
| 11350 | nid = cfg->line_out_pins[i]; |
| 11351 | if (nid) { |
| 11352 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11353 | continue; |
| 11354 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11355 | } |
| 11356 | } |
| 11357 | spec->multiout.num_dacs = cfg->line_outs; |
| 11358 | return 0; |
| 11359 | } |
| 11360 | |
| 11361 | /* add playback controls from the parsed DAC table */ |
| 11362 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11363 | const struct auto_pin_cfg *cfg) |
| 11364 | { |
| 11365 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11366 | static const char *chname[4] = { |
| 11367 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11368 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11369 | hda_nid_t nid; |
| 11370 | int i, idx, err; |
| 11371 | |
| 11372 | for (i = 0; i < cfg->line_outs; i++) { |
| 11373 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11374 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11375 | continue; |
| 11376 | if (nid == 0x05) { |
| 11377 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11378 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11379 | "Center Playback Switch", |
| 11380 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11381 | HDA_OUTPUT)); |
| 11382 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11383 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11384 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11385 | "LFE Playback Switch", |
| 11386 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11387 | HDA_OUTPUT)); |
| 11388 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11389 | return err; |
| 11390 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11391 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11392 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11393 | if (nid == alc861_dac_nids[idx]) |
| 11394 | break; |
| 11395 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11396 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11397 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11398 | HDA_OUTPUT)); |
| 11399 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11400 | return err; |
| 11401 | } |
| 11402 | } |
| 11403 | return 0; |
| 11404 | } |
| 11405 | |
| 11406 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11407 | { |
| 11408 | int err; |
| 11409 | hda_nid_t nid; |
| 11410 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11411 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11412 | return 0; |
| 11413 | |
| 11414 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11415 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11416 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11417 | "Headphone Playback Switch", |
| 11418 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11419 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11420 | return err; |
| 11421 | spec->multiout.hp_nid = nid; |
| 11422 | } |
| 11423 | return 0; |
| 11424 | } |
| 11425 | |
| 11426 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11427 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11428 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11429 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11430 | struct hda_input_mux *imux = &spec->private_imux; |
| 11431 | int i, err, idx, idx1; |
| 11432 | |
| 11433 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11434 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11435 | case 0x0c: |
| 11436 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11437 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11438 | break; |
| 11439 | case 0x0f: |
| 11440 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11441 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11442 | break; |
| 11443 | case 0x0d: |
| 11444 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11445 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11446 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11447 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11448 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11449 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11450 | break; |
| 11451 | case 0x11: |
| 11452 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11453 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11454 | break; |
| 11455 | default: |
| 11456 | continue; |
| 11457 | } |
| 11458 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11459 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11460 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11461 | if (err < 0) |
| 11462 | return err; |
| 11463 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11464 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11465 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11466 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11467 | } |
| 11468 | return 0; |
| 11469 | } |
| 11470 | |
| 11471 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11472 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11473 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11474 | |
| 11475 | { |
| 11476 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11477 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11478 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11479 | */ |
| 11480 | /* .name = "Capture Source", */ |
| 11481 | .name = "Input Source", |
| 11482 | .count = 1, |
| 11483 | .info = alc_mux_enum_info, |
| 11484 | .get = alc_mux_enum_get, |
| 11485 | .put = alc_mux_enum_put, |
| 11486 | }, |
| 11487 | { } /* end */ |
| 11488 | }; |
| 11489 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11490 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11491 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11492 | int pin_type, int dac_idx) |
| 11493 | { |
| 11494 | /* set as output */ |
| 11495 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11496 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11497 | pin_type); |
| 11498 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11499 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11500 | |
| 11501 | } |
| 11502 | |
| 11503 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11504 | { |
| 11505 | struct alc_spec *spec = codec->spec; |
| 11506 | int i; |
| 11507 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11508 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11509 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11510 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11511 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11512 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11513 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11514 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11515 | } |
| 11516 | } |
| 11517 | |
| 11518 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11519 | { |
| 11520 | struct alc_spec *spec = codec->spec; |
| 11521 | hda_nid_t pin; |
| 11522 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11523 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11524 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11525 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11526 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11527 | } |
| 11528 | |
| 11529 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11530 | { |
| 11531 | struct alc_spec *spec = codec->spec; |
| 11532 | int i; |
| 11533 | |
| 11534 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11535 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11536 | if (nid >= 0x0c && nid <= 0x11) { |
| 11537 | snd_hda_codec_write(codec, nid, 0, |
| 11538 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11539 | i <= AUTO_PIN_FRONT_MIC ? |
| 11540 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11541 | } |
| 11542 | } |
| 11543 | } |
| 11544 | |
| 11545 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11546 | /* return 1 if successful, 0 if the proper config is not found, |
| 11547 | * or a negative error code |
| 11548 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11549 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11550 | { |
| 11551 | struct alc_spec *spec = codec->spec; |
| 11552 | int err; |
| 11553 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11554 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11555 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11556 | alc861_ignore); |
| 11557 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11558 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11559 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11560 | return 0; /* can't find valid BIOS pin config */ |
| 11561 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11562 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11563 | if (err < 0) |
| 11564 | return err; |
| 11565 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11566 | if (err < 0) |
| 11567 | return err; |
| 11568 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11569 | if (err < 0) |
| 11570 | return err; |
| 11571 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11572 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11573 | return err; |
| 11574 | |
| 11575 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11576 | |
| 11577 | if (spec->autocfg.dig_out_pin) |
| 11578 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 11579 | |
| 11580 | if (spec->kctl_alloc) |
| 11581 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11582 | |
| 11583 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 11584 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11585 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11586 | spec->input_mux = &spec->private_imux; |
| 11587 | |
| 11588 | spec->adc_nids = alc861_adc_nids; |
| 11589 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 11590 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 11591 | spec->num_mixers++; |
| 11592 | |
| 11593 | return 1; |
| 11594 | } |
| 11595 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11596 | /* additional initialization for auto-configuration model */ |
| 11597 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11598 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11599 | alc861_auto_init_multi_out(codec); |
| 11600 | alc861_auto_init_hp_out(codec); |
| 11601 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11602 | } |
| 11603 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11604 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11605 | static struct hda_amp_list alc861_loopbacks[] = { |
| 11606 | { 0x15, HDA_INPUT, 0 }, |
| 11607 | { 0x15, HDA_INPUT, 1 }, |
| 11608 | { 0x15, HDA_INPUT, 2 }, |
| 11609 | { 0x15, HDA_INPUT, 3 }, |
| 11610 | { } /* end */ |
| 11611 | }; |
| 11612 | #endif |
| 11613 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11614 | |
| 11615 | /* |
| 11616 | * configuration and preset |
| 11617 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11618 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 11619 | [ALC861_3ST] = "3stack", |
| 11620 | [ALC660_3ST] = "3stack-660", |
| 11621 | [ALC861_3ST_DIG] = "3stack-dig", |
| 11622 | [ALC861_6ST_DIG] = "6stack-dig", |
| 11623 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 11624 | [ALC861_TOSHIBA] = "toshiba", |
| 11625 | [ALC861_ASUS] = "asus", |
| 11626 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 11627 | [ALC861_AUTO] = "auto", |
| 11628 | }; |
| 11629 | |
| 11630 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 11631 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11632 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11633 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11634 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11635 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11636 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 11637 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 11638 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 11639 | * Any other models that need this preset? |
| 11640 | */ |
| 11641 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 11642 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 11643 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11644 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 11645 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 11646 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 11647 | /* FIXME: the below seems conflict */ |
| 11648 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 11649 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 11650 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11651 | {} |
| 11652 | }; |
| 11653 | |
| 11654 | static struct alc_config_preset alc861_presets[] = { |
| 11655 | [ALC861_3ST] = { |
| 11656 | .mixers = { alc861_3ST_mixer }, |
| 11657 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11658 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11659 | .dac_nids = alc861_dac_nids, |
| 11660 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11661 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11662 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11663 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11664 | .adc_nids = alc861_adc_nids, |
| 11665 | .input_mux = &alc861_capture_source, |
| 11666 | }, |
| 11667 | [ALC861_3ST_DIG] = { |
| 11668 | .mixers = { alc861_base_mixer }, |
| 11669 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11670 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11671 | .dac_nids = alc861_dac_nids, |
| 11672 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11673 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11674 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11675 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11676 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11677 | .adc_nids = alc861_adc_nids, |
| 11678 | .input_mux = &alc861_capture_source, |
| 11679 | }, |
| 11680 | [ALC861_6ST_DIG] = { |
| 11681 | .mixers = { alc861_base_mixer }, |
| 11682 | .init_verbs = { alc861_base_init_verbs }, |
| 11683 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11684 | .dac_nids = alc861_dac_nids, |
| 11685 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11686 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 11687 | .channel_mode = alc861_8ch_modes, |
| 11688 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11689 | .adc_nids = alc861_adc_nids, |
| 11690 | .input_mux = &alc861_capture_source, |
| 11691 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11692 | [ALC660_3ST] = { |
| 11693 | .mixers = { alc861_3ST_mixer }, |
| 11694 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11695 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 11696 | .dac_nids = alc660_dac_nids, |
| 11697 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11698 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11699 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11700 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11701 | .adc_nids = alc861_adc_nids, |
| 11702 | .input_mux = &alc861_capture_source, |
| 11703 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11704 | [ALC861_UNIWILL_M31] = { |
| 11705 | .mixers = { alc861_uniwill_m31_mixer }, |
| 11706 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 11707 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11708 | .dac_nids = alc861_dac_nids, |
| 11709 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11710 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11711 | .channel_mode = alc861_uniwill_m31_modes, |
| 11712 | .need_dac_fix = 1, |
| 11713 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11714 | .adc_nids = alc861_adc_nids, |
| 11715 | .input_mux = &alc861_capture_source, |
| 11716 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11717 | [ALC861_TOSHIBA] = { |
| 11718 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11719 | .init_verbs = { alc861_base_init_verbs, |
| 11720 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11721 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11722 | .dac_nids = alc861_dac_nids, |
| 11723 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11724 | .channel_mode = alc883_3ST_2ch_modes, |
| 11725 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11726 | .adc_nids = alc861_adc_nids, |
| 11727 | .input_mux = &alc861_capture_source, |
| 11728 | .unsol_event = alc861_toshiba_unsol_event, |
| 11729 | .init_hook = alc861_toshiba_automute, |
| 11730 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11731 | [ALC861_ASUS] = { |
| 11732 | .mixers = { alc861_asus_mixer }, |
| 11733 | .init_verbs = { alc861_asus_init_verbs }, |
| 11734 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11735 | .dac_nids = alc861_dac_nids, |
| 11736 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11737 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 11738 | .channel_mode = alc861_asus_modes, |
| 11739 | .need_dac_fix = 1, |
| 11740 | .hp_nid = 0x06, |
| 11741 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11742 | .adc_nids = alc861_adc_nids, |
| 11743 | .input_mux = &alc861_capture_source, |
| 11744 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11745 | [ALC861_ASUS_LAPTOP] = { |
| 11746 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 11747 | .init_verbs = { alc861_asus_init_verbs, |
| 11748 | alc861_asus_laptop_init_verbs }, |
| 11749 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11750 | .dac_nids = alc861_dac_nids, |
| 11751 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11752 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11753 | .channel_mode = alc883_3ST_2ch_modes, |
| 11754 | .need_dac_fix = 1, |
| 11755 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11756 | .adc_nids = alc861_adc_nids, |
| 11757 | .input_mux = &alc861_capture_source, |
| 11758 | }, |
| 11759 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11760 | |
| 11761 | |
| 11762 | static int patch_alc861(struct hda_codec *codec) |
| 11763 | { |
| 11764 | struct alc_spec *spec; |
| 11765 | int board_config; |
| 11766 | int err; |
| 11767 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11768 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11769 | if (spec == NULL) |
| 11770 | return -ENOMEM; |
| 11771 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11772 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11773 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11774 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 11775 | alc861_models, |
| 11776 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11777 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11778 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11779 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 11780 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11781 | board_config = ALC861_AUTO; |
| 11782 | } |
| 11783 | |
| 11784 | if (board_config == ALC861_AUTO) { |
| 11785 | /* automatic parse from the BIOS config */ |
| 11786 | err = alc861_parse_auto_config(codec); |
| 11787 | if (err < 0) { |
| 11788 | alc_free(codec); |
| 11789 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11790 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11791 | printk(KERN_INFO |
| 11792 | "hda_codec: Cannot set up configuration " |
| 11793 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11794 | board_config = ALC861_3ST_DIG; |
| 11795 | } |
| 11796 | } |
| 11797 | |
| 11798 | if (board_config != ALC861_AUTO) |
| 11799 | setup_preset(spec, &alc861_presets[board_config]); |
| 11800 | |
| 11801 | spec->stream_name_analog = "ALC861 Analog"; |
| 11802 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 11803 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 11804 | |
| 11805 | spec->stream_name_digital = "ALC861 Digital"; |
| 11806 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 11807 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 11808 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11809 | spec->vmaster_nid = 0x03; |
| 11810 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11811 | codec->patch_ops = alc_patch_ops; |
| 11812 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11813 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11814 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11815 | if (!spec->loopback.amplist) |
| 11816 | spec->loopback.amplist = alc861_loopbacks; |
| 11817 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11818 | |
| 11819 | return 0; |
| 11820 | } |
| 11821 | |
| 11822 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11823 | * ALC861-VD support |
| 11824 | * |
| 11825 | * Based on ALC882 |
| 11826 | * |
| 11827 | * In addition, an independent DAC |
| 11828 | */ |
| 11829 | #define ALC861VD_DIGOUT_NID 0x06 |
| 11830 | |
| 11831 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 11832 | /* front, surr, clfe, side surr */ |
| 11833 | 0x02, 0x03, 0x04, 0x05 |
| 11834 | }; |
| 11835 | |
| 11836 | /* dac_nids for ALC660vd are in a different order - according to |
| 11837 | * Realtek's driver. |
| 11838 | * This should probably tesult in a different mixer for 6stack models |
| 11839 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 11840 | * - and it is the same as in 861vd. |
| 11841 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 11842 | */ |
| 11843 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 11844 | /* front, rear, clfe, rear_surr */ |
| 11845 | 0x02, 0x04, 0x03 |
| 11846 | }; |
| 11847 | |
| 11848 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 11849 | /* ADC0 */ |
| 11850 | 0x09, |
| 11851 | }; |
| 11852 | |
| 11853 | /* input MUX */ |
| 11854 | /* FIXME: should be a matrix-type input source selection */ |
| 11855 | static struct hda_input_mux alc861vd_capture_source = { |
| 11856 | .num_items = 4, |
| 11857 | .items = { |
| 11858 | { "Mic", 0x0 }, |
| 11859 | { "Front Mic", 0x1 }, |
| 11860 | { "Line", 0x2 }, |
| 11861 | { "CD", 0x4 }, |
| 11862 | }, |
| 11863 | }; |
| 11864 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11865 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 11866 | .num_items = 3, |
| 11867 | .items = { |
| 11868 | { "Front Mic", 0x0 }, |
| 11869 | { "ATAPI Mic", 0x1 }, |
| 11870 | { "Line In", 0x5 }, |
| 11871 | }, |
| 11872 | }; |
| 11873 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11874 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 11875 | .num_items = 2, |
| 11876 | .items = { |
| 11877 | { "Front Mic", 0x0 }, |
| 11878 | { "ATAPI Mic", 0x1 }, |
| 11879 | }, |
| 11880 | }; |
| 11881 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11882 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 11883 | #define alc861vd_mux_enum_get alc_mux_enum_get |
| 11884 | |
| 11885 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11886 | struct snd_ctl_elem_value *ucontrol) |
| 11887 | { |
| 11888 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11889 | struct alc_spec *spec = codec->spec; |
| 11890 | const struct hda_input_mux *imux = spec->input_mux; |
| 11891 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 11892 | static hda_nid_t capture_mixers[1] = { 0x22 }; |
| 11893 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 11894 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 11895 | unsigned int i, idx; |
| 11896 | |
| 11897 | idx = ucontrol->value.enumerated.item[0]; |
| 11898 | if (idx >= imux->num_items) |
| 11899 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11900 | if (*cur_val == idx) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11901 | return 0; |
| 11902 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11903 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 11904 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 11905 | imux->items[i].index, |
| 11906 | HDA_AMP_MUTE, v); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11907 | } |
| 11908 | *cur_val = idx; |
| 11909 | return 1; |
| 11910 | } |
| 11911 | |
| 11912 | /* |
| 11913 | * 2ch mode |
| 11914 | */ |
| 11915 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 11916 | { 2, NULL } |
| 11917 | }; |
| 11918 | |
| 11919 | /* |
| 11920 | * 6ch mode |
| 11921 | */ |
| 11922 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 11923 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11924 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11925 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11926 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11927 | { } /* end */ |
| 11928 | }; |
| 11929 | |
| 11930 | /* |
| 11931 | * 8ch mode |
| 11932 | */ |
| 11933 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 11934 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11935 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11936 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11937 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11938 | { } /* end */ |
| 11939 | }; |
| 11940 | |
| 11941 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 11942 | { 6, alc861vd_6stack_ch6_init }, |
| 11943 | { 8, alc861vd_6stack_ch8_init }, |
| 11944 | }; |
| 11945 | |
| 11946 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 11947 | { |
| 11948 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11949 | .name = "Channel Mode", |
| 11950 | .info = alc_ch_mode_info, |
| 11951 | .get = alc_ch_mode_get, |
| 11952 | .put = alc_ch_mode_put, |
| 11953 | }, |
| 11954 | { } /* end */ |
| 11955 | }; |
| 11956 | |
| 11957 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 11958 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11959 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11960 | |
| 11961 | { |
| 11962 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11963 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11964 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11965 | */ |
| 11966 | /* .name = "Capture Source", */ |
| 11967 | .name = "Input Source", |
| 11968 | .count = 1, |
| 11969 | .info = alc861vd_mux_enum_info, |
| 11970 | .get = alc861vd_mux_enum_get, |
| 11971 | .put = alc861vd_mux_enum_put, |
| 11972 | }, |
| 11973 | { } /* end */ |
| 11974 | }; |
| 11975 | |
| 11976 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 11977 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 11978 | */ |
| 11979 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 11980 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11981 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11982 | |
| 11983 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11984 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11985 | |
| 11986 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 11987 | HDA_OUTPUT), |
| 11988 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 11989 | HDA_OUTPUT), |
| 11990 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11991 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 11992 | |
| 11993 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 11994 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11995 | |
| 11996 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11997 | |
| 11998 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11999 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12000 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12001 | |
| 12002 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12003 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12004 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12005 | |
| 12006 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12007 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12008 | |
| 12009 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12010 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12011 | |
| 12012 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12013 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12014 | |
| 12015 | { } /* end */ |
| 12016 | }; |
| 12017 | |
| 12018 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 12019 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12020 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12021 | |
| 12022 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12023 | |
| 12024 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12025 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12026 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12027 | |
| 12028 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12029 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12030 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12031 | |
| 12032 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12033 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12034 | |
| 12035 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12036 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12037 | |
| 12038 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12039 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12040 | |
| 12041 | { } /* end */ |
| 12042 | }; |
| 12043 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12044 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 12045 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12046 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 12047 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12048 | |
| 12049 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12050 | |
| 12051 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12052 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12053 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12054 | |
| 12055 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12056 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12057 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12058 | |
| 12059 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12060 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12061 | |
| 12062 | { } /* end */ |
| 12063 | }; |
| 12064 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12065 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 12066 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 12067 | */ |
| 12068 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 12069 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12070 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12071 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12072 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12073 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12074 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12075 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12076 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12077 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12078 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12079 | { } /* end */ |
| 12080 | }; |
| 12081 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12082 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12083 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12084 | */ |
| 12085 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12087 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12088 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12089 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12090 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12091 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12092 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12093 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12094 | |
| 12095 | { } /* end */ |
| 12096 | }; |
| 12097 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12098 | /* |
| 12099 | * generic initialization of ADC, input mixers and output mixers |
| 12100 | */ |
| 12101 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12102 | /* |
| 12103 | * Unmute ADC0 and set the default input to mic-in |
| 12104 | */ |
| 12105 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12106 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12107 | |
| 12108 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12109 | * the analog-loopback mixer widget |
| 12110 | */ |
| 12111 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12117 | |
| 12118 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12119 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12120 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12121 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12122 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12123 | |
| 12124 | /* |
| 12125 | * Set up output mixers (0x02 - 0x05) |
| 12126 | */ |
| 12127 | /* set vol=0 to output mixers */ |
| 12128 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12129 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12130 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12131 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12132 | |
| 12133 | /* set up input amps for analog loopback */ |
| 12134 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12135 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12136 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12137 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12138 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12139 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12140 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12141 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12142 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12143 | |
| 12144 | { } |
| 12145 | }; |
| 12146 | |
| 12147 | /* |
| 12148 | * 3-stack pin configuration: |
| 12149 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 12150 | */ |
| 12151 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 12152 | /* |
| 12153 | * Set pin mode and muting |
| 12154 | */ |
| 12155 | /* set front pin widgets 0x14 for output */ |
| 12156 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12157 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12158 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12159 | |
| 12160 | /* Mic (rear) pin: input vref at 80% */ |
| 12161 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12162 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12163 | /* Front Mic pin: input vref at 80% */ |
| 12164 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12165 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12166 | /* Line In pin: input */ |
| 12167 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12168 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12169 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12170 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12171 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12172 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12173 | /* CD pin widget for input */ |
| 12174 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12175 | |
| 12176 | { } |
| 12177 | }; |
| 12178 | |
| 12179 | /* |
| 12180 | * 6-stack pin configuration: |
| 12181 | */ |
| 12182 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 12183 | /* |
| 12184 | * Set pin mode and muting |
| 12185 | */ |
| 12186 | /* set front pin widgets 0x14 for output */ |
| 12187 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12188 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12189 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12190 | |
| 12191 | /* Rear Pin: output 1 (0x0d) */ |
| 12192 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12193 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12194 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12195 | /* CLFE Pin: output 2 (0x0e) */ |
| 12196 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12197 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12198 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 12199 | /* Side Pin: output 3 (0x0f) */ |
| 12200 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12201 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12202 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 12203 | |
| 12204 | /* Mic (rear) pin: input vref at 80% */ |
| 12205 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12206 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12207 | /* Front Mic pin: input vref at 80% */ |
| 12208 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12209 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12210 | /* Line In pin: input */ |
| 12211 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12212 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12213 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12214 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12215 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12216 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12217 | /* CD pin widget for input */ |
| 12218 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12219 | |
| 12220 | { } |
| 12221 | }; |
| 12222 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12223 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 12224 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12225 | { } |
| 12226 | }; |
| 12227 | |
| 12228 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 12229 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12231 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12232 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12233 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12234 | {} |
| 12235 | }; |
| 12236 | |
| 12237 | /* toggle speaker-output according to the hp-jack state */ |
| 12238 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 12239 | { |
| 12240 | unsigned int present; |
| 12241 | unsigned char bits; |
| 12242 | |
| 12243 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12244 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12245 | bits = present ? HDA_AMP_MUTE : 0; |
| 12246 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12247 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12248 | } |
| 12249 | |
| 12250 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 12251 | { |
| 12252 | unsigned int present; |
| 12253 | unsigned char bits; |
| 12254 | |
| 12255 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12256 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12257 | bits = present ? HDA_AMP_MUTE : 0; |
| 12258 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 12259 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12260 | } |
| 12261 | |
| 12262 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 12263 | { |
| 12264 | alc861vd_lenovo_hp_automute(codec); |
| 12265 | alc861vd_lenovo_mic_automute(codec); |
| 12266 | } |
| 12267 | |
| 12268 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12269 | unsigned int res) |
| 12270 | { |
| 12271 | switch (res >> 26) { |
| 12272 | case ALC880_HP_EVENT: |
| 12273 | alc861vd_lenovo_hp_automute(codec); |
| 12274 | break; |
| 12275 | case ALC880_MIC_EVENT: |
| 12276 | alc861vd_lenovo_mic_automute(codec); |
| 12277 | break; |
| 12278 | } |
| 12279 | } |
| 12280 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12281 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12282 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12283 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12284 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12285 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12286 | |
| 12287 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12288 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12289 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12290 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12291 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12292 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12293 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12294 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12295 | |
| 12296 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12297 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12298 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12299 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12300 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12301 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12302 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12303 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12304 | |
| 12305 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12306 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12307 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12308 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12309 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12310 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12311 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12312 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12313 | |
| 12314 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12315 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12316 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12317 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12318 | |
| 12319 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12320 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12321 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12322 | |
| 12323 | { } /* end */ |
| 12324 | }; |
| 12325 | |
| 12326 | /* toggle speaker-output according to the hp-jack state */ |
| 12327 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12328 | { |
| 12329 | unsigned int present; |
| 12330 | |
| 12331 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12332 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12333 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12334 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12335 | } |
| 12336 | |
| 12337 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12338 | { |
| 12339 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12340 | alc861vd_dallas_automute(codec); |
| 12341 | } |
| 12342 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12343 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12344 | #define alc861vd_loopbacks alc880_loopbacks |
| 12345 | #endif |
| 12346 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12347 | /* pcm configuration: identiacal with ALC880 */ |
| 12348 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12349 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12350 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12351 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12352 | |
| 12353 | /* |
| 12354 | * configuration and preset |
| 12355 | */ |
| 12356 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12357 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12358 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12359 | [ALC861VD_3ST] = "3stack", |
| 12360 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12361 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12362 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12363 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12364 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12365 | [ALC861VD_AUTO] = "auto", |
| 12366 | }; |
| 12367 | |
| 12368 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12369 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12370 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12371 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12372 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12373 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12374 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12375 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 12376 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12377 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 12378 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 12379 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12380 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12381 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12382 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12383 | {} |
| 12384 | }; |
| 12385 | |
| 12386 | static struct alc_config_preset alc861vd_presets[] = { |
| 12387 | [ALC660VD_3ST] = { |
| 12388 | .mixers = { alc861vd_3st_mixer }, |
| 12389 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12390 | alc861vd_3stack_init_verbs }, |
| 12391 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12392 | .dac_nids = alc660vd_dac_nids, |
| 12393 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12394 | .adc_nids = alc861vd_adc_nids, |
| 12395 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12396 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12397 | .input_mux = &alc861vd_capture_source, |
| 12398 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12399 | [ALC660VD_3ST_DIG] = { |
| 12400 | .mixers = { alc861vd_3st_mixer }, |
| 12401 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12402 | alc861vd_3stack_init_verbs }, |
| 12403 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12404 | .dac_nids = alc660vd_dac_nids, |
| 12405 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12406 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12407 | .adc_nids = alc861vd_adc_nids, |
| 12408 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12409 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12410 | .input_mux = &alc861vd_capture_source, |
| 12411 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12412 | [ALC861VD_3ST] = { |
| 12413 | .mixers = { alc861vd_3st_mixer }, |
| 12414 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12415 | alc861vd_3stack_init_verbs }, |
| 12416 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12417 | .dac_nids = alc861vd_dac_nids, |
| 12418 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12419 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12420 | .input_mux = &alc861vd_capture_source, |
| 12421 | }, |
| 12422 | [ALC861VD_3ST_DIG] = { |
| 12423 | .mixers = { alc861vd_3st_mixer }, |
| 12424 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12425 | alc861vd_3stack_init_verbs }, |
| 12426 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12427 | .dac_nids = alc861vd_dac_nids, |
| 12428 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12429 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12430 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12431 | .input_mux = &alc861vd_capture_source, |
| 12432 | }, |
| 12433 | [ALC861VD_6ST_DIG] = { |
| 12434 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12435 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12436 | alc861vd_6stack_init_verbs }, |
| 12437 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12438 | .dac_nids = alc861vd_dac_nids, |
| 12439 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12440 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12441 | .channel_mode = alc861vd_6stack_modes, |
| 12442 | .input_mux = &alc861vd_capture_source, |
| 12443 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12444 | [ALC861VD_LENOVO] = { |
| 12445 | .mixers = { alc861vd_lenovo_mixer }, |
| 12446 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12447 | alc861vd_3stack_init_verbs, |
| 12448 | alc861vd_eapd_verbs, |
| 12449 | alc861vd_lenovo_unsol_verbs }, |
| 12450 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12451 | .dac_nids = alc660vd_dac_nids, |
| 12452 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12453 | .adc_nids = alc861vd_adc_nids, |
| 12454 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12455 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12456 | .input_mux = &alc861vd_capture_source, |
| 12457 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12458 | .init_hook = alc861vd_lenovo_automute, |
| 12459 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12460 | [ALC861VD_DALLAS] = { |
| 12461 | .mixers = { alc861vd_dallas_mixer }, |
| 12462 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12463 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12464 | .dac_nids = alc861vd_dac_nids, |
| 12465 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12466 | .adc_nids = alc861vd_adc_nids, |
| 12467 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12468 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12469 | .input_mux = &alc861vd_dallas_capture_source, |
| 12470 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12471 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12472 | }, |
| 12473 | [ALC861VD_HP] = { |
| 12474 | .mixers = { alc861vd_hp_mixer }, |
| 12475 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12476 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12477 | .dac_nids = alc861vd_dac_nids, |
| 12478 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12479 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12480 | .adc_nids = alc861vd_adc_nids, |
| 12481 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12482 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12483 | .input_mux = &alc861vd_hp_capture_source, |
| 12484 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12485 | .init_hook = alc861vd_dallas_automute, |
| 12486 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12487 | }; |
| 12488 | |
| 12489 | /* |
| 12490 | * BIOS auto configuration |
| 12491 | */ |
| 12492 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12493 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12494 | { |
| 12495 | /* set as output */ |
| 12496 | snd_hda_codec_write(codec, nid, 0, |
| 12497 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 12498 | snd_hda_codec_write(codec, nid, 0, |
| 12499 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 12500 | } |
| 12501 | |
| 12502 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12503 | { |
| 12504 | struct alc_spec *spec = codec->spec; |
| 12505 | int i; |
| 12506 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12507 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12508 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12509 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12510 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12511 | if (nid) |
| 12512 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12513 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12514 | } |
| 12515 | } |
| 12516 | |
| 12517 | |
| 12518 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12519 | { |
| 12520 | struct alc_spec *spec = codec->spec; |
| 12521 | hda_nid_t pin; |
| 12522 | |
| 12523 | pin = spec->autocfg.hp_pins[0]; |
| 12524 | if (pin) /* connect to front and use dac 0 */ |
| 12525 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 12526 | } |
| 12527 | |
| 12528 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12529 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12530 | |
| 12531 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12532 | { |
| 12533 | struct alc_spec *spec = codec->spec; |
| 12534 | int i; |
| 12535 | |
| 12536 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12537 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12538 | if (alc861vd_is_input_pin(nid)) { |
| 12539 | snd_hda_codec_write(codec, nid, 0, |
| 12540 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12541 | i <= AUTO_PIN_FRONT_MIC ? |
| 12542 | PIN_VREF80 : PIN_IN); |
| 12543 | if (nid != ALC861VD_PIN_CD_NID) |
| 12544 | snd_hda_codec_write(codec, nid, 0, |
| 12545 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12546 | AMP_OUT_MUTE); |
| 12547 | } |
| 12548 | } |
| 12549 | } |
| 12550 | |
| 12551 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12552 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12553 | |
| 12554 | /* add playback controls from the parsed DAC table */ |
| 12555 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12556 | * different NIDs for mute/unmute switch and volume control */ |
| 12557 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12558 | const struct auto_pin_cfg *cfg) |
| 12559 | { |
| 12560 | char name[32]; |
| 12561 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12562 | hda_nid_t nid_v, nid_s; |
| 12563 | int i, err; |
| 12564 | |
| 12565 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12566 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12567 | continue; |
| 12568 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12569 | alc880_dac_to_idx( |
| 12570 | spec->multiout.dac_nids[i])); |
| 12571 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12572 | alc880_dac_to_idx( |
| 12573 | spec->multiout.dac_nids[i])); |
| 12574 | |
| 12575 | if (i == 2) { |
| 12576 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12577 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12578 | "Center Playback Volume", |
| 12579 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12580 | HDA_OUTPUT)); |
| 12581 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12582 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12583 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12584 | "LFE Playback Volume", |
| 12585 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12586 | HDA_OUTPUT)); |
| 12587 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12588 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12589 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12590 | "Center Playback Switch", |
| 12591 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12592 | HDA_INPUT)); |
| 12593 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12594 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12595 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12596 | "LFE Playback Switch", |
| 12597 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12598 | HDA_INPUT)); |
| 12599 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12600 | return err; |
| 12601 | } else { |
| 12602 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12603 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12604 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 12605 | HDA_OUTPUT)); |
| 12606 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12607 | return err; |
| 12608 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12609 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12610 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12611 | HDA_INPUT)); |
| 12612 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12613 | return err; |
| 12614 | } |
| 12615 | } |
| 12616 | return 0; |
| 12617 | } |
| 12618 | |
| 12619 | /* add playback controls for speaker and HP outputs */ |
| 12620 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12621 | * different NIDs for mute/unmute switch and volume control */ |
| 12622 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 12623 | hda_nid_t pin, const char *pfx) |
| 12624 | { |
| 12625 | hda_nid_t nid_v, nid_s; |
| 12626 | int err; |
| 12627 | char name[32]; |
| 12628 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12629 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12630 | return 0; |
| 12631 | |
| 12632 | if (alc880_is_fixed_pin(pin)) { |
| 12633 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 12634 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12635 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12636 | spec->multiout.hp_nid = nid_v; |
| 12637 | else |
| 12638 | spec->multiout.extra_out_nid[0] = nid_v; |
| 12639 | /* control HP volume/switch on the output mixer amp */ |
| 12640 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12641 | alc880_fixed_pin_idx(pin)); |
| 12642 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12643 | alc880_fixed_pin_idx(pin)); |
| 12644 | |
| 12645 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12646 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12647 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 12648 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12649 | return err; |
| 12650 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12651 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12652 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 12653 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12654 | return err; |
| 12655 | } else if (alc880_is_multi_pin(pin)) { |
| 12656 | /* set manual connection */ |
| 12657 | /* we have only a switch on HP-out PIN */ |
| 12658 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12659 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12660 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 12661 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12662 | return err; |
| 12663 | } |
| 12664 | return 0; |
| 12665 | } |
| 12666 | |
| 12667 | /* parse the BIOS configuration and set up the alc_spec |
| 12668 | * return 1 if successful, 0 if the proper config is not found, |
| 12669 | * or a negative error code |
| 12670 | * Based on ALC880 version - had to change it to override |
| 12671 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 12672 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 12673 | { |
| 12674 | struct alc_spec *spec = codec->spec; |
| 12675 | int err; |
| 12676 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 12677 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12678 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12679 | alc861vd_ignore); |
| 12680 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12681 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12682 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12683 | return 0; /* can't find valid BIOS pin config */ |
| 12684 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12685 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12686 | if (err < 0) |
| 12687 | return err; |
| 12688 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12689 | if (err < 0) |
| 12690 | return err; |
| 12691 | err = alc861vd_auto_create_extra_out(spec, |
| 12692 | spec->autocfg.speaker_pins[0], |
| 12693 | "Speaker"); |
| 12694 | if (err < 0) |
| 12695 | return err; |
| 12696 | err = alc861vd_auto_create_extra_out(spec, |
| 12697 | spec->autocfg.hp_pins[0], |
| 12698 | "Headphone"); |
| 12699 | if (err < 0) |
| 12700 | return err; |
| 12701 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12702 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12703 | return err; |
| 12704 | |
| 12705 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12706 | |
| 12707 | if (spec->autocfg.dig_out_pin) |
| 12708 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 12709 | |
| 12710 | if (spec->kctl_alloc) |
| 12711 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12712 | |
| 12713 | spec->init_verbs[spec->num_init_verbs++] |
| 12714 | = alc861vd_volume_init_verbs; |
| 12715 | |
| 12716 | spec->num_mux_defs = 1; |
| 12717 | spec->input_mux = &spec->private_imux; |
| 12718 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12719 | err = alc_auto_add_mic_boost(codec); |
| 12720 | if (err < 0) |
| 12721 | return err; |
| 12722 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12723 | return 1; |
| 12724 | } |
| 12725 | |
| 12726 | /* additional initialization for auto-configuration model */ |
| 12727 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 12728 | { |
| 12729 | alc861vd_auto_init_multi_out(codec); |
| 12730 | alc861vd_auto_init_hp_out(codec); |
| 12731 | alc861vd_auto_init_analog_input(codec); |
| 12732 | } |
| 12733 | |
| 12734 | static int patch_alc861vd(struct hda_codec *codec) |
| 12735 | { |
| 12736 | struct alc_spec *spec; |
| 12737 | int err, board_config; |
| 12738 | |
| 12739 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12740 | if (spec == NULL) |
| 12741 | return -ENOMEM; |
| 12742 | |
| 12743 | codec->spec = spec; |
| 12744 | |
| 12745 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 12746 | alc861vd_models, |
| 12747 | alc861vd_cfg_tbl); |
| 12748 | |
| 12749 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 12750 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 12751 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 12752 | board_config = ALC861VD_AUTO; |
| 12753 | } |
| 12754 | |
| 12755 | if (board_config == ALC861VD_AUTO) { |
| 12756 | /* automatic parse from the BIOS config */ |
| 12757 | err = alc861vd_parse_auto_config(codec); |
| 12758 | if (err < 0) { |
| 12759 | alc_free(codec); |
| 12760 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12761 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12762 | printk(KERN_INFO |
| 12763 | "hda_codec: Cannot set up configuration " |
| 12764 | "from BIOS. Using base mode...\n"); |
| 12765 | board_config = ALC861VD_3ST; |
| 12766 | } |
| 12767 | } |
| 12768 | |
| 12769 | if (board_config != ALC861VD_AUTO) |
| 12770 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 12771 | |
| 12772 | spec->stream_name_analog = "ALC861VD Analog"; |
| 12773 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 12774 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 12775 | |
| 12776 | spec->stream_name_digital = "ALC861VD Digital"; |
| 12777 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 12778 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 12779 | |
| 12780 | spec->adc_nids = alc861vd_adc_nids; |
| 12781 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 12782 | |
| 12783 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 12784 | spec->num_mixers++; |
| 12785 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12786 | spec->vmaster_nid = 0x02; |
| 12787 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12788 | codec->patch_ops = alc_patch_ops; |
| 12789 | |
| 12790 | if (board_config == ALC861VD_AUTO) |
| 12791 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12792 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12793 | if (!spec->loopback.amplist) |
| 12794 | spec->loopback.amplist = alc861vd_loopbacks; |
| 12795 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12796 | |
| 12797 | return 0; |
| 12798 | } |
| 12799 | |
| 12800 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12801 | * ALC662 support |
| 12802 | * |
| 12803 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 12804 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 12805 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 12806 | * 6-channel independent captures. |
| 12807 | * |
| 12808 | * In addition, an independent DAC for the multi-playback (not used in this |
| 12809 | * driver yet). |
| 12810 | */ |
| 12811 | #define ALC662_DIGOUT_NID 0x06 |
| 12812 | #define ALC662_DIGIN_NID 0x0a |
| 12813 | |
| 12814 | static hda_nid_t alc662_dac_nids[4] = { |
| 12815 | /* front, rear, clfe, rear_surr */ |
| 12816 | 0x02, 0x03, 0x04 |
| 12817 | }; |
| 12818 | |
| 12819 | static hda_nid_t alc662_adc_nids[1] = { |
| 12820 | /* ADC1-2 */ |
| 12821 | 0x09, |
| 12822 | }; |
| 12823 | /* input MUX */ |
| 12824 | /* FIXME: should be a matrix-type input source selection */ |
| 12825 | |
| 12826 | static struct hda_input_mux alc662_capture_source = { |
| 12827 | .num_items = 4, |
| 12828 | .items = { |
| 12829 | { "Mic", 0x0 }, |
| 12830 | { "Front Mic", 0x1 }, |
| 12831 | { "Line", 0x2 }, |
| 12832 | { "CD", 0x4 }, |
| 12833 | }, |
| 12834 | }; |
| 12835 | |
| 12836 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 12837 | .num_items = 2, |
| 12838 | .items = { |
| 12839 | { "Mic", 0x1 }, |
| 12840 | { "Line", 0x2 }, |
| 12841 | }, |
| 12842 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12843 | |
| 12844 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 12845 | .num_items = 2, |
| 12846 | .items = { |
| 12847 | { "i-Mic", 0x1 }, |
| 12848 | { "e-Mic", 0x0 }, |
| 12849 | }, |
| 12850 | }; |
| 12851 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12852 | #define alc662_mux_enum_info alc_mux_enum_info |
| 12853 | #define alc662_mux_enum_get alc_mux_enum_get |
| 12854 | |
| 12855 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12856 | struct snd_ctl_elem_value *ucontrol) |
| 12857 | { |
| 12858 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12859 | struct alc_spec *spec = codec->spec; |
| 12860 | const struct hda_input_mux *imux = spec->input_mux; |
| 12861 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12862 | static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12863 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 12864 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 12865 | unsigned int i, idx; |
| 12866 | |
| 12867 | idx = ucontrol->value.enumerated.item[0]; |
| 12868 | if (idx >= imux->num_items) |
| 12869 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 12870 | if (*cur_val == idx) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12871 | return 0; |
| 12872 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12873 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 12874 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 12875 | imux->items[i].index, |
| 12876 | HDA_AMP_MUTE, v); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12877 | } |
| 12878 | *cur_val = idx; |
| 12879 | return 1; |
| 12880 | } |
| 12881 | /* |
| 12882 | * 2ch mode |
| 12883 | */ |
| 12884 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 12885 | { 2, NULL } |
| 12886 | }; |
| 12887 | |
| 12888 | /* |
| 12889 | * 2ch mode |
| 12890 | */ |
| 12891 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 12892 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 12893 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12894 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 12895 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12896 | { } /* end */ |
| 12897 | }; |
| 12898 | |
| 12899 | /* |
| 12900 | * 6ch mode |
| 12901 | */ |
| 12902 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 12903 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12904 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12905 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 12906 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12907 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12908 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12909 | { } /* end */ |
| 12910 | }; |
| 12911 | |
| 12912 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 12913 | { 2, alc662_3ST_ch2_init }, |
| 12914 | { 6, alc662_3ST_ch6_init }, |
| 12915 | }; |
| 12916 | |
| 12917 | /* |
| 12918 | * 2ch mode |
| 12919 | */ |
| 12920 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 12921 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12922 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12923 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12924 | { } /* end */ |
| 12925 | }; |
| 12926 | |
| 12927 | /* |
| 12928 | * 6ch mode |
| 12929 | */ |
| 12930 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 12931 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12932 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12933 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12934 | { } /* end */ |
| 12935 | }; |
| 12936 | |
| 12937 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 12938 | { 2, alc662_sixstack_ch6_init }, |
| 12939 | { 6, alc662_sixstack_ch8_init }, |
| 12940 | }; |
| 12941 | |
| 12942 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12943 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12944 | */ |
| 12945 | |
| 12946 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 12947 | /* output mixer control */ |
| 12948 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12949 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 12950 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12951 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12952 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12953 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12954 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12955 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12956 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12957 | |
| 12958 | /*Input mixer control */ |
| 12959 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 12960 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 12961 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 12962 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 12963 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 12964 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 12965 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 12966 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12967 | { } /* end */ |
| 12968 | }; |
| 12969 | |
| 12970 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 12971 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12972 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12973 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12974 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12975 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12976 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12977 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12978 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12979 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12980 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12981 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12982 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12983 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12984 | { } /* end */ |
| 12985 | }; |
| 12986 | |
| 12987 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 12988 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12989 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12990 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12991 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12992 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12993 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12994 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12995 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12996 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12997 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12998 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12999 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13000 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13001 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13003 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13004 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13005 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13006 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13007 | { } /* end */ |
| 13008 | }; |
| 13009 | |
| 13010 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 13011 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13012 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13013 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13014 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13015 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13016 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13017 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13018 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13019 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13020 | { } /* end */ |
| 13021 | }; |
| 13022 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13023 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13024 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13025 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 13026 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13027 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13028 | |
| 13029 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 13030 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13031 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13032 | |
| 13033 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 13034 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13035 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13036 | { } /* end */ |
| 13037 | }; |
| 13038 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13039 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 13040 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13041 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13042 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13043 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 13044 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13045 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13046 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13047 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13048 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13049 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13050 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13051 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13052 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13053 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13054 | { } /* end */ |
| 13055 | }; |
| 13056 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13057 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 13058 | { |
| 13059 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13060 | .name = "Channel Mode", |
| 13061 | .info = alc_ch_mode_info, |
| 13062 | .get = alc_ch_mode_get, |
| 13063 | .put = alc_ch_mode_put, |
| 13064 | }, |
| 13065 | { } /* end */ |
| 13066 | }; |
| 13067 | |
| 13068 | static struct hda_verb alc662_init_verbs[] = { |
| 13069 | /* ADC: mute amp left and right */ |
| 13070 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13071 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13072 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 13073 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13074 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13075 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13076 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13077 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13078 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13079 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13080 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13081 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13082 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13083 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13084 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13085 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13086 | |
| 13087 | /* Front Pin: output 0 (0x0c) */ |
| 13088 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13089 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13090 | |
| 13091 | /* Rear Pin: output 1 (0x0d) */ |
| 13092 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13093 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13094 | |
| 13095 | /* CLFE Pin: output 2 (0x0e) */ |
| 13096 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13097 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13098 | |
| 13099 | /* Mic (rear) pin: input vref at 80% */ |
| 13100 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13101 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13102 | /* Front Mic pin: input vref at 80% */ |
| 13103 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13104 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13105 | /* Line In pin: input */ |
| 13106 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13107 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13108 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13109 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13110 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13111 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13112 | /* CD pin widget for input */ |
| 13113 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13114 | |
| 13115 | /* FIXME: use matrix-type input source selection */ |
| 13116 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13117 | /* Input mixer */ |
| 13118 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13119 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13120 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13121 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13122 | |
| 13123 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13124 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13125 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13126 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13127 | { } |
| 13128 | }; |
| 13129 | |
| 13130 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 13131 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13132 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13133 | {} |
| 13134 | }; |
| 13135 | |
| 13136 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 13137 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13138 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13139 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13140 | }; |
| 13141 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13142 | /* Set Unsolicited Event*/ |
| 13143 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 13144 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13145 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13146 | {} |
| 13147 | }; |
| 13148 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13149 | /* |
| 13150 | * generic initialization of ADC, input mixers and output mixers |
| 13151 | */ |
| 13152 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 13153 | /* |
| 13154 | * Unmute ADC and set the default input to mic-in |
| 13155 | */ |
| 13156 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13157 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13158 | |
| 13159 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 13160 | * mixer widget |
| 13161 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 13162 | * panel mic (mic 2) |
| 13163 | */ |
| 13164 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13165 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13166 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13167 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13168 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13169 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13170 | |
| 13171 | /* |
| 13172 | * Set up output mixers (0x0c - 0x0f) |
| 13173 | */ |
| 13174 | /* set vol=0 to output mixers */ |
| 13175 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13176 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13177 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13178 | |
| 13179 | /* set up input amps for analog loopback */ |
| 13180 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13181 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13182 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13183 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13184 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13185 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13186 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13187 | |
| 13188 | |
| 13189 | /* FIXME: use matrix-type input source selection */ |
| 13190 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13191 | /* Input mixer */ |
| 13192 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13193 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13194 | { } |
| 13195 | }; |
| 13196 | |
| 13197 | /* capture mixer elements */ |
| 13198 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 13199 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13200 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13201 | { |
| 13202 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13203 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13204 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13205 | */ |
| 13206 | /* .name = "Capture Source", */ |
| 13207 | .name = "Input Source", |
| 13208 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 13209 | .info = alc662_mux_enum_info, |
| 13210 | .get = alc662_mux_enum_get, |
| 13211 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13212 | }, |
| 13213 | { } /* end */ |
| 13214 | }; |
| 13215 | |
| 13216 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 13217 | { |
| 13218 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13219 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13220 | |
| 13221 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13222 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13223 | bits = present ? HDA_AMP_MUTE : 0; |
| 13224 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13225 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13226 | } |
| 13227 | |
| 13228 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 13229 | { |
| 13230 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13231 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13232 | |
| 13233 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13234 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13235 | bits = present ? HDA_AMP_MUTE : 0; |
| 13236 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13237 | HDA_AMP_MUTE, bits); |
| 13238 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13239 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13240 | } |
| 13241 | |
| 13242 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 13243 | unsigned int res) |
| 13244 | { |
| 13245 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13246 | alc662_lenovo_101e_all_automute(codec); |
| 13247 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 13248 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 13249 | } |
| 13250 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13251 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 13252 | { |
| 13253 | unsigned int present; |
| 13254 | |
| 13255 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13256 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13257 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13258 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13259 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13260 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13261 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13262 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13263 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13264 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13265 | } |
| 13266 | |
| 13267 | /* unsolicited event for HP jack sensing */ |
| 13268 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13269 | unsigned int res) |
| 13270 | { |
| 13271 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13272 | alc262_hippo1_automute( codec ); |
| 13273 | |
| 13274 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13275 | alc662_eeepc_mic_automute(codec); |
| 13276 | } |
| 13277 | |
| 13278 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13279 | { |
| 13280 | alc262_hippo1_automute( codec ); |
| 13281 | alc662_eeepc_mic_automute(codec); |
| 13282 | } |
| 13283 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13284 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13285 | { |
| 13286 | unsigned int mute; |
| 13287 | unsigned int present; |
| 13288 | |
| 13289 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13290 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13291 | AC_VERB_GET_PIN_SENSE, 0); |
| 13292 | present = (present & 0x80000000) != 0; |
| 13293 | if (present) { |
| 13294 | /* mute internal speaker */ |
| 13295 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13296 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13297 | } else { |
| 13298 | /* unmute internal speaker if necessary */ |
| 13299 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13300 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13301 | HDA_AMP_MUTE, mute); |
| 13302 | } |
| 13303 | } |
| 13304 | |
| 13305 | /* unsolicited event for HP jack sensing */ |
| 13306 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 13307 | unsigned int res) |
| 13308 | { |
| 13309 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13310 | alc662_eeepc_ep20_automute(codec); |
| 13311 | } |
| 13312 | |
| 13313 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 13314 | { |
| 13315 | alc662_eeepc_ep20_automute(codec); |
| 13316 | } |
| 13317 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13318 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13319 | #define alc662_loopbacks alc880_loopbacks |
| 13320 | #endif |
| 13321 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13322 | |
| 13323 | /* pcm configuration: identiacal with ALC880 */ |
| 13324 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 13325 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 13326 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 13327 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 13328 | |
| 13329 | /* |
| 13330 | * configuration and preset |
| 13331 | */ |
| 13332 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 13333 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 13334 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 13335 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 13336 | [ALC662_5ST_DIG] = "6stack-dig", |
| 13337 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 13338 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13339 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13340 | [ALC662_AUTO] = "auto", |
| 13341 | }; |
| 13342 | |
| 13343 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13344 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13345 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13346 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13347 | {} |
| 13348 | }; |
| 13349 | |
| 13350 | static struct alc_config_preset alc662_presets[] = { |
| 13351 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13352 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13353 | .init_verbs = { alc662_init_verbs }, |
| 13354 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13355 | .dac_nids = alc662_dac_nids, |
| 13356 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 13357 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13358 | .adc_nids = alc662_adc_nids, |
| 13359 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13360 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13361 | .channel_mode = alc662_3ST_2ch_modes, |
| 13362 | .input_mux = &alc662_capture_source, |
| 13363 | }, |
| 13364 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13365 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13366 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13367 | .init_verbs = { alc662_init_verbs }, |
| 13368 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13369 | .dac_nids = alc662_dac_nids, |
| 13370 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 13371 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13372 | .adc_nids = alc662_adc_nids, |
| 13373 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13374 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13375 | .channel_mode = alc662_3ST_6ch_modes, |
| 13376 | .need_dac_fix = 1, |
| 13377 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13378 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13379 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13380 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13381 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13382 | .init_verbs = { alc662_init_verbs }, |
| 13383 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13384 | .dac_nids = alc662_dac_nids, |
| 13385 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13386 | .adc_nids = alc662_adc_nids, |
| 13387 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13388 | .channel_mode = alc662_3ST_6ch_modes, |
| 13389 | .need_dac_fix = 1, |
| 13390 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13391 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13392 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13393 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13394 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13395 | .init_verbs = { alc662_init_verbs }, |
| 13396 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13397 | .dac_nids = alc662_dac_nids, |
| 13398 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 13399 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13400 | .adc_nids = alc662_adc_nids, |
| 13401 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13402 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 13403 | .channel_mode = alc662_5stack_modes, |
| 13404 | .input_mux = &alc662_capture_source, |
| 13405 | }, |
| 13406 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13407 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13408 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 13409 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13410 | .dac_nids = alc662_dac_nids, |
| 13411 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13412 | .adc_nids = alc662_adc_nids, |
| 13413 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13414 | .channel_mode = alc662_3ST_2ch_modes, |
| 13415 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13416 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 13417 | .init_hook = alc662_lenovo_101e_all_automute, |
| 13418 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13419 | [ALC662_ASUS_EEEPC_P701] = { |
| 13420 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 13421 | .init_verbs = { alc662_init_verbs, |
| 13422 | alc662_eeepc_sue_init_verbs }, |
| 13423 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13424 | .dac_nids = alc662_dac_nids, |
| 13425 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 13426 | .adc_nids = alc662_adc_nids, |
| 13427 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13428 | .channel_mode = alc662_3ST_2ch_modes, |
| 13429 | .input_mux = &alc662_eeepc_capture_source, |
| 13430 | .unsol_event = alc662_eeepc_unsol_event, |
| 13431 | .init_hook = alc662_eeepc_inithook, |
| 13432 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13433 | [ALC662_ASUS_EEEPC_EP20] = { |
| 13434 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 13435 | alc662_chmode_mixer }, |
| 13436 | .init_verbs = { alc662_init_verbs, |
| 13437 | alc662_eeepc_ep20_sue_init_verbs }, |
| 13438 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13439 | .dac_nids = alc662_dac_nids, |
| 13440 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13441 | .adc_nids = alc662_adc_nids, |
| 13442 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13443 | .channel_mode = alc662_3ST_6ch_modes, |
| 13444 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13445 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 13446 | .init_hook = alc662_eeepc_ep20_inithook, |
| 13447 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13448 | |
| 13449 | }; |
| 13450 | |
| 13451 | |
| 13452 | /* |
| 13453 | * BIOS auto configuration |
| 13454 | */ |
| 13455 | |
| 13456 | /* add playback controls from the parsed DAC table */ |
| 13457 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13458 | const struct auto_pin_cfg *cfg) |
| 13459 | { |
| 13460 | char name[32]; |
| 13461 | static const char *chname[4] = { |
| 13462 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13463 | }; |
| 13464 | hda_nid_t nid; |
| 13465 | int i, err; |
| 13466 | |
| 13467 | for (i = 0; i < cfg->line_outs; i++) { |
| 13468 | if (!spec->multiout.dac_nids[i]) |
| 13469 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13470 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13471 | if (i == 2) { |
| 13472 | /* Center/LFE */ |
| 13473 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13474 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13475 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13476 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13477 | if (err < 0) |
| 13478 | return err; |
| 13479 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13480 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13481 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13482 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13483 | if (err < 0) |
| 13484 | return err; |
| 13485 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13486 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13487 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13488 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13489 | if (err < 0) |
| 13490 | return err; |
| 13491 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13492 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13493 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13494 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13495 | if (err < 0) |
| 13496 | return err; |
| 13497 | } else { |
| 13498 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13499 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13500 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13501 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13502 | if (err < 0) |
| 13503 | return err; |
| 13504 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13505 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13506 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13507 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13508 | if (err < 0) |
| 13509 | return err; |
| 13510 | } |
| 13511 | } |
| 13512 | return 0; |
| 13513 | } |
| 13514 | |
| 13515 | /* add playback controls for speaker and HP outputs */ |
| 13516 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13517 | const char *pfx) |
| 13518 | { |
| 13519 | hda_nid_t nid; |
| 13520 | int err; |
| 13521 | char name[32]; |
| 13522 | |
| 13523 | if (!pin) |
| 13524 | return 0; |
| 13525 | |
| 13526 | if (alc880_is_fixed_pin(pin)) { |
| 13527 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13528 | /* printk("DAC nid=%x\n",nid); */ |
| 13529 | /* specify the DAC as the extra output */ |
| 13530 | if (!spec->multiout.hp_nid) |
| 13531 | spec->multiout.hp_nid = nid; |
| 13532 | else |
| 13533 | spec->multiout.extra_out_nid[0] = nid; |
| 13534 | /* control HP volume/switch on the output mixer amp */ |
| 13535 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13536 | sprintf(name, "%s Playback Volume", pfx); |
| 13537 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13538 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13539 | if (err < 0) |
| 13540 | return err; |
| 13541 | sprintf(name, "%s Playback Switch", pfx); |
| 13542 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13543 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13544 | if (err < 0) |
| 13545 | return err; |
| 13546 | } else if (alc880_is_multi_pin(pin)) { |
| 13547 | /* set manual connection */ |
| 13548 | /* we have only a switch on HP-out PIN */ |
| 13549 | sprintf(name, "%s Playback Switch", pfx); |
| 13550 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13551 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13552 | if (err < 0) |
| 13553 | return err; |
| 13554 | } |
| 13555 | return 0; |
| 13556 | } |
| 13557 | |
| 13558 | /* create playback/capture controls for input pins */ |
| 13559 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13560 | const struct auto_pin_cfg *cfg) |
| 13561 | { |
| 13562 | struct hda_input_mux *imux = &spec->private_imux; |
| 13563 | int i, err, idx; |
| 13564 | |
| 13565 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13566 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13567 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13568 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13569 | auto_pin_cfg_labels[i], |
| 13570 | idx, 0x0b); |
| 13571 | if (err < 0) |
| 13572 | return err; |
| 13573 | imux->items[imux->num_items].label = |
| 13574 | auto_pin_cfg_labels[i]; |
| 13575 | imux->items[imux->num_items].index = |
| 13576 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13577 | imux->num_items++; |
| 13578 | } |
| 13579 | } |
| 13580 | return 0; |
| 13581 | } |
| 13582 | |
| 13583 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13584 | hda_nid_t nid, int pin_type, |
| 13585 | int dac_idx) |
| 13586 | { |
| 13587 | /* set as output */ |
| 13588 | snd_hda_codec_write(codec, nid, 0, |
| 13589 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 13590 | snd_hda_codec_write(codec, nid, 0, |
| 13591 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 13592 | /* need the manual connection? */ |
| 13593 | if (alc880_is_multi_pin(nid)) { |
| 13594 | struct alc_spec *spec = codec->spec; |
| 13595 | int idx = alc880_multi_pin_idx(nid); |
| 13596 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13597 | AC_VERB_SET_CONNECT_SEL, |
| 13598 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13599 | } |
| 13600 | } |
| 13601 | |
| 13602 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13603 | { |
| 13604 | struct alc_spec *spec = codec->spec; |
| 13605 | int i; |
| 13606 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13607 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13608 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13609 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13610 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13611 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13612 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13613 | i); |
| 13614 | } |
| 13615 | } |
| 13616 | |
| 13617 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13618 | { |
| 13619 | struct alc_spec *spec = codec->spec; |
| 13620 | hda_nid_t pin; |
| 13621 | |
| 13622 | pin = spec->autocfg.hp_pins[0]; |
| 13623 | if (pin) /* connect to front */ |
| 13624 | /* use dac 0 */ |
| 13625 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 13626 | } |
| 13627 | |
| 13628 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13629 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13630 | |
| 13631 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13632 | { |
| 13633 | struct alc_spec *spec = codec->spec; |
| 13634 | int i; |
| 13635 | |
| 13636 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13637 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13638 | if (alc662_is_input_pin(nid)) { |
| 13639 | snd_hda_codec_write(codec, nid, 0, |
| 13640 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13641 | (i <= AUTO_PIN_FRONT_MIC ? |
| 13642 | PIN_VREF80 : PIN_IN)); |
| 13643 | if (nid != ALC662_PIN_CD_NID) |
| 13644 | snd_hda_codec_write(codec, nid, 0, |
| 13645 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13646 | AMP_OUT_MUTE); |
| 13647 | } |
| 13648 | } |
| 13649 | } |
| 13650 | |
| 13651 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 13652 | { |
| 13653 | struct alc_spec *spec = codec->spec; |
| 13654 | int err; |
| 13655 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 13656 | |
| 13657 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13658 | alc662_ignore); |
| 13659 | if (err < 0) |
| 13660 | return err; |
| 13661 | if (!spec->autocfg.line_outs) |
| 13662 | return 0; /* can't find valid BIOS pin config */ |
| 13663 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13664 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13665 | if (err < 0) |
| 13666 | return err; |
| 13667 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13668 | if (err < 0) |
| 13669 | return err; |
| 13670 | err = alc662_auto_create_extra_out(spec, |
| 13671 | spec->autocfg.speaker_pins[0], |
| 13672 | "Speaker"); |
| 13673 | if (err < 0) |
| 13674 | return err; |
| 13675 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 13676 | "Headphone"); |
| 13677 | if (err < 0) |
| 13678 | return err; |
| 13679 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13680 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13681 | return err; |
| 13682 | |
| 13683 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13684 | |
| 13685 | if (spec->autocfg.dig_out_pin) |
| 13686 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 13687 | |
| 13688 | if (spec->kctl_alloc) |
| 13689 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13690 | |
| 13691 | spec->num_mux_defs = 1; |
| 13692 | spec->input_mux = &spec->private_imux; |
| 13693 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13694 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13695 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 13696 | spec->num_mixers++; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13697 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13698 | } |
| 13699 | |
| 13700 | /* additional initialization for auto-configuration model */ |
| 13701 | static void alc662_auto_init(struct hda_codec *codec) |
| 13702 | { |
| 13703 | alc662_auto_init_multi_out(codec); |
| 13704 | alc662_auto_init_hp_out(codec); |
| 13705 | alc662_auto_init_analog_input(codec); |
| 13706 | } |
| 13707 | |
| 13708 | static int patch_alc662(struct hda_codec *codec) |
| 13709 | { |
| 13710 | struct alc_spec *spec; |
| 13711 | int err, board_config; |
| 13712 | |
| 13713 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13714 | if (!spec) |
| 13715 | return -ENOMEM; |
| 13716 | |
| 13717 | codec->spec = spec; |
| 13718 | |
| 13719 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 13720 | alc662_models, |
| 13721 | alc662_cfg_tbl); |
| 13722 | if (board_config < 0) { |
| 13723 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 13724 | "trying auto-probe from BIOS...\n"); |
| 13725 | board_config = ALC662_AUTO; |
| 13726 | } |
| 13727 | |
| 13728 | if (board_config == ALC662_AUTO) { |
| 13729 | /* automatic parse from the BIOS config */ |
| 13730 | err = alc662_parse_auto_config(codec); |
| 13731 | if (err < 0) { |
| 13732 | alc_free(codec); |
| 13733 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13734 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13735 | printk(KERN_INFO |
| 13736 | "hda_codec: Cannot set up configuration " |
| 13737 | "from BIOS. Using base mode...\n"); |
| 13738 | board_config = ALC662_3ST_2ch_DIG; |
| 13739 | } |
| 13740 | } |
| 13741 | |
| 13742 | if (board_config != ALC662_AUTO) |
| 13743 | setup_preset(spec, &alc662_presets[board_config]); |
| 13744 | |
| 13745 | spec->stream_name_analog = "ALC662 Analog"; |
| 13746 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 13747 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 13748 | |
| 13749 | spec->stream_name_digital = "ALC662 Digital"; |
| 13750 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 13751 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 13752 | |
| 13753 | if (!spec->adc_nids && spec->input_mux) { |
| 13754 | spec->adc_nids = alc662_adc_nids; |
| 13755 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 13756 | } |
| 13757 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13758 | spec->vmaster_nid = 0x02; |
| 13759 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13760 | codec->patch_ops = alc_patch_ops; |
| 13761 | if (board_config == ALC662_AUTO) |
| 13762 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13763 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13764 | if (!spec->loopback.amplist) |
| 13765 | spec->loopback.amplist = alc662_loopbacks; |
| 13766 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13767 | |
| 13768 | return 0; |
| 13769 | } |
| 13770 | |
| 13771 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13772 | * patch entries |
| 13773 | */ |
| 13774 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 13775 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13776 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13777 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13778 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13779 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13780 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13781 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13782 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 13783 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 13784 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13785 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 13786 | .patch = patch_alc883 }, |
| 13787 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 13788 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13789 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13790 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13791 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13792 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13793 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13794 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13795 | {} /* terminator */ |
| 13796 | }; |