Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
| 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 | 7cf51e48 | 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, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 110 | #ifdef CONFIG_SND_DEBUG |
| 111 | ALC268_TEST, |
| 112 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | ALC268_AUTO, |
| 114 | ALC268_MODEL_LAST /* last tag */ |
| 115 | }; |
| 116 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 117 | /* ALC269 models */ |
| 118 | enum { |
| 119 | ALC269_BASIC, |
| 120 | ALC269_AUTO, |
| 121 | ALC269_MODEL_LAST /* last tag */ |
| 122 | }; |
| 123 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 124 | /* ALC861 models */ |
| 125 | enum { |
| 126 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 127 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 128 | ALC861_3ST_DIG, |
| 129 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 130 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 131 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 132 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 133 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 134 | ALC861_AUTO, |
| 135 | ALC861_MODEL_LAST, |
| 136 | }; |
| 137 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 138 | /* ALC861-VD models */ |
| 139 | enum { |
| 140 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 141 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 142 | ALC861VD_3ST, |
| 143 | ALC861VD_3ST_DIG, |
| 144 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 145 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 146 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 147 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 148 | ALC861VD_AUTO, |
| 149 | ALC861VD_MODEL_LAST, |
| 150 | }; |
| 151 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 152 | /* ALC662 models */ |
| 153 | enum { |
| 154 | ALC662_3ST_2ch_DIG, |
| 155 | ALC662_3ST_6ch_DIG, |
| 156 | ALC662_3ST_6ch, |
| 157 | ALC662_5ST_DIG, |
| 158 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 159 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 160 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 161 | ALC662_AUTO, |
| 162 | ALC662_MODEL_LAST, |
| 163 | }; |
| 164 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 165 | /* ALC882 models */ |
| 166 | enum { |
| 167 | ALC882_3ST_DIG, |
| 168 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 169 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 170 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 171 | ALC882_TARGA, |
| 172 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 173 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 174 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 175 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 176 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 177 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 178 | ALC882_MODEL_LAST, |
| 179 | }; |
| 180 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 181 | /* ALC883 models */ |
| 182 | enum { |
| 183 | ALC883_3ST_2ch_DIG, |
| 184 | ALC883_3ST_6ch_DIG, |
| 185 | ALC883_3ST_6ch, |
| 186 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 187 | ALC883_TARGA_DIG, |
| 188 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 189 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 190 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 191 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 192 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 193 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 194 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 195 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 196 | ALC888_LENOVO_MS7195_DIG, |
| 197 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 198 | ALC888_6ST_HP, |
| 199 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 200 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 201 | ALC883_MITAC, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 202 | ALC883_AUTO, |
| 203 | ALC883_MODEL_LAST, |
| 204 | }; |
| 205 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 206 | /* for GPIO Poll */ |
| 207 | #define GPIO_MASK 0x03 |
| 208 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | struct alc_spec { |
| 210 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 211 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | unsigned int num_mixers; |
| 213 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 214 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 215 | * don't forget NULL |
| 216 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 217 | */ |
| 218 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 220 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | struct hda_pcm_stream *stream_analog_playback; |
| 222 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 223 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 224 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 226 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | struct hda_pcm_stream *stream_digital_playback; |
| 228 | struct hda_pcm_stream *stream_digital_capture; |
| 229 | |
| 230 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 231 | struct hda_multi_out multiout; /* playback set-up |
| 232 | * max_channels, dacs must be set |
| 233 | * dig_out_nid and hp_nid are optional |
| 234 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 235 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | |
| 237 | /* capture */ |
| 238 | unsigned int num_adc_nids; |
| 239 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 240 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | |
| 242 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 243 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | const struct hda_input_mux *input_mux; |
| 245 | unsigned int cur_mux[3]; |
| 246 | |
| 247 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 248 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 250 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | |
| 252 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 253 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 254 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 255 | /* dynamic controls, init_verbs and input_mux */ |
| 256 | struct auto_pin_cfg autocfg; |
| 257 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 258 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 259 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 260 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 261 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 262 | /* hooks */ |
| 263 | void (*init_hook)(struct hda_codec *codec); |
| 264 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 265 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 266 | /* for pin sensing */ |
| 267 | unsigned int sense_updated: 1; |
| 268 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 269 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 270 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 271 | /* for virtual master */ |
| 272 | hda_nid_t vmaster_nid; |
| 273 | u32 vmaster_tlv[4]; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 274 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 275 | struct hda_loopback_check loopback; |
| 276 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 277 | }; |
| 278 | |
| 279 | /* |
| 280 | * configuration template - to be copied to the spec instance |
| 281 | */ |
| 282 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 283 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 284 | * with spec |
| 285 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 286 | const struct hda_verb *init_verbs[5]; |
| 287 | unsigned int num_dacs; |
| 288 | hda_nid_t *dac_nids; |
| 289 | hda_nid_t dig_out_nid; /* optional */ |
| 290 | hda_nid_t hp_nid; /* optional */ |
| 291 | unsigned int num_adc_nids; |
| 292 | hda_nid_t *adc_nids; |
| 293 | hda_nid_t dig_in_nid; |
| 294 | unsigned int num_channel_mode; |
| 295 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 296 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 297 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 298 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 299 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 300 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 301 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 302 | struct hda_amp_list *loopbacks; |
| 303 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | }; |
| 305 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | |
| 307 | /* |
| 308 | * input MUX handling |
| 309 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 310 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 311 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | { |
| 313 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 314 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 315 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 316 | if (mux_idx >= spec->num_mux_defs) |
| 317 | mux_idx = 0; |
| 318 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | } |
| 320 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 321 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 322 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | { |
| 324 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 325 | struct alc_spec *spec = codec->spec; |
| 326 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 327 | |
| 328 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 329 | return 0; |
| 330 | } |
| 331 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 332 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 333 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | { |
| 335 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 336 | struct alc_spec *spec = codec->spec; |
| 337 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 338 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 339 | 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] | 340 | spec->adc_nids[adc_idx], |
| 341 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | } |
| 343 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 344 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | /* |
| 346 | * channel mode setting |
| 347 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 348 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 349 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | { |
| 351 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 352 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 353 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 354 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | } |
| 356 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 357 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 358 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | { |
| 360 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 361 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 362 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 363 | spec->num_channel_mode, |
| 364 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | } |
| 366 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 367 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 368 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | { |
| 370 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 371 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 372 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 373 | spec->num_channel_mode, |
| 374 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 375 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 376 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 377 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | } |
| 379 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 381 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 382 | * instead of "%" to avoid consequences of accidently treating the % as |
| 383 | * being part of a format specifier. Maximum allowed length of a value is |
| 384 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 385 | * |
| 386 | * Note: some retasking pin complexes seem to ignore requests for input |
| 387 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 388 | * are requested. Therefore order this list so that this behaviour will not |
| 389 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 390 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 391 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 392 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 393 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 394 | "Mic 50pc bias", "Mic 80pc bias", |
| 395 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 396 | }; |
| 397 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 398 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 399 | }; |
| 400 | /* 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] | 401 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 402 | * addition, "input" pins may or may not process the mic bias option |
| 403 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 404 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 405 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 406 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 407 | #define ALC_PIN_DIR_IN 0x00 |
| 408 | #define ALC_PIN_DIR_OUT 0x01 |
| 409 | #define ALC_PIN_DIR_INOUT 0x02 |
| 410 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 411 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 412 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 413 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 414 | * For each direction the minimum and maximum values are given. |
| 415 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 416 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 417 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 418 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 419 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 420 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 421 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 422 | }; |
| 423 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 424 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 425 | #define alc_pin_mode_n_items(_dir) \ |
| 426 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 427 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 428 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 429 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 430 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 431 | unsigned int item_num = uinfo->value.enumerated.item; |
| 432 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 433 | |
| 434 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 435 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 436 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 437 | |
| 438 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 439 | item_num = alc_pin_mode_min(dir); |
| 440 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 441 | return 0; |
| 442 | } |
| 443 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 444 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 445 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 446 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 447 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 448 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 449 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 450 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 451 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 452 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 453 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 454 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 455 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 456 | /* Find enumerated value for current pinctl setting */ |
| 457 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | 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] | 459 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 460 | *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] | 461 | return 0; |
| 462 | } |
| 463 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 464 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 465 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 466 | { |
| 467 | signed int change; |
| 468 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 469 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 470 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 471 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 472 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 473 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 474 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 475 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 476 | 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] | 477 | val = alc_pin_mode_min(dir); |
| 478 | |
| 479 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 480 | if (change) { |
| 481 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 482 | snd_hda_codec_write_cache(codec, nid, 0, |
| 483 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 484 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 485 | |
| 486 | /* Also enable the retasking pin's input/output as required |
| 487 | * for the requested pin mode. Enum values of 2 or less are |
| 488 | * input modes. |
| 489 | * |
| 490 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 491 | * reduces noise slightly (particularly on input) so we'll |
| 492 | * do it. However, having both input and output buffers |
| 493 | * enabled simultaneously doesn't seem to be problematic if |
| 494 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 495 | */ |
| 496 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 497 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 498 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 499 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 500 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 501 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 502 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 503 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 504 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 505 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 506 | } |
| 507 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 508 | return change; |
| 509 | } |
| 510 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 511 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 512 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 513 | .info = alc_pin_mode_info, \ |
| 514 | .get = alc_pin_mode_get, \ |
| 515 | .put = alc_pin_mode_put, \ |
| 516 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 517 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 518 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 519 | * together using a mask with more than one bit set. This control is |
| 520 | * currently used only by the ALC260 test model. At this stage they are not |
| 521 | * needed for any "production" models. |
| 522 | */ |
| 523 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 524 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 525 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 526 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 527 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 528 | { |
| 529 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 530 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 531 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 532 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 533 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 534 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 535 | |
| 536 | *valp = (val & mask) != 0; |
| 537 | return 0; |
| 538 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 539 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 540 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 541 | { |
| 542 | signed int change; |
| 543 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 544 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 545 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 546 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 547 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 548 | AC_VERB_GET_GPIO_DATA, |
| 549 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 550 | |
| 551 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 552 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 553 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 554 | gpio_data &= ~mask; |
| 555 | else |
| 556 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 557 | snd_hda_codec_write_cache(codec, nid, 0, |
| 558 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 559 | |
| 560 | return change; |
| 561 | } |
| 562 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 563 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 564 | .info = alc_gpio_data_info, \ |
| 565 | .get = alc_gpio_data_get, \ |
| 566 | .put = alc_gpio_data_put, \ |
| 567 | .private_value = nid | (mask<<16) } |
| 568 | #endif /* CONFIG_SND_DEBUG */ |
| 569 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 570 | /* A switch control to allow the enabling of the digital IO pins on the |
| 571 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 572 | * to provide something in the test model allowing digital outputs to be |
| 573 | * identified if present. If models are found which can utilise these |
| 574 | * outputs a more complete mixer control can be devised for those models if |
| 575 | * necessary. |
| 576 | */ |
| 577 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 578 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 579 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 580 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 581 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 582 | { |
| 583 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 584 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 585 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 586 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 587 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 588 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 589 | |
| 590 | *valp = (val & mask) != 0; |
| 591 | return 0; |
| 592 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 593 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 594 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 595 | { |
| 596 | signed int change; |
| 597 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 598 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 599 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 600 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 601 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 602 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 603 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 604 | |
| 605 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 606 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 607 | if (val==0) |
| 608 | ctrl_data &= ~mask; |
| 609 | else |
| 610 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 611 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 612 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 613 | |
| 614 | return change; |
| 615 | } |
| 616 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 617 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 618 | .info = alc_spdif_ctrl_info, \ |
| 619 | .get = alc_spdif_ctrl_get, \ |
| 620 | .put = alc_spdif_ctrl_put, \ |
| 621 | .private_value = nid | (mask<<16) } |
| 622 | #endif /* CONFIG_SND_DEBUG */ |
| 623 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 624 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 625 | * Again, this is only used in the ALC26x test models to help identify when |
| 626 | * the EAPD line must be asserted for features to work. |
| 627 | */ |
| 628 | #ifdef CONFIG_SND_DEBUG |
| 629 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 630 | |
| 631 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 632 | struct snd_ctl_elem_value *ucontrol) |
| 633 | { |
| 634 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 635 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 636 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 637 | long *valp = ucontrol->value.integer.value; |
| 638 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 639 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 640 | |
| 641 | *valp = (val & mask) != 0; |
| 642 | return 0; |
| 643 | } |
| 644 | |
| 645 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 646 | struct snd_ctl_elem_value *ucontrol) |
| 647 | { |
| 648 | int change; |
| 649 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 650 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 651 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 652 | long val = *ucontrol->value.integer.value; |
| 653 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 654 | AC_VERB_GET_EAPD_BTLENABLE, |
| 655 | 0x00); |
| 656 | |
| 657 | /* Set/unset the masked control bit(s) as needed */ |
| 658 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 659 | if (!val) |
| 660 | ctrl_data &= ~mask; |
| 661 | else |
| 662 | ctrl_data |= mask; |
| 663 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 664 | ctrl_data); |
| 665 | |
| 666 | return change; |
| 667 | } |
| 668 | |
| 669 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 670 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 671 | .info = alc_eapd_ctrl_info, \ |
| 672 | .get = alc_eapd_ctrl_get, \ |
| 673 | .put = alc_eapd_ctrl_put, \ |
| 674 | .private_value = nid | (mask<<16) } |
| 675 | #endif /* CONFIG_SND_DEBUG */ |
| 676 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 677 | /* |
| 678 | * set up from the preset table |
| 679 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 680 | static void setup_preset(struct alc_spec *spec, |
| 681 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 682 | { |
| 683 | int i; |
| 684 | |
| 685 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 686 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 687 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 688 | i++) |
| 689 | spec->init_verbs[spec->num_init_verbs++] = |
| 690 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 691 | |
| 692 | spec->channel_mode = preset->channel_mode; |
| 693 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 694 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 695 | |
| 696 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 697 | |
| 698 | spec->multiout.num_dacs = preset->num_dacs; |
| 699 | spec->multiout.dac_nids = preset->dac_nids; |
| 700 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 701 | spec->multiout.hp_nid = preset->hp_nid; |
| 702 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 703 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 704 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 705 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 706 | spec->input_mux = preset->input_mux; |
| 707 | |
| 708 | spec->num_adc_nids = preset->num_adc_nids; |
| 709 | spec->adc_nids = preset->adc_nids; |
| 710 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 711 | |
| 712 | spec->unsol_event = preset->unsol_event; |
| 713 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 714 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 715 | spec->loopback.amplist = preset->loopbacks; |
| 716 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 717 | } |
| 718 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 719 | /* Enable GPIO mask and set output */ |
| 720 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 721 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 722 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 723 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 724 | { } |
| 725 | }; |
| 726 | |
| 727 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 728 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 729 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 730 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 731 | { } |
| 732 | }; |
| 733 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 734 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 735 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 736 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 737 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 738 | { } |
| 739 | }; |
| 740 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 741 | static void alc_sku_automute(struct hda_codec *codec) |
| 742 | { |
| 743 | struct alc_spec *spec = codec->spec; |
| 744 | unsigned int mute; |
| 745 | unsigned int present; |
| 746 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 747 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 748 | |
| 749 | /* need to execute and sync at first */ |
| 750 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 751 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 752 | AC_VERB_GET_PIN_SENSE, 0); |
| 753 | spec->jack_present = (present & 0x80000000) != 0; |
| 754 | if (spec->jack_present) { |
| 755 | /* mute internal speaker */ |
| 756 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, |
| 757 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 758 | } else { |
| 759 | /* unmute internal speaker if necessary */ |
| 760 | mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0); |
| 761 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, |
| 762 | HDA_AMP_MUTE, mute); |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | /* unsolicited event for HP jack sensing */ |
| 767 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 768 | { |
| 769 | if (codec->vendor_id == 0x10ec0880) |
| 770 | res >>= 28; |
| 771 | else |
| 772 | res >>= 26; |
| 773 | if (res != ALC880_HP_EVENT) |
| 774 | return; |
| 775 | |
| 776 | alc_sku_automute(codec); |
| 777 | } |
| 778 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 779 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 780 | * 31 ~ 16 : Manufacture ID |
| 781 | * 15 ~ 8 : SKU ID |
| 782 | * 7 ~ 0 : Assembly ID |
| 783 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 784 | */ |
| 785 | static void alc_subsystem_id(struct hda_codec *codec, |
| 786 | unsigned int porta, unsigned int porte, |
| 787 | unsigned int portd) |
| 788 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 789 | unsigned int ass, tmp, i; |
| 790 | unsigned nid; |
| 791 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 792 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 793 | ass = codec->subsystem_id & 0xffff; |
| 794 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 795 | goto do_sku; |
| 796 | |
| 797 | /* |
| 798 | * 31~30 : port conetcivity |
| 799 | * 29~21 : reserve |
| 800 | * 20 : PCBEEP input |
| 801 | * 19~16 : Check sum (15:1) |
| 802 | * 15~1 : Custom |
| 803 | * 0 : override |
| 804 | */ |
| 805 | nid = 0x1d; |
| 806 | if (codec->vendor_id == 0x10ec0260) |
| 807 | nid = 0x17; |
| 808 | ass = snd_hda_codec_read(codec, nid, 0, |
| 809 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 810 | if (!(ass & 1) && !(ass & 0x100000)) |
| 811 | return; |
| 812 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 813 | return; |
| 814 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 815 | /* check sum */ |
| 816 | tmp = 0; |
| 817 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 818 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 819 | tmp++; |
| 820 | } |
| 821 | if (((ass >> 16) & 0xf) != tmp) |
| 822 | return; |
| 823 | do_sku: |
| 824 | /* |
| 825 | * 0 : override |
| 826 | * 1 : Swap Jack |
| 827 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 828 | * 3~5 : External Amplifier control |
| 829 | * 7~6 : Reserved |
| 830 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 831 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 832 | switch (tmp) { |
| 833 | case 1: |
| 834 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 835 | break; |
| 836 | case 3: |
| 837 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 838 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 839 | case 7: |
| 840 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 841 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 842 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 843 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 844 | case 0x10ec0260: |
| 845 | snd_hda_codec_write(codec, 0x0f, 0, |
| 846 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 847 | snd_hda_codec_write(codec, 0x10, 0, |
| 848 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 849 | break; |
| 850 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 851 | case 0x10ec0267: |
| 852 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 853 | case 0x10ec0269: |
| 854 | case 0x10ec0862: |
| 855 | case 0x10ec0662: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 856 | snd_hda_codec_write(codec, 0x14, 0, |
| 857 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 858 | snd_hda_codec_write(codec, 0x15, 0, |
| 859 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 860 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 861 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 862 | switch (codec->vendor_id) { |
| 863 | case 0x10ec0260: |
| 864 | snd_hda_codec_write(codec, 0x1a, 0, |
| 865 | AC_VERB_SET_COEF_INDEX, 7); |
| 866 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 867 | AC_VERB_GET_PROC_COEF, 0); |
| 868 | snd_hda_codec_write(codec, 0x1a, 0, |
| 869 | AC_VERB_SET_COEF_INDEX, 7); |
| 870 | snd_hda_codec_write(codec, 0x1a, 0, |
| 871 | AC_VERB_SET_PROC_COEF, |
| 872 | tmp | 0x2010); |
| 873 | break; |
| 874 | case 0x10ec0262: |
| 875 | case 0x10ec0880: |
| 876 | case 0x10ec0882: |
| 877 | case 0x10ec0883: |
| 878 | case 0x10ec0885: |
| 879 | case 0x10ec0888: |
| 880 | snd_hda_codec_write(codec, 0x20, 0, |
| 881 | AC_VERB_SET_COEF_INDEX, 7); |
| 882 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 883 | AC_VERB_GET_PROC_COEF, 0); |
| 884 | snd_hda_codec_write(codec, 0x20, 0, |
| 885 | AC_VERB_SET_COEF_INDEX, 7); |
| 886 | snd_hda_codec_write(codec, 0x20, 0, |
| 887 | AC_VERB_SET_PROC_COEF, |
| 888 | tmp | 0x2010); |
| 889 | break; |
| 890 | case 0x10ec0267: |
| 891 | case 0x10ec0268: |
| 892 | snd_hda_codec_write(codec, 0x20, 0, |
| 893 | AC_VERB_SET_COEF_INDEX, 7); |
| 894 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 895 | AC_VERB_GET_PROC_COEF, 0); |
| 896 | snd_hda_codec_write(codec, 0x20, 0, |
| 897 | AC_VERB_SET_COEF_INDEX, 7); |
| 898 | snd_hda_codec_write(codec, 0x20, 0, |
| 899 | AC_VERB_SET_PROC_COEF, |
| 900 | tmp | 0x3000); |
| 901 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 902 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 903 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 904 | break; |
| 905 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 906 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 907 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 908 | * when the external headphone out jack is plugged" |
| 909 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 910 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 911 | return; |
| 912 | /* |
| 913 | * 10~8 : Jack location |
| 914 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 915 | * 14~13: Resvered |
| 916 | * 15 : 1 --> enable the function "Mute internal speaker |
| 917 | * when the external headphone out jack is plugged" |
| 918 | */ |
| 919 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 920 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 921 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 922 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 923 | else |
| 924 | return; |
| 925 | } |
| 926 | |
| 927 | if (!spec->autocfg.hp_pins[0]) { |
| 928 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 929 | if (tmp == 0) |
| 930 | spec->autocfg.hp_pins[0] = porta; |
| 931 | else if (tmp == 1) |
| 932 | spec->autocfg.hp_pins[0] = porte; |
| 933 | else if (tmp == 2) |
| 934 | spec->autocfg.hp_pins[0] = portd; |
| 935 | else |
| 936 | return; |
| 937 | } |
| 938 | |
| 939 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 940 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 941 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 942 | spec->unsol_event = alc_sku_unsol_event; |
| 943 | spec->init_hook = alc_sku_automute; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 944 | } |
| 945 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 946 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 947 | * Fix-up pin default configurations |
| 948 | */ |
| 949 | |
| 950 | struct alc_pincfg { |
| 951 | hda_nid_t nid; |
| 952 | u32 val; |
| 953 | }; |
| 954 | |
| 955 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 956 | const struct snd_pci_quirk *quirk, |
| 957 | const struct alc_pincfg **pinfix) |
| 958 | { |
| 959 | const struct alc_pincfg *cfg; |
| 960 | |
| 961 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 962 | if (!quirk) |
| 963 | return; |
| 964 | |
| 965 | cfg = pinfix[quirk->value]; |
| 966 | for (; cfg->nid; cfg++) { |
| 967 | int i; |
| 968 | u32 val = cfg->val; |
| 969 | for (i = 0; i < 4; i++) { |
| 970 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 971 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 972 | val & 0xff); |
| 973 | val >>= 8; |
| 974 | } |
| 975 | } |
| 976 | } |
| 977 | |
| 978 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 979 | * ALC880 3-stack model |
| 980 | * |
| 981 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 982 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 983 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 984 | */ |
| 985 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 986 | static hda_nid_t alc880_dac_nids[4] = { |
| 987 | /* front, rear, clfe, rear_surr */ |
| 988 | 0x02, 0x05, 0x04, 0x03 |
| 989 | }; |
| 990 | |
| 991 | static hda_nid_t alc880_adc_nids[3] = { |
| 992 | /* ADC0-2 */ |
| 993 | 0x07, 0x08, 0x09, |
| 994 | }; |
| 995 | |
| 996 | /* The datasheet says the node 0x07 is connected from inputs, |
| 997 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 998 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 999 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1000 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1001 | /* ADC1-2 */ |
| 1002 | 0x08, 0x09, |
| 1003 | }; |
| 1004 | |
| 1005 | #define ALC880_DIGOUT_NID 0x06 |
| 1006 | #define ALC880_DIGIN_NID 0x0a |
| 1007 | |
| 1008 | static struct hda_input_mux alc880_capture_source = { |
| 1009 | .num_items = 4, |
| 1010 | .items = { |
| 1011 | { "Mic", 0x0 }, |
| 1012 | { "Front Mic", 0x3 }, |
| 1013 | { "Line", 0x2 }, |
| 1014 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1015 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1016 | }; |
| 1017 | |
| 1018 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1019 | /* 2ch mode */ |
| 1020 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1021 | /* set line-in to input, mute it */ |
| 1022 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1023 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1024 | /* set mic-in to input vref 80%, mute it */ |
| 1025 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1026 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1027 | { } /* end */ |
| 1028 | }; |
| 1029 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1030 | /* 6ch mode */ |
| 1031 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1032 | /* set line-in to output, unmute it */ |
| 1033 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1034 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1035 | /* set mic-in to output, unmute it */ |
| 1036 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1037 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1038 | { } /* end */ |
| 1039 | }; |
| 1040 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1041 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1042 | { 2, alc880_threestack_ch2_init }, |
| 1043 | { 6, alc880_threestack_ch6_init }, |
| 1044 | }; |
| 1045 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1046 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1047 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1048 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1049 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1050 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1051 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1052 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1053 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1054 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1055 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1056 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1057 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1058 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1059 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1060 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1061 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1062 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1063 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1064 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1065 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1066 | { |
| 1067 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1068 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1069 | .info = alc_ch_mode_info, |
| 1070 | .get = alc_ch_mode_get, |
| 1071 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1072 | }, |
| 1073 | { } /* end */ |
| 1074 | }; |
| 1075 | |
| 1076 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1077 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1078 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1079 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1080 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1081 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1082 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1083 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1084 | { |
| 1085 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1086 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1087 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1088 | */ |
| 1089 | /* .name = "Capture Source", */ |
| 1090 | .name = "Input Source", |
| 1091 | .count = 3, |
| 1092 | .info = alc_mux_enum_info, |
| 1093 | .get = alc_mux_enum_get, |
| 1094 | .put = alc_mux_enum_put, |
| 1095 | }, |
| 1096 | { } /* end */ |
| 1097 | }; |
| 1098 | |
| 1099 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1100 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1101 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1102 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1103 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1104 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1105 | { |
| 1106 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1107 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1108 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1109 | */ |
| 1110 | /* .name = "Capture Source", */ |
| 1111 | .name = "Input Source", |
| 1112 | .count = 2, |
| 1113 | .info = alc_mux_enum_info, |
| 1114 | .get = alc_mux_enum_get, |
| 1115 | .put = alc_mux_enum_put, |
| 1116 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1117 | { } /* end */ |
| 1118 | }; |
| 1119 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1120 | |
| 1121 | |
| 1122 | /* |
| 1123 | * ALC880 5-stack model |
| 1124 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1125 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1126 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1127 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1128 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1129 | */ |
| 1130 | |
| 1131 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1132 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1133 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1134 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1135 | { } /* end */ |
| 1136 | }; |
| 1137 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1138 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1139 | /* 6ch mode */ |
| 1140 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1141 | /* set line-in to input, mute it */ |
| 1142 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1143 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1144 | { } /* end */ |
| 1145 | }; |
| 1146 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1147 | /* 8ch mode */ |
| 1148 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1149 | /* set line-in to output, unmute it */ |
| 1150 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1151 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1152 | { } /* end */ |
| 1153 | }; |
| 1154 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1155 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1156 | { 6, alc880_fivestack_ch6_init }, |
| 1157 | { 8, alc880_fivestack_ch8_init }, |
| 1158 | }; |
| 1159 | |
| 1160 | |
| 1161 | /* |
| 1162 | * ALC880 6-stack model |
| 1163 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1164 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1165 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1166 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1167 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1168 | */ |
| 1169 | |
| 1170 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1171 | /* front, rear, clfe, rear_surr */ |
| 1172 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1173 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1174 | |
| 1175 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1176 | .num_items = 4, |
| 1177 | .items = { |
| 1178 | { "Mic", 0x0 }, |
| 1179 | { "Front Mic", 0x1 }, |
| 1180 | { "Line", 0x2 }, |
| 1181 | { "CD", 0x4 }, |
| 1182 | }, |
| 1183 | }; |
| 1184 | |
| 1185 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1186 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1187 | { 8, NULL }, |
| 1188 | }; |
| 1189 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1190 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1191 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1192 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1193 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1194 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1195 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1196 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1197 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1198 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1199 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1200 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1201 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1202 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1203 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1204 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1205 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1206 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1207 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1208 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1209 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1210 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1211 | { |
| 1212 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1213 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1214 | .info = alc_ch_mode_info, |
| 1215 | .get = alc_ch_mode_get, |
| 1216 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1217 | }, |
| 1218 | { } /* end */ |
| 1219 | }; |
| 1220 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1221 | |
| 1222 | /* |
| 1223 | * ALC880 W810 model |
| 1224 | * |
| 1225 | * W810 has rear IO for: |
| 1226 | * Front (DAC 02) |
| 1227 | * Surround (DAC 03) |
| 1228 | * Center/LFE (DAC 04) |
| 1229 | * Digital out (06) |
| 1230 | * |
| 1231 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1232 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1233 | * |
| 1234 | * There is a variable resistor to control the speaker or headphone |
| 1235 | * volume. This is a hardware-only device without a software API. |
| 1236 | * |
| 1237 | * Plugging headphones in will disable the internal speakers. This is |
| 1238 | * implemented in hardware, not via the driver using jack sense. In |
| 1239 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1240 | * disable both the speakers and headphones. |
| 1241 | * |
| 1242 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1243 | * These may not do anything useful with this driver yet, because I |
| 1244 | * haven't setup any initialization verbs for these yet... |
| 1245 | */ |
| 1246 | |
| 1247 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1248 | /* front, rear/surround, clfe */ |
| 1249 | 0x02, 0x03, 0x04 |
| 1250 | }; |
| 1251 | |
| 1252 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1253 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1254 | { 6, NULL } |
| 1255 | }; |
| 1256 | |
| 1257 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1258 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1259 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1260 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1261 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1262 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1263 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1264 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1265 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1266 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1267 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1268 | { } /* end */ |
| 1269 | }; |
| 1270 | |
| 1271 | |
| 1272 | /* |
| 1273 | * Z710V model |
| 1274 | * |
| 1275 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1276 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1277 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1278 | */ |
| 1279 | |
| 1280 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1281 | 0x02 |
| 1282 | }; |
| 1283 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1284 | |
| 1285 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1286 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1287 | { 2, NULL } |
| 1288 | }; |
| 1289 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1290 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1291 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1292 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1293 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1294 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1295 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1296 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1297 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1298 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1299 | { } /* end */ |
| 1300 | }; |
| 1301 | |
| 1302 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1303 | /* |
| 1304 | * ALC880 F1734 model |
| 1305 | * |
| 1306 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1307 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1308 | */ |
| 1309 | |
| 1310 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1311 | 0x03 |
| 1312 | }; |
| 1313 | #define ALC880_F1734_HP_DAC 0x02 |
| 1314 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1315 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1316 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1317 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1318 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1319 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1320 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1321 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1322 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1323 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1324 | { } /* end */ |
| 1325 | }; |
| 1326 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1327 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1328 | /* |
| 1329 | * ALC880 ASUS model |
| 1330 | * |
| 1331 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1332 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1333 | * Mic = 0x18, Line = 0x1a |
| 1334 | */ |
| 1335 | |
| 1336 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1337 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1338 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1339 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1340 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1341 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1342 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1343 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1344 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1345 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1346 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1347 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1348 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1349 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1350 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1351 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1352 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1353 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1354 | { |
| 1355 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1356 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1357 | .info = alc_ch_mode_info, |
| 1358 | .get = alc_ch_mode_get, |
| 1359 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1360 | }, |
| 1361 | { } /* end */ |
| 1362 | }; |
| 1363 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1364 | /* |
| 1365 | * ALC880 ASUS W1V model |
| 1366 | * |
| 1367 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1368 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1369 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1370 | */ |
| 1371 | |
| 1372 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1373 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1374 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1375 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1376 | { } /* end */ |
| 1377 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1378 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1379 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1380 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1381 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1382 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1383 | { } /* end */ |
| 1384 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1385 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1386 | /* TCL S700 */ |
| 1387 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1388 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1389 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1390 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1391 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1392 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1393 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1394 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1395 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1396 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1397 | { |
| 1398 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1399 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1400 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1401 | */ |
| 1402 | /* .name = "Capture Source", */ |
| 1403 | .name = "Input Source", |
| 1404 | .count = 1, |
| 1405 | .info = alc_mux_enum_info, |
| 1406 | .get = alc_mux_enum_get, |
| 1407 | .put = alc_mux_enum_put, |
| 1408 | }, |
| 1409 | { } /* end */ |
| 1410 | }; |
| 1411 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1412 | /* Uniwill */ |
| 1413 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1414 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1415 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1416 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1417 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1418 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1419 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1420 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1421 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1422 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1423 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1424 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1425 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1426 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1427 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1428 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1429 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1430 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1431 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1432 | { |
| 1433 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1434 | .name = "Channel Mode", |
| 1435 | .info = alc_ch_mode_info, |
| 1436 | .get = alc_ch_mode_get, |
| 1437 | .put = alc_ch_mode_put, |
| 1438 | }, |
| 1439 | { } /* end */ |
| 1440 | }; |
| 1441 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1442 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1443 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1444 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1445 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1446 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1447 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1448 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1449 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1450 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1451 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1452 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1453 | { } /* end */ |
| 1454 | }; |
| 1455 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1456 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1457 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1458 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1459 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1460 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1461 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1462 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1463 | { } /* end */ |
| 1464 | }; |
| 1465 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1466 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1467 | * virtual master controls |
| 1468 | */ |
| 1469 | |
| 1470 | /* |
| 1471 | * slave controls for virtual master |
| 1472 | */ |
| 1473 | static const char *alc_slave_vols[] = { |
| 1474 | "Front Playback Volume", |
| 1475 | "Surround Playback Volume", |
| 1476 | "Center Playback Volume", |
| 1477 | "LFE Playback Volume", |
| 1478 | "Side Playback Volume", |
| 1479 | "Headphone Playback Volume", |
| 1480 | "Speaker Playback Volume", |
| 1481 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1482 | "Line-Out Playback Volume", |
| 1483 | NULL, |
| 1484 | }; |
| 1485 | |
| 1486 | static const char *alc_slave_sws[] = { |
| 1487 | "Front Playback Switch", |
| 1488 | "Surround Playback Switch", |
| 1489 | "Center Playback Switch", |
| 1490 | "LFE Playback Switch", |
| 1491 | "Side Playback Switch", |
| 1492 | "Headphone Playback Switch", |
| 1493 | "Speaker Playback Switch", |
| 1494 | "Mono Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1495 | NULL, |
| 1496 | }; |
| 1497 | |
| 1498 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1499 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1500 | */ |
| 1501 | static int alc_build_controls(struct hda_codec *codec) |
| 1502 | { |
| 1503 | struct alc_spec *spec = codec->spec; |
| 1504 | int err; |
| 1505 | int i; |
| 1506 | |
| 1507 | for (i = 0; i < spec->num_mixers; i++) { |
| 1508 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1509 | if (err < 0) |
| 1510 | return err; |
| 1511 | } |
| 1512 | |
| 1513 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1514 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1515 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1516 | if (err < 0) |
| 1517 | return err; |
| 1518 | } |
| 1519 | if (spec->dig_in_nid) { |
| 1520 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1521 | if (err < 0) |
| 1522 | return err; |
| 1523 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1524 | |
| 1525 | /* if we have no master control, let's create it */ |
| 1526 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
| 1527 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
| 1528 | HDA_OUTPUT, spec->vmaster_tlv); |
| 1529 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
| 1530 | spec->vmaster_tlv, alc_slave_vols); |
| 1531 | if (err < 0) |
| 1532 | return err; |
| 1533 | } |
| 1534 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1535 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1536 | NULL, alc_slave_sws); |
| 1537 | if (err < 0) |
| 1538 | return err; |
| 1539 | } |
| 1540 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1541 | return 0; |
| 1542 | } |
| 1543 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1544 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1545 | /* |
| 1546 | * initialize the codec volumes, etc |
| 1547 | */ |
| 1548 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1549 | /* |
| 1550 | * generic initialization of ADC, input mixers and output mixers |
| 1551 | */ |
| 1552 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1553 | /* |
| 1554 | * Unmute ADC0-2 and set the default input to mic-in |
| 1555 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1556 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1557 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1558 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1559 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1560 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1561 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1562 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1563 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1564 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1565 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1566 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1567 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1568 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1569 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1570 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1571 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1572 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1573 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1574 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1575 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1576 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1577 | /* |
| 1578 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1579 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1580 | /* set vol=0 to output mixers */ |
| 1581 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1582 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1583 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1584 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1585 | /* set up input amps for analog loopback */ |
| 1586 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1587 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1588 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1589 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1590 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1591 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1592 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1593 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1594 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1595 | |
| 1596 | { } |
| 1597 | }; |
| 1598 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1599 | /* |
| 1600 | * 3-stack pin configuration: |
| 1601 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1602 | */ |
| 1603 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1604 | /* |
| 1605 | * preset connection lists of input pins |
| 1606 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1607 | */ |
| 1608 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1609 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1610 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1611 | |
| 1612 | /* |
| 1613 | * Set pin mode and muting |
| 1614 | */ |
| 1615 | /* set front pin widgets 0x14 for output */ |
| 1616 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1617 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1618 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1619 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1620 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1621 | /* Mic2 (as headphone out) for HP output */ |
| 1622 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1623 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1624 | /* Line In pin widget for input */ |
| 1625 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1626 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1627 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1628 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1629 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1630 | /* CD pin widget for input */ |
| 1631 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1632 | |
| 1633 | { } |
| 1634 | }; |
| 1635 | |
| 1636 | /* |
| 1637 | * 5-stack pin configuration: |
| 1638 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1639 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1640 | */ |
| 1641 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1642 | /* |
| 1643 | * preset connection lists of input pins |
| 1644 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1645 | */ |
| 1646 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1647 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1648 | |
| 1649 | /* |
| 1650 | * Set pin mode and muting |
| 1651 | */ |
| 1652 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1653 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1654 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1655 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1656 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1657 | /* unmute pins for output (no gain on this amp) */ |
| 1658 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1659 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1660 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1661 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1662 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1663 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1664 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1665 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1666 | /* Mic2 (as headphone out) for HP output */ |
| 1667 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1668 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1669 | /* Line In pin widget for input */ |
| 1670 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1671 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1672 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1673 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1674 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1675 | /* CD pin widget for input */ |
| 1676 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1677 | |
| 1678 | { } |
| 1679 | }; |
| 1680 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1681 | /* |
| 1682 | * W810 pin configuration: |
| 1683 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1684 | */ |
| 1685 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1686 | /* hphone/speaker input selector: front DAC */ |
| 1687 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1688 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1689 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1690 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1691 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1692 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1693 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1694 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1695 | |
| 1696 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1697 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1698 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1699 | { } |
| 1700 | }; |
| 1701 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1702 | /* |
| 1703 | * Z71V pin configuration: |
| 1704 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1705 | */ |
| 1706 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1708 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1709 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1710 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1711 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1712 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1713 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1714 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1715 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1716 | |
| 1717 | { } |
| 1718 | }; |
| 1719 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1720 | /* |
| 1721 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1722 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1723 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1724 | */ |
| 1725 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1726 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1727 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1728 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1729 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1730 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1731 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1732 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1733 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1734 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1735 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1736 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1737 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1738 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1739 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1740 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1741 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1742 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1743 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1744 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1745 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1746 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1747 | { } |
| 1748 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1749 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1750 | /* |
| 1751 | * Uniwill pin configuration: |
| 1752 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1753 | * line = 0x1a |
| 1754 | */ |
| 1755 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1756 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1757 | |
| 1758 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1759 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1760 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1761 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1762 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1763 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1764 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1765 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1766 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1767 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1768 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1769 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1770 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1771 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1772 | |
| 1773 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1774 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1775 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1776 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1777 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1778 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1779 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1780 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1781 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1782 | |
| 1783 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1784 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1785 | |
| 1786 | { } |
| 1787 | }; |
| 1788 | |
| 1789 | /* |
| 1790 | * Uniwill P53 |
| 1791 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1792 | */ |
| 1793 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1794 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1795 | |
| 1796 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1797 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1798 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1799 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1800 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1801 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1802 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1803 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1804 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1805 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1806 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1807 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1808 | |
| 1809 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1810 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1811 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1812 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1813 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1814 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1815 | |
| 1816 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1817 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1818 | |
| 1819 | { } |
| 1820 | }; |
| 1821 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1822 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1823 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1824 | { } |
| 1825 | }; |
| 1826 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1827 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1828 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1829 | { |
| 1830 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1831 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1832 | |
| 1833 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1834 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1835 | bits = present ? HDA_AMP_MUTE : 0; |
| 1836 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1837 | HDA_AMP_MUTE, bits); |
| 1838 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1839 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1840 | } |
| 1841 | |
| 1842 | /* auto-toggle front mic */ |
| 1843 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1844 | { |
| 1845 | unsigned int present; |
| 1846 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1847 | |
| 1848 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1849 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1850 | bits = present ? HDA_AMP_MUTE : 0; |
| 1851 | 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] | 1852 | } |
| 1853 | |
| 1854 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1855 | { |
| 1856 | alc880_uniwill_hp_automute(codec); |
| 1857 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1858 | } |
| 1859 | |
| 1860 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1861 | unsigned int res) |
| 1862 | { |
| 1863 | /* Looks like the unsol event is incompatible with the standard |
| 1864 | * definition. 4bit tag is placed at 28 bit! |
| 1865 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1866 | switch (res >> 28) { |
| 1867 | case ALC880_HP_EVENT: |
| 1868 | alc880_uniwill_hp_automute(codec); |
| 1869 | break; |
| 1870 | case ALC880_MIC_EVENT: |
| 1871 | alc880_uniwill_mic_automute(codec); |
| 1872 | break; |
| 1873 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1874 | } |
| 1875 | |
| 1876 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1877 | { |
| 1878 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1879 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1880 | |
| 1881 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1882 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1883 | bits = present ? HDA_AMP_MUTE : 0; |
| 1884 | 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] | 1885 | } |
| 1886 | |
| 1887 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1888 | { |
| 1889 | unsigned int present; |
| 1890 | |
| 1891 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1892 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1893 | present &= HDA_AMP_VOLMASK; |
| 1894 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1895 | HDA_AMP_VOLMASK, present); |
| 1896 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1897 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1898 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1899 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1900 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1901 | unsigned int res) |
| 1902 | { |
| 1903 | /* Looks like the unsol event is incompatible with the standard |
| 1904 | * definition. 4bit tag is placed at 28 bit! |
| 1905 | */ |
| 1906 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1907 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1908 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1909 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1910 | } |
| 1911 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1912 | /* |
| 1913 | * F1734 pin configuration: |
| 1914 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1915 | */ |
| 1916 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1917 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1918 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1919 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1920 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1921 | |
| 1922 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1923 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1924 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1925 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1926 | |
| 1927 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1928 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1929 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1930 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1931 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1932 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1933 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1934 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1935 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1936 | |
| 1937 | { } |
| 1938 | }; |
| 1939 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1940 | /* |
| 1941 | * ASUS pin configuration: |
| 1942 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1943 | */ |
| 1944 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1945 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1946 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1947 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1948 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1949 | |
| 1950 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1951 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1952 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1953 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1954 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1955 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1956 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1957 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1958 | |
| 1959 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1960 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1961 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1962 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1963 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1964 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1965 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1966 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1967 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1968 | |
| 1969 | { } |
| 1970 | }; |
| 1971 | |
| 1972 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1973 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1974 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1975 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1976 | /* Clevo m520g init */ |
| 1977 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1978 | /* headphone output */ |
| 1979 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1980 | /* line-out */ |
| 1981 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1982 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1983 | /* Line-in */ |
| 1984 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1985 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1986 | /* CD */ |
| 1987 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1988 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1989 | /* Mic1 (rear panel) */ |
| 1990 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1991 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1992 | /* Mic2 (front panel) */ |
| 1993 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1994 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1995 | /* headphone */ |
| 1996 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1997 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1998 | /* change to EAPD mode */ |
| 1999 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2000 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2001 | |
| 2002 | { } |
| 2003 | }; |
| 2004 | |
| 2005 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2006 | /* change to EAPD mode */ |
| 2007 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2008 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2009 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2010 | /* Headphone output */ |
| 2011 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2012 | /* Front output*/ |
| 2013 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2014 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2015 | |
| 2016 | /* Line In pin widget for input */ |
| 2017 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2018 | /* CD pin widget for input */ |
| 2019 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2020 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2021 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2022 | |
| 2023 | /* change to EAPD mode */ |
| 2024 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2025 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2026 | |
| 2027 | { } |
| 2028 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2029 | |
| 2030 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2031 | * LG m1 express dual |
| 2032 | * |
| 2033 | * Pin assignment: |
| 2034 | * Rear Line-In/Out (blue): 0x14 |
| 2035 | * Build-in Mic-In: 0x15 |
| 2036 | * Speaker-out: 0x17 |
| 2037 | * HP-Out (green): 0x1b |
| 2038 | * Mic-In/Out (red): 0x19 |
| 2039 | * SPDIF-Out: 0x1e |
| 2040 | */ |
| 2041 | |
| 2042 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2043 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2044 | 0x05, 0x02, 0x03 |
| 2045 | }; |
| 2046 | |
| 2047 | /* seems analog CD is not working */ |
| 2048 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2049 | .num_items = 3, |
| 2050 | .items = { |
| 2051 | { "Mic", 0x1 }, |
| 2052 | { "Line", 0x5 }, |
| 2053 | { "Internal Mic", 0x6 }, |
| 2054 | }, |
| 2055 | }; |
| 2056 | |
| 2057 | /* 2,4,6 channel modes */ |
| 2058 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2059 | /* set line-in and mic-in to input */ |
| 2060 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2061 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2062 | { } |
| 2063 | }; |
| 2064 | |
| 2065 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2066 | /* set line-in to out and mic-in to input */ |
| 2067 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2068 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2069 | { } |
| 2070 | }; |
| 2071 | |
| 2072 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2073 | /* set line-in and mic-in to output */ |
| 2074 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2075 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2076 | { } |
| 2077 | }; |
| 2078 | |
| 2079 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2080 | { 2, alc880_lg_ch2_init }, |
| 2081 | { 4, alc880_lg_ch4_init }, |
| 2082 | { 6, alc880_lg_ch6_init }, |
| 2083 | }; |
| 2084 | |
| 2085 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2087 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2088 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2089 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2090 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2091 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2092 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2093 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2094 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2095 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2096 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2097 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2098 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2099 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2100 | { |
| 2101 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2102 | .name = "Channel Mode", |
| 2103 | .info = alc_ch_mode_info, |
| 2104 | .get = alc_ch_mode_get, |
| 2105 | .put = alc_ch_mode_put, |
| 2106 | }, |
| 2107 | { } /* end */ |
| 2108 | }; |
| 2109 | |
| 2110 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2111 | /* set capture source to mic-in */ |
| 2112 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2113 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2114 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2115 | /* mute all amp mixer inputs */ |
| 2116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2118 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2119 | /* line-in to input */ |
| 2120 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2121 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2122 | /* built-in mic */ |
| 2123 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2124 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2125 | /* speaker-out */ |
| 2126 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2127 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2128 | /* mic-in to input */ |
| 2129 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2130 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2131 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2132 | /* HP-out */ |
| 2133 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2134 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2135 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2136 | /* jack sense */ |
| 2137 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2138 | { } |
| 2139 | }; |
| 2140 | |
| 2141 | /* toggle speaker-output according to the hp-jack state */ |
| 2142 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2143 | { |
| 2144 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2145 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2146 | |
| 2147 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2148 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2149 | bits = present ? HDA_AMP_MUTE : 0; |
| 2150 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2151 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2152 | } |
| 2153 | |
| 2154 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2155 | { |
| 2156 | /* Looks like the unsol event is incompatible with the standard |
| 2157 | * definition. 4bit tag is placed at 28 bit! |
| 2158 | */ |
| 2159 | if ((res >> 28) == 0x01) |
| 2160 | alc880_lg_automute(codec); |
| 2161 | } |
| 2162 | |
| 2163 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2164 | * LG LW20 |
| 2165 | * |
| 2166 | * Pin assignment: |
| 2167 | * Speaker-out: 0x14 |
| 2168 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2169 | * Built-in Mic-In: 0x19 |
| 2170 | * Line-In: 0x1b |
| 2171 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2172 | * SPDIF-Out: 0x1e |
| 2173 | */ |
| 2174 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2175 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2176 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2177 | .items = { |
| 2178 | { "Mic", 0x0 }, |
| 2179 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2180 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2181 | }, |
| 2182 | }; |
| 2183 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2184 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2185 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2186 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2187 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2188 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2189 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2190 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2191 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2192 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2193 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2194 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2195 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2196 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2197 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2198 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2199 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2200 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2201 | { |
| 2202 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2203 | .name = "Channel Mode", |
| 2204 | .info = alc_ch_mode_info, |
| 2205 | .get = alc_ch_mode_get, |
| 2206 | .put = alc_ch_mode_put, |
| 2207 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2208 | { } /* end */ |
| 2209 | }; |
| 2210 | |
| 2211 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2212 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2213 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2214 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2215 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2216 | /* set capture source to mic-in */ |
| 2217 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2218 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2219 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2220 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2221 | /* speaker-out */ |
| 2222 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2223 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2224 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2225 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2226 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2227 | /* mic-in to input */ |
| 2228 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2229 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2230 | /* built-in mic */ |
| 2231 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2232 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2233 | /* jack sense */ |
| 2234 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2235 | { } |
| 2236 | }; |
| 2237 | |
| 2238 | /* toggle speaker-output according to the hp-jack state */ |
| 2239 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2240 | { |
| 2241 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2242 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2243 | |
| 2244 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2245 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2246 | bits = present ? HDA_AMP_MUTE : 0; |
| 2247 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2248 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2249 | } |
| 2250 | |
| 2251 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2252 | { |
| 2253 | /* Looks like the unsol event is incompatible with the standard |
| 2254 | * definition. 4bit tag is placed at 28 bit! |
| 2255 | */ |
| 2256 | if ((res >> 28) == 0x01) |
| 2257 | alc880_lg_lw_automute(codec); |
| 2258 | } |
| 2259 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2260 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2261 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2262 | { 0x0b, HDA_INPUT, 0 }, |
| 2263 | { 0x0b, HDA_INPUT, 1 }, |
| 2264 | { 0x0b, HDA_INPUT, 2 }, |
| 2265 | { 0x0b, HDA_INPUT, 3 }, |
| 2266 | { 0x0b, HDA_INPUT, 4 }, |
| 2267 | { } /* end */ |
| 2268 | }; |
| 2269 | |
| 2270 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2271 | { 0x0b, HDA_INPUT, 1 }, |
| 2272 | { 0x0b, HDA_INPUT, 6 }, |
| 2273 | { 0x0b, HDA_INPUT, 7 }, |
| 2274 | { } /* end */ |
| 2275 | }; |
| 2276 | #endif |
| 2277 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2278 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2279 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2280 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2281 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2282 | static int alc_init(struct hda_codec *codec) |
| 2283 | { |
| 2284 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2285 | unsigned int i; |
| 2286 | |
| 2287 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2288 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2289 | |
| 2290 | if (spec->init_hook) |
| 2291 | spec->init_hook(codec); |
| 2292 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2293 | return 0; |
| 2294 | } |
| 2295 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2296 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2297 | { |
| 2298 | struct alc_spec *spec = codec->spec; |
| 2299 | |
| 2300 | if (spec->unsol_event) |
| 2301 | spec->unsol_event(codec, res); |
| 2302 | } |
| 2303 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2304 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2305 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2306 | { |
| 2307 | struct alc_spec *spec = codec->spec; |
| 2308 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2309 | } |
| 2310 | #endif |
| 2311 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2312 | /* |
| 2313 | * Analog playback callbacks |
| 2314 | */ |
| 2315 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2316 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2317 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2318 | { |
| 2319 | struct alc_spec *spec = codec->spec; |
| 2320 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 2321 | } |
| 2322 | |
| 2323 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2324 | struct hda_codec *codec, |
| 2325 | unsigned int stream_tag, |
| 2326 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2327 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2328 | { |
| 2329 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2330 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2331 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2332 | } |
| 2333 | |
| 2334 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2335 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2336 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2337 | { |
| 2338 | struct alc_spec *spec = codec->spec; |
| 2339 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2340 | } |
| 2341 | |
| 2342 | /* |
| 2343 | * Digital out |
| 2344 | */ |
| 2345 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2346 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2347 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2348 | { |
| 2349 | struct alc_spec *spec = codec->spec; |
| 2350 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2351 | } |
| 2352 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2353 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2354 | struct hda_codec *codec, |
| 2355 | unsigned int stream_tag, |
| 2356 | unsigned int format, |
| 2357 | struct snd_pcm_substream *substream) |
| 2358 | { |
| 2359 | struct alc_spec *spec = codec->spec; |
| 2360 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2361 | stream_tag, format, substream); |
| 2362 | } |
| 2363 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2364 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2365 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2366 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2367 | { |
| 2368 | struct alc_spec *spec = codec->spec; |
| 2369 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2370 | } |
| 2371 | |
| 2372 | /* |
| 2373 | * Analog capture |
| 2374 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2375 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2376 | struct hda_codec *codec, |
| 2377 | unsigned int stream_tag, |
| 2378 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 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 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2383 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2384 | stream_tag, 0, format); |
| 2385 | return 0; |
| 2386 | } |
| 2387 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2388 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2389 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2390 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2391 | { |
| 2392 | struct alc_spec *spec = codec->spec; |
| 2393 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2394 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2395 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2396 | return 0; |
| 2397 | } |
| 2398 | |
| 2399 | |
| 2400 | /* |
| 2401 | */ |
| 2402 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2403 | .substreams = 1, |
| 2404 | .channels_min = 2, |
| 2405 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2406 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2407 | .ops = { |
| 2408 | .open = alc880_playback_pcm_open, |
| 2409 | .prepare = alc880_playback_pcm_prepare, |
| 2410 | .cleanup = alc880_playback_pcm_cleanup |
| 2411 | }, |
| 2412 | }; |
| 2413 | |
| 2414 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2415 | .substreams = 1, |
| 2416 | .channels_min = 2, |
| 2417 | .channels_max = 2, |
| 2418 | /* NID is set in alc_build_pcms */ |
| 2419 | }; |
| 2420 | |
| 2421 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2422 | .substreams = 1, |
| 2423 | .channels_min = 2, |
| 2424 | .channels_max = 2, |
| 2425 | /* NID is set in alc_build_pcms */ |
| 2426 | }; |
| 2427 | |
| 2428 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2429 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2430 | .channels_min = 2, |
| 2431 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2432 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2433 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2434 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2435 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2436 | }, |
| 2437 | }; |
| 2438 | |
| 2439 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2440 | .substreams = 1, |
| 2441 | .channels_min = 2, |
| 2442 | .channels_max = 2, |
| 2443 | /* NID is set in alc_build_pcms */ |
| 2444 | .ops = { |
| 2445 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2446 | .close = alc880_dig_playback_pcm_close, |
| 2447 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2448 | }, |
| 2449 | }; |
| 2450 | |
| 2451 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2452 | .substreams = 1, |
| 2453 | .channels_min = 2, |
| 2454 | .channels_max = 2, |
| 2455 | /* NID is set in alc_build_pcms */ |
| 2456 | }; |
| 2457 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2458 | /* 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] | 2459 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2460 | .substreams = 0, |
| 2461 | .channels_min = 0, |
| 2462 | .channels_max = 0, |
| 2463 | }; |
| 2464 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2465 | static int alc_build_pcms(struct hda_codec *codec) |
| 2466 | { |
| 2467 | struct alc_spec *spec = codec->spec; |
| 2468 | struct hda_pcm *info = spec->pcm_rec; |
| 2469 | int i; |
| 2470 | |
| 2471 | codec->num_pcms = 1; |
| 2472 | codec->pcm_info = info; |
| 2473 | |
| 2474 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2475 | if (spec->stream_analog_playback) { |
| 2476 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2477 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2478 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2479 | } |
| 2480 | if (spec->stream_analog_capture) { |
| 2481 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2482 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2483 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2484 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2485 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2486 | if (spec->channel_mode) { |
| 2487 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2488 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2489 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2490 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2491 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2492 | } |
| 2493 | } |
| 2494 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2495 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2496 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2497 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2498 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2499 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2500 | if (spec->multiout.dig_out_nid && |
| 2501 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2502 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2503 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2504 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2505 | if (spec->dig_in_nid && |
| 2506 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2507 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2508 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2509 | } |
| 2510 | } |
| 2511 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2512 | /* If the use of more than one ADC is requested for the current |
| 2513 | * model, configure a second analog capture-only PCM. |
| 2514 | */ |
| 2515 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2516 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2517 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2518 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2519 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2520 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2521 | if (spec->alt_dac_nid) { |
| 2522 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2523 | *spec->stream_analog_alt_playback; |
| 2524 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2525 | spec->alt_dac_nid; |
| 2526 | } else { |
| 2527 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2528 | alc_pcm_null_stream; |
| 2529 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2530 | } |
| 2531 | if (spec->num_adc_nids > 1) { |
| 2532 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2533 | *spec->stream_analog_alt_capture; |
| 2534 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2535 | spec->adc_nids[1]; |
| 2536 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2537 | spec->num_adc_nids - 1; |
| 2538 | } else { |
| 2539 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2540 | alc_pcm_null_stream; |
| 2541 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2542 | } |
| 2543 | } |
| 2544 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2545 | return 0; |
| 2546 | } |
| 2547 | |
| 2548 | static void alc_free(struct hda_codec *codec) |
| 2549 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2550 | struct alc_spec *spec = codec->spec; |
| 2551 | unsigned int i; |
| 2552 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2553 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2554 | return; |
| 2555 | |
| 2556 | if (spec->kctl_alloc) { |
| 2557 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2558 | kfree(spec->kctl_alloc[i].name); |
| 2559 | kfree(spec->kctl_alloc); |
| 2560 | } |
| 2561 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2562 | } |
| 2563 | |
| 2564 | /* |
| 2565 | */ |
| 2566 | static struct hda_codec_ops alc_patch_ops = { |
| 2567 | .build_controls = alc_build_controls, |
| 2568 | .build_pcms = alc_build_pcms, |
| 2569 | .init = alc_init, |
| 2570 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2571 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2572 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2573 | .check_power_status = alc_check_power_status, |
| 2574 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2575 | }; |
| 2576 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2577 | |
| 2578 | /* |
| 2579 | * Test configuration for debugging |
| 2580 | * |
| 2581 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2582 | * enum controls. |
| 2583 | */ |
| 2584 | #ifdef CONFIG_SND_DEBUG |
| 2585 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2586 | 0x02, 0x03, 0x04, 0x05 |
| 2587 | }; |
| 2588 | |
| 2589 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2590 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2591 | .items = { |
| 2592 | { "In-1", 0x0 }, |
| 2593 | { "In-2", 0x1 }, |
| 2594 | { "In-3", 0x2 }, |
| 2595 | { "In-4", 0x3 }, |
| 2596 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2597 | { "Front", 0x5 }, |
| 2598 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2599 | }, |
| 2600 | }; |
| 2601 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2602 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2603 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2604 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2605 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2606 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2607 | }; |
| 2608 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2609 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2610 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2611 | { |
| 2612 | static char *texts[] = { |
| 2613 | "N/A", "Line Out", "HP Out", |
| 2614 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2615 | }; |
| 2616 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2617 | uinfo->count = 1; |
| 2618 | uinfo->value.enumerated.items = 8; |
| 2619 | if (uinfo->value.enumerated.item >= 8) |
| 2620 | uinfo->value.enumerated.item = 7; |
| 2621 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2622 | return 0; |
| 2623 | } |
| 2624 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2625 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2626 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2627 | { |
| 2628 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2629 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2630 | unsigned int pin_ctl, item = 0; |
| 2631 | |
| 2632 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2633 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2634 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2635 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2636 | item = 2; |
| 2637 | else |
| 2638 | item = 1; |
| 2639 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2640 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2641 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2642 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2643 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2644 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2645 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2646 | } |
| 2647 | } |
| 2648 | ucontrol->value.enumerated.item[0] = item; |
| 2649 | return 0; |
| 2650 | } |
| 2651 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2652 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2653 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2654 | { |
| 2655 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2656 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2657 | static unsigned int ctls[] = { |
| 2658 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2659 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2660 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2661 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2662 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2663 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2664 | }; |
| 2665 | unsigned int old_ctl, new_ctl; |
| 2666 | |
| 2667 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2668 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2669 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2670 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2671 | int val; |
| 2672 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2673 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2674 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2675 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2676 | HDA_AMP_MUTE : 0; |
| 2677 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2678 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2679 | return 1; |
| 2680 | } |
| 2681 | return 0; |
| 2682 | } |
| 2683 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2684 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2685 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2686 | { |
| 2687 | static char *texts[] = { |
| 2688 | "Front", "Surround", "CLFE", "Side" |
| 2689 | }; |
| 2690 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2691 | uinfo->count = 1; |
| 2692 | uinfo->value.enumerated.items = 4; |
| 2693 | if (uinfo->value.enumerated.item >= 4) |
| 2694 | uinfo->value.enumerated.item = 3; |
| 2695 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2696 | return 0; |
| 2697 | } |
| 2698 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2699 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2700 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2701 | { |
| 2702 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2703 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2704 | unsigned int sel; |
| 2705 | |
| 2706 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2707 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2708 | return 0; |
| 2709 | } |
| 2710 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2711 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2712 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2713 | { |
| 2714 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2715 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2716 | unsigned int sel; |
| 2717 | |
| 2718 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2719 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2720 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2721 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2722 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2723 | return 1; |
| 2724 | } |
| 2725 | return 0; |
| 2726 | } |
| 2727 | |
| 2728 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2729 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2730 | .name = xname, \ |
| 2731 | .info = alc_test_pin_ctl_info, \ |
| 2732 | .get = alc_test_pin_ctl_get, \ |
| 2733 | .put = alc_test_pin_ctl_put, \ |
| 2734 | .private_value = nid \ |
| 2735 | } |
| 2736 | |
| 2737 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2738 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2739 | .name = xname, \ |
| 2740 | .info = alc_test_pin_src_info, \ |
| 2741 | .get = alc_test_pin_src_get, \ |
| 2742 | .put = alc_test_pin_src_put, \ |
| 2743 | .private_value = nid \ |
| 2744 | } |
| 2745 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2746 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2747 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2748 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2749 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2750 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2751 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2752 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2753 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2754 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2755 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2756 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2757 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2758 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2759 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2760 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2761 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2762 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2763 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2764 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2765 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2766 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2767 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2768 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2769 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2770 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2771 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2772 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2773 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2774 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2775 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2776 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2777 | { |
| 2778 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2779 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2780 | .info = alc_ch_mode_info, |
| 2781 | .get = alc_ch_mode_get, |
| 2782 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2783 | }, |
| 2784 | { } /* end */ |
| 2785 | }; |
| 2786 | |
| 2787 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2788 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2789 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2790 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2791 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2792 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2793 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2794 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2795 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2796 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2797 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2798 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2799 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2800 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2801 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2802 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2803 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2804 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2805 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2806 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2807 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2808 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2809 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2810 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2811 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2812 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2813 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2814 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2815 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2816 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2817 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2818 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2819 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2820 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2821 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2822 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2823 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2824 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2825 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2826 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2827 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2828 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2829 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2830 | /* Analog input/passthru */ |
| 2831 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2832 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2833 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2834 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2835 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2836 | { } |
| 2837 | }; |
| 2838 | #endif |
| 2839 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2840 | /* |
| 2841 | */ |
| 2842 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2843 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2844 | [ALC880_3ST] = "3stack", |
| 2845 | [ALC880_TCL_S700] = "tcl", |
| 2846 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2847 | [ALC880_CLEVO] = "clevo", |
| 2848 | [ALC880_5ST] = "5stack", |
| 2849 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2850 | [ALC880_W810] = "w810", |
| 2851 | [ALC880_Z71V] = "z71v", |
| 2852 | [ALC880_6ST] = "6stack", |
| 2853 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2854 | [ALC880_ASUS] = "asus", |
| 2855 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2856 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2857 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2858 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2859 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2860 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2861 | [ALC880_F1734] = "F1734", |
| 2862 | [ALC880_LG] = "lg", |
| 2863 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2864 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2865 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2866 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2867 | [ALC880_AUTO] = "auto", |
| 2868 | }; |
| 2869 | |
| 2870 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2871 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2872 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2873 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2874 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2875 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2876 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2877 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2878 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2879 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2880 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2881 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2882 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2883 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2884 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2885 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2886 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2887 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2888 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2889 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2890 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2891 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2892 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2893 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2894 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2895 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2896 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2897 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2898 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2899 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2900 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2901 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2902 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2903 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2904 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2905 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2906 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2907 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2908 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2909 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2910 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2911 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2912 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2913 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2914 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2915 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2916 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2917 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2918 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2919 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2920 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2921 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2922 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2923 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2924 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2925 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 2926 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2927 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2928 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2929 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2930 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2931 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2932 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2933 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2934 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2935 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2936 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2937 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 2938 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2939 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2940 | {} |
| 2941 | }; |
| 2942 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2943 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2944 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2945 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2946 | static struct alc_config_preset alc880_presets[] = { |
| 2947 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2948 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2949 | .init_verbs = { alc880_volume_init_verbs, |
| 2950 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2951 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2952 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2953 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2954 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2955 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2956 | .input_mux = &alc880_capture_source, |
| 2957 | }, |
| 2958 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2959 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2960 | .init_verbs = { alc880_volume_init_verbs, |
| 2961 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2962 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2963 | .dac_nids = alc880_dac_nids, |
| 2964 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2965 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2966 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2967 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2968 | .input_mux = &alc880_capture_source, |
| 2969 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2970 | [ALC880_TCL_S700] = { |
| 2971 | .mixers = { alc880_tcl_s700_mixer }, |
| 2972 | .init_verbs = { alc880_volume_init_verbs, |
| 2973 | alc880_pin_tcl_S700_init_verbs, |
| 2974 | alc880_gpio2_init_verbs }, |
| 2975 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2976 | .dac_nids = alc880_dac_nids, |
| 2977 | .hp_nid = 0x03, |
| 2978 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2979 | .channel_mode = alc880_2_jack_modes, |
| 2980 | .input_mux = &alc880_capture_source, |
| 2981 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2982 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2983 | .mixers = { alc880_three_stack_mixer, |
| 2984 | alc880_five_stack_mixer}, |
| 2985 | .init_verbs = { alc880_volume_init_verbs, |
| 2986 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2987 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2988 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2989 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2990 | .channel_mode = alc880_fivestack_modes, |
| 2991 | .input_mux = &alc880_capture_source, |
| 2992 | }, |
| 2993 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2994 | .mixers = { alc880_three_stack_mixer, |
| 2995 | alc880_five_stack_mixer }, |
| 2996 | .init_verbs = { alc880_volume_init_verbs, |
| 2997 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2998 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2999 | .dac_nids = alc880_dac_nids, |
| 3000 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3001 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3002 | .channel_mode = alc880_fivestack_modes, |
| 3003 | .input_mux = &alc880_capture_source, |
| 3004 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3005 | [ALC880_6ST] = { |
| 3006 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3007 | .init_verbs = { alc880_volume_init_verbs, |
| 3008 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3009 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3010 | .dac_nids = alc880_6st_dac_nids, |
| 3011 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3012 | .channel_mode = alc880_sixstack_modes, |
| 3013 | .input_mux = &alc880_6stack_capture_source, |
| 3014 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3015 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3016 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3017 | .init_verbs = { alc880_volume_init_verbs, |
| 3018 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3019 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3020 | .dac_nids = alc880_6st_dac_nids, |
| 3021 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3022 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3023 | .channel_mode = alc880_sixstack_modes, |
| 3024 | .input_mux = &alc880_6stack_capture_source, |
| 3025 | }, |
| 3026 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3027 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3028 | .init_verbs = { alc880_volume_init_verbs, |
| 3029 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3030 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3031 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3032 | .dac_nids = alc880_w810_dac_nids, |
| 3033 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3034 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3035 | .channel_mode = alc880_w810_modes, |
| 3036 | .input_mux = &alc880_capture_source, |
| 3037 | }, |
| 3038 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3039 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3040 | .init_verbs = { alc880_volume_init_verbs, |
| 3041 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3042 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3043 | .dac_nids = alc880_z71v_dac_nids, |
| 3044 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3045 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3046 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3047 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3048 | .input_mux = &alc880_capture_source, |
| 3049 | }, |
| 3050 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3051 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3052 | .init_verbs = { alc880_volume_init_verbs, |
| 3053 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3054 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3055 | .dac_nids = alc880_f1734_dac_nids, |
| 3056 | .hp_nid = 0x02, |
| 3057 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3058 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3059 | .input_mux = &alc880_capture_source, |
| 3060 | }, |
| 3061 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3062 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3063 | .init_verbs = { alc880_volume_init_verbs, |
| 3064 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3065 | alc880_gpio1_init_verbs }, |
| 3066 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3067 | .dac_nids = alc880_asus_dac_nids, |
| 3068 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3069 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3070 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3071 | .input_mux = &alc880_capture_source, |
| 3072 | }, |
| 3073 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3074 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3075 | .init_verbs = { alc880_volume_init_verbs, |
| 3076 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3077 | alc880_gpio1_init_verbs }, |
| 3078 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3079 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3080 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3081 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3082 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3083 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3084 | .input_mux = &alc880_capture_source, |
| 3085 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3086 | [ALC880_ASUS_DIG2] = { |
| 3087 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3088 | .init_verbs = { alc880_volume_init_verbs, |
| 3089 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3090 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3091 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3092 | .dac_nids = alc880_asus_dac_nids, |
| 3093 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3094 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3095 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3096 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3097 | .input_mux = &alc880_capture_source, |
| 3098 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3099 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3100 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3101 | .init_verbs = { alc880_volume_init_verbs, |
| 3102 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3103 | alc880_gpio1_init_verbs }, |
| 3104 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3105 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3106 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3107 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3108 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3109 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3110 | .input_mux = &alc880_capture_source, |
| 3111 | }, |
| 3112 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3113 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3114 | .init_verbs = { alc880_volume_init_verbs, |
| 3115 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3116 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3117 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3118 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3119 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3120 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3121 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3122 | .input_mux = &alc880_capture_source, |
| 3123 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3124 | [ALC880_UNIWILL] = { |
| 3125 | .mixers = { alc880_uniwill_mixer }, |
| 3126 | .init_verbs = { alc880_volume_init_verbs, |
| 3127 | alc880_uniwill_init_verbs }, |
| 3128 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3129 | .dac_nids = alc880_asus_dac_nids, |
| 3130 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3131 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3132 | .channel_mode = alc880_threestack_modes, |
| 3133 | .need_dac_fix = 1, |
| 3134 | .input_mux = &alc880_capture_source, |
| 3135 | .unsol_event = alc880_uniwill_unsol_event, |
| 3136 | .init_hook = alc880_uniwill_automute, |
| 3137 | }, |
| 3138 | [ALC880_UNIWILL_P53] = { |
| 3139 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3140 | .init_verbs = { alc880_volume_init_verbs, |
| 3141 | alc880_uniwill_p53_init_verbs }, |
| 3142 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3143 | .dac_nids = alc880_asus_dac_nids, |
| 3144 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3145 | .channel_mode = alc880_threestack_modes, |
| 3146 | .input_mux = &alc880_capture_source, |
| 3147 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3148 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3149 | }, |
| 3150 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3151 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3152 | alc880_pcbeep_mixer, }, |
| 3153 | .init_verbs = { alc880_volume_init_verbs, |
| 3154 | alc880_uniwill_p53_init_verbs, |
| 3155 | alc880_beep_init_verbs }, |
| 3156 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3157 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3158 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3159 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3160 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3161 | .input_mux = &alc880_capture_source, |
| 3162 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3163 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3164 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3165 | [ALC880_CLEVO] = { |
| 3166 | .mixers = { alc880_three_stack_mixer }, |
| 3167 | .init_verbs = { alc880_volume_init_verbs, |
| 3168 | alc880_pin_clevo_init_verbs }, |
| 3169 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3170 | .dac_nids = alc880_dac_nids, |
| 3171 | .hp_nid = 0x03, |
| 3172 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3173 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3174 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3175 | .input_mux = &alc880_capture_source, |
| 3176 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3177 | [ALC880_LG] = { |
| 3178 | .mixers = { alc880_lg_mixer }, |
| 3179 | .init_verbs = { alc880_volume_init_verbs, |
| 3180 | alc880_lg_init_verbs }, |
| 3181 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3182 | .dac_nids = alc880_lg_dac_nids, |
| 3183 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3184 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3185 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3186 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3187 | .input_mux = &alc880_lg_capture_source, |
| 3188 | .unsol_event = alc880_lg_unsol_event, |
| 3189 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3190 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3191 | .loopbacks = alc880_lg_loopbacks, |
| 3192 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3193 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3194 | [ALC880_LG_LW] = { |
| 3195 | .mixers = { alc880_lg_lw_mixer }, |
| 3196 | .init_verbs = { alc880_volume_init_verbs, |
| 3197 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3198 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3199 | .dac_nids = alc880_dac_nids, |
| 3200 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3201 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3202 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3203 | .input_mux = &alc880_lg_lw_capture_source, |
| 3204 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3205 | .init_hook = alc880_lg_lw_automute, |
| 3206 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3207 | #ifdef CONFIG_SND_DEBUG |
| 3208 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3209 | .mixers = { alc880_test_mixer }, |
| 3210 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3211 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3212 | .dac_nids = alc880_test_dac_nids, |
| 3213 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3214 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3215 | .channel_mode = alc880_test_modes, |
| 3216 | .input_mux = &alc880_test_capture_source, |
| 3217 | }, |
| 3218 | #endif |
| 3219 | }; |
| 3220 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3221 | /* |
| 3222 | * Automatic parse of I/O pins from the BIOS configuration |
| 3223 | */ |
| 3224 | |
| 3225 | #define NUM_CONTROL_ALLOC 32 |
| 3226 | #define NUM_VERB_ALLOC 32 |
| 3227 | |
| 3228 | enum { |
| 3229 | ALC_CTL_WIDGET_VOL, |
| 3230 | ALC_CTL_WIDGET_MUTE, |
| 3231 | ALC_CTL_BIND_MUTE, |
| 3232 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3233 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3234 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3235 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3236 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3237 | }; |
| 3238 | |
| 3239 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3240 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3241 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3242 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3243 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3244 | |
| 3245 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3246 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3247 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3248 | /* array + terminator */ |
| 3249 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3250 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3251 | return -ENOMEM; |
| 3252 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3253 | memcpy(knew, spec->kctl_alloc, |
| 3254 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3255 | kfree(spec->kctl_alloc); |
| 3256 | } |
| 3257 | spec->kctl_alloc = knew; |
| 3258 | spec->num_kctl_alloc = num; |
| 3259 | } |
| 3260 | |
| 3261 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3262 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3263 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3264 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3265 | return -ENOMEM; |
| 3266 | knew->private_value = val; |
| 3267 | spec->num_kctl_used++; |
| 3268 | return 0; |
| 3269 | } |
| 3270 | |
| 3271 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3272 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3273 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3274 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3275 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3276 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3277 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3278 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3279 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3280 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3281 | #define ALC880_PIN_CD_NID 0x1c |
| 3282 | |
| 3283 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3284 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3285 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3286 | { |
| 3287 | hda_nid_t nid; |
| 3288 | int assigned[4]; |
| 3289 | int i, j; |
| 3290 | |
| 3291 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3292 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3293 | |
| 3294 | /* check the pins hardwired to audio widget */ |
| 3295 | for (i = 0; i < cfg->line_outs; i++) { |
| 3296 | nid = cfg->line_out_pins[i]; |
| 3297 | if (alc880_is_fixed_pin(nid)) { |
| 3298 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3299 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3300 | assigned[idx] = 1; |
| 3301 | } |
| 3302 | } |
| 3303 | /* left pins can be connect to any audio widget */ |
| 3304 | for (i = 0; i < cfg->line_outs; i++) { |
| 3305 | nid = cfg->line_out_pins[i]; |
| 3306 | if (alc880_is_fixed_pin(nid)) |
| 3307 | continue; |
| 3308 | /* search for an empty channel */ |
| 3309 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3310 | if (!assigned[j]) { |
| 3311 | spec->multiout.dac_nids[i] = |
| 3312 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3313 | assigned[j] = 1; |
| 3314 | break; |
| 3315 | } |
| 3316 | } |
| 3317 | } |
| 3318 | spec->multiout.num_dacs = cfg->line_outs; |
| 3319 | return 0; |
| 3320 | } |
| 3321 | |
| 3322 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3323 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3324 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3325 | { |
| 3326 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3327 | static const char *chname[4] = { |
| 3328 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3329 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3330 | hda_nid_t nid; |
| 3331 | int i, err; |
| 3332 | |
| 3333 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3334 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3335 | continue; |
| 3336 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3337 | if (i == 2) { |
| 3338 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3339 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3340 | "Center Playback Volume", |
| 3341 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3342 | HDA_OUTPUT)); |
| 3343 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3344 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3345 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3346 | "LFE Playback Volume", |
| 3347 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3348 | HDA_OUTPUT)); |
| 3349 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3350 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3351 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3352 | "Center Playback Switch", |
| 3353 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3354 | HDA_INPUT)); |
| 3355 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3356 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3357 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3358 | "LFE Playback Switch", |
| 3359 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3360 | HDA_INPUT)); |
| 3361 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3362 | return err; |
| 3363 | } else { |
| 3364 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3365 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3366 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3367 | HDA_OUTPUT)); |
| 3368 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3369 | return err; |
| 3370 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3371 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3372 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3373 | HDA_INPUT)); |
| 3374 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3375 | return err; |
| 3376 | } |
| 3377 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3378 | return 0; |
| 3379 | } |
| 3380 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3381 | /* add playback controls for speaker and HP outputs */ |
| 3382 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3383 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3384 | { |
| 3385 | hda_nid_t nid; |
| 3386 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3387 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3388 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3389 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3390 | return 0; |
| 3391 | |
| 3392 | if (alc880_is_fixed_pin(pin)) { |
| 3393 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3394 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3395 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3396 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3397 | else |
| 3398 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3399 | /* control HP volume/switch on the output mixer amp */ |
| 3400 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3401 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3402 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3403 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3404 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3405 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3406 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3407 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3408 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3409 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3410 | return err; |
| 3411 | } else if (alc880_is_multi_pin(pin)) { |
| 3412 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3413 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3414 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3415 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3416 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3417 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3418 | return err; |
| 3419 | } |
| 3420 | return 0; |
| 3421 | } |
| 3422 | |
| 3423 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3424 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3425 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3426 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3427 | { |
| 3428 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3429 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3430 | |
| 3431 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3432 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3433 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3434 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3435 | return err; |
| 3436 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3437 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3438 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3439 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3440 | return err; |
| 3441 | return 0; |
| 3442 | } |
| 3443 | |
| 3444 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3445 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3446 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3447 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3448 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3449 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3450 | |
| 3451 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3452 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3453 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3454 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3455 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3456 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3457 | if (err < 0) |
| 3458 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3459 | imux->items[imux->num_items].label = |
| 3460 | auto_pin_cfg_labels[i]; |
| 3461 | imux->items[imux->num_items].index = |
| 3462 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3463 | imux->num_items++; |
| 3464 | } |
| 3465 | } |
| 3466 | return 0; |
| 3467 | } |
| 3468 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3469 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3470 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3471 | int dac_idx) |
| 3472 | { |
| 3473 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3474 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3475 | pin_type); |
| 3476 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3477 | AMP_OUT_UNMUTE); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3478 | /* need the manual connection? */ |
| 3479 | if (alc880_is_multi_pin(nid)) { |
| 3480 | struct alc_spec *spec = codec->spec; |
| 3481 | int idx = alc880_multi_pin_idx(nid); |
| 3482 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3483 | AC_VERB_SET_CONNECT_SEL, |
| 3484 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3485 | } |
| 3486 | } |
| 3487 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3488 | static int get_pin_type(int line_out_type) |
| 3489 | { |
| 3490 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3491 | return PIN_HP; |
| 3492 | else |
| 3493 | return PIN_OUT; |
| 3494 | } |
| 3495 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3496 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3497 | { |
| 3498 | struct alc_spec *spec = codec->spec; |
| 3499 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3500 | |
| 3501 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3502 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3503 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3504 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3505 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3506 | } |
| 3507 | } |
| 3508 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3509 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3510 | { |
| 3511 | struct alc_spec *spec = codec->spec; |
| 3512 | hda_nid_t pin; |
| 3513 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3514 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3515 | if (pin) /* connect to front */ |
| 3516 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3517 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3518 | if (pin) /* connect to front */ |
| 3519 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3520 | } |
| 3521 | |
| 3522 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3523 | { |
| 3524 | struct alc_spec *spec = codec->spec; |
| 3525 | int i; |
| 3526 | |
| 3527 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3528 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3529 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3530 | snd_hda_codec_write(codec, nid, 0, |
| 3531 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3532 | i <= AUTO_PIN_FRONT_MIC ? |
| 3533 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3534 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3535 | snd_hda_codec_write(codec, nid, 0, |
| 3536 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3537 | AMP_OUT_MUTE); |
| 3538 | } |
| 3539 | } |
| 3540 | } |
| 3541 | |
| 3542 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3543 | /* return 1 if successful, 0 if the proper config is not found, |
| 3544 | * or a negative error code |
| 3545 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3546 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3547 | { |
| 3548 | struct alc_spec *spec = codec->spec; |
| 3549 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3550 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3551 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3552 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3553 | alc880_ignore); |
| 3554 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3555 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3556 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3557 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3558 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3559 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3560 | if (err < 0) |
| 3561 | return err; |
| 3562 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3563 | if (err < 0) |
| 3564 | return err; |
| 3565 | err = alc880_auto_create_extra_out(spec, |
| 3566 | spec->autocfg.speaker_pins[0], |
| 3567 | "Speaker"); |
| 3568 | if (err < 0) |
| 3569 | return err; |
| 3570 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3571 | "Headphone"); |
| 3572 | if (err < 0) |
| 3573 | return err; |
| 3574 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3575 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3576 | return err; |
| 3577 | |
| 3578 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3579 | |
| 3580 | if (spec->autocfg.dig_out_pin) |
| 3581 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3582 | if (spec->autocfg.dig_in_pin) |
| 3583 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3584 | |
| 3585 | if (spec->kctl_alloc) |
| 3586 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3587 | |
| 3588 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3589 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3590 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3591 | spec->input_mux = &spec->private_imux; |
| 3592 | |
| 3593 | return 1; |
| 3594 | } |
| 3595 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3596 | /* additional initialization for auto-configuration model */ |
| 3597 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3598 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3599 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3600 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3601 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3602 | } |
| 3603 | |
| 3604 | /* |
| 3605 | * OK, here we have finally the patch for ALC880 |
| 3606 | */ |
| 3607 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3608 | static int patch_alc880(struct hda_codec *codec) |
| 3609 | { |
| 3610 | struct alc_spec *spec; |
| 3611 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3612 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3613 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3614 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3615 | if (spec == NULL) |
| 3616 | return -ENOMEM; |
| 3617 | |
| 3618 | codec->spec = spec; |
| 3619 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3620 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3621 | alc880_models, |
| 3622 | alc880_cfg_tbl); |
| 3623 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3624 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3625 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3626 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3627 | } |
| 3628 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3629 | if (board_config == ALC880_AUTO) { |
| 3630 | /* automatic parse from the BIOS config */ |
| 3631 | err = alc880_parse_auto_config(codec); |
| 3632 | if (err < 0) { |
| 3633 | alc_free(codec); |
| 3634 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3635 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3636 | printk(KERN_INFO |
| 3637 | "hda_codec: Cannot set up configuration " |
| 3638 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3639 | board_config = ALC880_3ST; |
| 3640 | } |
| 3641 | } |
| 3642 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3643 | if (board_config != ALC880_AUTO) |
| 3644 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3645 | |
| 3646 | spec->stream_name_analog = "ALC880 Analog"; |
| 3647 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3648 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3649 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3650 | |
| 3651 | spec->stream_name_digital = "ALC880 Digital"; |
| 3652 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3653 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3654 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3655 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3656 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3657 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3658 | /* get type */ |
| 3659 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3660 | if (wcap != AC_WID_AUD_IN) { |
| 3661 | spec->adc_nids = alc880_adc_nids_alt; |
| 3662 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3663 | spec->mixers[spec->num_mixers] = |
| 3664 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3665 | spec->num_mixers++; |
| 3666 | } else { |
| 3667 | spec->adc_nids = alc880_adc_nids; |
| 3668 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3669 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3670 | spec->num_mixers++; |
| 3671 | } |
| 3672 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3673 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3674 | spec->vmaster_nid = 0x0c; |
| 3675 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3676 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3677 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3678 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3679 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3680 | if (!spec->loopback.amplist) |
| 3681 | spec->loopback.amplist = alc880_loopbacks; |
| 3682 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3683 | |
| 3684 | return 0; |
| 3685 | } |
| 3686 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3687 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3688 | /* |
| 3689 | * ALC260 support |
| 3690 | */ |
| 3691 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3692 | static hda_nid_t alc260_dac_nids[1] = { |
| 3693 | /* front */ |
| 3694 | 0x02, |
| 3695 | }; |
| 3696 | |
| 3697 | static hda_nid_t alc260_adc_nids[1] = { |
| 3698 | /* ADC0 */ |
| 3699 | 0x04, |
| 3700 | }; |
| 3701 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3702 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3703 | /* ADC1 */ |
| 3704 | 0x05, |
| 3705 | }; |
| 3706 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3707 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3708 | /* ADC1, 0 */ |
| 3709 | 0x05, 0x04 |
| 3710 | }; |
| 3711 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3712 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3713 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3714 | */ |
| 3715 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3716 | /* ADC0, ADC1 */ |
| 3717 | 0x04, 0x05 |
| 3718 | }; |
| 3719 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3720 | #define ALC260_DIGOUT_NID 0x03 |
| 3721 | #define ALC260_DIGIN_NID 0x06 |
| 3722 | |
| 3723 | static struct hda_input_mux alc260_capture_source = { |
| 3724 | .num_items = 4, |
| 3725 | .items = { |
| 3726 | { "Mic", 0x0 }, |
| 3727 | { "Front Mic", 0x1 }, |
| 3728 | { "Line", 0x2 }, |
| 3729 | { "CD", 0x4 }, |
| 3730 | }, |
| 3731 | }; |
| 3732 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3733 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3734 | * headphone jack and the internal CD lines since these are the only pins at |
| 3735 | * which audio can appear. For flexibility, also allow the option of |
| 3736 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3737 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3738 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3739 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3740 | { |
| 3741 | .num_items = 3, |
| 3742 | .items = { |
| 3743 | { "Mic/Line", 0x0 }, |
| 3744 | { "CD", 0x4 }, |
| 3745 | { "Headphone", 0x2 }, |
| 3746 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3747 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3748 | { |
| 3749 | .num_items = 4, |
| 3750 | .items = { |
| 3751 | { "Mic/Line", 0x0 }, |
| 3752 | { "CD", 0x4 }, |
| 3753 | { "Headphone", 0x2 }, |
| 3754 | { "Mixer", 0x5 }, |
| 3755 | }, |
| 3756 | }, |
| 3757 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3758 | }; |
| 3759 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3760 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3761 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3762 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3763 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3764 | { |
| 3765 | .num_items = 4, |
| 3766 | .items = { |
| 3767 | { "Mic", 0x0 }, |
| 3768 | { "Line", 0x2 }, |
| 3769 | { "CD", 0x4 }, |
| 3770 | { "Headphone", 0x5 }, |
| 3771 | }, |
| 3772 | }, |
| 3773 | { |
| 3774 | .num_items = 5, |
| 3775 | .items = { |
| 3776 | { "Mic", 0x0 }, |
| 3777 | { "Line", 0x2 }, |
| 3778 | { "CD", 0x4 }, |
| 3779 | { "Headphone", 0x6 }, |
| 3780 | { "Mixer", 0x5 }, |
| 3781 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3782 | }, |
| 3783 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3784 | /* |
| 3785 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3786 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3787 | * element which allows changing the channel mode, so the verb list is |
| 3788 | * never used. |
| 3789 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3790 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3791 | { 2, NULL }, |
| 3792 | }; |
| 3793 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3794 | |
| 3795 | /* Mixer combinations |
| 3796 | * |
| 3797 | * basic: base_output + input + pc_beep + capture |
| 3798 | * HP: base_output + input + capture_alt |
| 3799 | * HP_3013: hp_3013 + input + capture |
| 3800 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3801 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3802 | */ |
| 3803 | |
| 3804 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3805 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3806 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3807 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3808 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3809 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3810 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3811 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3812 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3813 | |
| 3814 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3815 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3816 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3817 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3818 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3821 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3822 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3823 | { } /* end */ |
| 3824 | }; |
| 3825 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3826 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3827 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3828 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3829 | { } /* end */ |
| 3830 | }; |
| 3831 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3832 | /* update HP, line and mono out pins according to the master switch */ |
| 3833 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 3834 | hda_nid_t hp, hda_nid_t line, |
| 3835 | hda_nid_t mono) |
| 3836 | { |
| 3837 | struct alc_spec *spec = codec->spec; |
| 3838 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 3839 | /* change HP and line-out pins */ |
| 3840 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3841 | val); |
| 3842 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3843 | val); |
| 3844 | /* mono (speaker) depending on the HP jack sense */ |
| 3845 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 3846 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3847 | val); |
| 3848 | } |
| 3849 | |
| 3850 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 3851 | struct snd_ctl_elem_value *ucontrol) |
| 3852 | { |
| 3853 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3854 | struct alc_spec *spec = codec->spec; |
| 3855 | *ucontrol->value.integer.value = spec->master_sw; |
| 3856 | return 0; |
| 3857 | } |
| 3858 | |
| 3859 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 3860 | struct snd_ctl_elem_value *ucontrol) |
| 3861 | { |
| 3862 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3863 | struct alc_spec *spec = codec->spec; |
| 3864 | int val = !!*ucontrol->value.integer.value; |
| 3865 | hda_nid_t hp, line, mono; |
| 3866 | |
| 3867 | if (val == spec->master_sw) |
| 3868 | return 0; |
| 3869 | spec->master_sw = val; |
| 3870 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 3871 | line = (kcontrol->private_value >> 8) & 0xff; |
| 3872 | mono = kcontrol->private_value & 0xff; |
| 3873 | alc260_hp_master_update(codec, hp, line, mono); |
| 3874 | return 1; |
| 3875 | } |
| 3876 | |
| 3877 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 3878 | { |
| 3879 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3880 | .name = "Master Playback Switch", |
| 3881 | .info = snd_ctl_boolean_mono_info, |
| 3882 | .get = alc260_hp_master_sw_get, |
| 3883 | .put = alc260_hp_master_sw_put, |
| 3884 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 3885 | }, |
| 3886 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3887 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 3888 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3889 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3890 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3891 | HDA_OUTPUT), |
| 3892 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3893 | { } /* end */ |
| 3894 | }; |
| 3895 | |
| 3896 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 3897 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3898 | {}, |
| 3899 | }; |
| 3900 | |
| 3901 | static void alc260_hp_automute(struct hda_codec *codec) |
| 3902 | { |
| 3903 | struct alc_spec *spec = codec->spec; |
| 3904 | unsigned int present; |
| 3905 | |
| 3906 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 3907 | AC_VERB_GET_PIN_SENSE, 0); |
| 3908 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3909 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 3910 | } |
| 3911 | |
| 3912 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3913 | { |
| 3914 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3915 | alc260_hp_automute(codec); |
| 3916 | } |
| 3917 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3918 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3919 | { |
| 3920 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3921 | .name = "Master Playback Switch", |
| 3922 | .info = snd_ctl_boolean_mono_info, |
| 3923 | .get = alc260_hp_master_sw_get, |
| 3924 | .put = alc260_hp_master_sw_put, |
| 3925 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 3926 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3927 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3928 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3929 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3930 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3931 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3932 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 3933 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3934 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3935 | { } /* end */ |
| 3936 | }; |
| 3937 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3938 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 3939 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3940 | {}, |
| 3941 | }; |
| 3942 | |
| 3943 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 3944 | { |
| 3945 | struct alc_spec *spec = codec->spec; |
| 3946 | unsigned int present; |
| 3947 | |
| 3948 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 3949 | AC_VERB_GET_PIN_SENSE, 0); |
| 3950 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3951 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 3952 | } |
| 3953 | |
| 3954 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 3955 | unsigned int res) |
| 3956 | { |
| 3957 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3958 | alc260_hp_3013_automute(codec); |
| 3959 | } |
| 3960 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3961 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3962 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3963 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3964 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3965 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3966 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3967 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3968 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3969 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3970 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3971 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3972 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3973 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3974 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3975 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3976 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3977 | { } /* end */ |
| 3978 | }; |
| 3979 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3980 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3981 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3982 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3983 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3984 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3985 | * revisions available in early 2006. Therefore for now allow the |
| 3986 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3987 | * that the lack of mic bias for this NID is intentional we could change the |
| 3988 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3989 | * |
| 3990 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3991 | * don't appear to make the mic bias available from the "line" jack, even |
| 3992 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3993 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3994 | * and the output jack. If this turns out to be the case for all such |
| 3995 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3996 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3997 | * |
| 3998 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 3999 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4000 | * controls for such models. On models without a "mono speaker" the control |
| 4001 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4002 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4003 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4004 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4005 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4006 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4007 | HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4008 | HDA_OUTPUT), |
| 4009 | HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, |
| 4010 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4011 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4012 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4013 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4014 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4015 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4016 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4017 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4018 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4019 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4020 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4021 | { } /* end */ |
| 4022 | }; |
| 4023 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4024 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4025 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4026 | */ |
| 4027 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4028 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4029 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4030 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4031 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4032 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4033 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4034 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4035 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4036 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4037 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4038 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4039 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4040 | { } /* end */ |
| 4041 | }; |
| 4042 | |
| 4043 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4044 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4045 | */ |
| 4046 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4047 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4048 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4049 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4050 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4051 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4052 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4053 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4054 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4055 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4056 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4057 | { } /* end */ |
| 4058 | }; |
| 4059 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4060 | /* capture mixer elements */ |
| 4061 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4062 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4063 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4064 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4065 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4066 | { |
| 4067 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4068 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4069 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4070 | */ |
| 4071 | /* .name = "Capture Source", */ |
| 4072 | .name = "Input Source", |
| 4073 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4074 | .info = alc_mux_enum_info, |
| 4075 | .get = alc_mux_enum_get, |
| 4076 | .put = alc_mux_enum_put, |
| 4077 | }, |
| 4078 | { } /* end */ |
| 4079 | }; |
| 4080 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4081 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4082 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4083 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4084 | { |
| 4085 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4086 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4087 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4088 | */ |
| 4089 | /* .name = "Capture Source", */ |
| 4090 | .name = "Input Source", |
| 4091 | .count = 1, |
| 4092 | .info = alc_mux_enum_info, |
| 4093 | .get = alc_mux_enum_get, |
| 4094 | .put = alc_mux_enum_put, |
| 4095 | }, |
| 4096 | { } /* end */ |
| 4097 | }; |
| 4098 | |
| 4099 | /* |
| 4100 | * initialization verbs |
| 4101 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4102 | static struct hda_verb alc260_init_verbs[] = { |
| 4103 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4104 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4105 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4106 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4107 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4108 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4109 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4110 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4111 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4112 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4113 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4114 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4115 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4116 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4117 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4118 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4119 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4120 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4121 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4122 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4123 | /* set connection select to line in (default select for this ADC) */ |
| 4124 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4125 | /* mute capture amp left and right */ |
| 4126 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4127 | /* set connection select to line in (default select for this ADC) */ |
| 4128 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4129 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4130 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4131 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4132 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4133 | /* set vol=0 HP mixer amp left and right */ |
| 4134 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4135 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4136 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4137 | /* set vol=0 Mono mixer amp left and right */ |
| 4138 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4139 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4140 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4141 | /* unmute LINE-2 out pin */ |
| 4142 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4143 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4144 | * Line In 2 = 0x03 |
| 4145 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4146 | /* mute analog inputs */ |
| 4147 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4148 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4149 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4150 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4151 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4152 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4153 | /* mute Front out path */ |
| 4154 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4155 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4156 | /* mute Headphone out path */ |
| 4157 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4158 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4159 | /* mute Mono out path */ |
| 4160 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4161 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4162 | { } |
| 4163 | }; |
| 4164 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4165 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4166 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4167 | /* Headphone and output */ |
| 4168 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4169 | /* mono output */ |
| 4170 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4171 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4172 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4173 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4174 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4175 | /* Line In pin widget for input */ |
| 4176 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4177 | /* Line-2 pin widget for output */ |
| 4178 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4179 | /* CD pin widget for input */ |
| 4180 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4181 | /* unmute amp left and right */ |
| 4182 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4183 | /* set connection select to line in (default select for this ADC) */ |
| 4184 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4185 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4186 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4187 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4188 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4189 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4190 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4191 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4192 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4193 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4194 | * Line In 2 = 0x03 |
| 4195 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4196 | /* mute analog inputs */ |
| 4197 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4198 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4201 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4202 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4203 | /* Unmute Front out path */ |
| 4204 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4205 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4206 | /* Unmute Headphone out path */ |
| 4207 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4208 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4209 | /* Unmute Mono out path */ |
| 4210 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4211 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4212 | { } |
| 4213 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4214 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4215 | |
| 4216 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4217 | /* Line out and output */ |
| 4218 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4219 | /* mono output */ |
| 4220 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4221 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4222 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4223 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4224 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4225 | /* Line In pin widget for input */ |
| 4226 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4227 | /* Headphone pin widget for output */ |
| 4228 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4229 | /* CD pin widget for input */ |
| 4230 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4231 | /* unmute amp left and right */ |
| 4232 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4233 | /* set connection select to line in (default select for this ADC) */ |
| 4234 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4235 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4236 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4237 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4238 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4239 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4240 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4241 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4242 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4243 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4244 | * Line In 2 = 0x03 |
| 4245 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4246 | /* mute analog inputs */ |
| 4247 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4248 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4249 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4250 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4251 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4252 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4253 | /* Unmute Front out path */ |
| 4254 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4255 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4256 | /* Unmute Headphone out path */ |
| 4257 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4258 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4259 | /* Unmute Mono out path */ |
| 4260 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4261 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4262 | { } |
| 4263 | }; |
| 4264 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4265 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4266 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4267 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4268 | */ |
| 4269 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4270 | /* Disable all GPIOs */ |
| 4271 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4272 | /* Internal speaker is connected to headphone pin */ |
| 4273 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4274 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4275 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4276 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4277 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4278 | /* Ensure all other unused pins are disabled and muted. */ |
| 4279 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4280 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4281 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4282 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4283 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4284 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4285 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4286 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4287 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4288 | /* Disable digital (SPDIF) pins */ |
| 4289 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4290 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4291 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4292 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4293 | * when acting as an output. |
| 4294 | */ |
| 4295 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4296 | |
| 4297 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4298 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4299 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4300 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4301 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4302 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4303 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4304 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4305 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4306 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4307 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4308 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4309 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4310 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4311 | * If the pin mode is changed by the user the pin mode control will |
| 4312 | * take care of enabling the pin's input/output buffers as needed. |
| 4313 | * Therefore there's no need to enable the input buffer at this |
| 4314 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4315 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4316 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4317 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4318 | * mixer ctrl) |
| 4319 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4320 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4321 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4322 | /* Mute capture amp left and right */ |
| 4323 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4324 | /* Set ADC connection select to match default mixer setting - line |
| 4325 | * in (on mic1 pin) |
| 4326 | */ |
| 4327 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4328 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4329 | /* Do the same for the second ADC: mute capture input amp and |
| 4330 | * set ADC connection to line in (on mic1 pin) |
| 4331 | */ |
| 4332 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4333 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4334 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4335 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4336 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4337 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4338 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4339 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4340 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4341 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4342 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4343 | {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] | 4344 | |
| 4345 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4346 | }; |
| 4347 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4348 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4349 | * similar laptops (adapted from Fujitsu init verbs). |
| 4350 | */ |
| 4351 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4352 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4353 | * the headphone jack. Turn this on and rely on the standard mute |
| 4354 | * methods whenever the user wants to turn these outputs off. |
| 4355 | */ |
| 4356 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4357 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4358 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4359 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4360 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4361 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4362 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4363 | /* Line In jack is connected to Line1 pin */ |
| 4364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4365 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4366 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4367 | /* Ensure all other unused pins are disabled and muted. */ |
| 4368 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4369 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4370 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4371 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4372 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4373 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4374 | /* Disable digital (SPDIF) pins */ |
| 4375 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4376 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4377 | |
| 4378 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4379 | * bus when acting as outputs. |
| 4380 | */ |
| 4381 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4382 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4383 | |
| 4384 | /* Start with output sum widgets muted and their output gains at min */ |
| 4385 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4386 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4387 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4388 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4389 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4390 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4391 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4392 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4393 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4394 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4395 | /* Unmute Line-out pin widget amp left and right |
| 4396 | * (no equiv mixer ctrl) |
| 4397 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4398 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4399 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4400 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4401 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4402 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4403 | * will take care of enabling the pin's input/output buffers as needed. |
| 4404 | * Therefore there's no need to enable the input buffer at this |
| 4405 | * stage. |
| 4406 | */ |
| 4407 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4408 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4409 | |
| 4410 | /* Mute capture amp left and right */ |
| 4411 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4412 | /* Set ADC connection select to match default mixer setting - mic |
| 4413 | * (on mic1 pin) |
| 4414 | */ |
| 4415 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4416 | |
| 4417 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4418 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4419 | */ |
| 4420 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4421 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4422 | |
| 4423 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4424 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4425 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4426 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4427 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4428 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4429 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4430 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4431 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4432 | |
| 4433 | { } |
| 4434 | }; |
| 4435 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4436 | static struct hda_verb alc260_will_verbs[] = { |
| 4437 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4438 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4439 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4440 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4441 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4442 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4443 | {} |
| 4444 | }; |
| 4445 | |
| 4446 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4447 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4448 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4449 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4450 | |
| 4451 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4452 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4453 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4454 | |
| 4455 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4456 | {} |
| 4457 | }; |
| 4458 | |
| 4459 | /* toggle speaker-output according to the hp-jack state */ |
| 4460 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4461 | { |
| 4462 | unsigned int present; |
| 4463 | |
| 4464 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4465 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4466 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4467 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4468 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4469 | AC_VERB_SET_GPIO_DATA, 1); |
| 4470 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4471 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4472 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4473 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4474 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4475 | AC_VERB_SET_GPIO_DATA, 0); |
| 4476 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4477 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4478 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4479 | } |
| 4480 | } |
| 4481 | |
| 4482 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4483 | unsigned int res) |
| 4484 | { |
| 4485 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4486 | alc260_replacer_672v_automute(codec); |
| 4487 | } |
| 4488 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4489 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4490 | * configuration. |
| 4491 | */ |
| 4492 | #ifdef CONFIG_SND_DEBUG |
| 4493 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4494 | 0x02, |
| 4495 | }; |
| 4496 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4497 | 0x04, 0x05, |
| 4498 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4499 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4500 | * the signal assignments are different. This assumes that the first ADC |
| 4501 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4502 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4503 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4504 | { |
| 4505 | .num_items = 7, |
| 4506 | .items = { |
| 4507 | { "MIC1 pin", 0x0 }, |
| 4508 | { "MIC2 pin", 0x1 }, |
| 4509 | { "LINE1 pin", 0x2 }, |
| 4510 | { "LINE2 pin", 0x3 }, |
| 4511 | { "CD pin", 0x4 }, |
| 4512 | { "LINE-OUT pin", 0x5 }, |
| 4513 | { "HP-OUT pin", 0x6 }, |
| 4514 | }, |
| 4515 | }, |
| 4516 | { |
| 4517 | .num_items = 8, |
| 4518 | .items = { |
| 4519 | { "MIC1 pin", 0x0 }, |
| 4520 | { "MIC2 pin", 0x1 }, |
| 4521 | { "LINE1 pin", 0x2 }, |
| 4522 | { "LINE2 pin", 0x3 }, |
| 4523 | { "CD pin", 0x4 }, |
| 4524 | { "Mixer", 0x5 }, |
| 4525 | { "LINE-OUT pin", 0x6 }, |
| 4526 | { "HP-OUT pin", 0x7 }, |
| 4527 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4528 | }, |
| 4529 | }; |
| 4530 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4531 | /* Output driver widgets */ |
| 4532 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4533 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4534 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4535 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4536 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4537 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4538 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4539 | /* Modes for retasking pin widgets |
| 4540 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4541 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4542 | * mention this restriction. At this stage it's not clear whether |
| 4543 | * this behaviour is intentional or is a hardware bug in chip |
| 4544 | * revisions available at least up until early 2006. Therefore for |
| 4545 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4546 | * choices, but if it turns out that the lack of mic bias for these |
| 4547 | * NIDs is intentional we could change their modes from |
| 4548 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4549 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4550 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4551 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4552 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4553 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4554 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4555 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4556 | |
| 4557 | /* Loopback mixer controls */ |
| 4558 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4559 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4560 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4561 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4562 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4563 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4564 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4565 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4566 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4567 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4568 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4569 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4570 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4571 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4572 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4573 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4574 | |
| 4575 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4576 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4577 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4578 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4579 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4580 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4581 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4582 | * is ambigious as to which NID is which; testing on laptops which |
| 4583 | * make this output available should provide clarification. |
| 4584 | */ |
| 4585 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4586 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4587 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4588 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4589 | * this output to turn on an external amplifier. |
| 4590 | */ |
| 4591 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4592 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4593 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4594 | { } /* end */ |
| 4595 | }; |
| 4596 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4597 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4598 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4599 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4600 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4601 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4602 | /* Enable retasking pins as output, initially without power amp */ |
| 4603 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4604 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4605 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4606 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4607 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4608 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4609 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4610 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4611 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4612 | * payload also sets the generation to 0, output to be in "consumer" |
| 4613 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4614 | * control. |
| 4615 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4616 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4617 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4618 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4619 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4620 | * OUT1 sum bus when acting as an output. |
| 4621 | */ |
| 4622 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4623 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4624 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4625 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4626 | |
| 4627 | /* Start with output sum widgets muted and their output gains at min */ |
| 4628 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4629 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4630 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4631 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4632 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4633 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4634 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4635 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4636 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4637 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4638 | /* Unmute retasking pin widget output buffers since the default |
| 4639 | * state appears to be output. As the pin mode is changed by the |
| 4640 | * user the pin mode control will take care of enabling the pin's |
| 4641 | * input/output buffers as needed. |
| 4642 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4643 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4644 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4645 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4646 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4647 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4648 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4649 | /* Also unmute the mono-out pin widget */ |
| 4650 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4651 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4652 | /* Mute capture amp left and right */ |
| 4653 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4654 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4655 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4656 | */ |
| 4657 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4658 | |
| 4659 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4660 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4661 | */ |
| 4662 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4663 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4664 | |
| 4665 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4666 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4667 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4668 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4669 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4670 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4671 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4672 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4673 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4674 | |
| 4675 | { } |
| 4676 | }; |
| 4677 | #endif |
| 4678 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4679 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4680 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4681 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4682 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4683 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4684 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4685 | /* |
| 4686 | * for BIOS auto-configuration |
| 4687 | */ |
| 4688 | |
| 4689 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4690 | const char *pfx) |
| 4691 | { |
| 4692 | hda_nid_t nid_vol; |
| 4693 | unsigned long vol_val, sw_val; |
| 4694 | char name[32]; |
| 4695 | int err; |
| 4696 | |
| 4697 | if (nid >= 0x0f && nid < 0x11) { |
| 4698 | nid_vol = nid - 0x7; |
| 4699 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4700 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4701 | } else if (nid == 0x11) { |
| 4702 | nid_vol = nid - 0x7; |
| 4703 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4704 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4705 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4706 | nid_vol = 0x08; |
| 4707 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4708 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4709 | } else |
| 4710 | return 0; /* N/A */ |
| 4711 | |
| 4712 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4713 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4714 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4715 | return err; |
| 4716 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4717 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4718 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4719 | return err; |
| 4720 | return 1; |
| 4721 | } |
| 4722 | |
| 4723 | /* add playback controls from the parsed DAC table */ |
| 4724 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4725 | const struct auto_pin_cfg *cfg) |
| 4726 | { |
| 4727 | hda_nid_t nid; |
| 4728 | int err; |
| 4729 | |
| 4730 | spec->multiout.num_dacs = 1; |
| 4731 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4732 | spec->multiout.dac_nids[0] = 0x02; |
| 4733 | |
| 4734 | nid = cfg->line_out_pins[0]; |
| 4735 | if (nid) { |
| 4736 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4737 | if (err < 0) |
| 4738 | return err; |
| 4739 | } |
| 4740 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4741 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4742 | if (nid) { |
| 4743 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4744 | if (err < 0) |
| 4745 | return err; |
| 4746 | } |
| 4747 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4748 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4749 | if (nid) { |
| 4750 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4751 | if (err < 0) |
| 4752 | return err; |
| 4753 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4754 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4755 | } |
| 4756 | |
| 4757 | /* create playback/capture controls for input pins */ |
| 4758 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4759 | const struct auto_pin_cfg *cfg) |
| 4760 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4761 | struct hda_input_mux *imux = &spec->private_imux; |
| 4762 | int i, err, idx; |
| 4763 | |
| 4764 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4765 | if (cfg->input_pins[i] >= 0x12) { |
| 4766 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4767 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4768 | auto_pin_cfg_labels[i], idx, |
| 4769 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4770 | if (err < 0) |
| 4771 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4772 | imux->items[imux->num_items].label = |
| 4773 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4774 | imux->items[imux->num_items].index = idx; |
| 4775 | imux->num_items++; |
| 4776 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4777 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4778 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4779 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4780 | auto_pin_cfg_labels[i], idx, |
| 4781 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4782 | if (err < 0) |
| 4783 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4784 | imux->items[imux->num_items].label = |
| 4785 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4786 | imux->items[imux->num_items].index = idx; |
| 4787 | imux->num_items++; |
| 4788 | } |
| 4789 | } |
| 4790 | return 0; |
| 4791 | } |
| 4792 | |
| 4793 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4794 | hda_nid_t nid, int pin_type, |
| 4795 | int sel_idx) |
| 4796 | { |
| 4797 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4798 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4799 | pin_type); |
| 4800 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4801 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4802 | /* need the manual connection? */ |
| 4803 | if (nid >= 0x12) { |
| 4804 | int idx = nid - 0x12; |
| 4805 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4806 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4807 | } |
| 4808 | } |
| 4809 | |
| 4810 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4811 | { |
| 4812 | struct alc_spec *spec = codec->spec; |
| 4813 | hda_nid_t nid; |
| 4814 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4815 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4816 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4817 | if (nid) { |
| 4818 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4819 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4820 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4821 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4822 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4823 | if (nid) |
| 4824 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4825 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4826 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4827 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4828 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4829 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4830 | |
| 4831 | #define ALC260_PIN_CD_NID 0x16 |
| 4832 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4833 | { |
| 4834 | struct alc_spec *spec = codec->spec; |
| 4835 | int i; |
| 4836 | |
| 4837 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4838 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4839 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4840 | snd_hda_codec_write(codec, nid, 0, |
| 4841 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4842 | i <= AUTO_PIN_FRONT_MIC ? |
| 4843 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4844 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4845 | snd_hda_codec_write(codec, nid, 0, |
| 4846 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4847 | AMP_OUT_MUTE); |
| 4848 | } |
| 4849 | } |
| 4850 | } |
| 4851 | |
| 4852 | /* |
| 4853 | * generic initialization of ADC, input mixers and output mixers |
| 4854 | */ |
| 4855 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4856 | /* |
| 4857 | * Unmute ADC0-1 and set the default input to mic-in |
| 4858 | */ |
| 4859 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4860 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4861 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4862 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4863 | |
| 4864 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4865 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4866 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4867 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4868 | */ |
| 4869 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4870 | /* mute analog inputs */ |
| 4871 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4872 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4873 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4874 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4875 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4876 | |
| 4877 | /* |
| 4878 | * Set up output mixers (0x08 - 0x0a) |
| 4879 | */ |
| 4880 | /* set vol=0 to output mixers */ |
| 4881 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4882 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4883 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4884 | /* set up input amps for analog loopback */ |
| 4885 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4886 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4887 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4888 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4889 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4890 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4891 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4892 | |
| 4893 | { } |
| 4894 | }; |
| 4895 | |
| 4896 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4897 | { |
| 4898 | struct alc_spec *spec = codec->spec; |
| 4899 | unsigned int wcap; |
| 4900 | int err; |
| 4901 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4902 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4903 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4904 | alc260_ignore); |
| 4905 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4906 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4907 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4908 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4909 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4910 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4911 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4912 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4913 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4914 | return err; |
| 4915 | |
| 4916 | spec->multiout.max_channels = 2; |
| 4917 | |
| 4918 | if (spec->autocfg.dig_out_pin) |
| 4919 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4920 | if (spec->kctl_alloc) |
| 4921 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4922 | |
| 4923 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4924 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4925 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4926 | spec->input_mux = &spec->private_imux; |
| 4927 | |
| 4928 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4929 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4930 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4931 | if (wcap != AC_WID_AUD_IN) { |
| 4932 | spec->adc_nids = alc260_adc_nids_alt; |
| 4933 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4934 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4935 | } else { |
| 4936 | spec->adc_nids = alc260_adc_nids; |
| 4937 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4938 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4939 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4940 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4941 | |
| 4942 | return 1; |
| 4943 | } |
| 4944 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4945 | /* additional initialization for auto-configuration model */ |
| 4946 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4947 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4948 | alc260_auto_init_multi_out(codec); |
| 4949 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4950 | } |
| 4951 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4952 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4953 | static struct hda_amp_list alc260_loopbacks[] = { |
| 4954 | { 0x07, HDA_INPUT, 0 }, |
| 4955 | { 0x07, HDA_INPUT, 1 }, |
| 4956 | { 0x07, HDA_INPUT, 2 }, |
| 4957 | { 0x07, HDA_INPUT, 3 }, |
| 4958 | { 0x07, HDA_INPUT, 4 }, |
| 4959 | { } /* end */ |
| 4960 | }; |
| 4961 | #endif |
| 4962 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4963 | /* |
| 4964 | * ALC260 configurations |
| 4965 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4966 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4967 | [ALC260_BASIC] = "basic", |
| 4968 | [ALC260_HP] = "hp", |
| 4969 | [ALC260_HP_3013] = "hp-3013", |
| 4970 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4971 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4972 | [ALC260_WILL] = "will", |
| 4973 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4974 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4975 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4976 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4977 | [ALC260_AUTO] = "auto", |
| 4978 | }; |
| 4979 | |
| 4980 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4981 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4982 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 4983 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 4984 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4985 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 4986 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 4987 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 4988 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 4989 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 4990 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 4991 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 4992 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 4993 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 4994 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 4995 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 4996 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4997 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4998 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4999 | {} |
| 5000 | }; |
| 5001 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5002 | static struct alc_config_preset alc260_presets[] = { |
| 5003 | [ALC260_BASIC] = { |
| 5004 | .mixers = { alc260_base_output_mixer, |
| 5005 | alc260_input_mixer, |
| 5006 | alc260_pc_beep_mixer, |
| 5007 | alc260_capture_mixer }, |
| 5008 | .init_verbs = { alc260_init_verbs }, |
| 5009 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5010 | .dac_nids = alc260_dac_nids, |
| 5011 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5012 | .adc_nids = alc260_adc_nids, |
| 5013 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5014 | .channel_mode = alc260_modes, |
| 5015 | .input_mux = &alc260_capture_source, |
| 5016 | }, |
| 5017 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5018 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5019 | alc260_input_mixer, |
| 5020 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5021 | .init_verbs = { alc260_init_verbs, |
| 5022 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5023 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5024 | .dac_nids = alc260_dac_nids, |
| 5025 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5026 | .adc_nids = alc260_hp_adc_nids, |
| 5027 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5028 | .channel_mode = alc260_modes, |
| 5029 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5030 | .unsol_event = alc260_hp_unsol_event, |
| 5031 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5032 | }, |
| 5033 | [ALC260_HP_3013] = { |
| 5034 | .mixers = { alc260_hp_3013_mixer, |
| 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_hp_3013_init_verbs, |
| 5038 | alc260_hp_3013_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_3013_unsol_event, |
| 5047 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5048 | }, |
| 5049 | [ALC260_FUJITSU_S702X] = { |
| 5050 | .mixers = { alc260_fujitsu_mixer, |
| 5051 | alc260_capture_mixer }, |
| 5052 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5053 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5054 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5055 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5056 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5057 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5058 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5059 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5060 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5061 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5062 | [ALC260_ACER] = { |
| 5063 | .mixers = { alc260_acer_mixer, |
| 5064 | alc260_capture_mixer }, |
| 5065 | .init_verbs = { alc260_acer_init_verbs }, |
| 5066 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5067 | .dac_nids = alc260_dac_nids, |
| 5068 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5069 | .adc_nids = alc260_dual_adc_nids, |
| 5070 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5071 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5072 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5073 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5074 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5075 | [ALC260_WILL] = { |
| 5076 | .mixers = { alc260_will_mixer, |
| 5077 | alc260_capture_mixer }, |
| 5078 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5079 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5080 | .dac_nids = alc260_dac_nids, |
| 5081 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5082 | .adc_nids = alc260_adc_nids, |
| 5083 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5084 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5085 | .channel_mode = alc260_modes, |
| 5086 | .input_mux = &alc260_capture_source, |
| 5087 | }, |
| 5088 | [ALC260_REPLACER_672V] = { |
| 5089 | .mixers = { alc260_replacer_672v_mixer, |
| 5090 | alc260_capture_mixer }, |
| 5091 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5092 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5093 | .dac_nids = alc260_dac_nids, |
| 5094 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5095 | .adc_nids = alc260_adc_nids, |
| 5096 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5097 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5098 | .channel_mode = alc260_modes, |
| 5099 | .input_mux = &alc260_capture_source, |
| 5100 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5101 | .init_hook = alc260_replacer_672v_automute, |
| 5102 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5103 | #ifdef CONFIG_SND_DEBUG |
| 5104 | [ALC260_TEST] = { |
| 5105 | .mixers = { alc260_test_mixer, |
| 5106 | alc260_capture_mixer }, |
| 5107 | .init_verbs = { alc260_test_init_verbs }, |
| 5108 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5109 | .dac_nids = alc260_test_dac_nids, |
| 5110 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5111 | .adc_nids = alc260_test_adc_nids, |
| 5112 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5113 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5114 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5115 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5116 | }, |
| 5117 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5118 | }; |
| 5119 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5120 | static int patch_alc260(struct hda_codec *codec) |
| 5121 | { |
| 5122 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5123 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5124 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5125 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5126 | if (spec == NULL) |
| 5127 | return -ENOMEM; |
| 5128 | |
| 5129 | codec->spec = spec; |
| 5130 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5131 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5132 | alc260_models, |
| 5133 | alc260_cfg_tbl); |
| 5134 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5135 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5136 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5137 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5138 | } |
| 5139 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5140 | if (board_config == ALC260_AUTO) { |
| 5141 | /* automatic parse from the BIOS config */ |
| 5142 | err = alc260_parse_auto_config(codec); |
| 5143 | if (err < 0) { |
| 5144 | alc_free(codec); |
| 5145 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5146 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5147 | printk(KERN_INFO |
| 5148 | "hda_codec: Cannot set up configuration " |
| 5149 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5150 | board_config = ALC260_BASIC; |
| 5151 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5152 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5153 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5154 | if (board_config != ALC260_AUTO) |
| 5155 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5156 | |
| 5157 | spec->stream_name_analog = "ALC260 Analog"; |
| 5158 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5159 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5160 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5161 | spec->stream_name_digital = "ALC260 Digital"; |
| 5162 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5163 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5164 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5165 | spec->vmaster_nid = 0x08; |
| 5166 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5167 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5168 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5169 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5170 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5171 | if (!spec->loopback.amplist) |
| 5172 | spec->loopback.amplist = alc260_loopbacks; |
| 5173 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5174 | |
| 5175 | return 0; |
| 5176 | } |
| 5177 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5178 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5179 | /* |
| 5180 | * ALC882 support |
| 5181 | * |
| 5182 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5183 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5184 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5185 | * 6-channel independent captures. |
| 5186 | * |
| 5187 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5188 | * driver yet). |
| 5189 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5190 | #define ALC882_DIGOUT_NID 0x06 |
| 5191 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5192 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5193 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5194 | { 8, NULL } |
| 5195 | }; |
| 5196 | |
| 5197 | static hda_nid_t alc882_dac_nids[4] = { |
| 5198 | /* front, rear, clfe, rear_surr */ |
| 5199 | 0x02, 0x03, 0x04, 0x05 |
| 5200 | }; |
| 5201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5202 | /* identical with ALC880 */ |
| 5203 | #define alc882_adc_nids alc880_adc_nids |
| 5204 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5205 | |
| 5206 | /* input MUX */ |
| 5207 | /* FIXME: should be a matrix-type input source selection */ |
| 5208 | |
| 5209 | static struct hda_input_mux alc882_capture_source = { |
| 5210 | .num_items = 4, |
| 5211 | .items = { |
| 5212 | { "Mic", 0x0 }, |
| 5213 | { "Front Mic", 0x1 }, |
| 5214 | { "Line", 0x2 }, |
| 5215 | { "CD", 0x4 }, |
| 5216 | }, |
| 5217 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5218 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5219 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5220 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5221 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5222 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5223 | { |
| 5224 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5225 | struct alc_spec *spec = codec->spec; |
| 5226 | const struct hda_input_mux *imux = spec->input_mux; |
| 5227 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 5228 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 5229 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 5230 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5231 | unsigned int i, idx; |
| 5232 | |
| 5233 | idx = ucontrol->value.enumerated.item[0]; |
| 5234 | if (idx >= imux->num_items) |
| 5235 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5236 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5237 | return 0; |
| 5238 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5239 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5240 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5241 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5242 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5243 | } |
| 5244 | *cur_val = idx; |
| 5245 | return 1; |
| 5246 | } |
| 5247 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5248 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5249 | * 2ch mode |
| 5250 | */ |
| 5251 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5252 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5253 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5254 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5255 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5256 | { } /* end */ |
| 5257 | }; |
| 5258 | |
| 5259 | /* |
| 5260 | * 6ch mode |
| 5261 | */ |
| 5262 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5263 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5264 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5265 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5266 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5267 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5268 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5269 | { } /* end */ |
| 5270 | }; |
| 5271 | |
| 5272 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5273 | { 2, alc882_3ST_ch2_init }, |
| 5274 | { 6, alc882_3ST_ch6_init }, |
| 5275 | }; |
| 5276 | |
| 5277 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5278 | * 6ch mode |
| 5279 | */ |
| 5280 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5281 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5282 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5283 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5284 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5285 | { } /* end */ |
| 5286 | }; |
| 5287 | |
| 5288 | /* |
| 5289 | * 8ch mode |
| 5290 | */ |
| 5291 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5292 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5293 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5294 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5295 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5296 | { } /* end */ |
| 5297 | }; |
| 5298 | |
| 5299 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5300 | { 6, alc882_sixstack_ch6_init }, |
| 5301 | { 8, alc882_sixstack_ch8_init }, |
| 5302 | }; |
| 5303 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5304 | /* |
| 5305 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5306 | */ |
| 5307 | |
| 5308 | /* |
| 5309 | * 2ch mode |
| 5310 | */ |
| 5311 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5312 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5313 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5314 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5315 | { } /* end */ |
| 5316 | }; |
| 5317 | |
| 5318 | /* |
| 5319 | * 6ch mode |
| 5320 | */ |
| 5321 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5322 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5323 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5324 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5325 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5326 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5327 | { } /* end */ |
| 5328 | }; |
| 5329 | |
| 5330 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5331 | { 2, alc885_mbp_ch2_init }, |
| 5332 | { 6, alc885_mbp_ch6_init }, |
| 5333 | }; |
| 5334 | |
| 5335 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5336 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5337 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5338 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5339 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5340 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5341 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5342 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5343 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5344 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5345 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5346 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5347 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5348 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5349 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5350 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5351 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5352 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5353 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5354 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5355 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5356 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5357 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5358 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5359 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5360 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5361 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5362 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5363 | { } /* end */ |
| 5364 | }; |
| 5365 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5366 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5367 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5368 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5369 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5370 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5371 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5372 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5373 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5374 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5375 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5376 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5377 | { } /* end */ |
| 5378 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5379 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5380 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5381 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5382 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5383 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5384 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5385 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5386 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5387 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5388 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5389 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5390 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5391 | { } /* end */ |
| 5392 | }; |
| 5393 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5394 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5395 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5396 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5397 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5398 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5399 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5400 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5401 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5402 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5403 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5404 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5405 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5406 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5407 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5408 | { } /* end */ |
| 5409 | }; |
| 5410 | |
| 5411 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5412 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5413 | */ |
| 5414 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5415 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5416 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5417 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5418 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5419 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5420 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5421 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5422 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5423 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5424 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5425 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5426 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5427 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5428 | { } /* end */ |
| 5429 | }; |
| 5430 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5431 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5432 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5433 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5434 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5435 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5436 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5437 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5438 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5439 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5440 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5441 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5442 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5443 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5444 | { } /* end */ |
| 5445 | }; |
| 5446 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5447 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5448 | { |
| 5449 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5450 | .name = "Channel Mode", |
| 5451 | .info = alc_ch_mode_info, |
| 5452 | .get = alc_ch_mode_get, |
| 5453 | .put = alc_ch_mode_put, |
| 5454 | }, |
| 5455 | { } /* end */ |
| 5456 | }; |
| 5457 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5458 | static struct hda_verb alc882_init_verbs[] = { |
| 5459 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5460 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5461 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5463 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5464 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5465 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5466 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5467 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5468 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5469 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5470 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5471 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5472 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5473 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5474 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5475 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5476 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5477 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5478 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5479 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5480 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5481 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5482 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5483 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5484 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5485 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5486 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5487 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5488 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5489 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5490 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5491 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5492 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5493 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5494 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5495 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5496 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5497 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5498 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5499 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5500 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5501 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5502 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5503 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5504 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5505 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5506 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5507 | |
| 5508 | /* FIXME: use matrix-type input source selection */ |
| 5509 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5510 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5511 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5512 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5513 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5514 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5515 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5516 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5517 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5518 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5519 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5520 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5521 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5522 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5523 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5524 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5525 | /* ADC1: mute amp left and right */ |
| 5526 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5527 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5528 | /* ADC2: mute amp left and right */ |
| 5529 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5530 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5531 | /* ADC3: mute amp left and right */ |
| 5532 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5533 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5534 | |
| 5535 | { } |
| 5536 | }; |
| 5537 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5538 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5539 | /* change to EAPD mode */ |
| 5540 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5541 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5542 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5543 | }; |
| 5544 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5545 | /* Mac Pro test */ |
| 5546 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5547 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5548 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5549 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5550 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5551 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5552 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5553 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5554 | { } /* end */ |
| 5555 | }; |
| 5556 | |
| 5557 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5558 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5559 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5560 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5561 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5562 | /* Front Pin: output 0 (0x0c) */ |
| 5563 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5564 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5565 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5566 | /* Front Mic pin: input vref at 80% */ |
| 5567 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5568 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5569 | /* Speaker: output */ |
| 5570 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5571 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5572 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5573 | /* Headphone output (output 0 - 0x0c) */ |
| 5574 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5575 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5576 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5577 | |
| 5578 | /* FIXME: use matrix-type input source selection */ |
| 5579 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5580 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5581 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5582 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5583 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5584 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5585 | /* Input mixer2 */ |
| 5586 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5587 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5588 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5589 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5590 | /* Input mixer3 */ |
| 5591 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5592 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5593 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5594 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5595 | /* ADC1: mute amp left and right */ |
| 5596 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5597 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5598 | /* ADC2: mute amp left and right */ |
| 5599 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5600 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5601 | /* ADC3: mute amp left and right */ |
| 5602 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5603 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5604 | |
| 5605 | { } |
| 5606 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5607 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5608 | /* Macbook Pro rev3 */ |
| 5609 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5610 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5611 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5612 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5613 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5614 | /* Rear mixer */ |
| 5615 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5616 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5617 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5618 | /* Front Pin: output 0 (0x0c) */ |
| 5619 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5620 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5621 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5622 | /* HP Pin: output 0 (0x0d) */ |
| 5623 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5625 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5626 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5627 | /* Mic (rear) pin: input vref at 80% */ |
| 5628 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5629 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5630 | /* Front Mic pin: input vref at 80% */ |
| 5631 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5632 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5633 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5634 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5635 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5636 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5637 | |
| 5638 | /* FIXME: use matrix-type input source selection */ |
| 5639 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5640 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5641 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5642 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5643 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5644 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5645 | /* Input mixer2 */ |
| 5646 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5647 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5648 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5649 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5650 | /* Input mixer3 */ |
| 5651 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5652 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5653 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5654 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5655 | /* ADC1: mute amp left and right */ |
| 5656 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5657 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5658 | /* ADC2: mute amp left and right */ |
| 5659 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5660 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5661 | /* ADC3: mute amp left and right */ |
| 5662 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5663 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5664 | |
| 5665 | { } |
| 5666 | }; |
| 5667 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5668 | /* iMac 24 mixer. */ |
| 5669 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5670 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5671 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5672 | { } /* end */ |
| 5673 | }; |
| 5674 | |
| 5675 | /* iMac 24 init verbs. */ |
| 5676 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5677 | /* Internal speakers: output 0 (0x0c) */ |
| 5678 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5679 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5680 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5681 | /* Internal speakers: output 0 (0x0c) */ |
| 5682 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5683 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5684 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5685 | /* Headphone: output 0 (0x0c) */ |
| 5686 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5687 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5688 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5689 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5690 | /* Front Mic: input vref at 80% */ |
| 5691 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5692 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5693 | { } |
| 5694 | }; |
| 5695 | |
| 5696 | /* Toggle speaker-output according to the hp-jack state */ |
| 5697 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5698 | { |
| 5699 | unsigned int present; |
| 5700 | |
| 5701 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5702 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5703 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5704 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5705 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5706 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5707 | } |
| 5708 | |
| 5709 | /* Processes unsolicited events. */ |
| 5710 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5711 | unsigned int res) |
| 5712 | { |
| 5713 | /* Headphone insertion or removal. */ |
| 5714 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5715 | alc885_imac24_automute(codec); |
| 5716 | } |
| 5717 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5718 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5719 | { |
| 5720 | unsigned int present; |
| 5721 | |
| 5722 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5723 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5724 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5725 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5726 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5727 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5728 | |
| 5729 | } |
| 5730 | static void alc885_mbp3_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_mbp3_automute(codec); |
| 5736 | } |
| 5737 | |
| 5738 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5739 | static struct hda_verb alc882_targa_verbs[] = { |
| 5740 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5741 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5742 | |
| 5743 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5744 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5745 | |
| 5746 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5747 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5748 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5749 | |
| 5750 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5751 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5752 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5753 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5754 | { } /* end */ |
| 5755 | }; |
| 5756 | |
| 5757 | /* toggle speaker-output according to the hp-jack state */ |
| 5758 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5759 | { |
| 5760 | unsigned int present; |
| 5761 | |
| 5762 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5763 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5764 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5765 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5766 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5767 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5768 | } |
| 5769 | |
| 5770 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5771 | { |
| 5772 | /* Looks like the unsol event is incompatible with the standard |
| 5773 | * definition. 4bit tag is placed at 26 bit! |
| 5774 | */ |
| 5775 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5776 | alc882_targa_automute(codec); |
| 5777 | } |
| 5778 | } |
| 5779 | |
| 5780 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5781 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5782 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5783 | |
| 5784 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5785 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5786 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5787 | |
| 5788 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5789 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5790 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5791 | |
| 5792 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5793 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5794 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5795 | { } /* end */ |
| 5796 | }; |
| 5797 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5798 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5799 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5800 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5801 | |
| 5802 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5803 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5804 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5805 | |
| 5806 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5807 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5808 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5809 | |
| 5810 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5811 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5812 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5813 | { } /* end */ |
| 5814 | }; |
| 5815 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5816 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5817 | { |
| 5818 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5819 | |
| 5820 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5821 | AC_VERB_GET_GPIO_DATA, 0); |
| 5822 | |
| 5823 | if (!muted) |
| 5824 | gpiostate |= (1 << pin); |
| 5825 | else |
| 5826 | gpiostate &= ~(1 << pin); |
| 5827 | |
| 5828 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5829 | AC_VERB_GET_GPIO_MASK, 0); |
| 5830 | gpiomask |= (1 << pin); |
| 5831 | |
| 5832 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5833 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5834 | gpiodir |= (1 << pin); |
| 5835 | |
| 5836 | |
| 5837 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5838 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5839 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5840 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5841 | |
| 5842 | msleep(1); |
| 5843 | |
| 5844 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5845 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5846 | } |
| 5847 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5848 | /* set up GPIO at initialization */ |
| 5849 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5850 | { |
| 5851 | alc882_gpio_mute(codec, 0, 0); |
| 5852 | alc882_gpio_mute(codec, 1, 0); |
| 5853 | } |
| 5854 | |
| 5855 | /* set up GPIO and update auto-muting at initialization */ |
| 5856 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5857 | { |
| 5858 | alc885_macpro_init_hook(codec); |
| 5859 | alc885_imac24_automute(codec); |
| 5860 | } |
| 5861 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5862 | /* |
| 5863 | * generic initialization of ADC, input mixers and output mixers |
| 5864 | */ |
| 5865 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5866 | /* |
| 5867 | * Unmute ADC0-2 and set the default input to mic-in |
| 5868 | */ |
| 5869 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5870 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5871 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5872 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5873 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5874 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5875 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5876 | /* 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] | 5877 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5878 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5879 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5880 | */ |
| 5881 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5882 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5883 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5884 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5885 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5886 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5887 | |
| 5888 | /* |
| 5889 | * Set up output mixers (0x0c - 0x0f) |
| 5890 | */ |
| 5891 | /* set vol=0 to output mixers */ |
| 5892 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5893 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5894 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5895 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5896 | /* set up input amps for analog loopback */ |
| 5897 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5898 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5899 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5900 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5901 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5902 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5903 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5904 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5905 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5906 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5907 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5908 | |
| 5909 | /* FIXME: use matrix-type input source selection */ |
| 5910 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5911 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5912 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5913 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5914 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5915 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5916 | /* Input mixer2 */ |
| 5917 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5918 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5919 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5920 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5921 | /* Input mixer3 */ |
| 5922 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5923 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5924 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5925 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5926 | |
| 5927 | { } |
| 5928 | }; |
| 5929 | |
| 5930 | /* capture mixer elements */ |
| 5931 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5932 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5933 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5934 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5935 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5936 | { |
| 5937 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5938 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5939 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5940 | */ |
| 5941 | /* .name = "Capture Source", */ |
| 5942 | .name = "Input Source", |
| 5943 | .count = 2, |
| 5944 | .info = alc882_mux_enum_info, |
| 5945 | .get = alc882_mux_enum_get, |
| 5946 | .put = alc882_mux_enum_put, |
| 5947 | }, |
| 5948 | { } /* end */ |
| 5949 | }; |
| 5950 | |
| 5951 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5952 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5953 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5954 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5955 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5956 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5957 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5958 | { |
| 5959 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5960 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5961 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5962 | */ |
| 5963 | /* .name = "Capture Source", */ |
| 5964 | .name = "Input Source", |
| 5965 | .count = 3, |
| 5966 | .info = alc882_mux_enum_info, |
| 5967 | .get = alc882_mux_enum_get, |
| 5968 | .put = alc882_mux_enum_put, |
| 5969 | }, |
| 5970 | { } /* end */ |
| 5971 | }; |
| 5972 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5973 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5974 | #define alc882_loopbacks alc880_loopbacks |
| 5975 | #endif |
| 5976 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5977 | /* pcm configuration: identiacal with ALC880 */ |
| 5978 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 5979 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 5980 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 5981 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 5982 | |
| 5983 | /* |
| 5984 | * configuration and preset |
| 5985 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5986 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 5987 | [ALC882_3ST_DIG] = "3stack-dig", |
| 5988 | [ALC882_6ST_DIG] = "6stack-dig", |
| 5989 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5990 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 5991 | [ALC882_TARGA] = "targa", |
| 5992 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 5993 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5994 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5995 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5996 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5997 | [ALC882_AUTO] = "auto", |
| 5998 | }; |
| 5999 | |
| 6000 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6001 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6002 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6003 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6004 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6005 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6006 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6007 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6008 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6009 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6010 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6011 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6012 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6013 | {} |
| 6014 | }; |
| 6015 | |
| 6016 | static struct alc_config_preset alc882_presets[] = { |
| 6017 | [ALC882_3ST_DIG] = { |
| 6018 | .mixers = { alc882_base_mixer }, |
| 6019 | .init_verbs = { alc882_init_verbs }, |
| 6020 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6021 | .dac_nids = alc882_dac_nids, |
| 6022 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6023 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6024 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6025 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6026 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6027 | .input_mux = &alc882_capture_source, |
| 6028 | }, |
| 6029 | [ALC882_6ST_DIG] = { |
| 6030 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6031 | .init_verbs = { alc882_init_verbs }, |
| 6032 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6033 | .dac_nids = alc882_dac_nids, |
| 6034 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6035 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6036 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6037 | .channel_mode = alc882_sixstack_modes, |
| 6038 | .input_mux = &alc882_capture_source, |
| 6039 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6040 | [ALC882_ARIMA] = { |
| 6041 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6042 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6043 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6044 | .dac_nids = alc882_dac_nids, |
| 6045 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6046 | .channel_mode = alc882_sixstack_modes, |
| 6047 | .input_mux = &alc882_capture_source, |
| 6048 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6049 | [ALC882_W2JC] = { |
| 6050 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6051 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6052 | alc880_gpio1_init_verbs }, |
| 6053 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6054 | .dac_nids = alc882_dac_nids, |
| 6055 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6056 | .channel_mode = alc880_threestack_modes, |
| 6057 | .need_dac_fix = 1, |
| 6058 | .input_mux = &alc882_capture_source, |
| 6059 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6060 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6061 | [ALC885_MBP3] = { |
| 6062 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6063 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6064 | alc880_gpio1_init_verbs }, |
| 6065 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6066 | .dac_nids = alc882_dac_nids, |
| 6067 | .channel_mode = alc885_mbp_6ch_modes, |
| 6068 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6069 | .input_mux = &alc882_capture_source, |
| 6070 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6071 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6072 | .unsol_event = alc885_mbp3_unsol_event, |
| 6073 | .init_hook = alc885_mbp3_automute, |
| 6074 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6075 | [ALC885_MACPRO] = { |
| 6076 | .mixers = { alc882_macpro_mixer }, |
| 6077 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6078 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6079 | .dac_nids = alc882_dac_nids, |
| 6080 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6081 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6082 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6083 | .channel_mode = alc882_ch_modes, |
| 6084 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6085 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6086 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6087 | [ALC885_IMAC24] = { |
| 6088 | .mixers = { alc885_imac24_mixer }, |
| 6089 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6090 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6091 | .dac_nids = alc882_dac_nids, |
| 6092 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6093 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6094 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6095 | .channel_mode = alc882_ch_modes, |
| 6096 | .input_mux = &alc882_capture_source, |
| 6097 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6098 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6099 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6100 | [ALC882_TARGA] = { |
| 6101 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6102 | alc882_capture_mixer }, |
| 6103 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6104 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6105 | .dac_nids = alc882_dac_nids, |
| 6106 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6107 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6108 | .adc_nids = alc882_adc_nids, |
| 6109 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6110 | .channel_mode = alc882_3ST_6ch_modes, |
| 6111 | .need_dac_fix = 1, |
| 6112 | .input_mux = &alc882_capture_source, |
| 6113 | .unsol_event = alc882_targa_unsol_event, |
| 6114 | .init_hook = alc882_targa_automute, |
| 6115 | }, |
| 6116 | [ALC882_ASUS_A7J] = { |
| 6117 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6118 | alc882_capture_mixer }, |
| 6119 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6120 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6121 | .dac_nids = alc882_dac_nids, |
| 6122 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6123 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6124 | .adc_nids = alc882_adc_nids, |
| 6125 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6126 | .channel_mode = alc882_3ST_6ch_modes, |
| 6127 | .need_dac_fix = 1, |
| 6128 | .input_mux = &alc882_capture_source, |
| 6129 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6130 | [ALC882_ASUS_A7M] = { |
| 6131 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6132 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6133 | alc880_gpio1_init_verbs, |
| 6134 | alc882_asus_a7m_verbs }, |
| 6135 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6136 | .dac_nids = alc882_dac_nids, |
| 6137 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6138 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6139 | .channel_mode = alc880_threestack_modes, |
| 6140 | .need_dac_fix = 1, |
| 6141 | .input_mux = &alc882_capture_source, |
| 6142 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6143 | }; |
| 6144 | |
| 6145 | |
| 6146 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6147 | * Pin config fixes |
| 6148 | */ |
| 6149 | enum { |
| 6150 | PINFIX_ABIT_AW9D_MAX |
| 6151 | }; |
| 6152 | |
| 6153 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6154 | { 0x15, 0x01080104 }, /* side */ |
| 6155 | { 0x16, 0x01011012 }, /* rear */ |
| 6156 | { 0x17, 0x01016011 }, /* clfe */ |
| 6157 | { } |
| 6158 | }; |
| 6159 | |
| 6160 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6161 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6162 | }; |
| 6163 | |
| 6164 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6165 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6166 | {} |
| 6167 | }; |
| 6168 | |
| 6169 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6170 | * BIOS auto configuration |
| 6171 | */ |
| 6172 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6173 | hda_nid_t nid, int pin_type, |
| 6174 | int dac_idx) |
| 6175 | { |
| 6176 | /* set as output */ |
| 6177 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6178 | int idx; |
| 6179 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6180 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6181 | idx = 4; |
| 6182 | else |
| 6183 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 6184 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6185 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6186 | pin_type); |
| 6187 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 6188 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6189 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6190 | |
| 6191 | } |
| 6192 | |
| 6193 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6194 | { |
| 6195 | struct alc_spec *spec = codec->spec; |
| 6196 | int i; |
| 6197 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6198 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6199 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6200 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6201 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6202 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6203 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6204 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6205 | } |
| 6206 | } |
| 6207 | |
| 6208 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6209 | { |
| 6210 | struct alc_spec *spec = codec->spec; |
| 6211 | hda_nid_t pin; |
| 6212 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6213 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6214 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6215 | /* use dac 0 */ |
| 6216 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6217 | } |
| 6218 | |
| 6219 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6220 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6221 | |
| 6222 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6223 | { |
| 6224 | struct alc_spec *spec = codec->spec; |
| 6225 | int i; |
| 6226 | |
| 6227 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6228 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6229 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6230 | snd_hda_codec_write(codec, nid, 0, |
| 6231 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6232 | i <= AUTO_PIN_FRONT_MIC ? |
| 6233 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6234 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6235 | snd_hda_codec_write(codec, nid, 0, |
| 6236 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6237 | AMP_OUT_MUTE); |
| 6238 | } |
| 6239 | } |
| 6240 | } |
| 6241 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6242 | /* add mic boosts if needed */ |
| 6243 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6244 | { |
| 6245 | struct alc_spec *spec = codec->spec; |
| 6246 | int err; |
| 6247 | hda_nid_t nid; |
| 6248 | |
| 6249 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6250 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6251 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6252 | "Mic Boost", |
| 6253 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6254 | if (err < 0) |
| 6255 | return err; |
| 6256 | } |
| 6257 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6258 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6259 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6260 | "Front Mic Boost", |
| 6261 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6262 | if (err < 0) |
| 6263 | return err; |
| 6264 | } |
| 6265 | return 0; |
| 6266 | } |
| 6267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6268 | /* almost identical with ALC880 parser... */ |
| 6269 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6270 | { |
| 6271 | struct alc_spec *spec = codec->spec; |
| 6272 | int err = alc880_parse_auto_config(codec); |
| 6273 | |
| 6274 | if (err < 0) |
| 6275 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6276 | else if (!err) |
| 6277 | return 0; /* no config found */ |
| 6278 | |
| 6279 | err = alc_auto_add_mic_boost(codec); |
| 6280 | if (err < 0) |
| 6281 | return err; |
| 6282 | |
| 6283 | /* hack - override the init verbs */ |
| 6284 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6285 | |
| 6286 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6287 | } |
| 6288 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6289 | /* additional initialization for auto-configuration model */ |
| 6290 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6291 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6292 | alc882_auto_init_multi_out(codec); |
| 6293 | alc882_auto_init_hp_out(codec); |
| 6294 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6295 | } |
| 6296 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6297 | static int patch_alc882(struct hda_codec *codec) |
| 6298 | { |
| 6299 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6300 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6301 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6302 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6303 | if (spec == NULL) |
| 6304 | return -ENOMEM; |
| 6305 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6306 | codec->spec = spec; |
| 6307 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6308 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6309 | alc882_models, |
| 6310 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6311 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6312 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6313 | /* Pick up systems that don't supply PCI SSID */ |
| 6314 | switch (codec->subsystem_id) { |
| 6315 | case 0x106b0c00: /* Mac Pro */ |
| 6316 | board_config = ALC885_MACPRO; |
| 6317 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6318 | case 0x106b1000: /* iMac 24 */ |
| 6319 | board_config = ALC885_IMAC24; |
| 6320 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame] | 6321 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6322 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6323 | board_config = ALC885_MBP3; |
| 6324 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6325 | default: |
| 6326 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6327 | "trying auto-probe from BIOS...\n"); |
| 6328 | board_config = ALC882_AUTO; |
| 6329 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6330 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6331 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6332 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6333 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6334 | if (board_config == ALC882_AUTO) { |
| 6335 | /* automatic parse from the BIOS config */ |
| 6336 | err = alc882_parse_auto_config(codec); |
| 6337 | if (err < 0) { |
| 6338 | alc_free(codec); |
| 6339 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6340 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6341 | printk(KERN_INFO |
| 6342 | "hda_codec: Cannot set up configuration " |
| 6343 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6344 | board_config = ALC882_3ST_DIG; |
| 6345 | } |
| 6346 | } |
| 6347 | |
| 6348 | if (board_config != ALC882_AUTO) |
| 6349 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6350 | |
| 6351 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6352 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6353 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6354 | /* FIXME: setup DAC5 */ |
| 6355 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6356 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6357 | |
| 6358 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6359 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6360 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6361 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6362 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6363 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6364 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6365 | /* get type */ |
| 6366 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6367 | if (wcap != AC_WID_AUD_IN) { |
| 6368 | spec->adc_nids = alc882_adc_nids_alt; |
| 6369 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6370 | spec->mixers[spec->num_mixers] = |
| 6371 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6372 | spec->num_mixers++; |
| 6373 | } else { |
| 6374 | spec->adc_nids = alc882_adc_nids; |
| 6375 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 6376 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6377 | spec->num_mixers++; |
| 6378 | } |
| 6379 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6380 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6381 | spec->vmaster_nid = 0x0c; |
| 6382 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6383 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6384 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6385 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6386 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6387 | if (!spec->loopback.amplist) |
| 6388 | spec->loopback.amplist = alc882_loopbacks; |
| 6389 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6390 | |
| 6391 | return 0; |
| 6392 | } |
| 6393 | |
| 6394 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6395 | * ALC883 support |
| 6396 | * |
| 6397 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6398 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6399 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6400 | * 6-channel independent captures. |
| 6401 | * |
| 6402 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6403 | * driver yet). |
| 6404 | */ |
| 6405 | #define ALC883_DIGOUT_NID 0x06 |
| 6406 | #define ALC883_DIGIN_NID 0x0a |
| 6407 | |
| 6408 | static hda_nid_t alc883_dac_nids[4] = { |
| 6409 | /* front, rear, clfe, rear_surr */ |
| 6410 | 0x02, 0x04, 0x03, 0x05 |
| 6411 | }; |
| 6412 | |
| 6413 | static hda_nid_t alc883_adc_nids[2] = { |
| 6414 | /* ADC1-2 */ |
| 6415 | 0x08, 0x09, |
| 6416 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6417 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6418 | /* input MUX */ |
| 6419 | /* FIXME: should be a matrix-type input source selection */ |
| 6420 | |
| 6421 | static struct hda_input_mux alc883_capture_source = { |
| 6422 | .num_items = 4, |
| 6423 | .items = { |
| 6424 | { "Mic", 0x0 }, |
| 6425 | { "Front Mic", 0x1 }, |
| 6426 | { "Line", 0x2 }, |
| 6427 | { "CD", 0x4 }, |
| 6428 | }, |
| 6429 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6430 | |
| 6431 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6432 | .num_items = 2, |
| 6433 | .items = { |
| 6434 | { "Mic", 0x1 }, |
| 6435 | { "Line", 0x2 }, |
| 6436 | }, |
| 6437 | }; |
| 6438 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6439 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6440 | .num_items = 4, |
| 6441 | .items = { |
| 6442 | { "Mic", 0x0 }, |
| 6443 | { "iMic", 0x1 }, |
| 6444 | { "Line", 0x2 }, |
| 6445 | { "CD", 0x4 }, |
| 6446 | }, |
| 6447 | }; |
| 6448 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6449 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6450 | #define alc883_mux_enum_get alc_mux_enum_get |
| 6451 | |
| 6452 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 6453 | struct snd_ctl_elem_value *ucontrol) |
| 6454 | { |
| 6455 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6456 | struct alc_spec *spec = codec->spec; |
| 6457 | const struct hda_input_mux *imux = spec->input_mux; |
| 6458 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 6459 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 6460 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 6461 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 6462 | unsigned int i, idx; |
| 6463 | |
| 6464 | idx = ucontrol->value.enumerated.item[0]; |
| 6465 | if (idx >= imux->num_items) |
| 6466 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6467 | if (*cur_val == idx) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6468 | return 0; |
| 6469 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6470 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 6471 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6472 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6473 | HDA_AMP_MUTE, v); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6474 | } |
| 6475 | *cur_val = idx; |
| 6476 | return 1; |
| 6477 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6478 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6479 | /* |
| 6480 | * 2ch mode |
| 6481 | */ |
| 6482 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6483 | { 2, NULL } |
| 6484 | }; |
| 6485 | |
| 6486 | /* |
| 6487 | * 2ch mode |
| 6488 | */ |
| 6489 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6490 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6491 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6492 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6493 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6494 | { } /* end */ |
| 6495 | }; |
| 6496 | |
| 6497 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6498 | * 4ch mode |
| 6499 | */ |
| 6500 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6501 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6502 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6503 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6504 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6505 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6506 | { } /* end */ |
| 6507 | }; |
| 6508 | |
| 6509 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6510 | * 6ch mode |
| 6511 | */ |
| 6512 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6513 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6514 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6515 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6516 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6517 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6518 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6519 | { } /* end */ |
| 6520 | }; |
| 6521 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6522 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6523 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6524 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6525 | { 6, alc883_3ST_ch6_init }, |
| 6526 | }; |
| 6527 | |
| 6528 | /* |
| 6529 | * 6ch mode |
| 6530 | */ |
| 6531 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6532 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6533 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6534 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6535 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6536 | { } /* end */ |
| 6537 | }; |
| 6538 | |
| 6539 | /* |
| 6540 | * 8ch mode |
| 6541 | */ |
| 6542 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6543 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6544 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6545 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6546 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6547 | { } /* end */ |
| 6548 | }; |
| 6549 | |
| 6550 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6551 | { 6, alc883_sixstack_ch6_init }, |
| 6552 | { 8, alc883_sixstack_ch8_init }, |
| 6553 | }; |
| 6554 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6555 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6556 | /* eanable EAPD on medion laptop */ |
| 6557 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6558 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6559 | { } |
| 6560 | }; |
| 6561 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6562 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6563 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6564 | */ |
| 6565 | |
| 6566 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6567 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6568 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6569 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6570 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6571 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6572 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6573 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6574 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6575 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6576 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6577 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6578 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6579 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6580 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6581 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6582 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6583 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6584 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6585 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6586 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6587 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6588 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6589 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6590 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6591 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6592 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6593 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6594 | { |
| 6595 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6596 | /* .name = "Capture Source", */ |
| 6597 | .name = "Input Source", |
| 6598 | .count = 2, |
| 6599 | .info = alc883_mux_enum_info, |
| 6600 | .get = alc883_mux_enum_get, |
| 6601 | .put = alc883_mux_enum_put, |
| 6602 | }, |
| 6603 | { } /* end */ |
| 6604 | }; |
| 6605 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6606 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6607 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6608 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6609 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6610 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6611 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6612 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6613 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6614 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6615 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6616 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6617 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6618 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6619 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6620 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6621 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6622 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6623 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6624 | { |
| 6625 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6626 | /* .name = "Capture Source", */ |
| 6627 | .name = "Input Source", |
| 6628 | .count = 2, |
| 6629 | .info = alc883_mux_enum_info, |
| 6630 | .get = alc883_mux_enum_get, |
| 6631 | .put = alc883_mux_enum_put, |
| 6632 | }, |
| 6633 | { } /* end */ |
| 6634 | }; |
| 6635 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6636 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6637 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6638 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6639 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6640 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6641 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6642 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6643 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6644 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6645 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6646 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6647 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6648 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6649 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6650 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6651 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6652 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6653 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6654 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6655 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6656 | { |
| 6657 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6658 | /* .name = "Capture Source", */ |
| 6659 | .name = "Input Source", |
| 6660 | .count = 2, |
| 6661 | .info = alc883_mux_enum_info, |
| 6662 | .get = alc883_mux_enum_get, |
| 6663 | .put = alc883_mux_enum_put, |
| 6664 | }, |
| 6665 | { } /* end */ |
| 6666 | }; |
| 6667 | |
| 6668 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6669 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6670 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6671 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6672 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6673 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6674 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6675 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6676 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6677 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6678 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6679 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6680 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6681 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6682 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6683 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6684 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6685 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6686 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6687 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6688 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6689 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6690 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6691 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6692 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6693 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6694 | { |
| 6695 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6696 | /* .name = "Capture Source", */ |
| 6697 | .name = "Input Source", |
| 6698 | .count = 2, |
| 6699 | .info = alc883_mux_enum_info, |
| 6700 | .get = alc883_mux_enum_get, |
| 6701 | .put = alc883_mux_enum_put, |
| 6702 | }, |
| 6703 | { } /* end */ |
| 6704 | }; |
| 6705 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6706 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6707 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6708 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6709 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6710 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6711 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6712 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6713 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6714 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6715 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6716 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6717 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6718 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6719 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6720 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6721 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6722 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6723 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6724 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6725 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6726 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6727 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6728 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6729 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6730 | |
| 6731 | { |
| 6732 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6733 | /* .name = "Capture Source", */ |
| 6734 | .name = "Input Source", |
| 6735 | .count = 1, |
| 6736 | .info = alc883_mux_enum_info, |
| 6737 | .get = alc883_mux_enum_get, |
| 6738 | .put = alc883_mux_enum_put, |
| 6739 | }, |
| 6740 | { } /* end */ |
| 6741 | }; |
| 6742 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6743 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6744 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6745 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6746 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6747 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6748 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6749 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6750 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6751 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6752 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6753 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6754 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6755 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6756 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6757 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6758 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6759 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6760 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6761 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6762 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6763 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6764 | { |
| 6765 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6766 | /* .name = "Capture Source", */ |
| 6767 | .name = "Input Source", |
| 6768 | .count = 2, |
| 6769 | .info = alc883_mux_enum_info, |
| 6770 | .get = alc883_mux_enum_get, |
| 6771 | .put = alc883_mux_enum_put, |
| 6772 | }, |
| 6773 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6774 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6775 | |
| 6776 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6777 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6778 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6779 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6780 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6781 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6782 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6783 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6784 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6785 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6786 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6787 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6788 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6789 | { |
| 6790 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6791 | /* .name = "Capture Source", */ |
| 6792 | .name = "Input Source", |
| 6793 | .count = 2, |
| 6794 | .info = alc883_mux_enum_info, |
| 6795 | .get = alc883_mux_enum_get, |
| 6796 | .put = alc883_mux_enum_put, |
| 6797 | }, |
| 6798 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6799 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6800 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6801 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6802 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6803 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6804 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6805 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6806 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6807 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6808 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6809 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6810 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6811 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6812 | { |
| 6813 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6814 | /* .name = "Capture Source", */ |
| 6815 | .name = "Input Source", |
| 6816 | .count = 1, |
| 6817 | .info = alc883_mux_enum_info, |
| 6818 | .get = alc883_mux_enum_get, |
| 6819 | .put = alc883_mux_enum_put, |
| 6820 | }, |
| 6821 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6822 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6823 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6824 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6825 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6826 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6827 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6828 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6829 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6830 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6831 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6832 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6833 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6834 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6835 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6836 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6837 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6838 | { |
| 6839 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6840 | /* .name = "Capture Source", */ |
| 6841 | .name = "Input Source", |
| 6842 | .count = 2, |
| 6843 | .info = alc883_mux_enum_info, |
| 6844 | .get = alc883_mux_enum_get, |
| 6845 | .put = alc883_mux_enum_put, |
| 6846 | }, |
| 6847 | { } /* end */ |
| 6848 | }; |
| 6849 | |
| 6850 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6851 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6852 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6853 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6854 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6855 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6856 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6857 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6858 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6859 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6860 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6861 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6862 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6863 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6864 | { |
| 6865 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6866 | /* .name = "Capture Source", */ |
| 6867 | .name = "Input Source", |
| 6868 | .count = 2, |
| 6869 | .info = alc883_mux_enum_info, |
| 6870 | .get = alc883_mux_enum_get, |
| 6871 | .put = alc883_mux_enum_put, |
| 6872 | }, |
| 6873 | { } /* end */ |
| 6874 | }; |
| 6875 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6876 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6878 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6879 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6880 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6881 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6882 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6883 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6884 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6885 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6886 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6887 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6888 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6889 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6890 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6891 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6892 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6893 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6894 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6895 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6896 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6897 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6898 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6899 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6900 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6901 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6902 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6903 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6904 | { |
| 6905 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6906 | /* .name = "Capture Source", */ |
| 6907 | .name = "Input Source", |
| 6908 | .count = 2, |
| 6909 | .info = alc883_mux_enum_info, |
| 6910 | .get = alc883_mux_enum_get, |
| 6911 | .put = alc883_mux_enum_put, |
| 6912 | }, |
| 6913 | { } /* end */ |
| 6914 | }; |
| 6915 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6916 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6917 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6918 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6919 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6920 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6921 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6922 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6923 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6924 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6925 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6926 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6927 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6928 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6929 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6930 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6931 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6932 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6933 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6934 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6935 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6936 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6937 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6938 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6939 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6940 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6941 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6942 | { |
| 6943 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6944 | /* .name = "Capture Source", */ |
| 6945 | .name = "Input Source", |
| 6946 | .count = 2, |
| 6947 | .info = alc883_mux_enum_info, |
| 6948 | .get = alc883_mux_enum_get, |
| 6949 | .put = alc883_mux_enum_put, |
| 6950 | }, |
| 6951 | { } /* end */ |
| 6952 | }; |
| 6953 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 6954 | static struct snd_kcontrol_new alc888_6st_dell_mixer[] = { |
| 6955 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6956 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6957 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6958 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6959 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6960 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6961 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6962 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6963 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6964 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6965 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6966 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6967 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6968 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6969 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6970 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6971 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6972 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6973 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6974 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6975 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6976 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6977 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6978 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6979 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6980 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6981 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6982 | { |
| 6983 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6984 | /* .name = "Capture Source", */ |
| 6985 | .name = "Input Source", |
| 6986 | .count = 2, |
| 6987 | .info = alc883_mux_enum_info, |
| 6988 | .get = alc883_mux_enum_get, |
| 6989 | .put = alc883_mux_enum_put, |
| 6990 | }, |
| 6991 | { } /* end */ |
| 6992 | }; |
| 6993 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6994 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6995 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6996 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6997 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6999 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7001 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7003 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7004 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7005 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7006 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7007 | { |
| 7008 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7009 | /* .name = "Capture Source", */ |
| 7010 | .name = "Input Source", |
| 7011 | .count = 2, |
| 7012 | .info = alc883_mux_enum_info, |
| 7013 | .get = alc883_mux_enum_get, |
| 7014 | .put = alc883_mux_enum_put, |
| 7015 | }, |
| 7016 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7017 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7018 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7019 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7020 | { |
| 7021 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7022 | .name = "Channel Mode", |
| 7023 | .info = alc_ch_mode_info, |
| 7024 | .get = alc_ch_mode_get, |
| 7025 | .put = alc_ch_mode_put, |
| 7026 | }, |
| 7027 | { } /* end */ |
| 7028 | }; |
| 7029 | |
| 7030 | static struct hda_verb alc883_init_verbs[] = { |
| 7031 | /* ADC1: mute amp left and right */ |
| 7032 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7033 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7034 | /* ADC2: mute amp left and right */ |
| 7035 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7036 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7037 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7038 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7039 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7040 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7041 | /* Rear mixer */ |
| 7042 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7043 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7044 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7045 | /* CLFE mixer */ |
| 7046 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7047 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7048 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7049 | /* Side mixer */ |
| 7050 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7051 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7052 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7053 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7054 | /* mute analog input loopbacks */ |
| 7055 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7056 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7057 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7058 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7059 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7060 | |
| 7061 | /* Front Pin: output 0 (0x0c) */ |
| 7062 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7063 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7064 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7065 | /* Rear Pin: output 1 (0x0d) */ |
| 7066 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7068 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7069 | /* CLFE Pin: output 2 (0x0e) */ |
| 7070 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7071 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7072 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7073 | /* Side Pin: output 3 (0x0f) */ |
| 7074 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7075 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7076 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7077 | /* Mic (rear) pin: input vref at 80% */ |
| 7078 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7079 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7080 | /* Front Mic pin: input vref at 80% */ |
| 7081 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7082 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7083 | /* Line In pin: input */ |
| 7084 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7085 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7086 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7087 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7088 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7089 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7090 | /* CD pin widget for input */ |
| 7091 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7092 | |
| 7093 | /* FIXME: use matrix-type input source selection */ |
| 7094 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7095 | /* Input mixer2 */ |
| 7096 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7097 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7098 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7099 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7100 | /* Input mixer3 */ |
| 7101 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7102 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7103 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7104 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7105 | { } |
| 7106 | }; |
| 7107 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7108 | /* toggle speaker-output according to the hp-jack state */ |
| 7109 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7110 | { |
| 7111 | unsigned int present; |
| 7112 | |
| 7113 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7114 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7115 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7116 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7117 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7118 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7119 | } |
| 7120 | |
| 7121 | /* auto-toggle front mic */ |
| 7122 | /* |
| 7123 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7124 | { |
| 7125 | unsigned int present; |
| 7126 | unsigned char bits; |
| 7127 | |
| 7128 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7129 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7130 | bits = present ? HDA_AMP_MUTE : 0; |
| 7131 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7132 | } |
| 7133 | */ |
| 7134 | |
| 7135 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7136 | { |
| 7137 | alc883_mitac_hp_automute(codec); |
| 7138 | /* alc883_mitac_mic_automute(codec); */ |
| 7139 | } |
| 7140 | |
| 7141 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7142 | unsigned int res) |
| 7143 | { |
| 7144 | switch (res >> 26) { |
| 7145 | case ALC880_HP_EVENT: |
| 7146 | alc883_mitac_hp_automute(codec); |
| 7147 | break; |
| 7148 | case ALC880_MIC_EVENT: |
| 7149 | /* alc883_mitac_mic_automute(codec); */ |
| 7150 | break; |
| 7151 | } |
| 7152 | } |
| 7153 | |
| 7154 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7155 | /* HP */ |
| 7156 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7157 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7158 | /* Subwoofer */ |
| 7159 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7160 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7161 | |
| 7162 | /* enable unsolicited event */ |
| 7163 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7164 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7165 | |
| 7166 | { } /* end */ |
| 7167 | }; |
| 7168 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7169 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7170 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7171 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7172 | |
| 7173 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7174 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7175 | |
| 7176 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7177 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7178 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7179 | |
| 7180 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7181 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7182 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7183 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7184 | |
| 7185 | { } /* end */ |
| 7186 | }; |
| 7187 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7188 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7189 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7190 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7191 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7192 | { } /* end */ |
| 7193 | }; |
| 7194 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7195 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7196 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7197 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7198 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7199 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7200 | { } /* end */ |
| 7201 | }; |
| 7202 | |
| 7203 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7204 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7205 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7206 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7207 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7208 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7209 | { } /* end */ |
| 7210 | }; |
| 7211 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7212 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7213 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7214 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7215 | |
| 7216 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7217 | |
| 7218 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7219 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7220 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7221 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7222 | { } /* end */ |
| 7223 | }; |
| 7224 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7225 | static struct hda_verb alc888_6st_hp_verbs[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7226 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7227 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ |
| 7228 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ |
| 7229 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 7230 | { } |
| 7231 | }; |
| 7232 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7233 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7234 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7235 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7236 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
| 7237 | { } |
| 7238 | }; |
| 7239 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7240 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 7241 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7242 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */ |
| 7243 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */ |
| 7244 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 7245 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7246 | { } |
| 7247 | }; |
| 7248 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7249 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7250 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7251 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7252 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7253 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7254 | { } |
| 7255 | }; |
| 7256 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7257 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7258 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7259 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7260 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7261 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7262 | { } |
| 7263 | }; |
| 7264 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7265 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7266 | { 2, alc888_3st_hp_2ch_init }, |
| 7267 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7268 | }; |
| 7269 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7270 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7271 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7272 | { |
| 7273 | unsigned int present; |
| 7274 | |
| 7275 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7276 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7277 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7278 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7279 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7280 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7281 | } |
| 7282 | |
| 7283 | /* toggle RCA according to the front-jack state */ |
| 7284 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7285 | { |
| 7286 | unsigned int present; |
| 7287 | |
| 7288 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7289 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7290 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7291 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7292 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7293 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7294 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7295 | unsigned int res) |
| 7296 | { |
| 7297 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7298 | alc888_lenovo_ms7195_front_automute(codec); |
| 7299 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7300 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7301 | } |
| 7302 | |
| 7303 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7304 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7305 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7306 | |
| 7307 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7308 | |
| 7309 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7310 | { } /* end */ |
| 7311 | }; |
| 7312 | |
| 7313 | /* toggle speaker-output according to the hp-jack state */ |
| 7314 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7315 | { |
| 7316 | unsigned int present; |
| 7317 | |
| 7318 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7319 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7320 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7321 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7322 | } |
| 7323 | |
| 7324 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7325 | unsigned int res) |
| 7326 | { |
| 7327 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7328 | alc883_medion_md2_automute(codec); |
| 7329 | } |
| 7330 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7331 | /* toggle speaker-output according to the hp-jack state */ |
| 7332 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7333 | { |
| 7334 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7335 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7336 | |
| 7337 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7338 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7339 | bits = present ? HDA_AMP_MUTE : 0; |
| 7340 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7341 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7342 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7343 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7344 | } |
| 7345 | |
| 7346 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7347 | { |
| 7348 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7349 | alc883_tagra_automute(codec); |
| 7350 | } |
| 7351 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7352 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7353 | { |
| 7354 | unsigned int present; |
| 7355 | unsigned char bits; |
| 7356 | |
| 7357 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7358 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7359 | bits = present ? 0x80 : 0; |
| 7360 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7361 | 0x80, bits); |
| 7362 | } |
| 7363 | |
| 7364 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7365 | unsigned int res) |
| 7366 | { |
| 7367 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7368 | alc883_haier_w66_automute(codec); |
| 7369 | } |
| 7370 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7371 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7372 | { |
| 7373 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7374 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7375 | |
| 7376 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7377 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7378 | bits = present ? HDA_AMP_MUTE : 0; |
| 7379 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7380 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7381 | } |
| 7382 | |
| 7383 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7384 | { |
| 7385 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7386 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7387 | |
| 7388 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7389 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7390 | bits = present ? HDA_AMP_MUTE : 0; |
| 7391 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7392 | HDA_AMP_MUTE, bits); |
| 7393 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7394 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7395 | } |
| 7396 | |
| 7397 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7398 | unsigned int res) |
| 7399 | { |
| 7400 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7401 | alc883_lenovo_101e_all_automute(codec); |
| 7402 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7403 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7404 | } |
| 7405 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7406 | /* toggle speaker-output according to the hp-jack state */ |
| 7407 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7408 | { |
| 7409 | unsigned int present; |
| 7410 | |
| 7411 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7412 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7413 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7414 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7415 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7416 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7417 | } |
| 7418 | |
| 7419 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7420 | unsigned int res) |
| 7421 | { |
| 7422 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7423 | alc883_acer_aspire_automute(codec); |
| 7424 | } |
| 7425 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7426 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7427 | /* HP Pin: output 0 (0x0c) */ |
| 7428 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7429 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7430 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7431 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7432 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7433 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7434 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7435 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7436 | /* eanable EAPD on medion laptop */ |
| 7437 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7438 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7439 | /* enable unsolicited event */ |
| 7440 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7441 | { } |
| 7442 | }; |
| 7443 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7444 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7445 | { |
| 7446 | unsigned int present; |
| 7447 | |
| 7448 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7449 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7450 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7451 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7452 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7453 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7454 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7455 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7456 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7457 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7458 | } |
| 7459 | |
| 7460 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7461 | unsigned int res) |
| 7462 | { |
| 7463 | switch (res >> 26) { |
| 7464 | case ALC880_HP_EVENT: |
| 7465 | printk("hp_event\n"); |
| 7466 | alc888_6st_dell_front_automute(codec); |
| 7467 | break; |
| 7468 | } |
| 7469 | } |
| 7470 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7471 | /* |
| 7472 | * generic initialization of ADC, input mixers and output mixers |
| 7473 | */ |
| 7474 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7475 | /* |
| 7476 | * Unmute ADC0-2 and set the default input to mic-in |
| 7477 | */ |
| 7478 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7479 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7480 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7481 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7482 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7483 | /* 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] | 7484 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7485 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7486 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7487 | */ |
| 7488 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7489 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7490 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7491 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7492 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7493 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7494 | |
| 7495 | /* |
| 7496 | * Set up output mixers (0x0c - 0x0f) |
| 7497 | */ |
| 7498 | /* set vol=0 to output mixers */ |
| 7499 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7500 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7501 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7502 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7503 | /* set up input amps for analog loopback */ |
| 7504 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7505 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7506 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7507 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7508 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7509 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7510 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7511 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7512 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7513 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7514 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7515 | |
| 7516 | /* FIXME: use matrix-type input source selection */ |
| 7517 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7518 | /* Input mixer1 */ |
| 7519 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7520 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7521 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7522 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7523 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7524 | /* Input mixer2 */ |
| 7525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7526 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7527 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7528 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7529 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7530 | |
| 7531 | { } |
| 7532 | }; |
| 7533 | |
| 7534 | /* capture mixer elements */ |
| 7535 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7536 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7537 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7538 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7539 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7540 | { |
| 7541 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7542 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7543 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7544 | */ |
| 7545 | /* .name = "Capture Source", */ |
| 7546 | .name = "Input Source", |
| 7547 | .count = 2, |
| 7548 | .info = alc882_mux_enum_info, |
| 7549 | .get = alc882_mux_enum_get, |
| 7550 | .put = alc882_mux_enum_put, |
| 7551 | }, |
| 7552 | { } /* end */ |
| 7553 | }; |
| 7554 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7555 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7556 | #define alc883_loopbacks alc880_loopbacks |
| 7557 | #endif |
| 7558 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7559 | /* pcm configuration: identiacal with ALC880 */ |
| 7560 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7561 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7562 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7563 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7564 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7565 | |
| 7566 | /* |
| 7567 | * configuration and preset |
| 7568 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7569 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7570 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7571 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7572 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7573 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7574 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7575 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7576 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7577 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7578 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7579 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7580 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7581 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7582 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7583 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7584 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7585 | [ALC888_6ST_HP] = "6stack-hp", |
| 7586 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7587 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7588 | [ALC883_MITAC] = "mitac", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7589 | [ALC883_AUTO] = "auto", |
| 7590 | }; |
| 7591 | |
| 7592 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7593 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7594 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7595 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7596 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7597 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7598 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7599 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7600 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7601 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 7602 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 7603 | 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] | 7604 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7605 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7606 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7607 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7608 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7609 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7610 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7611 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
| 7612 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
| 7613 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7614 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7615 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7616 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7617 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7618 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7619 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7620 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7621 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7622 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7623 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7624 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7625 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7626 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7627 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7628 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
| 7629 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7630 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7631 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7632 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7633 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7634 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7635 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7636 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7637 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7638 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7639 | {} |
| 7640 | }; |
| 7641 | |
| 7642 | static struct alc_config_preset alc883_presets[] = { |
| 7643 | [ALC883_3ST_2ch_DIG] = { |
| 7644 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7645 | .init_verbs = { alc883_init_verbs }, |
| 7646 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7647 | .dac_nids = alc883_dac_nids, |
| 7648 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7649 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7650 | .adc_nids = alc883_adc_nids, |
| 7651 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7652 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7653 | .channel_mode = alc883_3ST_2ch_modes, |
| 7654 | .input_mux = &alc883_capture_source, |
| 7655 | }, |
| 7656 | [ALC883_3ST_6ch_DIG] = { |
| 7657 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7658 | .init_verbs = { alc883_init_verbs }, |
| 7659 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7660 | .dac_nids = alc883_dac_nids, |
| 7661 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7662 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7663 | .adc_nids = alc883_adc_nids, |
| 7664 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7665 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7666 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7667 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7668 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7669 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7670 | [ALC883_3ST_6ch] = { |
| 7671 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7672 | .init_verbs = { alc883_init_verbs }, |
| 7673 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7674 | .dac_nids = alc883_dac_nids, |
| 7675 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7676 | .adc_nids = alc883_adc_nids, |
| 7677 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7678 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7679 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7680 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7681 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7682 | [ALC883_6ST_DIG] = { |
| 7683 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7684 | .init_verbs = { alc883_init_verbs }, |
| 7685 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7686 | .dac_nids = alc883_dac_nids, |
| 7687 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7688 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7689 | .adc_nids = alc883_adc_nids, |
| 7690 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7691 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7692 | .channel_mode = alc883_sixstack_modes, |
| 7693 | .input_mux = &alc883_capture_source, |
| 7694 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7695 | [ALC883_TARGA_DIG] = { |
| 7696 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7697 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7698 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7699 | .dac_nids = alc883_dac_nids, |
| 7700 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7701 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7702 | .adc_nids = alc883_adc_nids, |
| 7703 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7704 | .channel_mode = alc883_3ST_6ch_modes, |
| 7705 | .need_dac_fix = 1, |
| 7706 | .input_mux = &alc883_capture_source, |
| 7707 | .unsol_event = alc883_tagra_unsol_event, |
| 7708 | .init_hook = alc883_tagra_automute, |
| 7709 | }, |
| 7710 | [ALC883_TARGA_2ch_DIG] = { |
| 7711 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7712 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7713 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7714 | .dac_nids = alc883_dac_nids, |
| 7715 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7716 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7717 | .adc_nids = alc883_adc_nids, |
| 7718 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7719 | .channel_mode = alc883_3ST_2ch_modes, |
| 7720 | .input_mux = &alc883_capture_source, |
| 7721 | .unsol_event = alc883_tagra_unsol_event, |
| 7722 | .init_hook = alc883_tagra_automute, |
| 7723 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7724 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7725 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7726 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7727 | * and the headphone jack. Turn this on and rely on the |
| 7728 | * standard mute methods whenever the user wants to turn |
| 7729 | * these outputs off. |
| 7730 | */ |
| 7731 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7732 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7733 | .dac_nids = alc883_dac_nids, |
| 7734 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7735 | .adc_nids = alc883_adc_nids, |
| 7736 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7737 | .channel_mode = alc883_3ST_2ch_modes, |
| 7738 | .input_mux = &alc883_capture_source, |
| 7739 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7740 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7741 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7742 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7743 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7744 | .dac_nids = alc883_dac_nids, |
| 7745 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7746 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7747 | .adc_nids = alc883_adc_nids, |
| 7748 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7749 | .channel_mode = alc883_3ST_2ch_modes, |
| 7750 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7751 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7752 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7753 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7754 | [ALC883_MEDION] = { |
| 7755 | .mixers = { alc883_fivestack_mixer, |
| 7756 | alc883_chmode_mixer }, |
| 7757 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7758 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7759 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7760 | .dac_nids = alc883_dac_nids, |
| 7761 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7762 | .adc_nids = alc883_adc_nids, |
| 7763 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7764 | .channel_mode = alc883_sixstack_modes, |
| 7765 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7766 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7767 | [ALC883_MEDION_MD2] = { |
| 7768 | .mixers = { alc883_medion_md2_mixer}, |
| 7769 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7770 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7771 | .dac_nids = alc883_dac_nids, |
| 7772 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7773 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7774 | .adc_nids = alc883_adc_nids, |
| 7775 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7776 | .channel_mode = alc883_3ST_2ch_modes, |
| 7777 | .input_mux = &alc883_capture_source, |
| 7778 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7779 | .init_hook = alc883_medion_md2_automute, |
| 7780 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7781 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7782 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7783 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7784 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7785 | .dac_nids = alc883_dac_nids, |
| 7786 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7787 | .adc_nids = alc883_adc_nids, |
| 7788 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7789 | .channel_mode = alc883_3ST_2ch_modes, |
| 7790 | .input_mux = &alc883_capture_source, |
| 7791 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7792 | [ALC883_LENOVO_101E_2ch] = { |
| 7793 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7794 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7795 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7796 | .dac_nids = alc883_dac_nids, |
| 7797 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7798 | .adc_nids = alc883_adc_nids, |
| 7799 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7800 | .channel_mode = alc883_3ST_2ch_modes, |
| 7801 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7802 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7803 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7804 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7805 | [ALC883_LENOVO_NB0763] = { |
| 7806 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7807 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7808 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7809 | .dac_nids = alc883_dac_nids, |
| 7810 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7811 | .adc_nids = alc883_adc_nids, |
| 7812 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7813 | .channel_mode = alc883_3ST_2ch_modes, |
| 7814 | .need_dac_fix = 1, |
| 7815 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7816 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7817 | .init_hook = alc883_medion_md2_automute, |
| 7818 | }, |
| 7819 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7820 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7821 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7822 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7823 | .dac_nids = alc883_dac_nids, |
| 7824 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7825 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7826 | .adc_nids = alc883_adc_nids, |
| 7827 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7828 | .channel_mode = alc883_3ST_6ch_modes, |
| 7829 | .need_dac_fix = 1, |
| 7830 | .input_mux = &alc883_capture_source, |
| 7831 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7832 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7833 | }, |
| 7834 | [ALC883_HAIER_W66] = { |
| 7835 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7836 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7837 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7838 | .dac_nids = alc883_dac_nids, |
| 7839 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7840 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7841 | .adc_nids = alc883_adc_nids, |
| 7842 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7843 | .channel_mode = alc883_3ST_2ch_modes, |
| 7844 | .input_mux = &alc883_capture_source, |
| 7845 | .unsol_event = alc883_haier_w66_unsol_event, |
| 7846 | .init_hook = alc883_haier_w66_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7847 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7848 | [ALC888_6ST_HP] = { |
| 7849 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
| 7850 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7851 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7852 | .dac_nids = alc883_dac_nids, |
| 7853 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7854 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7855 | .adc_nids = alc883_adc_nids, |
| 7856 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7857 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7858 | .channel_mode = alc883_sixstack_modes, |
| 7859 | .input_mux = &alc883_capture_source, |
| 7860 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7861 | [ALC888_3ST_HP] = { |
| 7862 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 7863 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7864 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7865 | .dac_nids = alc883_dac_nids, |
| 7866 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7867 | .adc_nids = alc883_adc_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7868 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 7869 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7870 | .need_dac_fix = 1, |
| 7871 | .input_mux = &alc883_capture_source, |
| 7872 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7873 | [ALC888_6ST_DELL] = { |
| 7874 | .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer }, |
| 7875 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 7876 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7877 | .dac_nids = alc883_dac_nids, |
| 7878 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7879 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7880 | .adc_nids = alc883_adc_nids, |
| 7881 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7882 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7883 | .channel_mode = alc883_sixstack_modes, |
| 7884 | .input_mux = &alc883_capture_source, |
| 7885 | .unsol_event = alc888_6st_dell_unsol_event, |
| 7886 | .init_hook = alc888_6st_dell_front_automute, |
| 7887 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7888 | [ALC883_MITAC] = { |
| 7889 | .mixers = { alc883_mitac_mixer }, |
| 7890 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 7891 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7892 | .dac_nids = alc883_dac_nids, |
| 7893 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7894 | .adc_nids = alc883_adc_nids, |
| 7895 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7896 | .channel_mode = alc883_3ST_2ch_modes, |
| 7897 | .input_mux = &alc883_capture_source, |
| 7898 | .unsol_event = alc883_mitac_unsol_event, |
| 7899 | .init_hook = alc883_mitac_automute, |
| 7900 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7901 | }; |
| 7902 | |
| 7903 | |
| 7904 | /* |
| 7905 | * BIOS auto configuration |
| 7906 | */ |
| 7907 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7908 | hda_nid_t nid, int pin_type, |
| 7909 | int dac_idx) |
| 7910 | { |
| 7911 | /* set as output */ |
| 7912 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7913 | int idx; |
| 7914 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7915 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7916 | idx = 4; |
| 7917 | else |
| 7918 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 7919 | |
| 7920 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7921 | pin_type); |
| 7922 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 7923 | AMP_OUT_UNMUTE); |
| 7924 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7925 | |
| 7926 | } |
| 7927 | |
| 7928 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 7929 | { |
| 7930 | struct alc_spec *spec = codec->spec; |
| 7931 | int i; |
| 7932 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7933 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7934 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7935 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7936 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7937 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7938 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7939 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7940 | } |
| 7941 | } |
| 7942 | |
| 7943 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 7944 | { |
| 7945 | struct alc_spec *spec = codec->spec; |
| 7946 | hda_nid_t pin; |
| 7947 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7948 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7949 | if (pin) /* connect to front */ |
| 7950 | /* use dac 0 */ |
| 7951 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 7952 | } |
| 7953 | |
| 7954 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7955 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 7956 | |
| 7957 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 7958 | { |
| 7959 | struct alc_spec *spec = codec->spec; |
| 7960 | int i; |
| 7961 | |
| 7962 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7963 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 7964 | if (alc883_is_input_pin(nid)) { |
| 7965 | snd_hda_codec_write(codec, nid, 0, |
| 7966 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7967 | (i <= AUTO_PIN_FRONT_MIC ? |
| 7968 | PIN_VREF80 : PIN_IN)); |
| 7969 | if (nid != ALC883_PIN_CD_NID) |
| 7970 | snd_hda_codec_write(codec, nid, 0, |
| 7971 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7972 | AMP_OUT_MUTE); |
| 7973 | } |
| 7974 | } |
| 7975 | } |
| 7976 | |
| 7977 | /* almost identical with ALC880 parser... */ |
| 7978 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 7979 | { |
| 7980 | struct alc_spec *spec = codec->spec; |
| 7981 | int err = alc880_parse_auto_config(codec); |
| 7982 | |
| 7983 | if (err < 0) |
| 7984 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7985 | else if (!err) |
| 7986 | return 0; /* no config found */ |
| 7987 | |
| 7988 | err = alc_auto_add_mic_boost(codec); |
| 7989 | if (err < 0) |
| 7990 | return err; |
| 7991 | |
| 7992 | /* hack - override the init verbs */ |
| 7993 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7994 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 7995 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7996 | |
| 7997 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7998 | } |
| 7999 | |
| 8000 | /* additional initialization for auto-configuration model */ |
| 8001 | static void alc883_auto_init(struct hda_codec *codec) |
| 8002 | { |
| 8003 | alc883_auto_init_multi_out(codec); |
| 8004 | alc883_auto_init_hp_out(codec); |
| 8005 | alc883_auto_init_analog_input(codec); |
| 8006 | } |
| 8007 | |
| 8008 | static int patch_alc883(struct hda_codec *codec) |
| 8009 | { |
| 8010 | struct alc_spec *spec; |
| 8011 | int err, board_config; |
| 8012 | |
| 8013 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8014 | if (spec == NULL) |
| 8015 | return -ENOMEM; |
| 8016 | |
| 8017 | codec->spec = spec; |
| 8018 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8019 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8020 | alc883_models, |
| 8021 | alc883_cfg_tbl); |
| 8022 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8023 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8024 | "trying auto-probe from BIOS...\n"); |
| 8025 | board_config = ALC883_AUTO; |
| 8026 | } |
| 8027 | |
| 8028 | if (board_config == ALC883_AUTO) { |
| 8029 | /* automatic parse from the BIOS config */ |
| 8030 | err = alc883_parse_auto_config(codec); |
| 8031 | if (err < 0) { |
| 8032 | alc_free(codec); |
| 8033 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8034 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8035 | printk(KERN_INFO |
| 8036 | "hda_codec: Cannot set up configuration " |
| 8037 | "from BIOS. Using base mode...\n"); |
| 8038 | board_config = ALC883_3ST_2ch_DIG; |
| 8039 | } |
| 8040 | } |
| 8041 | |
| 8042 | if (board_config != ALC883_AUTO) |
| 8043 | setup_preset(spec, &alc883_presets[board_config]); |
| 8044 | |
| 8045 | spec->stream_name_analog = "ALC883 Analog"; |
| 8046 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8047 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8048 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8049 | |
| 8050 | spec->stream_name_digital = "ALC883 Digital"; |
| 8051 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8052 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8053 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8054 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8055 | spec->adc_nids = alc883_adc_nids; |
| 8056 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8057 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8058 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8059 | spec->vmaster_nid = 0x0c; |
| 8060 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8061 | codec->patch_ops = alc_patch_ops; |
| 8062 | if (board_config == ALC883_AUTO) |
| 8063 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8064 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8065 | if (!spec->loopback.amplist) |
| 8066 | spec->loopback.amplist = alc883_loopbacks; |
| 8067 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8068 | |
| 8069 | return 0; |
| 8070 | } |
| 8071 | |
| 8072 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8073 | * ALC262 support |
| 8074 | */ |
| 8075 | |
| 8076 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8077 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8078 | |
| 8079 | #define alc262_dac_nids alc260_dac_nids |
| 8080 | #define alc262_adc_nids alc882_adc_nids |
| 8081 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 8082 | |
| 8083 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8084 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8085 | |
| 8086 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8087 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8088 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8089 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8090 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8091 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8092 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8093 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8094 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8095 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8096 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8097 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8098 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8099 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8100 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 8101 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8102 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8103 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8104 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8105 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8106 | }; |
| 8107 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8108 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8109 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8110 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8111 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8112 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8113 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8114 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8115 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8116 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8117 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8118 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8119 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8120 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8121 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8122 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 8123 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8124 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8125 | { } /* end */ |
| 8126 | }; |
| 8127 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame^] | 8128 | /* update HP, line and mono-out pins according to the master switch */ |
| 8129 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8130 | { |
| 8131 | struct alc_spec *spec = codec->spec; |
| 8132 | int val = spec->master_sw; |
| 8133 | |
| 8134 | /* HP & line-out */ |
| 8135 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8136 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8137 | val ? PIN_HP : 0); |
| 8138 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8139 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8140 | val ? PIN_HP : 0); |
| 8141 | /* mono (speaker) depending on the HP jack sense */ |
| 8142 | val = val && !spec->jack_present; |
| 8143 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8144 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8145 | val ? PIN_OUT : 0); |
| 8146 | } |
| 8147 | |
| 8148 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8149 | { |
| 8150 | struct alc_spec *spec = codec->spec; |
| 8151 | unsigned int presence; |
| 8152 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8153 | AC_VERB_GET_PIN_SENSE, 0); |
| 8154 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8155 | alc262_hp_master_update(codec); |
| 8156 | } |
| 8157 | |
| 8158 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8159 | { |
| 8160 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8161 | return; |
| 8162 | alc262_hp_bpc_automute(codec); |
| 8163 | } |
| 8164 | |
| 8165 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8166 | { |
| 8167 | struct alc_spec *spec = codec->spec; |
| 8168 | unsigned int presence; |
| 8169 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8170 | AC_VERB_GET_PIN_SENSE, 0); |
| 8171 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8172 | alc262_hp_master_update(codec); |
| 8173 | } |
| 8174 | |
| 8175 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8176 | unsigned int res) |
| 8177 | { |
| 8178 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8179 | return; |
| 8180 | alc262_hp_wildwest_automute(codec); |
| 8181 | } |
| 8182 | |
| 8183 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8184 | struct snd_ctl_elem_value *ucontrol) |
| 8185 | { |
| 8186 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8187 | struct alc_spec *spec = codec->spec; |
| 8188 | *ucontrol->value.integer.value = spec->master_sw; |
| 8189 | return 0; |
| 8190 | } |
| 8191 | |
| 8192 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8193 | struct snd_ctl_elem_value *ucontrol) |
| 8194 | { |
| 8195 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8196 | struct alc_spec *spec = codec->spec; |
| 8197 | int val = !!*ucontrol->value.integer.value; |
| 8198 | |
| 8199 | if (val == spec->master_sw) |
| 8200 | return 0; |
| 8201 | spec->master_sw = val; |
| 8202 | alc262_hp_master_update(codec); |
| 8203 | return 1; |
| 8204 | } |
| 8205 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8206 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame^] | 8207 | { |
| 8208 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8209 | .name = "Master Playback Switch", |
| 8210 | .info = snd_ctl_boolean_mono_info, |
| 8211 | .get = alc262_hp_master_sw_get, |
| 8212 | .put = alc262_hp_master_sw_put, |
| 8213 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8214 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8215 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8216 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame^] | 8217 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8218 | HDA_OUTPUT), |
| 8219 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8220 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8221 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8223 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8224 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8225 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8226 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8227 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8228 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8229 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8230 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8231 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8232 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8233 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8234 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8235 | { } /* end */ |
| 8236 | }; |
| 8237 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8238 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame^] | 8239 | { |
| 8240 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8241 | .name = "Master Playback Switch", |
| 8242 | .info = snd_ctl_boolean_mono_info, |
| 8243 | .get = alc262_hp_master_sw_get, |
| 8244 | .put = alc262_hp_master_sw_put, |
| 8245 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8246 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8247 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8248 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8249 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame^] | 8250 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8251 | HDA_OUTPUT), |
| 8252 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8253 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8254 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8255 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8256 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8257 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8258 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8259 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8260 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8261 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8262 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8263 | { } /* end */ |
| 8264 | }; |
| 8265 | |
| 8266 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8267 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8268 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8269 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8270 | { } /* end */ |
| 8271 | }; |
| 8272 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8273 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8274 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8275 | { |
| 8276 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8277 | |
| 8278 | if (force || !spec->sense_updated) { |
| 8279 | unsigned int present; |
| 8280 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8281 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8282 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8283 | spec->sense_updated = 1; |
| 8284 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8285 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8286 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8287 | } |
| 8288 | |
| 8289 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8290 | unsigned int res) |
| 8291 | { |
| 8292 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8293 | return; |
| 8294 | alc262_hp_t5735_automute(codec, 1); |
| 8295 | } |
| 8296 | |
| 8297 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8298 | { |
| 8299 | alc262_hp_t5735_automute(codec, 1); |
| 8300 | } |
| 8301 | |
| 8302 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8303 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8304 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8305 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8306 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8307 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8308 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8309 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8310 | { } /* end */ |
| 8311 | }; |
| 8312 | |
| 8313 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8314 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8315 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8316 | |
| 8317 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8318 | { } |
| 8319 | }; |
| 8320 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8321 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8322 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8323 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8324 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8325 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8326 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8327 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8328 | { } /* end */ |
| 8329 | }; |
| 8330 | |
| 8331 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8332 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8333 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8334 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8335 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8336 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8337 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8338 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8339 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8340 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8341 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8342 | {} |
| 8343 | }; |
| 8344 | |
| 8345 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8346 | .num_items = 1, |
| 8347 | .items = { |
| 8348 | { "Line", 0x1 }, |
| 8349 | }, |
| 8350 | }; |
| 8351 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8352 | /* bind hp and internal speaker mute (with plug check) */ |
| 8353 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8354 | struct snd_ctl_elem_value *ucontrol) |
| 8355 | { |
| 8356 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8357 | long *valp = ucontrol->value.integer.value; |
| 8358 | int change; |
| 8359 | |
| 8360 | /* change hp mute */ |
| 8361 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8362 | HDA_AMP_MUTE, |
| 8363 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8364 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8365 | HDA_AMP_MUTE, |
| 8366 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8367 | if (change) { |
| 8368 | /* change speaker according to HP jack state */ |
| 8369 | struct alc_spec *spec = codec->spec; |
| 8370 | unsigned int mute; |
| 8371 | if (spec->jack_present) |
| 8372 | mute = HDA_AMP_MUTE; |
| 8373 | else |
| 8374 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8375 | HDA_OUTPUT, 0); |
| 8376 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8377 | HDA_AMP_MUTE, mute); |
| 8378 | } |
| 8379 | return change; |
| 8380 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8381 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8382 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8383 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8384 | { |
| 8385 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8386 | .name = "Master Playback Switch", |
| 8387 | .info = snd_hda_mixer_amp_switch_info, |
| 8388 | .get = snd_hda_mixer_amp_switch_get, |
| 8389 | .put = alc262_sony_master_sw_put, |
| 8390 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8391 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8392 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8393 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8394 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8395 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8396 | { } /* end */ |
| 8397 | }; |
| 8398 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8399 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8400 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8401 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8402 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8403 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8404 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8405 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8406 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8407 | { } /* end */ |
| 8408 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8409 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8410 | #define alc262_capture_mixer alc882_capture_mixer |
| 8411 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8412 | |
| 8413 | /* |
| 8414 | * generic initialization of ADC, input mixers and output mixers |
| 8415 | */ |
| 8416 | static struct hda_verb alc262_init_verbs[] = { |
| 8417 | /* |
| 8418 | * Unmute ADC0-2 and set the default input to mic-in |
| 8419 | */ |
| 8420 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8421 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8422 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8423 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8424 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8425 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8426 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8427 | /* 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] | 8428 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8429 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8430 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8431 | */ |
| 8432 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8433 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8434 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8435 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8436 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8437 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8438 | |
| 8439 | /* |
| 8440 | * Set up output mixers (0x0c - 0x0e) |
| 8441 | */ |
| 8442 | /* set vol=0 to output mixers */ |
| 8443 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8444 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8445 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8446 | /* set up input amps for analog loopback */ |
| 8447 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8448 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8449 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8450 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8451 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8452 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8453 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8454 | |
| 8455 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8456 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8457 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8458 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8459 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8460 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8461 | |
| 8462 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8463 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8464 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8465 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8466 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8467 | |
| 8468 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8469 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8470 | |
| 8471 | /* FIXME: use matrix-type input source selection */ |
| 8472 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8473 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8474 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8475 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8476 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8477 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8478 | /* Input mixer2 */ |
| 8479 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8480 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8481 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8482 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8483 | /* Input mixer3 */ |
| 8484 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8485 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8486 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8487 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8488 | |
| 8489 | { } |
| 8490 | }; |
| 8491 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8492 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8493 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8494 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8495 | {} |
| 8496 | }; |
| 8497 | |
| 8498 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8499 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8500 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8501 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8502 | |
| 8503 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8504 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8505 | {} |
| 8506 | }; |
| 8507 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8508 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8509 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8510 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8511 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8512 | |
| 8513 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8514 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8515 | }; |
| 8516 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8517 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8518 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8519 | { |
| 8520 | struct alc_spec *spec = codec->spec; |
| 8521 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8522 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8523 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8524 | /* need to execute and sync at first */ |
| 8525 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8526 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8527 | AC_VERB_GET_PIN_SENSE, 0); |
| 8528 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8529 | if (spec->jack_present) { |
| 8530 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8531 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8532 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8533 | } else { |
| 8534 | /* unmute internal speaker if necessary */ |
| 8535 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8536 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8537 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8538 | } |
| 8539 | } |
| 8540 | |
| 8541 | /* unsolicited event for HP jack sensing */ |
| 8542 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8543 | unsigned int res) |
| 8544 | { |
| 8545 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8546 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8547 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8548 | } |
| 8549 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8550 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8551 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8552 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8553 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8554 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8555 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8556 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8557 | AC_VERB_GET_PIN_SENSE, 0); |
| 8558 | present = (present & 0x80000000) != 0; |
| 8559 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8560 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8561 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8562 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8563 | } else { |
| 8564 | /* unmute internal speaker if necessary */ |
| 8565 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8566 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8567 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8568 | } |
| 8569 | } |
| 8570 | |
| 8571 | /* unsolicited event for HP jack sensing */ |
| 8572 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8573 | unsigned int res) |
| 8574 | { |
| 8575 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8576 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8577 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8578 | } |
| 8579 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8580 | /* |
| 8581 | * fujitsu model |
| 8582 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 8583 | */ |
| 8584 | |
| 8585 | #define ALC_HP_EVENT 0x37 |
| 8586 | |
| 8587 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8588 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8589 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8590 | {} |
| 8591 | }; |
| 8592 | |
| 8593 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8594 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8595 | .items = { |
| 8596 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8597 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8598 | { "CD", 0x4 }, |
| 8599 | }, |
| 8600 | }; |
| 8601 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8602 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8603 | .num_items = 5, |
| 8604 | .items = { |
| 8605 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8606 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8607 | { "Line", 0x2 }, |
| 8608 | { "CD", 0x4 }, |
| 8609 | { "AUX IN", 0x6 }, |
| 8610 | }, |
| 8611 | }; |
| 8612 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8613 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8614 | .num_items = 4, |
| 8615 | .items = { |
| 8616 | { "Mic", 0x0 }, |
| 8617 | { "Front Mic", 0x2 }, |
| 8618 | { "Line", 0x1 }, |
| 8619 | { "CD", 0x4 }, |
| 8620 | }, |
| 8621 | }; |
| 8622 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8623 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8624 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8625 | { |
| 8626 | struct alc_spec *spec = codec->spec; |
| 8627 | unsigned int mute; |
| 8628 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8629 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8630 | unsigned int present; |
| 8631 | /* need to execute and sync at first */ |
| 8632 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8633 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8634 | AC_VERB_GET_PIN_SENSE, 0); |
| 8635 | spec->jack_present = (present & 0x80000000) != 0; |
| 8636 | spec->sense_updated = 1; |
| 8637 | } |
| 8638 | if (spec->jack_present) { |
| 8639 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8640 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8641 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8642 | } else { |
| 8643 | /* unmute internal speaker if necessary */ |
| 8644 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8645 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8646 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8647 | } |
| 8648 | } |
| 8649 | |
| 8650 | /* unsolicited event for HP jack sensing */ |
| 8651 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8652 | unsigned int res) |
| 8653 | { |
| 8654 | if ((res >> 26) != ALC_HP_EVENT) |
| 8655 | return; |
| 8656 | alc262_fujitsu_automute(codec, 1); |
| 8657 | } |
| 8658 | |
| 8659 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8660 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8661 | .ops = &snd_hda_bind_vol, |
| 8662 | .values = { |
| 8663 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8664 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8665 | 0 |
| 8666 | }, |
| 8667 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8668 | |
| 8669 | /* bind hp and internal speaker mute (with plug check) */ |
| 8670 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8671 | struct snd_ctl_elem_value *ucontrol) |
| 8672 | { |
| 8673 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8674 | long *valp = ucontrol->value.integer.value; |
| 8675 | int change; |
| 8676 | |
| 8677 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8678 | HDA_AMP_MUTE, |
| 8679 | valp[0] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8680 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8681 | HDA_AMP_MUTE, |
| 8682 | valp[1] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8683 | if (change) |
| 8684 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8685 | return change; |
| 8686 | } |
| 8687 | |
| 8688 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8689 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8690 | { |
| 8691 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8692 | .name = "Master Playback Switch", |
| 8693 | .info = snd_hda_mixer_amp_switch_info, |
| 8694 | .get = snd_hda_mixer_amp_switch_get, |
| 8695 | .put = alc262_fujitsu_master_sw_put, |
| 8696 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8697 | }, |
| 8698 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8699 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8700 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8701 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8702 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8703 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8704 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8705 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8706 | { } /* end */ |
| 8707 | }; |
| 8708 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8709 | /* additional init verbs for Benq laptops */ |
| 8710 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8711 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8712 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8713 | {} |
| 8714 | }; |
| 8715 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8716 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8717 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8718 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8719 | |
| 8720 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8721 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8722 | {} |
| 8723 | }; |
| 8724 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8725 | /* Samsung Q1 Ultra Vista model setup */ |
| 8726 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
| 8727 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8728 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8729 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8730 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8731 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8732 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8733 | { } /* end */ |
| 8734 | }; |
| 8735 | |
| 8736 | static struct hda_verb alc262_ultra_verbs[] = { |
| 8737 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8738 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8739 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8740 | /* Mic is on Node 0x19 */ |
| 8741 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8742 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8743 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8744 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8745 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8746 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8747 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8748 | {} |
| 8749 | }; |
| 8750 | |
| 8751 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 8752 | .num_items = 1, |
| 8753 | .items = { |
| 8754 | { "Mic", 0x1 }, |
| 8755 | }, |
| 8756 | }; |
| 8757 | |
| 8758 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8759 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 8760 | { |
| 8761 | struct alc_spec *spec = codec->spec; |
| 8762 | unsigned int mute; |
| 8763 | unsigned int present; |
| 8764 | |
| 8765 | /* need to execute and sync at first */ |
| 8766 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8767 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8768 | AC_VERB_GET_PIN_SENSE, 0); |
| 8769 | spec->jack_present = (present & 0x80000000) != 0; |
| 8770 | if (spec->jack_present) { |
| 8771 | /* mute internal speaker */ |
| 8772 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8773 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8774 | } else { |
| 8775 | /* unmute internal speaker if necessary */ |
| 8776 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 8777 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8778 | HDA_AMP_MUTE, mute); |
| 8779 | } |
| 8780 | } |
| 8781 | |
| 8782 | /* unsolicited event for HP jack sensing */ |
| 8783 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 8784 | unsigned int res) |
| 8785 | { |
| 8786 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8787 | return; |
| 8788 | alc262_ultra_automute(codec); |
| 8789 | } |
| 8790 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8791 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8792 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8793 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8794 | { |
| 8795 | hda_nid_t nid; |
| 8796 | int err; |
| 8797 | |
| 8798 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 8799 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8800 | spec->multiout.dac_nids[0] = 2; |
| 8801 | |
| 8802 | nid = cfg->line_out_pins[0]; |
| 8803 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8804 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8805 | "Front Playback Volume", |
| 8806 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 8807 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8808 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8809 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8810 | "Front Playback Switch", |
| 8811 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 8812 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8813 | return err; |
| 8814 | } |
| 8815 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 8816 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8817 | if (nid) { |
| 8818 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8819 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8820 | "Speaker Playback Volume", |
| 8821 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8822 | HDA_OUTPUT)); |
| 8823 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8824 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8825 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8826 | "Speaker Playback Switch", |
| 8827 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8828 | HDA_OUTPUT)); |
| 8829 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8830 | return err; |
| 8831 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8832 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8833 | "Speaker Playback Switch", |
| 8834 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8835 | HDA_OUTPUT)); |
| 8836 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8837 | return err; |
| 8838 | } |
| 8839 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8840 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8841 | if (nid) { |
| 8842 | /* spec->multiout.hp_nid = 2; */ |
| 8843 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8844 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8845 | "Headphone Playback Volume", |
| 8846 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8847 | HDA_OUTPUT)); |
| 8848 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8849 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8850 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8851 | "Headphone Playback Switch", |
| 8852 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8853 | HDA_OUTPUT)); |
| 8854 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8855 | return err; |
| 8856 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8857 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8858 | "Headphone Playback Switch", |
| 8859 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8860 | HDA_OUTPUT)); |
| 8861 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8862 | return err; |
| 8863 | } |
| 8864 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8865 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8866 | } |
| 8867 | |
| 8868 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8869 | #define alc262_auto_create_analog_input_ctls \ |
| 8870 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8871 | |
| 8872 | /* |
| 8873 | * generic initialization of ADC, input mixers and output mixers |
| 8874 | */ |
| 8875 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 8876 | /* |
| 8877 | * Unmute ADC0-2 and set the default input to mic-in |
| 8878 | */ |
| 8879 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8880 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8881 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8882 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8883 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8884 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8885 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8886 | /* 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] | 8887 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8888 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8889 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8890 | */ |
| 8891 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8892 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8893 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8894 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8895 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8896 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8897 | |
| 8898 | /* |
| 8899 | * Set up output mixers (0x0c - 0x0f) |
| 8900 | */ |
| 8901 | /* set vol=0 to output mixers */ |
| 8902 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8903 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8904 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8905 | |
| 8906 | /* set up input amps for analog loopback */ |
| 8907 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8908 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8910 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8911 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8912 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8913 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8914 | |
| 8915 | /* FIXME: use matrix-type input source selection */ |
| 8916 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8917 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8918 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8919 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8920 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8921 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8922 | /* Input mixer2 */ |
| 8923 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8924 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8925 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8926 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8927 | /* Input mixer3 */ |
| 8928 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8929 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8930 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8931 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8932 | |
| 8933 | { } |
| 8934 | }; |
| 8935 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8936 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 8937 | /* |
| 8938 | * Unmute ADC0-2 and set the default input to mic-in |
| 8939 | */ |
| 8940 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8941 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8942 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8943 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8944 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8945 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8946 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8947 | /* 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] | 8948 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8949 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8950 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8951 | */ |
| 8952 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8953 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8954 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8955 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8956 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8957 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8958 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8959 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8960 | |
| 8961 | /* |
| 8962 | * Set up output mixers (0x0c - 0x0e) |
| 8963 | */ |
| 8964 | /* set vol=0 to output mixers */ |
| 8965 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8966 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8967 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8968 | |
| 8969 | /* set up input amps for analog loopback */ |
| 8970 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8971 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8972 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8973 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8974 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8975 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8976 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8977 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame^] | 8978 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8979 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8980 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8981 | |
| 8982 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8983 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8984 | |
| 8985 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8986 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8987 | |
| 8988 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8989 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8990 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8991 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8992 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8993 | |
| 8994 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8995 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8996 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8997 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8998 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8999 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9000 | |
| 9001 | |
| 9002 | /* FIXME: use matrix-type input source selection */ |
| 9003 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9004 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9005 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9006 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9007 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9008 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9009 | /* Input mixer2 */ |
| 9010 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9011 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9012 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9013 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9014 | /* Input mixer3 */ |
| 9015 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9016 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9017 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9018 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9019 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame^] | 9020 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9021 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9022 | { } |
| 9023 | }; |
| 9024 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9025 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9026 | /* |
| 9027 | * Unmute ADC0-2 and set the default input to mic-in |
| 9028 | */ |
| 9029 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9030 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9031 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9032 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9033 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9034 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9035 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9036 | /* 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] | 9037 | * mixer widget |
| 9038 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9039 | * panel mic (mic 2) |
| 9040 | */ |
| 9041 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9044 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9045 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9046 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9047 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9048 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9049 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9050 | /* |
| 9051 | * Set up output mixers (0x0c - 0x0e) |
| 9052 | */ |
| 9053 | /* set vol=0 to output mixers */ |
| 9054 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9055 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9056 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9057 | |
| 9058 | /* set up input amps for analog loopback */ |
| 9059 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9060 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9061 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9062 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9063 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9064 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9065 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9066 | |
| 9067 | |
| 9068 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9069 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9070 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9071 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9072 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9073 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9074 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9075 | |
| 9076 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9077 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9078 | |
| 9079 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9080 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9081 | |
| 9082 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9083 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9084 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9085 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9086 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9087 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9088 | |
| 9089 | /* FIXME: use matrix-type input source selection */ |
| 9090 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9091 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9092 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9093 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9094 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9095 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9096 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9097 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9098 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9099 | /* Input mixer2 */ |
| 9100 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9101 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9102 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9103 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9104 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9105 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9106 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9107 | /* Input mixer3 */ |
| 9108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9113 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9114 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9115 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame^] | 9116 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9117 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9118 | { } |
| 9119 | }; |
| 9120 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9121 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9122 | #define alc262_loopbacks alc880_loopbacks |
| 9123 | #endif |
| 9124 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9125 | /* pcm configuration: identiacal with ALC880 */ |
| 9126 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9127 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9128 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9129 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9130 | |
| 9131 | /* |
| 9132 | * BIOS auto configuration |
| 9133 | */ |
| 9134 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9135 | { |
| 9136 | struct alc_spec *spec = codec->spec; |
| 9137 | int err; |
| 9138 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9139 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9140 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9141 | alc262_ignore); |
| 9142 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9143 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9144 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9145 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9146 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9147 | if (err < 0) |
| 9148 | return err; |
| 9149 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9150 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9151 | return err; |
| 9152 | |
| 9153 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9154 | |
| 9155 | if (spec->autocfg.dig_out_pin) |
| 9156 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9157 | if (spec->autocfg.dig_in_pin) |
| 9158 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9159 | |
| 9160 | if (spec->kctl_alloc) |
| 9161 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9162 | |
| 9163 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9164 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9165 | spec->input_mux = &spec->private_imux; |
| 9166 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9167 | err = alc_auto_add_mic_boost(codec); |
| 9168 | if (err < 0) |
| 9169 | return err; |
| 9170 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9171 | return 1; |
| 9172 | } |
| 9173 | |
| 9174 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9175 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9176 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 9177 | |
| 9178 | |
| 9179 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9180 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9181 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9182 | alc262_auto_init_multi_out(codec); |
| 9183 | alc262_auto_init_hp_out(codec); |
| 9184 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9185 | } |
| 9186 | |
| 9187 | /* |
| 9188 | * configuration and preset |
| 9189 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9190 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9191 | [ALC262_BASIC] = "basic", |
| 9192 | [ALC262_HIPPO] = "hippo", |
| 9193 | [ALC262_HIPPO_1] = "hippo_1", |
| 9194 | [ALC262_FUJITSU] = "fujitsu", |
| 9195 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9196 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9197 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9198 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9199 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9200 | [ALC262_BENQ_T31] = "benq-t31", |
| 9201 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9202 | [ALC262_ULTRA] = "ultra", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9203 | [ALC262_AUTO] = "auto", |
| 9204 | }; |
| 9205 | |
| 9206 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9207 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 9208 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9209 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9210 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9211 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9212 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9213 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9214 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9215 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9216 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9217 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9218 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9219 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9220 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9221 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9222 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9223 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9224 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9225 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9226 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9227 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9228 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9229 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9230 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9231 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9232 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9233 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9234 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9235 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9236 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9237 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9238 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9239 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9240 | {} |
| 9241 | }; |
| 9242 | |
| 9243 | static struct alc_config_preset alc262_presets[] = { |
| 9244 | [ALC262_BASIC] = { |
| 9245 | .mixers = { alc262_base_mixer }, |
| 9246 | .init_verbs = { alc262_init_verbs }, |
| 9247 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9248 | .dac_nids = alc262_dac_nids, |
| 9249 | .hp_nid = 0x03, |
| 9250 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9251 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9252 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9253 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9254 | [ALC262_HIPPO] = { |
| 9255 | .mixers = { alc262_base_mixer }, |
| 9256 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9257 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9258 | .dac_nids = alc262_dac_nids, |
| 9259 | .hp_nid = 0x03, |
| 9260 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9261 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9262 | .channel_mode = alc262_modes, |
| 9263 | .input_mux = &alc262_capture_source, |
| 9264 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9265 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9266 | }, |
| 9267 | [ALC262_HIPPO_1] = { |
| 9268 | .mixers = { alc262_hippo1_mixer }, |
| 9269 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9270 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9271 | .dac_nids = alc262_dac_nids, |
| 9272 | .hp_nid = 0x02, |
| 9273 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9274 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9275 | .channel_mode = alc262_modes, |
| 9276 | .input_mux = &alc262_capture_source, |
| 9277 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9278 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9279 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9280 | [ALC262_FUJITSU] = { |
| 9281 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9282 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9283 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9284 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9285 | .dac_nids = alc262_dac_nids, |
| 9286 | .hp_nid = 0x03, |
| 9287 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9288 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9289 | .channel_mode = alc262_modes, |
| 9290 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9291 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9292 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9293 | [ALC262_HP_BPC] = { |
| 9294 | .mixers = { alc262_HP_BPC_mixer }, |
| 9295 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9296 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9297 | .dac_nids = alc262_dac_nids, |
| 9298 | .hp_nid = 0x03, |
| 9299 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9300 | .channel_mode = alc262_modes, |
| 9301 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame^] | 9302 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 9303 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9304 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9305 | [ALC262_HP_BPC_D7000_WF] = { |
| 9306 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9307 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9308 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9309 | .dac_nids = alc262_dac_nids, |
| 9310 | .hp_nid = 0x03, |
| 9311 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9312 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9313 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame^] | 9314 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9315 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9316 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9317 | [ALC262_HP_BPC_D7000_WL] = { |
| 9318 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9319 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9320 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9321 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9322 | .dac_nids = alc262_dac_nids, |
| 9323 | .hp_nid = 0x03, |
| 9324 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9325 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9326 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame^] | 9327 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9328 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9329 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9330 | [ALC262_HP_TC_T5735] = { |
| 9331 | .mixers = { alc262_hp_t5735_mixer }, |
| 9332 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9333 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9334 | .dac_nids = alc262_dac_nids, |
| 9335 | .hp_nid = 0x03, |
| 9336 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9337 | .channel_mode = alc262_modes, |
| 9338 | .input_mux = &alc262_capture_source, |
| 9339 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9340 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9341 | }, |
| 9342 | [ALC262_HP_RP5700] = { |
| 9343 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9344 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9345 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9346 | .dac_nids = alc262_dac_nids, |
| 9347 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9348 | .channel_mode = alc262_modes, |
| 9349 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9350 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9351 | [ALC262_BENQ_ED8] = { |
| 9352 | .mixers = { alc262_base_mixer }, |
| 9353 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9354 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9355 | .dac_nids = alc262_dac_nids, |
| 9356 | .hp_nid = 0x03, |
| 9357 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9358 | .channel_mode = alc262_modes, |
| 9359 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9360 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9361 | [ALC262_SONY_ASSAMD] = { |
| 9362 | .mixers = { alc262_sony_mixer }, |
| 9363 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9364 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9365 | .dac_nids = alc262_dac_nids, |
| 9366 | .hp_nid = 0x02, |
| 9367 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9368 | .channel_mode = alc262_modes, |
| 9369 | .input_mux = &alc262_capture_source, |
| 9370 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9371 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9372 | }, |
| 9373 | [ALC262_BENQ_T31] = { |
| 9374 | .mixers = { alc262_benq_t31_mixer }, |
| 9375 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_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, |
| 9382 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9383 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9384 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9385 | [ALC262_ULTRA] = { |
| 9386 | .mixers = { alc262_ultra_mixer }, |
| 9387 | .init_verbs = { alc262_init_verbs, alc262_ultra_verbs }, |
| 9388 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9389 | .dac_nids = alc262_dac_nids, |
| 9390 | .hp_nid = 0x03, |
| 9391 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9392 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9393 | .channel_mode = alc262_modes, |
| 9394 | .input_mux = &alc262_ultra_capture_source, |
| 9395 | .unsol_event = alc262_ultra_unsol_event, |
| 9396 | .init_hook = alc262_ultra_automute, |
| 9397 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9398 | }; |
| 9399 | |
| 9400 | static int patch_alc262(struct hda_codec *codec) |
| 9401 | { |
| 9402 | struct alc_spec *spec; |
| 9403 | int board_config; |
| 9404 | int err; |
| 9405 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9406 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9407 | if (spec == NULL) |
| 9408 | return -ENOMEM; |
| 9409 | |
| 9410 | codec->spec = spec; |
| 9411 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9412 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9413 | * under-run |
| 9414 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9415 | { |
| 9416 | int tmp; |
| 9417 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9418 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9419 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9420 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9421 | } |
| 9422 | #endif |
| 9423 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9424 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9425 | alc262_models, |
| 9426 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9427 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9428 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9429 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9430 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9431 | board_config = ALC262_AUTO; |
| 9432 | } |
| 9433 | |
| 9434 | if (board_config == ALC262_AUTO) { |
| 9435 | /* automatic parse from the BIOS config */ |
| 9436 | err = alc262_parse_auto_config(codec); |
| 9437 | if (err < 0) { |
| 9438 | alc_free(codec); |
| 9439 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9440 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9441 | printk(KERN_INFO |
| 9442 | "hda_codec: Cannot set up configuration " |
| 9443 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9444 | board_config = ALC262_BASIC; |
| 9445 | } |
| 9446 | } |
| 9447 | |
| 9448 | if (board_config != ALC262_AUTO) |
| 9449 | setup_preset(spec, &alc262_presets[board_config]); |
| 9450 | |
| 9451 | spec->stream_name_analog = "ALC262 Analog"; |
| 9452 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9453 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9454 | |
| 9455 | spec->stream_name_digital = "ALC262 Digital"; |
| 9456 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9457 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9458 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9459 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9460 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9461 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9462 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9463 | /* get type */ |
| 9464 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9465 | if (wcap != AC_WID_AUD_IN) { |
| 9466 | spec->adc_nids = alc262_adc_nids_alt; |
| 9467 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9468 | spec->mixers[spec->num_mixers] = |
| 9469 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9470 | spec->num_mixers++; |
| 9471 | } else { |
| 9472 | spec->adc_nids = alc262_adc_nids; |
| 9473 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 9474 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9475 | spec->num_mixers++; |
| 9476 | } |
| 9477 | } |
| 9478 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9479 | spec->vmaster_nid = 0x0c; |
| 9480 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9481 | codec->patch_ops = alc_patch_ops; |
| 9482 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9483 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9484 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9485 | if (!spec->loopback.amplist) |
| 9486 | spec->loopback.amplist = alc262_loopbacks; |
| 9487 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9488 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9489 | return 0; |
| 9490 | } |
| 9491 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9492 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9493 | * ALC268 channel source setting (2 channel) |
| 9494 | */ |
| 9495 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9496 | #define alc268_modes alc260_modes |
| 9497 | |
| 9498 | static hda_nid_t alc268_dac_nids[2] = { |
| 9499 | /* front, hp */ |
| 9500 | 0x02, 0x03 |
| 9501 | }; |
| 9502 | |
| 9503 | static hda_nid_t alc268_adc_nids[2] = { |
| 9504 | /* ADC0-1 */ |
| 9505 | 0x08, 0x07 |
| 9506 | }; |
| 9507 | |
| 9508 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9509 | /* ADC0 */ |
| 9510 | 0x08 |
| 9511 | }; |
| 9512 | |
| 9513 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9514 | /* output mixer control */ |
| 9515 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9516 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9517 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9518 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9519 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9520 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9521 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9522 | { } |
| 9523 | }; |
| 9524 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9525 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9526 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9527 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9528 | { } |
| 9529 | }; |
| 9530 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9531 | /* Toshiba specific */ |
| 9532 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9533 | |
| 9534 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9535 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9536 | { } /* end */ |
| 9537 | }; |
| 9538 | |
| 9539 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9540 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9541 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9542 | .ops = &snd_hda_bind_vol, |
| 9543 | .values = { |
| 9544 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9545 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9546 | 0 |
| 9547 | }, |
| 9548 | }; |
| 9549 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9550 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9551 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9552 | { |
| 9553 | struct alc_spec *spec = codec->spec; |
| 9554 | unsigned int mute; |
| 9555 | |
| 9556 | if (force || !spec->sense_updated) { |
| 9557 | unsigned int present; |
| 9558 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9559 | AC_VERB_GET_PIN_SENSE, 0); |
| 9560 | spec->jack_present = (present & 0x80000000) != 0; |
| 9561 | spec->sense_updated = 1; |
| 9562 | } |
| 9563 | if (spec->jack_present) |
| 9564 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9565 | else /* unmute internal speaker if necessary */ |
| 9566 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9567 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9568 | HDA_AMP_MUTE, mute); |
| 9569 | } |
| 9570 | |
| 9571 | |
| 9572 | /* bind hp and internal speaker mute (with plug check) */ |
| 9573 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9574 | struct snd_ctl_elem_value *ucontrol) |
| 9575 | { |
| 9576 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9577 | long *valp = ucontrol->value.integer.value; |
| 9578 | int change; |
| 9579 | |
| 9580 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9581 | HDA_AMP_MUTE, |
| 9582 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9583 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9584 | HDA_AMP_MUTE, |
| 9585 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9586 | if (change) |
| 9587 | alc268_acer_automute(codec, 0); |
| 9588 | return change; |
| 9589 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9590 | |
| 9591 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9592 | /* output mixer control */ |
| 9593 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9594 | { |
| 9595 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9596 | .name = "Master Playback Switch", |
| 9597 | .info = snd_hda_mixer_amp_switch_info, |
| 9598 | .get = snd_hda_mixer_amp_switch_get, |
| 9599 | .put = alc268_acer_master_sw_put, |
| 9600 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9601 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9602 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9603 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9604 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9605 | { } |
| 9606 | }; |
| 9607 | |
| 9608 | static struct hda_verb alc268_acer_verbs[] = { |
| 9609 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9610 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9611 | |
| 9612 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9613 | { } |
| 9614 | }; |
| 9615 | |
| 9616 | /* unsolicited event for HP jack sensing */ |
| 9617 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9618 | unsigned int res) |
| 9619 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9620 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9621 | return; |
| 9622 | alc268_toshiba_automute(codec); |
| 9623 | } |
| 9624 | |
| 9625 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9626 | unsigned int res) |
| 9627 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9628 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9629 | return; |
| 9630 | alc268_acer_automute(codec, 1); |
| 9631 | } |
| 9632 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9633 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9634 | { |
| 9635 | alc268_acer_automute(codec, 1); |
| 9636 | } |
| 9637 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9638 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 9639 | /* output mixer control */ |
| 9640 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9641 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9642 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9643 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9644 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9645 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9646 | { } |
| 9647 | }; |
| 9648 | |
| 9649 | static struct hda_verb alc268_dell_verbs[] = { |
| 9650 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9651 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9652 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9653 | { } |
| 9654 | }; |
| 9655 | |
| 9656 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9657 | static void alc268_dell_automute(struct hda_codec *codec) |
| 9658 | { |
| 9659 | unsigned int present; |
| 9660 | unsigned int mute; |
| 9661 | |
| 9662 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 9663 | if (present & 0x80000000) |
| 9664 | mute = HDA_AMP_MUTE; |
| 9665 | else |
| 9666 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 9667 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9668 | HDA_AMP_MUTE, mute); |
| 9669 | } |
| 9670 | |
| 9671 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 9672 | unsigned int res) |
| 9673 | { |
| 9674 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9675 | return; |
| 9676 | alc268_dell_automute(codec); |
| 9677 | } |
| 9678 | |
| 9679 | #define alc268_dell_init_hook alc268_dell_automute |
| 9680 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9681 | /* |
| 9682 | * generic initialization of ADC, input mixers and output mixers |
| 9683 | */ |
| 9684 | static struct hda_verb alc268_base_init_verbs[] = { |
| 9685 | /* Unmute DAC0-1 and set vol = 0 */ |
| 9686 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9687 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9688 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9689 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9690 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9691 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9692 | |
| 9693 | /* |
| 9694 | * Set up output mixers (0x0c - 0x0e) |
| 9695 | */ |
| 9696 | /* set vol=0 to output mixers */ |
| 9697 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9698 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9699 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9700 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9701 | |
| 9702 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9703 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9704 | |
| 9705 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9706 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9707 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9708 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9709 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9710 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9711 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9712 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9713 | |
| 9714 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9715 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9716 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9717 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9718 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9719 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9720 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9721 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9722 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9723 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 9724 | |
| 9725 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9726 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9727 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9728 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9729 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9730 | { } |
| 9731 | }; |
| 9732 | |
| 9733 | /* |
| 9734 | * generic initialization of ADC, input mixers and output mixers |
| 9735 | */ |
| 9736 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 9737 | /* set output DAC */ |
| 9738 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9739 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9740 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9741 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9742 | |
| 9743 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9744 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9745 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9746 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9747 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9748 | |
| 9749 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9750 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9751 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9752 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9753 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9754 | |
| 9755 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9756 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9757 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9758 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9759 | |
| 9760 | /* set PCBEEP vol = 0 */ |
| 9761 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, |
| 9762 | |
| 9763 | { } |
| 9764 | }; |
| 9765 | |
| 9766 | #define alc268_mux_enum_info alc_mux_enum_info |
| 9767 | #define alc268_mux_enum_get alc_mux_enum_get |
| 9768 | |
| 9769 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9770 | struct snd_ctl_elem_value *ucontrol) |
| 9771 | { |
| 9772 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9773 | struct alc_spec *spec = codec->spec; |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9774 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9775 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 9776 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; |
| 9777 | hda_nid_t nid = capture_mixers[adc_idx]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9778 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9779 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
| 9780 | nid, |
| 9781 | &spec->cur_mux[adc_idx]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9782 | } |
| 9783 | |
| 9784 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 9785 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9786 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9787 | { |
| 9788 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9789 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9790 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9791 | */ |
| 9792 | /* .name = "Capture Source", */ |
| 9793 | .name = "Input Source", |
| 9794 | .count = 1, |
| 9795 | .info = alc268_mux_enum_info, |
| 9796 | .get = alc268_mux_enum_get, |
| 9797 | .put = alc268_mux_enum_put, |
| 9798 | }, |
| 9799 | { } /* end */ |
| 9800 | }; |
| 9801 | |
| 9802 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 9803 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9804 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9805 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9806 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9807 | { |
| 9808 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9809 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9810 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9811 | */ |
| 9812 | /* .name = "Capture Source", */ |
| 9813 | .name = "Input Source", |
| 9814 | .count = 2, |
| 9815 | .info = alc268_mux_enum_info, |
| 9816 | .get = alc268_mux_enum_get, |
| 9817 | .put = alc268_mux_enum_put, |
| 9818 | }, |
| 9819 | { } /* end */ |
| 9820 | }; |
| 9821 | |
| 9822 | static struct hda_input_mux alc268_capture_source = { |
| 9823 | .num_items = 4, |
| 9824 | .items = { |
| 9825 | { "Mic", 0x0 }, |
| 9826 | { "Front Mic", 0x1 }, |
| 9827 | { "Line", 0x2 }, |
| 9828 | { "CD", 0x3 }, |
| 9829 | }, |
| 9830 | }; |
| 9831 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9832 | #ifdef CONFIG_SND_DEBUG |
| 9833 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
| 9834 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9835 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9836 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9837 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9838 | |
| 9839 | /* Volume widgets */ |
| 9840 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9841 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9842 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9843 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9844 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 9845 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 9846 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 9847 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 9848 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 9849 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 9850 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 9851 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 9852 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 9853 | /* The below appears problematic on some hardwares */ |
| 9854 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9855 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9856 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 9857 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 9858 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 9859 | |
| 9860 | /* Modes for retasking pin widgets */ |
| 9861 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 9862 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 9863 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 9864 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 9865 | |
| 9866 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 9867 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 9868 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 9869 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 9870 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 9871 | |
| 9872 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 9873 | * The ALC268 does not have an SPDIF input. |
| 9874 | */ |
| 9875 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 9876 | |
| 9877 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 9878 | * this output to turn on an external amplifier. |
| 9879 | */ |
| 9880 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 9881 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 9882 | |
| 9883 | { } /* end */ |
| 9884 | }; |
| 9885 | #endif |
| 9886 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9887 | /* create input playback/capture controls for the given pin */ |
| 9888 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 9889 | const char *ctlname, int idx) |
| 9890 | { |
| 9891 | char name[32]; |
| 9892 | int err; |
| 9893 | |
| 9894 | sprintf(name, "%s Playback Volume", ctlname); |
| 9895 | if (nid == 0x14) { |
| 9896 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9897 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 9898 | HDA_OUTPUT)); |
| 9899 | if (err < 0) |
| 9900 | return err; |
| 9901 | } else if (nid == 0x15) { |
| 9902 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9903 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 9904 | HDA_OUTPUT)); |
| 9905 | if (err < 0) |
| 9906 | return err; |
| 9907 | } else |
| 9908 | return -1; |
| 9909 | sprintf(name, "%s Playback Switch", ctlname); |
| 9910 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 9911 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 9912 | if (err < 0) |
| 9913 | return err; |
| 9914 | return 0; |
| 9915 | } |
| 9916 | |
| 9917 | /* add playback controls from the parsed DAC table */ |
| 9918 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9919 | const struct auto_pin_cfg *cfg) |
| 9920 | { |
| 9921 | hda_nid_t nid; |
| 9922 | int err; |
| 9923 | |
| 9924 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 9925 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9926 | spec->multiout.dac_nids[0] = 2; |
| 9927 | spec->multiout.dac_nids[1] = 3; |
| 9928 | |
| 9929 | nid = cfg->line_out_pins[0]; |
| 9930 | if (nid) |
| 9931 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 9932 | |
| 9933 | nid = cfg->speaker_pins[0]; |
| 9934 | if (nid == 0x1d) { |
| 9935 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9936 | "Speaker Playback Volume", |
| 9937 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9938 | if (err < 0) |
| 9939 | return err; |
| 9940 | } |
| 9941 | nid = cfg->hp_pins[0]; |
| 9942 | if (nid) |
| 9943 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 9944 | |
| 9945 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 9946 | if (nid == 0x16) { |
| 9947 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9948 | "Mono Playback Switch", |
| 9949 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 9950 | if (err < 0) |
| 9951 | return err; |
| 9952 | } |
| 9953 | return 0; |
| 9954 | } |
| 9955 | |
| 9956 | /* create playback/capture controls for input pins */ |
| 9957 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 9958 | const struct auto_pin_cfg *cfg) |
| 9959 | { |
| 9960 | struct hda_input_mux *imux = &spec->private_imux; |
| 9961 | int i, idx1; |
| 9962 | |
| 9963 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9964 | switch(cfg->input_pins[i]) { |
| 9965 | case 0x18: |
| 9966 | idx1 = 0; /* Mic 1 */ |
| 9967 | break; |
| 9968 | case 0x19: |
| 9969 | idx1 = 1; /* Mic 2 */ |
| 9970 | break; |
| 9971 | case 0x1a: |
| 9972 | idx1 = 2; /* Line In */ |
| 9973 | break; |
| 9974 | case 0x1c: |
| 9975 | idx1 = 3; /* CD */ |
| 9976 | break; |
| 9977 | default: |
| 9978 | continue; |
| 9979 | } |
| 9980 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 9981 | imux->items[imux->num_items].index = idx1; |
| 9982 | imux->num_items++; |
| 9983 | } |
| 9984 | return 0; |
| 9985 | } |
| 9986 | |
| 9987 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 9988 | { |
| 9989 | struct alc_spec *spec = codec->spec; |
| 9990 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9991 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9992 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9993 | unsigned int dac_vol1, dac_vol2; |
| 9994 | |
| 9995 | if (speaker_nid) { |
| 9996 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 9997 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 9998 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9999 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10000 | AMP_IN_UNMUTE(1)); |
| 10001 | snd_hda_codec_write(codec, 0x10, 0, |
| 10002 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10003 | AMP_IN_UNMUTE(1)); |
| 10004 | } else { |
| 10005 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10006 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10007 | snd_hda_codec_write(codec, 0x10, 0, |
| 10008 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10009 | } |
| 10010 | |
| 10011 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 10012 | if (line_nid == 0x14) |
| 10013 | dac_vol2 = AMP_OUT_ZERO; |
| 10014 | else if (line_nid == 0x15) |
| 10015 | dac_vol1 = AMP_OUT_ZERO; |
| 10016 | if (hp_nid == 0x14) |
| 10017 | dac_vol2 = AMP_OUT_ZERO; |
| 10018 | else if (hp_nid == 0x15) |
| 10019 | dac_vol1 = AMP_OUT_ZERO; |
| 10020 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10021 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10022 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10023 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10024 | |
| 10025 | snd_hda_codec_write(codec, 0x02, 0, |
| 10026 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10027 | snd_hda_codec_write(codec, 0x03, 0, |
| 10028 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10029 | } |
| 10030 | |
| 10031 | /* pcm configuration: identiacal with ALC880 */ |
| 10032 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10033 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10034 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10035 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10036 | |
| 10037 | /* |
| 10038 | * BIOS auto configuration |
| 10039 | */ |
| 10040 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10041 | { |
| 10042 | struct alc_spec *spec = codec->spec; |
| 10043 | int err; |
| 10044 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10045 | |
| 10046 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10047 | alc268_ignore); |
| 10048 | if (err < 0) |
| 10049 | return err; |
| 10050 | if (!spec->autocfg.line_outs) |
| 10051 | return 0; /* can't find valid BIOS pin config */ |
| 10052 | |
| 10053 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10054 | if (err < 0) |
| 10055 | return err; |
| 10056 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10057 | if (err < 0) |
| 10058 | return err; |
| 10059 | |
| 10060 | spec->multiout.max_channels = 2; |
| 10061 | |
| 10062 | /* digital only support output */ |
| 10063 | if (spec->autocfg.dig_out_pin) |
| 10064 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10065 | |
| 10066 | if (spec->kctl_alloc) |
| 10067 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10068 | |
| 10069 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10070 | spec->num_mux_defs = 1; |
| 10071 | spec->input_mux = &spec->private_imux; |
| 10072 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10073 | err = alc_auto_add_mic_boost(codec); |
| 10074 | if (err < 0) |
| 10075 | return err; |
| 10076 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10077 | return 1; |
| 10078 | } |
| 10079 | |
| 10080 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10081 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10082 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10083 | |
| 10084 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10085 | static void alc268_auto_init(struct hda_codec *codec) |
| 10086 | { |
| 10087 | alc268_auto_init_multi_out(codec); |
| 10088 | alc268_auto_init_hp_out(codec); |
| 10089 | alc268_auto_init_mono_speaker_out(codec); |
| 10090 | alc268_auto_init_analog_input(codec); |
| 10091 | } |
| 10092 | |
| 10093 | /* |
| 10094 | * configuration and preset |
| 10095 | */ |
| 10096 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 10097 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10098 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10099 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10100 | [ALC268_DELL] = "dell", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10101 | #ifdef CONFIG_SND_DEBUG |
| 10102 | [ALC268_TEST] = "test", |
| 10103 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10104 | [ALC268_AUTO] = "auto", |
| 10105 | }; |
| 10106 | |
| 10107 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10108 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10109 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10110 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10111 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10112 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10113 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10114 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10115 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10116 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10117 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10118 | {} |
| 10119 | }; |
| 10120 | |
| 10121 | static struct alc_config_preset alc268_presets[] = { |
| 10122 | [ALC268_3ST] = { |
| 10123 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 10124 | .init_verbs = { alc268_base_init_verbs }, |
| 10125 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10126 | .dac_nids = alc268_dac_nids, |
| 10127 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10128 | .adc_nids = alc268_adc_nids_alt, |
| 10129 | .hp_nid = 0x03, |
| 10130 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10131 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10132 | .channel_mode = alc268_modes, |
| 10133 | .input_mux = &alc268_capture_source, |
| 10134 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10135 | [ALC268_TOSHIBA] = { |
| 10136 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10137 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10138 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10139 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10140 | .dac_nids = alc268_dac_nids, |
| 10141 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10142 | .adc_nids = alc268_adc_nids_alt, |
| 10143 | .hp_nid = 0x03, |
| 10144 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10145 | .channel_mode = alc268_modes, |
| 10146 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10147 | .unsol_event = alc268_toshiba_unsol_event, |
| 10148 | .init_hook = alc268_toshiba_automute, |
| 10149 | }, |
| 10150 | [ALC268_ACER] = { |
| 10151 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer }, |
| 10152 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10153 | alc268_acer_verbs }, |
| 10154 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10155 | .dac_nids = alc268_dac_nids, |
| 10156 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10157 | .adc_nids = alc268_adc_nids_alt, |
| 10158 | .hp_nid = 0x02, |
| 10159 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10160 | .channel_mode = alc268_modes, |
| 10161 | .input_mux = &alc268_capture_source, |
| 10162 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10163 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10164 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10165 | [ALC268_DELL] = { |
| 10166 | .mixers = { alc268_dell_mixer }, |
| 10167 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10168 | alc268_dell_verbs }, |
| 10169 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10170 | .dac_nids = alc268_dac_nids, |
| 10171 | .hp_nid = 0x02, |
| 10172 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10173 | .channel_mode = alc268_modes, |
| 10174 | .unsol_event = alc268_dell_unsol_event, |
| 10175 | .init_hook = alc268_dell_init_hook, |
| 10176 | .input_mux = &alc268_capture_source, |
| 10177 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10178 | #ifdef CONFIG_SND_DEBUG |
| 10179 | [ALC268_TEST] = { |
| 10180 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10181 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10182 | alc268_volume_init_verbs }, |
| 10183 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10184 | .dac_nids = alc268_dac_nids, |
| 10185 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10186 | .adc_nids = alc268_adc_nids_alt, |
| 10187 | .hp_nid = 0x03, |
| 10188 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10189 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10190 | .channel_mode = alc268_modes, |
| 10191 | .input_mux = &alc268_capture_source, |
| 10192 | }, |
| 10193 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10194 | }; |
| 10195 | |
| 10196 | static int patch_alc268(struct hda_codec *codec) |
| 10197 | { |
| 10198 | struct alc_spec *spec; |
| 10199 | int board_config; |
| 10200 | int err; |
| 10201 | |
| 10202 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10203 | if (spec == NULL) |
| 10204 | return -ENOMEM; |
| 10205 | |
| 10206 | codec->spec = spec; |
| 10207 | |
| 10208 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10209 | alc268_models, |
| 10210 | alc268_cfg_tbl); |
| 10211 | |
| 10212 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10213 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10214 | "trying auto-probe from BIOS...\n"); |
| 10215 | board_config = ALC268_AUTO; |
| 10216 | } |
| 10217 | |
| 10218 | if (board_config == ALC268_AUTO) { |
| 10219 | /* automatic parse from the BIOS config */ |
| 10220 | err = alc268_parse_auto_config(codec); |
| 10221 | if (err < 0) { |
| 10222 | alc_free(codec); |
| 10223 | return err; |
| 10224 | } else if (!err) { |
| 10225 | printk(KERN_INFO |
| 10226 | "hda_codec: Cannot set up configuration " |
| 10227 | "from BIOS. Using base mode...\n"); |
| 10228 | board_config = ALC268_3ST; |
| 10229 | } |
| 10230 | } |
| 10231 | |
| 10232 | if (board_config != ALC268_AUTO) |
| 10233 | setup_preset(spec, &alc268_presets[board_config]); |
| 10234 | |
| 10235 | spec->stream_name_analog = "ALC268 Analog"; |
| 10236 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10237 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10238 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10239 | |
| 10240 | spec->stream_name_digital = "ALC268 Digital"; |
| 10241 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10242 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10243 | if (!spec->adc_nids && spec->input_mux) { |
| 10244 | /* check whether NID 0x07 is valid */ |
| 10245 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10246 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10247 | /* get type */ |
| 10248 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 10249 | if (wcap != AC_WID_AUD_IN) { |
| 10250 | spec->adc_nids = alc268_adc_nids_alt; |
| 10251 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10252 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10253 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10254 | spec->num_mixers++; |
| 10255 | } else { |
| 10256 | spec->adc_nids = alc268_adc_nids; |
| 10257 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10258 | spec->mixers[spec->num_mixers] = |
| 10259 | alc268_capture_mixer; |
| 10260 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10261 | } |
| 10262 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10263 | |
| 10264 | spec->vmaster_nid = 0x02; |
| 10265 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10266 | codec->patch_ops = alc_patch_ops; |
| 10267 | if (board_config == ALC268_AUTO) |
| 10268 | spec->init_hook = alc268_auto_init; |
| 10269 | |
| 10270 | return 0; |
| 10271 | } |
| 10272 | |
| 10273 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10274 | * ALC269 channel source setting (2 channel) |
| 10275 | */ |
| 10276 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10277 | |
| 10278 | #define alc269_dac_nids alc260_dac_nids |
| 10279 | |
| 10280 | static hda_nid_t alc269_adc_nids[1] = { |
| 10281 | /* ADC1 */ |
| 10282 | 0x07, |
| 10283 | }; |
| 10284 | |
| 10285 | #define alc269_modes alc260_modes |
| 10286 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10287 | |
| 10288 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10289 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10290 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10291 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10292 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10293 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10294 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10295 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10296 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10297 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10298 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10299 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10300 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10301 | { } /* end */ |
| 10302 | }; |
| 10303 | |
| 10304 | /* capture mixer elements */ |
| 10305 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10306 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10307 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10308 | { |
| 10309 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10310 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10311 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10312 | */ |
| 10313 | /* .name = "Capture Source", */ |
| 10314 | .name = "Input Source", |
| 10315 | .count = 1, |
| 10316 | .info = alc_mux_enum_info, |
| 10317 | .get = alc_mux_enum_get, |
| 10318 | .put = alc_mux_enum_put, |
| 10319 | }, |
| 10320 | { } /* end */ |
| 10321 | }; |
| 10322 | |
| 10323 | /* |
| 10324 | * generic initialization of ADC, input mixers and output mixers |
| 10325 | */ |
| 10326 | static struct hda_verb alc269_init_verbs[] = { |
| 10327 | /* |
| 10328 | * Unmute ADC0 and set the default input to mic-in |
| 10329 | */ |
| 10330 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10331 | |
| 10332 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 10333 | * analog-loopback mixer widget |
| 10334 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10335 | * front panel mic (mic 2) |
| 10336 | */ |
| 10337 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10338 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10339 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10340 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10341 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10342 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10343 | |
| 10344 | /* |
| 10345 | * Set up output mixers (0x0c - 0x0e) |
| 10346 | */ |
| 10347 | /* set vol=0 to output mixers */ |
| 10348 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10349 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10350 | |
| 10351 | /* set up input amps for analog loopback */ |
| 10352 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10353 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10354 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10355 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10356 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10357 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10358 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10359 | |
| 10360 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10361 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10362 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10363 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10364 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10365 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10366 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10367 | |
| 10368 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10369 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10370 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10371 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10372 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10373 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10374 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10375 | |
| 10376 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10377 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10378 | |
| 10379 | /* FIXME: use matrix-type input source selection */ |
| 10380 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10381 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10382 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10383 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10384 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10385 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10386 | |
| 10387 | /* set EAPD */ |
| 10388 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10389 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10390 | { } |
| 10391 | }; |
| 10392 | |
| 10393 | /* add playback controls from the parsed DAC table */ |
| 10394 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10395 | const struct auto_pin_cfg *cfg) |
| 10396 | { |
| 10397 | hda_nid_t nid; |
| 10398 | int err; |
| 10399 | |
| 10400 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10401 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10402 | spec->multiout.dac_nids[0] = 2; |
| 10403 | |
| 10404 | nid = cfg->line_out_pins[0]; |
| 10405 | if (nid) { |
| 10406 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10407 | "Front Playback Volume", |
| 10408 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10409 | if (err < 0) |
| 10410 | return err; |
| 10411 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10412 | "Front Playback Switch", |
| 10413 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10414 | if (err < 0) |
| 10415 | return err; |
| 10416 | } |
| 10417 | |
| 10418 | nid = cfg->speaker_pins[0]; |
| 10419 | if (nid) { |
| 10420 | if (!cfg->line_out_pins[0]) { |
| 10421 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10422 | "Speaker Playback Volume", |
| 10423 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10424 | HDA_OUTPUT)); |
| 10425 | if (err < 0) |
| 10426 | return err; |
| 10427 | } |
| 10428 | if (nid == 0x16) { |
| 10429 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10430 | "Speaker Playback Switch", |
| 10431 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10432 | HDA_OUTPUT)); |
| 10433 | if (err < 0) |
| 10434 | return err; |
| 10435 | } else { |
| 10436 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10437 | "Speaker Playback Switch", |
| 10438 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10439 | HDA_OUTPUT)); |
| 10440 | if (err < 0) |
| 10441 | return err; |
| 10442 | } |
| 10443 | } |
| 10444 | nid = cfg->hp_pins[0]; |
| 10445 | if (nid) { |
| 10446 | /* spec->multiout.hp_nid = 2; */ |
| 10447 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10448 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10449 | "Headphone Playback Volume", |
| 10450 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10451 | HDA_OUTPUT)); |
| 10452 | if (err < 0) |
| 10453 | return err; |
| 10454 | } |
| 10455 | if (nid == 0x16) { |
| 10456 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10457 | "Headphone Playback Switch", |
| 10458 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10459 | HDA_OUTPUT)); |
| 10460 | if (err < 0) |
| 10461 | return err; |
| 10462 | } else { |
| 10463 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10464 | "Headphone Playback Switch", |
| 10465 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10466 | HDA_OUTPUT)); |
| 10467 | if (err < 0) |
| 10468 | return err; |
| 10469 | } |
| 10470 | } |
| 10471 | return 0; |
| 10472 | } |
| 10473 | |
| 10474 | #define alc269_auto_create_analog_input_ctls \ |
| 10475 | alc880_auto_create_analog_input_ctls |
| 10476 | |
| 10477 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10478 | #define alc269_loopbacks alc880_loopbacks |
| 10479 | #endif |
| 10480 | |
| 10481 | /* pcm configuration: identiacal with ALC880 */ |
| 10482 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10483 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10484 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10485 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10486 | |
| 10487 | /* |
| 10488 | * BIOS auto configuration |
| 10489 | */ |
| 10490 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10491 | { |
| 10492 | struct alc_spec *spec = codec->spec; |
| 10493 | int err; |
| 10494 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10495 | |
| 10496 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10497 | alc269_ignore); |
| 10498 | if (err < 0) |
| 10499 | return err; |
| 10500 | |
| 10501 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10502 | if (err < 0) |
| 10503 | return err; |
| 10504 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10505 | if (err < 0) |
| 10506 | return err; |
| 10507 | |
| 10508 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10509 | |
| 10510 | if (spec->autocfg.dig_out_pin) |
| 10511 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10512 | |
| 10513 | if (spec->kctl_alloc) |
| 10514 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10515 | |
| 10516 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10517 | spec->num_mux_defs = 1; |
| 10518 | spec->input_mux = &spec->private_imux; |
| 10519 | |
| 10520 | err = alc_auto_add_mic_boost(codec); |
| 10521 | if (err < 0) |
| 10522 | return err; |
| 10523 | |
| 10524 | return 1; |
| 10525 | } |
| 10526 | |
| 10527 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10528 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10529 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10530 | |
| 10531 | |
| 10532 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10533 | static void alc269_auto_init(struct hda_codec *codec) |
| 10534 | { |
| 10535 | alc269_auto_init_multi_out(codec); |
| 10536 | alc269_auto_init_hp_out(codec); |
| 10537 | alc269_auto_init_analog_input(codec); |
| 10538 | } |
| 10539 | |
| 10540 | /* |
| 10541 | * configuration and preset |
| 10542 | */ |
| 10543 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 10544 | [ALC269_BASIC] = "basic", |
| 10545 | }; |
| 10546 | |
| 10547 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 10548 | {} |
| 10549 | }; |
| 10550 | |
| 10551 | static struct alc_config_preset alc269_presets[] = { |
| 10552 | [ALC269_BASIC] = { |
| 10553 | .mixers = { alc269_base_mixer }, |
| 10554 | .init_verbs = { alc269_init_verbs }, |
| 10555 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 10556 | .dac_nids = alc269_dac_nids, |
| 10557 | .hp_nid = 0x03, |
| 10558 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 10559 | .channel_mode = alc269_modes, |
| 10560 | .input_mux = &alc269_capture_source, |
| 10561 | }, |
| 10562 | }; |
| 10563 | |
| 10564 | static int patch_alc269(struct hda_codec *codec) |
| 10565 | { |
| 10566 | struct alc_spec *spec; |
| 10567 | int board_config; |
| 10568 | int err; |
| 10569 | |
| 10570 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10571 | if (spec == NULL) |
| 10572 | return -ENOMEM; |
| 10573 | |
| 10574 | codec->spec = spec; |
| 10575 | |
| 10576 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 10577 | alc269_models, |
| 10578 | alc269_cfg_tbl); |
| 10579 | |
| 10580 | if (board_config < 0) { |
| 10581 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 10582 | "trying auto-probe from BIOS...\n"); |
| 10583 | board_config = ALC269_AUTO; |
| 10584 | } |
| 10585 | |
| 10586 | if (board_config == ALC269_AUTO) { |
| 10587 | /* automatic parse from the BIOS config */ |
| 10588 | err = alc269_parse_auto_config(codec); |
| 10589 | if (err < 0) { |
| 10590 | alc_free(codec); |
| 10591 | return err; |
| 10592 | } else if (!err) { |
| 10593 | printk(KERN_INFO |
| 10594 | "hda_codec: Cannot set up configuration " |
| 10595 | "from BIOS. Using base mode...\n"); |
| 10596 | board_config = ALC269_BASIC; |
| 10597 | } |
| 10598 | } |
| 10599 | |
| 10600 | if (board_config != ALC269_AUTO) |
| 10601 | setup_preset(spec, &alc269_presets[board_config]); |
| 10602 | |
| 10603 | spec->stream_name_analog = "ALC269 Analog"; |
| 10604 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 10605 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 10606 | |
| 10607 | spec->stream_name_digital = "ALC269 Digital"; |
| 10608 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 10609 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 10610 | |
| 10611 | spec->adc_nids = alc269_adc_nids; |
| 10612 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 10613 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 10614 | spec->num_mixers++; |
| 10615 | |
| 10616 | codec->patch_ops = alc_patch_ops; |
| 10617 | if (board_config == ALC269_AUTO) |
| 10618 | spec->init_hook = alc269_auto_init; |
| 10619 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10620 | if (!spec->loopback.amplist) |
| 10621 | spec->loopback.amplist = alc269_loopbacks; |
| 10622 | #endif |
| 10623 | |
| 10624 | return 0; |
| 10625 | } |
| 10626 | |
| 10627 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10628 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 10629 | */ |
| 10630 | |
| 10631 | /* |
| 10632 | * set the path ways for 2 channel output |
| 10633 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 10634 | */ |
| 10635 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 10636 | /* set pin widget 1Ah (line in) for input */ |
| 10637 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10638 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10639 | * the vref |
| 10640 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10641 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10642 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10643 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10644 | #if 0 |
| 10645 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10646 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10647 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10648 | { } /* end */ |
| 10649 | }; |
| 10650 | /* |
| 10651 | * 6ch mode |
| 10652 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 10653 | */ |
| 10654 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 10655 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10656 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10657 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10658 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10659 | |
| 10660 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10661 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10662 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10663 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10664 | #if 0 |
| 10665 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10666 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10667 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10668 | { } /* end */ |
| 10669 | }; |
| 10670 | |
| 10671 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 10672 | { 2, alc861_threestack_ch2_init }, |
| 10673 | { 6, alc861_threestack_ch6_init }, |
| 10674 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10675 | /* Set mic1 as input and unmute the mixer */ |
| 10676 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 10677 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10678 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10679 | { } /* end */ |
| 10680 | }; |
| 10681 | /* Set mic1 as output and mute mixer */ |
| 10682 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 10683 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10684 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10685 | { } /* end */ |
| 10686 | }; |
| 10687 | |
| 10688 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 10689 | { 2, alc861_uniwill_m31_ch2_init }, |
| 10690 | { 4, alc861_uniwill_m31_ch4_init }, |
| 10691 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10692 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10693 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 10694 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 10695 | /* set pin widget 1Ah (line in) for input */ |
| 10696 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10697 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10698 | * the vref |
| 10699 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10700 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10701 | |
| 10702 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10703 | #if 0 |
| 10704 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10705 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10706 | #endif |
| 10707 | { } /* end */ |
| 10708 | }; |
| 10709 | /* Set mic1 nad line-in as output and mute mixer */ |
| 10710 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 10711 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10712 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10713 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10714 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10715 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10716 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10717 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10718 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10719 | |
| 10720 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10721 | #if 0 |
| 10722 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10723 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10724 | #endif |
| 10725 | { } /* end */ |
| 10726 | }; |
| 10727 | |
| 10728 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 10729 | { 2, alc861_asus_ch2_init }, |
| 10730 | { 6, alc861_asus_ch6_init }, |
| 10731 | }; |
| 10732 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10733 | /* patch-ALC861 */ |
| 10734 | |
| 10735 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 10736 | /* output mixer control */ |
| 10737 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10738 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10739 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10740 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10741 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10742 | |
| 10743 | /*Input mixer control */ |
| 10744 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10745 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10746 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10747 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10748 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10749 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10750 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10751 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10752 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10753 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10754 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10755 | /* Capture mixer control */ |
| 10756 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10757 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10758 | { |
| 10759 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10760 | .name = "Capture Source", |
| 10761 | .count = 1, |
| 10762 | .info = alc_mux_enum_info, |
| 10763 | .get = alc_mux_enum_get, |
| 10764 | .put = alc_mux_enum_put, |
| 10765 | }, |
| 10766 | { } /* end */ |
| 10767 | }; |
| 10768 | |
| 10769 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 10770 | /* output mixer control */ |
| 10771 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10772 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10773 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10774 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10775 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10776 | |
| 10777 | /* Input mixer control */ |
| 10778 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10779 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10780 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10781 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10782 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10783 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10784 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10785 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10786 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10787 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10788 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10789 | /* Capture mixer control */ |
| 10790 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10791 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10792 | { |
| 10793 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10794 | .name = "Capture Source", |
| 10795 | .count = 1, |
| 10796 | .info = alc_mux_enum_info, |
| 10797 | .get = alc_mux_enum_get, |
| 10798 | .put = alc_mux_enum_put, |
| 10799 | }, |
| 10800 | { |
| 10801 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10802 | .name = "Channel Mode", |
| 10803 | .info = alc_ch_mode_info, |
| 10804 | .get = alc_ch_mode_get, |
| 10805 | .put = alc_ch_mode_put, |
| 10806 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 10807 | }, |
| 10808 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10809 | }; |
| 10810 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10811 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10812 | /* output mixer control */ |
| 10813 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10816 | |
| 10817 | /*Capture mixer control */ |
| 10818 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10819 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10820 | { |
| 10821 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10822 | .name = "Capture Source", |
| 10823 | .count = 1, |
| 10824 | .info = alc_mux_enum_info, |
| 10825 | .get = alc_mux_enum_get, |
| 10826 | .put = alc_mux_enum_put, |
| 10827 | }, |
| 10828 | |
| 10829 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10830 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10831 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10832 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 10833 | /* output mixer control */ |
| 10834 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10835 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10836 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10837 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10838 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10839 | |
| 10840 | /* Input mixer control */ |
| 10841 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10842 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10843 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10844 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10845 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10846 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10847 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10848 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10849 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10850 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10851 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 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 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10865 | .name = "Channel Mode", |
| 10866 | .info = alc_ch_mode_info, |
| 10867 | .get = alc_ch_mode_get, |
| 10868 | .put = alc_ch_mode_put, |
| 10869 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 10870 | }, |
| 10871 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10872 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10873 | |
| 10874 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 10875 | /* output mixer control */ |
| 10876 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10877 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10878 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10879 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10880 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10881 | |
| 10882 | /* Input mixer control */ |
| 10883 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10884 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10885 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10886 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10887 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10888 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10889 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10890 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10891 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10892 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 10893 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10894 | /* Capture mixer control */ |
| 10895 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10896 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10897 | { |
| 10898 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10899 | .name = "Capture Source", |
| 10900 | .count = 1, |
| 10901 | .info = alc_mux_enum_info, |
| 10902 | .get = alc_mux_enum_get, |
| 10903 | .put = alc_mux_enum_put, |
| 10904 | }, |
| 10905 | { |
| 10906 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10907 | .name = "Channel Mode", |
| 10908 | .info = alc_ch_mode_info, |
| 10909 | .get = alc_ch_mode_get, |
| 10910 | .put = alc_ch_mode_put, |
| 10911 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 10912 | }, |
| 10913 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10914 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10915 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10916 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10917 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10918 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10919 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10920 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10921 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10922 | { } |
| 10923 | }; |
| 10924 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10925 | /* |
| 10926 | * generic initialization of ADC, input mixers and output mixers |
| 10927 | */ |
| 10928 | static struct hda_verb alc861_base_init_verbs[] = { |
| 10929 | /* |
| 10930 | * Unmute ADC0 and set the default input to mic-in |
| 10931 | */ |
| 10932 | /* port-A for surround (rear panel) */ |
| 10933 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10934 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10935 | /* port-B for mic-in (rear panel) with vref */ |
| 10936 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10937 | /* port-C for line-in (rear panel) */ |
| 10938 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10939 | /* port-D for Front */ |
| 10940 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10941 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10942 | /* port-E for HP out (front panel) */ |
| 10943 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 10944 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10945 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10946 | /* port-F for mic-in (front panel) with vref */ |
| 10947 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10948 | /* port-G for CLFE (rear panel) */ |
| 10949 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10950 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10951 | /* port-H for side (rear panel) */ |
| 10952 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10953 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10954 | /* CD-in */ |
| 10955 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10956 | /* route front mic to ADC1*/ |
| 10957 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10958 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10959 | |
| 10960 | /* Unmute DAC0~3 & spdif out*/ |
| 10961 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10962 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10963 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10964 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10965 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10966 | |
| 10967 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10968 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10969 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10970 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10971 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10972 | |
| 10973 | /* Unmute Stereo Mixer 15 */ |
| 10974 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10975 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10976 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10977 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10978 | |
| 10979 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10980 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10981 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10982 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10983 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10984 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10985 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10986 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10987 | /* hp used DAC 3 (Front) */ |
| 10988 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10989 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10990 | |
| 10991 | { } |
| 10992 | }; |
| 10993 | |
| 10994 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 10995 | /* |
| 10996 | * Unmute ADC0 and set the default input to mic-in |
| 10997 | */ |
| 10998 | /* port-A for surround (rear panel) */ |
| 10999 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11000 | /* port-B for mic-in (rear panel) with vref */ |
| 11001 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11002 | /* port-C for line-in (rear panel) */ |
| 11003 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11004 | /* port-D for Front */ |
| 11005 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11006 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11007 | /* port-E for HP out (front panel) */ |
| 11008 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11009 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11010 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11011 | /* port-F for mic-in (front panel) with vref */ |
| 11012 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11013 | /* port-G for CLFE (rear panel) */ |
| 11014 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11015 | /* port-H for side (rear panel) */ |
| 11016 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11017 | /* CD-in */ |
| 11018 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11019 | /* route front mic to ADC1*/ |
| 11020 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11021 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11022 | /* Unmute DAC0~3 & spdif out*/ |
| 11023 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11024 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11025 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11026 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11027 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11028 | |
| 11029 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11030 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11031 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11032 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11033 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11034 | |
| 11035 | /* Unmute Stereo Mixer 15 */ |
| 11036 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11038 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11039 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11040 | |
| 11041 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11042 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11043 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11044 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11045 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11046 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11047 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11048 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11049 | /* hp used DAC 3 (Front) */ |
| 11050 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11051 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11052 | { } |
| 11053 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11054 | |
| 11055 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11056 | /* |
| 11057 | * Unmute ADC0 and set the default input to mic-in |
| 11058 | */ |
| 11059 | /* port-A for surround (rear panel) */ |
| 11060 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11061 | /* port-B for mic-in (rear panel) with vref */ |
| 11062 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11063 | /* port-C for line-in (rear panel) */ |
| 11064 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11065 | /* port-D for Front */ |
| 11066 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11067 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11068 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11069 | /* this has to be set to VREF80 */ |
| 11070 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11071 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11072 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11073 | /* port-F for mic-in (front panel) with vref */ |
| 11074 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11075 | /* port-G for CLFE (rear panel) */ |
| 11076 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11077 | /* port-H for side (rear panel) */ |
| 11078 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11079 | /* CD-in */ |
| 11080 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11081 | /* route front mic to ADC1*/ |
| 11082 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11083 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11084 | /* Unmute DAC0~3 & spdif out*/ |
| 11085 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11086 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11087 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11088 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11089 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11090 | |
| 11091 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11092 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11093 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11094 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11095 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11096 | |
| 11097 | /* Unmute Stereo Mixer 15 */ |
| 11098 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11099 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11100 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11101 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11102 | |
| 11103 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11104 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11105 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11106 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11107 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11108 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11109 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11110 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11111 | /* hp used DAC 3 (Front) */ |
| 11112 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11113 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11114 | { } |
| 11115 | }; |
| 11116 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11117 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 11118 | /* |
| 11119 | * Unmute ADC0 and set the default input to mic-in |
| 11120 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11121 | /* port-A for surround (rear panel) |
| 11122 | * according to codec#0 this is the HP jack |
| 11123 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11124 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 11125 | /* route front PCM to HP */ |
| 11126 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11127 | /* port-B for mic-in (rear panel) with vref */ |
| 11128 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11129 | /* port-C for line-in (rear panel) */ |
| 11130 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11131 | /* port-D for Front */ |
| 11132 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11133 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11134 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11135 | /* this has to be set to VREF80 */ |
| 11136 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11137 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11138 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11139 | /* port-F for mic-in (front panel) with vref */ |
| 11140 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11141 | /* port-G for CLFE (rear panel) */ |
| 11142 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11143 | /* port-H for side (rear panel) */ |
| 11144 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11145 | /* CD-in */ |
| 11146 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11147 | /* route front mic to ADC1*/ |
| 11148 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11149 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11150 | /* Unmute DAC0~3 & spdif out*/ |
| 11151 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11152 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11153 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11154 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11155 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11156 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11157 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11158 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11159 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11160 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11161 | |
| 11162 | /* Unmute Stereo Mixer 15 */ |
| 11163 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11164 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11165 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11166 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11167 | |
| 11168 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11169 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11170 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11171 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11172 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11173 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11174 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11175 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11176 | /* hp used DAC 3 (Front) */ |
| 11177 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11178 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11179 | { } |
| 11180 | }; |
| 11181 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11182 | /* additional init verbs for ASUS laptops */ |
| 11183 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 11184 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 11185 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 11186 | { } |
| 11187 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11188 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11189 | /* |
| 11190 | * generic initialization of ADC, input mixers and output mixers |
| 11191 | */ |
| 11192 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 11193 | /* |
| 11194 | * Unmute ADC0 and set the default input to mic-in |
| 11195 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11196 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11197 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11198 | |
| 11199 | /* Unmute DAC0~3 & spdif out*/ |
| 11200 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11201 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11202 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11203 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11204 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11205 | |
| 11206 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11207 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11208 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11209 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11210 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11211 | |
| 11212 | /* Unmute Stereo Mixer 15 */ |
| 11213 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11214 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11215 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11216 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 11217 | |
| 11218 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11219 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11220 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11221 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11222 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11223 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11224 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11225 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11226 | |
| 11227 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11228 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11229 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11230 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11231 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11232 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11233 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11234 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11235 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11236 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11237 | |
| 11238 | { } |
| 11239 | }; |
| 11240 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11241 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11242 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11243 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11244 | { } |
| 11245 | }; |
| 11246 | |
| 11247 | /* toggle speaker-output according to the hp-jack state */ |
| 11248 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11249 | { |
| 11250 | unsigned int present; |
| 11251 | |
| 11252 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11253 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11254 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11255 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11256 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11257 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11258 | } |
| 11259 | |
| 11260 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11261 | unsigned int res) |
| 11262 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11263 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11264 | alc861_toshiba_automute(codec); |
| 11265 | } |
| 11266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11267 | /* pcm configuration: identiacal with ALC880 */ |
| 11268 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11269 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11270 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11271 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11272 | |
| 11273 | |
| 11274 | #define ALC861_DIGOUT_NID 0x07 |
| 11275 | |
| 11276 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11277 | { 8, NULL } |
| 11278 | }; |
| 11279 | |
| 11280 | static hda_nid_t alc861_dac_nids[4] = { |
| 11281 | /* front, surround, clfe, side */ |
| 11282 | 0x03, 0x06, 0x05, 0x04 |
| 11283 | }; |
| 11284 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11285 | static hda_nid_t alc660_dac_nids[3] = { |
| 11286 | /* front, clfe, surround */ |
| 11287 | 0x03, 0x05, 0x06 |
| 11288 | }; |
| 11289 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11290 | static hda_nid_t alc861_adc_nids[1] = { |
| 11291 | /* ADC0-2 */ |
| 11292 | 0x08, |
| 11293 | }; |
| 11294 | |
| 11295 | static struct hda_input_mux alc861_capture_source = { |
| 11296 | .num_items = 5, |
| 11297 | .items = { |
| 11298 | { "Mic", 0x0 }, |
| 11299 | { "Front Mic", 0x3 }, |
| 11300 | { "Line", 0x1 }, |
| 11301 | { "CD", 0x4 }, |
| 11302 | { "Mixer", 0x5 }, |
| 11303 | }, |
| 11304 | }; |
| 11305 | |
| 11306 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11307 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11308 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11309 | { |
| 11310 | int i; |
| 11311 | hda_nid_t nid; |
| 11312 | |
| 11313 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11314 | for (i = 0; i < cfg->line_outs; i++) { |
| 11315 | nid = cfg->line_out_pins[i]; |
| 11316 | if (nid) { |
| 11317 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11318 | continue; |
| 11319 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11320 | } |
| 11321 | } |
| 11322 | spec->multiout.num_dacs = cfg->line_outs; |
| 11323 | return 0; |
| 11324 | } |
| 11325 | |
| 11326 | /* add playback controls from the parsed DAC table */ |
| 11327 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11328 | const struct auto_pin_cfg *cfg) |
| 11329 | { |
| 11330 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11331 | static const char *chname[4] = { |
| 11332 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11333 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11334 | hda_nid_t nid; |
| 11335 | int i, idx, err; |
| 11336 | |
| 11337 | for (i = 0; i < cfg->line_outs; i++) { |
| 11338 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11339 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11340 | continue; |
| 11341 | if (nid == 0x05) { |
| 11342 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11343 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11344 | "Center Playback Switch", |
| 11345 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11346 | HDA_OUTPUT)); |
| 11347 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11348 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11349 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11350 | "LFE Playback Switch", |
| 11351 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11352 | HDA_OUTPUT)); |
| 11353 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11354 | return err; |
| 11355 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11356 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11357 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11358 | if (nid == alc861_dac_nids[idx]) |
| 11359 | break; |
| 11360 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11361 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11362 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11363 | HDA_OUTPUT)); |
| 11364 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11365 | return err; |
| 11366 | } |
| 11367 | } |
| 11368 | return 0; |
| 11369 | } |
| 11370 | |
| 11371 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11372 | { |
| 11373 | int err; |
| 11374 | hda_nid_t nid; |
| 11375 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11376 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11377 | return 0; |
| 11378 | |
| 11379 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11380 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11381 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11382 | "Headphone Playback Switch", |
| 11383 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11384 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11385 | return err; |
| 11386 | spec->multiout.hp_nid = nid; |
| 11387 | } |
| 11388 | return 0; |
| 11389 | } |
| 11390 | |
| 11391 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11392 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11393 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11394 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11395 | struct hda_input_mux *imux = &spec->private_imux; |
| 11396 | int i, err, idx, idx1; |
| 11397 | |
| 11398 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11399 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11400 | case 0x0c: |
| 11401 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11402 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11403 | break; |
| 11404 | case 0x0f: |
| 11405 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11406 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11407 | break; |
| 11408 | case 0x0d: |
| 11409 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11410 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11411 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11412 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11413 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11414 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11415 | break; |
| 11416 | case 0x11: |
| 11417 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11418 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11419 | break; |
| 11420 | default: |
| 11421 | continue; |
| 11422 | } |
| 11423 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11424 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11425 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11426 | if (err < 0) |
| 11427 | return err; |
| 11428 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11429 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11430 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11431 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11432 | } |
| 11433 | return 0; |
| 11434 | } |
| 11435 | |
| 11436 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11437 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11438 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11439 | |
| 11440 | { |
| 11441 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11442 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11443 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11444 | */ |
| 11445 | /* .name = "Capture Source", */ |
| 11446 | .name = "Input Source", |
| 11447 | .count = 1, |
| 11448 | .info = alc_mux_enum_info, |
| 11449 | .get = alc_mux_enum_get, |
| 11450 | .put = alc_mux_enum_put, |
| 11451 | }, |
| 11452 | { } /* end */ |
| 11453 | }; |
| 11454 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11455 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11456 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11457 | int pin_type, int dac_idx) |
| 11458 | { |
| 11459 | /* set as output */ |
| 11460 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11461 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11462 | pin_type); |
| 11463 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11464 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11465 | |
| 11466 | } |
| 11467 | |
| 11468 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11469 | { |
| 11470 | struct alc_spec *spec = codec->spec; |
| 11471 | int i; |
| 11472 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11473 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11474 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11475 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11476 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11477 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11478 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11479 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11480 | } |
| 11481 | } |
| 11482 | |
| 11483 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11484 | { |
| 11485 | struct alc_spec *spec = codec->spec; |
| 11486 | hda_nid_t pin; |
| 11487 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11488 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11489 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11490 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11491 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11492 | } |
| 11493 | |
| 11494 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11495 | { |
| 11496 | struct alc_spec *spec = codec->spec; |
| 11497 | int i; |
| 11498 | |
| 11499 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11500 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11501 | if (nid >= 0x0c && nid <= 0x11) { |
| 11502 | snd_hda_codec_write(codec, nid, 0, |
| 11503 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11504 | i <= AUTO_PIN_FRONT_MIC ? |
| 11505 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11506 | } |
| 11507 | } |
| 11508 | } |
| 11509 | |
| 11510 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11511 | /* return 1 if successful, 0 if the proper config is not found, |
| 11512 | * or a negative error code |
| 11513 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11514 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11515 | { |
| 11516 | struct alc_spec *spec = codec->spec; |
| 11517 | int err; |
| 11518 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11519 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11520 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11521 | alc861_ignore); |
| 11522 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11523 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11524 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11525 | return 0; /* can't find valid BIOS pin config */ |
| 11526 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11527 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11528 | if (err < 0) |
| 11529 | return err; |
| 11530 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11531 | if (err < 0) |
| 11532 | return err; |
| 11533 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11534 | if (err < 0) |
| 11535 | return err; |
| 11536 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11537 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11538 | return err; |
| 11539 | |
| 11540 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11541 | |
| 11542 | if (spec->autocfg.dig_out_pin) |
| 11543 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 11544 | |
| 11545 | if (spec->kctl_alloc) |
| 11546 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11547 | |
| 11548 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 11549 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11550 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11551 | spec->input_mux = &spec->private_imux; |
| 11552 | |
| 11553 | spec->adc_nids = alc861_adc_nids; |
| 11554 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 11555 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 11556 | spec->num_mixers++; |
| 11557 | |
| 11558 | return 1; |
| 11559 | } |
| 11560 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11561 | /* additional initialization for auto-configuration model */ |
| 11562 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11563 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11564 | alc861_auto_init_multi_out(codec); |
| 11565 | alc861_auto_init_hp_out(codec); |
| 11566 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11567 | } |
| 11568 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11569 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11570 | static struct hda_amp_list alc861_loopbacks[] = { |
| 11571 | { 0x15, HDA_INPUT, 0 }, |
| 11572 | { 0x15, HDA_INPUT, 1 }, |
| 11573 | { 0x15, HDA_INPUT, 2 }, |
| 11574 | { 0x15, HDA_INPUT, 3 }, |
| 11575 | { } /* end */ |
| 11576 | }; |
| 11577 | #endif |
| 11578 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11579 | |
| 11580 | /* |
| 11581 | * configuration and preset |
| 11582 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11583 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 11584 | [ALC861_3ST] = "3stack", |
| 11585 | [ALC660_3ST] = "3stack-660", |
| 11586 | [ALC861_3ST_DIG] = "3stack-dig", |
| 11587 | [ALC861_6ST_DIG] = "6stack-dig", |
| 11588 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 11589 | [ALC861_TOSHIBA] = "toshiba", |
| 11590 | [ALC861_ASUS] = "asus", |
| 11591 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 11592 | [ALC861_AUTO] = "auto", |
| 11593 | }; |
| 11594 | |
| 11595 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 11596 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11597 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11598 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11599 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11600 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11601 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 11602 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 11603 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 11604 | * Any other models that need this preset? |
| 11605 | */ |
| 11606 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 11607 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 11608 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11609 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 11610 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 11611 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 11612 | /* FIXME: the below seems conflict */ |
| 11613 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 11614 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 11615 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11616 | {} |
| 11617 | }; |
| 11618 | |
| 11619 | static struct alc_config_preset alc861_presets[] = { |
| 11620 | [ALC861_3ST] = { |
| 11621 | .mixers = { alc861_3ST_mixer }, |
| 11622 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11623 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11624 | .dac_nids = alc861_dac_nids, |
| 11625 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11626 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11627 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11628 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11629 | .adc_nids = alc861_adc_nids, |
| 11630 | .input_mux = &alc861_capture_source, |
| 11631 | }, |
| 11632 | [ALC861_3ST_DIG] = { |
| 11633 | .mixers = { alc861_base_mixer }, |
| 11634 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11635 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11636 | .dac_nids = alc861_dac_nids, |
| 11637 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11638 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11639 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11640 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11641 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11642 | .adc_nids = alc861_adc_nids, |
| 11643 | .input_mux = &alc861_capture_source, |
| 11644 | }, |
| 11645 | [ALC861_6ST_DIG] = { |
| 11646 | .mixers = { alc861_base_mixer }, |
| 11647 | .init_verbs = { alc861_base_init_verbs }, |
| 11648 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11649 | .dac_nids = alc861_dac_nids, |
| 11650 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11651 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 11652 | .channel_mode = alc861_8ch_modes, |
| 11653 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11654 | .adc_nids = alc861_adc_nids, |
| 11655 | .input_mux = &alc861_capture_source, |
| 11656 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11657 | [ALC660_3ST] = { |
| 11658 | .mixers = { alc861_3ST_mixer }, |
| 11659 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11660 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 11661 | .dac_nids = alc660_dac_nids, |
| 11662 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11663 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11664 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11665 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11666 | .adc_nids = alc861_adc_nids, |
| 11667 | .input_mux = &alc861_capture_source, |
| 11668 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11669 | [ALC861_UNIWILL_M31] = { |
| 11670 | .mixers = { alc861_uniwill_m31_mixer }, |
| 11671 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 11672 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11673 | .dac_nids = alc861_dac_nids, |
| 11674 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11675 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11676 | .channel_mode = alc861_uniwill_m31_modes, |
| 11677 | .need_dac_fix = 1, |
| 11678 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11679 | .adc_nids = alc861_adc_nids, |
| 11680 | .input_mux = &alc861_capture_source, |
| 11681 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11682 | [ALC861_TOSHIBA] = { |
| 11683 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11684 | .init_verbs = { alc861_base_init_verbs, |
| 11685 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11686 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11687 | .dac_nids = alc861_dac_nids, |
| 11688 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11689 | .channel_mode = alc883_3ST_2ch_modes, |
| 11690 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11691 | .adc_nids = alc861_adc_nids, |
| 11692 | .input_mux = &alc861_capture_source, |
| 11693 | .unsol_event = alc861_toshiba_unsol_event, |
| 11694 | .init_hook = alc861_toshiba_automute, |
| 11695 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11696 | [ALC861_ASUS] = { |
| 11697 | .mixers = { alc861_asus_mixer }, |
| 11698 | .init_verbs = { alc861_asus_init_verbs }, |
| 11699 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11700 | .dac_nids = alc861_dac_nids, |
| 11701 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11702 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 11703 | .channel_mode = alc861_asus_modes, |
| 11704 | .need_dac_fix = 1, |
| 11705 | .hp_nid = 0x06, |
| 11706 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11707 | .adc_nids = alc861_adc_nids, |
| 11708 | .input_mux = &alc861_capture_source, |
| 11709 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11710 | [ALC861_ASUS_LAPTOP] = { |
| 11711 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 11712 | .init_verbs = { alc861_asus_init_verbs, |
| 11713 | alc861_asus_laptop_init_verbs }, |
| 11714 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11715 | .dac_nids = alc861_dac_nids, |
| 11716 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11717 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11718 | .channel_mode = alc883_3ST_2ch_modes, |
| 11719 | .need_dac_fix = 1, |
| 11720 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11721 | .adc_nids = alc861_adc_nids, |
| 11722 | .input_mux = &alc861_capture_source, |
| 11723 | }, |
| 11724 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11725 | |
| 11726 | |
| 11727 | static int patch_alc861(struct hda_codec *codec) |
| 11728 | { |
| 11729 | struct alc_spec *spec; |
| 11730 | int board_config; |
| 11731 | int err; |
| 11732 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11733 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11734 | if (spec == NULL) |
| 11735 | return -ENOMEM; |
| 11736 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11737 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11738 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11739 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 11740 | alc861_models, |
| 11741 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11742 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11743 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11744 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 11745 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11746 | board_config = ALC861_AUTO; |
| 11747 | } |
| 11748 | |
| 11749 | if (board_config == ALC861_AUTO) { |
| 11750 | /* automatic parse from the BIOS config */ |
| 11751 | err = alc861_parse_auto_config(codec); |
| 11752 | if (err < 0) { |
| 11753 | alc_free(codec); |
| 11754 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11755 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11756 | printk(KERN_INFO |
| 11757 | "hda_codec: Cannot set up configuration " |
| 11758 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11759 | board_config = ALC861_3ST_DIG; |
| 11760 | } |
| 11761 | } |
| 11762 | |
| 11763 | if (board_config != ALC861_AUTO) |
| 11764 | setup_preset(spec, &alc861_presets[board_config]); |
| 11765 | |
| 11766 | spec->stream_name_analog = "ALC861 Analog"; |
| 11767 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 11768 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 11769 | |
| 11770 | spec->stream_name_digital = "ALC861 Digital"; |
| 11771 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 11772 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 11773 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11774 | spec->vmaster_nid = 0x03; |
| 11775 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11776 | codec->patch_ops = alc_patch_ops; |
| 11777 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11778 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11779 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11780 | if (!spec->loopback.amplist) |
| 11781 | spec->loopback.amplist = alc861_loopbacks; |
| 11782 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11783 | |
| 11784 | return 0; |
| 11785 | } |
| 11786 | |
| 11787 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11788 | * ALC861-VD support |
| 11789 | * |
| 11790 | * Based on ALC882 |
| 11791 | * |
| 11792 | * In addition, an independent DAC |
| 11793 | */ |
| 11794 | #define ALC861VD_DIGOUT_NID 0x06 |
| 11795 | |
| 11796 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 11797 | /* front, surr, clfe, side surr */ |
| 11798 | 0x02, 0x03, 0x04, 0x05 |
| 11799 | }; |
| 11800 | |
| 11801 | /* dac_nids for ALC660vd are in a different order - according to |
| 11802 | * Realtek's driver. |
| 11803 | * This should probably tesult in a different mixer for 6stack models |
| 11804 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 11805 | * - and it is the same as in 861vd. |
| 11806 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 11807 | */ |
| 11808 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 11809 | /* front, rear, clfe, rear_surr */ |
| 11810 | 0x02, 0x04, 0x03 |
| 11811 | }; |
| 11812 | |
| 11813 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 11814 | /* ADC0 */ |
| 11815 | 0x09, |
| 11816 | }; |
| 11817 | |
| 11818 | /* input MUX */ |
| 11819 | /* FIXME: should be a matrix-type input source selection */ |
| 11820 | static struct hda_input_mux alc861vd_capture_source = { |
| 11821 | .num_items = 4, |
| 11822 | .items = { |
| 11823 | { "Mic", 0x0 }, |
| 11824 | { "Front Mic", 0x1 }, |
| 11825 | { "Line", 0x2 }, |
| 11826 | { "CD", 0x4 }, |
| 11827 | }, |
| 11828 | }; |
| 11829 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11830 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 11831 | .num_items = 3, |
| 11832 | .items = { |
| 11833 | { "Front Mic", 0x0 }, |
| 11834 | { "ATAPI Mic", 0x1 }, |
| 11835 | { "Line In", 0x5 }, |
| 11836 | }, |
| 11837 | }; |
| 11838 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11839 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 11840 | .num_items = 2, |
| 11841 | .items = { |
| 11842 | { "Front Mic", 0x0 }, |
| 11843 | { "ATAPI Mic", 0x1 }, |
| 11844 | }, |
| 11845 | }; |
| 11846 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11847 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 11848 | #define alc861vd_mux_enum_get alc_mux_enum_get |
| 11849 | |
| 11850 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11851 | struct snd_ctl_elem_value *ucontrol) |
| 11852 | { |
| 11853 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11854 | struct alc_spec *spec = codec->spec; |
| 11855 | const struct hda_input_mux *imux = spec->input_mux; |
| 11856 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 11857 | static hda_nid_t capture_mixers[1] = { 0x22 }; |
| 11858 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 11859 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 11860 | unsigned int i, idx; |
| 11861 | |
| 11862 | idx = ucontrol->value.enumerated.item[0]; |
| 11863 | if (idx >= imux->num_items) |
| 11864 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11865 | if (*cur_val == idx) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11866 | return 0; |
| 11867 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11868 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 11869 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 11870 | imux->items[i].index, |
| 11871 | HDA_AMP_MUTE, v); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11872 | } |
| 11873 | *cur_val = idx; |
| 11874 | return 1; |
| 11875 | } |
| 11876 | |
| 11877 | /* |
| 11878 | * 2ch mode |
| 11879 | */ |
| 11880 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 11881 | { 2, NULL } |
| 11882 | }; |
| 11883 | |
| 11884 | /* |
| 11885 | * 6ch mode |
| 11886 | */ |
| 11887 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 11888 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11889 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11890 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11891 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11892 | { } /* end */ |
| 11893 | }; |
| 11894 | |
| 11895 | /* |
| 11896 | * 8ch mode |
| 11897 | */ |
| 11898 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 11899 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11900 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11901 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11902 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11903 | { } /* end */ |
| 11904 | }; |
| 11905 | |
| 11906 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 11907 | { 6, alc861vd_6stack_ch6_init }, |
| 11908 | { 8, alc861vd_6stack_ch8_init }, |
| 11909 | }; |
| 11910 | |
| 11911 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 11912 | { |
| 11913 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11914 | .name = "Channel Mode", |
| 11915 | .info = alc_ch_mode_info, |
| 11916 | .get = alc_ch_mode_get, |
| 11917 | .put = alc_ch_mode_put, |
| 11918 | }, |
| 11919 | { } /* end */ |
| 11920 | }; |
| 11921 | |
| 11922 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 11923 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11924 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11925 | |
| 11926 | { |
| 11927 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11928 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11929 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11930 | */ |
| 11931 | /* .name = "Capture Source", */ |
| 11932 | .name = "Input Source", |
| 11933 | .count = 1, |
| 11934 | .info = alc861vd_mux_enum_info, |
| 11935 | .get = alc861vd_mux_enum_get, |
| 11936 | .put = alc861vd_mux_enum_put, |
| 11937 | }, |
| 11938 | { } /* end */ |
| 11939 | }; |
| 11940 | |
| 11941 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 11942 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 11943 | */ |
| 11944 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 11945 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11946 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11947 | |
| 11948 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11949 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11950 | |
| 11951 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 11952 | HDA_OUTPUT), |
| 11953 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 11954 | HDA_OUTPUT), |
| 11955 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11956 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 11957 | |
| 11958 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 11959 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11960 | |
| 11961 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11962 | |
| 11963 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11964 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11965 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11966 | |
| 11967 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11968 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11969 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11970 | |
| 11971 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11972 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11973 | |
| 11974 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11975 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11976 | |
| 11977 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11978 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11979 | |
| 11980 | { } /* end */ |
| 11981 | }; |
| 11982 | |
| 11983 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 11984 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11985 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11986 | |
| 11987 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11988 | |
| 11989 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11990 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11991 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11992 | |
| 11993 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11994 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11995 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11996 | |
| 11997 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11998 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11999 | |
| 12000 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12001 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12002 | |
| 12003 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12004 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12005 | |
| 12006 | { } /* end */ |
| 12007 | }; |
| 12008 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12009 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 12010 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12011 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 12012 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12013 | |
| 12014 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12015 | |
| 12016 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12017 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12018 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12019 | |
| 12020 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12021 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12022 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12023 | |
| 12024 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12025 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12026 | |
| 12027 | { } /* end */ |
| 12028 | }; |
| 12029 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12030 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 12031 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 12032 | */ |
| 12033 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 12034 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12035 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12036 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12037 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12038 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12039 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12040 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12041 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12042 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12043 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12044 | { } /* end */ |
| 12045 | }; |
| 12046 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12047 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12048 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12049 | */ |
| 12050 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12051 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12052 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12053 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12054 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12055 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12056 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12057 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12058 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12059 | |
| 12060 | { } /* end */ |
| 12061 | }; |
| 12062 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12063 | /* |
| 12064 | * generic initialization of ADC, input mixers and output mixers |
| 12065 | */ |
| 12066 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12067 | /* |
| 12068 | * Unmute ADC0 and set the default input to mic-in |
| 12069 | */ |
| 12070 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12071 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12072 | |
| 12073 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12074 | * the analog-loopback mixer widget |
| 12075 | */ |
| 12076 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12077 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12078 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12079 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12080 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12081 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12082 | |
| 12083 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12084 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12088 | |
| 12089 | /* |
| 12090 | * Set up output mixers (0x02 - 0x05) |
| 12091 | */ |
| 12092 | /* set vol=0 to output mixers */ |
| 12093 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12094 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12095 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12096 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12097 | |
| 12098 | /* set up input amps for analog loopback */ |
| 12099 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12100 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12102 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12103 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12104 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12105 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12106 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12107 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12108 | |
| 12109 | { } |
| 12110 | }; |
| 12111 | |
| 12112 | /* |
| 12113 | * 3-stack pin configuration: |
| 12114 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 12115 | */ |
| 12116 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 12117 | /* |
| 12118 | * Set pin mode and muting |
| 12119 | */ |
| 12120 | /* set front pin widgets 0x14 for output */ |
| 12121 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12122 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12123 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12124 | |
| 12125 | /* Mic (rear) pin: input vref at 80% */ |
| 12126 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12127 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12128 | /* Front Mic pin: input vref at 80% */ |
| 12129 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12130 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12131 | /* Line In pin: input */ |
| 12132 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12133 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12134 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12135 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12136 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12137 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12138 | /* CD pin widget for input */ |
| 12139 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12140 | |
| 12141 | { } |
| 12142 | }; |
| 12143 | |
| 12144 | /* |
| 12145 | * 6-stack pin configuration: |
| 12146 | */ |
| 12147 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 12148 | /* |
| 12149 | * Set pin mode and muting |
| 12150 | */ |
| 12151 | /* set front pin widgets 0x14 for output */ |
| 12152 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12153 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12154 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12155 | |
| 12156 | /* Rear Pin: output 1 (0x0d) */ |
| 12157 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12158 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12159 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12160 | /* CLFE Pin: output 2 (0x0e) */ |
| 12161 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12162 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12163 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 12164 | /* Side Pin: output 3 (0x0f) */ |
| 12165 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12166 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12167 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 12168 | |
| 12169 | /* Mic (rear) pin: input vref at 80% */ |
| 12170 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12171 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12172 | /* Front Mic pin: input vref at 80% */ |
| 12173 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12174 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12175 | /* Line In pin: input */ |
| 12176 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12177 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12178 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12179 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12180 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12181 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12182 | /* CD pin widget for input */ |
| 12183 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12184 | |
| 12185 | { } |
| 12186 | }; |
| 12187 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12188 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 12189 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12190 | { } |
| 12191 | }; |
| 12192 | |
| 12193 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 12194 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12195 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12196 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12197 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12198 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12199 | {} |
| 12200 | }; |
| 12201 | |
| 12202 | /* toggle speaker-output according to the hp-jack state */ |
| 12203 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 12204 | { |
| 12205 | unsigned int present; |
| 12206 | unsigned char bits; |
| 12207 | |
| 12208 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12209 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12210 | bits = present ? HDA_AMP_MUTE : 0; |
| 12211 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12212 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12213 | } |
| 12214 | |
| 12215 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 12216 | { |
| 12217 | unsigned int present; |
| 12218 | unsigned char bits; |
| 12219 | |
| 12220 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12221 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12222 | bits = present ? HDA_AMP_MUTE : 0; |
| 12223 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 12224 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12225 | } |
| 12226 | |
| 12227 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 12228 | { |
| 12229 | alc861vd_lenovo_hp_automute(codec); |
| 12230 | alc861vd_lenovo_mic_automute(codec); |
| 12231 | } |
| 12232 | |
| 12233 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12234 | unsigned int res) |
| 12235 | { |
| 12236 | switch (res >> 26) { |
| 12237 | case ALC880_HP_EVENT: |
| 12238 | alc861vd_lenovo_hp_automute(codec); |
| 12239 | break; |
| 12240 | case ALC880_MIC_EVENT: |
| 12241 | alc861vd_lenovo_mic_automute(codec); |
| 12242 | break; |
| 12243 | } |
| 12244 | } |
| 12245 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12246 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12247 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12248 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12249 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12250 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12251 | |
| 12252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12253 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12254 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12255 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12256 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12257 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12258 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12259 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12260 | |
| 12261 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12262 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12263 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12264 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12265 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12266 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12267 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12268 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12269 | |
| 12270 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12271 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12272 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12273 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12274 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12275 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12276 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12277 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12278 | |
| 12279 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12280 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12281 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12282 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12283 | |
| 12284 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12285 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12286 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12287 | |
| 12288 | { } /* end */ |
| 12289 | }; |
| 12290 | |
| 12291 | /* toggle speaker-output according to the hp-jack state */ |
| 12292 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12293 | { |
| 12294 | unsigned int present; |
| 12295 | |
| 12296 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12297 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12298 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12299 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12300 | } |
| 12301 | |
| 12302 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12303 | { |
| 12304 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12305 | alc861vd_dallas_automute(codec); |
| 12306 | } |
| 12307 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12308 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12309 | #define alc861vd_loopbacks alc880_loopbacks |
| 12310 | #endif |
| 12311 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12312 | /* pcm configuration: identiacal with ALC880 */ |
| 12313 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12314 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12315 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12316 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12317 | |
| 12318 | /* |
| 12319 | * configuration and preset |
| 12320 | */ |
| 12321 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12322 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12323 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12324 | [ALC861VD_3ST] = "3stack", |
| 12325 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12326 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12327 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12328 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12329 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12330 | [ALC861VD_AUTO] = "auto", |
| 12331 | }; |
| 12332 | |
| 12333 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12334 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12335 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12336 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12337 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12338 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12339 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12340 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 12341 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12342 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 12343 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 12344 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12345 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12346 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12347 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12348 | {} |
| 12349 | }; |
| 12350 | |
| 12351 | static struct alc_config_preset alc861vd_presets[] = { |
| 12352 | [ALC660VD_3ST] = { |
| 12353 | .mixers = { alc861vd_3st_mixer }, |
| 12354 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12355 | alc861vd_3stack_init_verbs }, |
| 12356 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12357 | .dac_nids = alc660vd_dac_nids, |
| 12358 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12359 | .adc_nids = alc861vd_adc_nids, |
| 12360 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12361 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12362 | .input_mux = &alc861vd_capture_source, |
| 12363 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12364 | [ALC660VD_3ST_DIG] = { |
| 12365 | .mixers = { alc861vd_3st_mixer }, |
| 12366 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12367 | alc861vd_3stack_init_verbs }, |
| 12368 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12369 | .dac_nids = alc660vd_dac_nids, |
| 12370 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12371 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12372 | .adc_nids = alc861vd_adc_nids, |
| 12373 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12374 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12375 | .input_mux = &alc861vd_capture_source, |
| 12376 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12377 | [ALC861VD_3ST] = { |
| 12378 | .mixers = { alc861vd_3st_mixer }, |
| 12379 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12380 | alc861vd_3stack_init_verbs }, |
| 12381 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12382 | .dac_nids = alc861vd_dac_nids, |
| 12383 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12384 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12385 | .input_mux = &alc861vd_capture_source, |
| 12386 | }, |
| 12387 | [ALC861VD_3ST_DIG] = { |
| 12388 | .mixers = { alc861vd_3st_mixer }, |
| 12389 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12390 | alc861vd_3stack_init_verbs }, |
| 12391 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12392 | .dac_nids = alc861vd_dac_nids, |
| 12393 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12394 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12395 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12396 | .input_mux = &alc861vd_capture_source, |
| 12397 | }, |
| 12398 | [ALC861VD_6ST_DIG] = { |
| 12399 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12400 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12401 | alc861vd_6stack_init_verbs }, |
| 12402 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12403 | .dac_nids = alc861vd_dac_nids, |
| 12404 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12405 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12406 | .channel_mode = alc861vd_6stack_modes, |
| 12407 | .input_mux = &alc861vd_capture_source, |
| 12408 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12409 | [ALC861VD_LENOVO] = { |
| 12410 | .mixers = { alc861vd_lenovo_mixer }, |
| 12411 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12412 | alc861vd_3stack_init_verbs, |
| 12413 | alc861vd_eapd_verbs, |
| 12414 | alc861vd_lenovo_unsol_verbs }, |
| 12415 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12416 | .dac_nids = alc660vd_dac_nids, |
| 12417 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12418 | .adc_nids = alc861vd_adc_nids, |
| 12419 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12420 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12421 | .input_mux = &alc861vd_capture_source, |
| 12422 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12423 | .init_hook = alc861vd_lenovo_automute, |
| 12424 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12425 | [ALC861VD_DALLAS] = { |
| 12426 | .mixers = { alc861vd_dallas_mixer }, |
| 12427 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12428 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12429 | .dac_nids = alc861vd_dac_nids, |
| 12430 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12431 | .adc_nids = alc861vd_adc_nids, |
| 12432 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12433 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12434 | .input_mux = &alc861vd_dallas_capture_source, |
| 12435 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12436 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12437 | }, |
| 12438 | [ALC861VD_HP] = { |
| 12439 | .mixers = { alc861vd_hp_mixer }, |
| 12440 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12441 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12442 | .dac_nids = alc861vd_dac_nids, |
| 12443 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12444 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12445 | .adc_nids = alc861vd_adc_nids, |
| 12446 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12447 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12448 | .input_mux = &alc861vd_hp_capture_source, |
| 12449 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12450 | .init_hook = alc861vd_dallas_automute, |
| 12451 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12452 | }; |
| 12453 | |
| 12454 | /* |
| 12455 | * BIOS auto configuration |
| 12456 | */ |
| 12457 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12458 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12459 | { |
| 12460 | /* set as output */ |
| 12461 | snd_hda_codec_write(codec, nid, 0, |
| 12462 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 12463 | snd_hda_codec_write(codec, nid, 0, |
| 12464 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 12465 | } |
| 12466 | |
| 12467 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12468 | { |
| 12469 | struct alc_spec *spec = codec->spec; |
| 12470 | int i; |
| 12471 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12472 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12473 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12474 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12475 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12476 | if (nid) |
| 12477 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12478 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12479 | } |
| 12480 | } |
| 12481 | |
| 12482 | |
| 12483 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12484 | { |
| 12485 | struct alc_spec *spec = codec->spec; |
| 12486 | hda_nid_t pin; |
| 12487 | |
| 12488 | pin = spec->autocfg.hp_pins[0]; |
| 12489 | if (pin) /* connect to front and use dac 0 */ |
| 12490 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 12491 | } |
| 12492 | |
| 12493 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12494 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12495 | |
| 12496 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12497 | { |
| 12498 | struct alc_spec *spec = codec->spec; |
| 12499 | int i; |
| 12500 | |
| 12501 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12502 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12503 | if (alc861vd_is_input_pin(nid)) { |
| 12504 | snd_hda_codec_write(codec, nid, 0, |
| 12505 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12506 | i <= AUTO_PIN_FRONT_MIC ? |
| 12507 | PIN_VREF80 : PIN_IN); |
| 12508 | if (nid != ALC861VD_PIN_CD_NID) |
| 12509 | snd_hda_codec_write(codec, nid, 0, |
| 12510 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12511 | AMP_OUT_MUTE); |
| 12512 | } |
| 12513 | } |
| 12514 | } |
| 12515 | |
| 12516 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12517 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12518 | |
| 12519 | /* add playback controls from the parsed DAC table */ |
| 12520 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12521 | * different NIDs for mute/unmute switch and volume control */ |
| 12522 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12523 | const struct auto_pin_cfg *cfg) |
| 12524 | { |
| 12525 | char name[32]; |
| 12526 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12527 | hda_nid_t nid_v, nid_s; |
| 12528 | int i, err; |
| 12529 | |
| 12530 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12531 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12532 | continue; |
| 12533 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12534 | alc880_dac_to_idx( |
| 12535 | spec->multiout.dac_nids[i])); |
| 12536 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12537 | alc880_dac_to_idx( |
| 12538 | spec->multiout.dac_nids[i])); |
| 12539 | |
| 12540 | if (i == 2) { |
| 12541 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12542 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12543 | "Center Playback Volume", |
| 12544 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12545 | HDA_OUTPUT)); |
| 12546 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12547 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12548 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12549 | "LFE Playback Volume", |
| 12550 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12551 | HDA_OUTPUT)); |
| 12552 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12553 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12554 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12555 | "Center Playback Switch", |
| 12556 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12557 | HDA_INPUT)); |
| 12558 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12559 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12560 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12561 | "LFE Playback Switch", |
| 12562 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12563 | HDA_INPUT)); |
| 12564 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12565 | return err; |
| 12566 | } else { |
| 12567 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12568 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12569 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 12570 | HDA_OUTPUT)); |
| 12571 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12572 | return err; |
| 12573 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12574 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12575 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12576 | HDA_INPUT)); |
| 12577 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12578 | return err; |
| 12579 | } |
| 12580 | } |
| 12581 | return 0; |
| 12582 | } |
| 12583 | |
| 12584 | /* add playback controls for speaker and HP outputs */ |
| 12585 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12586 | * different NIDs for mute/unmute switch and volume control */ |
| 12587 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 12588 | hda_nid_t pin, const char *pfx) |
| 12589 | { |
| 12590 | hda_nid_t nid_v, nid_s; |
| 12591 | int err; |
| 12592 | char name[32]; |
| 12593 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12594 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12595 | return 0; |
| 12596 | |
| 12597 | if (alc880_is_fixed_pin(pin)) { |
| 12598 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 12599 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12600 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12601 | spec->multiout.hp_nid = nid_v; |
| 12602 | else |
| 12603 | spec->multiout.extra_out_nid[0] = nid_v; |
| 12604 | /* control HP volume/switch on the output mixer amp */ |
| 12605 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12606 | alc880_fixed_pin_idx(pin)); |
| 12607 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12608 | alc880_fixed_pin_idx(pin)); |
| 12609 | |
| 12610 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12611 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12612 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 12613 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12614 | return err; |
| 12615 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12616 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12617 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 12618 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12619 | return err; |
| 12620 | } else if (alc880_is_multi_pin(pin)) { |
| 12621 | /* set manual connection */ |
| 12622 | /* we have only a switch on HP-out PIN */ |
| 12623 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12624 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12625 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 12626 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12627 | return err; |
| 12628 | } |
| 12629 | return 0; |
| 12630 | } |
| 12631 | |
| 12632 | /* parse the BIOS configuration and set up the alc_spec |
| 12633 | * return 1 if successful, 0 if the proper config is not found, |
| 12634 | * or a negative error code |
| 12635 | * Based on ALC880 version - had to change it to override |
| 12636 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 12637 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 12638 | { |
| 12639 | struct alc_spec *spec = codec->spec; |
| 12640 | int err; |
| 12641 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 12642 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12643 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12644 | alc861vd_ignore); |
| 12645 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12646 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12647 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12648 | return 0; /* can't find valid BIOS pin config */ |
| 12649 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12650 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12651 | if (err < 0) |
| 12652 | return err; |
| 12653 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12654 | if (err < 0) |
| 12655 | return err; |
| 12656 | err = alc861vd_auto_create_extra_out(spec, |
| 12657 | spec->autocfg.speaker_pins[0], |
| 12658 | "Speaker"); |
| 12659 | if (err < 0) |
| 12660 | return err; |
| 12661 | err = alc861vd_auto_create_extra_out(spec, |
| 12662 | spec->autocfg.hp_pins[0], |
| 12663 | "Headphone"); |
| 12664 | if (err < 0) |
| 12665 | return err; |
| 12666 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12667 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12668 | return err; |
| 12669 | |
| 12670 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12671 | |
| 12672 | if (spec->autocfg.dig_out_pin) |
| 12673 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 12674 | |
| 12675 | if (spec->kctl_alloc) |
| 12676 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12677 | |
| 12678 | spec->init_verbs[spec->num_init_verbs++] |
| 12679 | = alc861vd_volume_init_verbs; |
| 12680 | |
| 12681 | spec->num_mux_defs = 1; |
| 12682 | spec->input_mux = &spec->private_imux; |
| 12683 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12684 | err = alc_auto_add_mic_boost(codec); |
| 12685 | if (err < 0) |
| 12686 | return err; |
| 12687 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12688 | return 1; |
| 12689 | } |
| 12690 | |
| 12691 | /* additional initialization for auto-configuration model */ |
| 12692 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 12693 | { |
| 12694 | alc861vd_auto_init_multi_out(codec); |
| 12695 | alc861vd_auto_init_hp_out(codec); |
| 12696 | alc861vd_auto_init_analog_input(codec); |
| 12697 | } |
| 12698 | |
| 12699 | static int patch_alc861vd(struct hda_codec *codec) |
| 12700 | { |
| 12701 | struct alc_spec *spec; |
| 12702 | int err, board_config; |
| 12703 | |
| 12704 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12705 | if (spec == NULL) |
| 12706 | return -ENOMEM; |
| 12707 | |
| 12708 | codec->spec = spec; |
| 12709 | |
| 12710 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 12711 | alc861vd_models, |
| 12712 | alc861vd_cfg_tbl); |
| 12713 | |
| 12714 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 12715 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 12716 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 12717 | board_config = ALC861VD_AUTO; |
| 12718 | } |
| 12719 | |
| 12720 | if (board_config == ALC861VD_AUTO) { |
| 12721 | /* automatic parse from the BIOS config */ |
| 12722 | err = alc861vd_parse_auto_config(codec); |
| 12723 | if (err < 0) { |
| 12724 | alc_free(codec); |
| 12725 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12726 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12727 | printk(KERN_INFO |
| 12728 | "hda_codec: Cannot set up configuration " |
| 12729 | "from BIOS. Using base mode...\n"); |
| 12730 | board_config = ALC861VD_3ST; |
| 12731 | } |
| 12732 | } |
| 12733 | |
| 12734 | if (board_config != ALC861VD_AUTO) |
| 12735 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 12736 | |
| 12737 | spec->stream_name_analog = "ALC861VD Analog"; |
| 12738 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 12739 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 12740 | |
| 12741 | spec->stream_name_digital = "ALC861VD Digital"; |
| 12742 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 12743 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 12744 | |
| 12745 | spec->adc_nids = alc861vd_adc_nids; |
| 12746 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 12747 | |
| 12748 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 12749 | spec->num_mixers++; |
| 12750 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12751 | spec->vmaster_nid = 0x02; |
| 12752 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12753 | codec->patch_ops = alc_patch_ops; |
| 12754 | |
| 12755 | if (board_config == ALC861VD_AUTO) |
| 12756 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12757 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12758 | if (!spec->loopback.amplist) |
| 12759 | spec->loopback.amplist = alc861vd_loopbacks; |
| 12760 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12761 | |
| 12762 | return 0; |
| 12763 | } |
| 12764 | |
| 12765 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12766 | * ALC662 support |
| 12767 | * |
| 12768 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 12769 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 12770 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 12771 | * 6-channel independent captures. |
| 12772 | * |
| 12773 | * In addition, an independent DAC for the multi-playback (not used in this |
| 12774 | * driver yet). |
| 12775 | */ |
| 12776 | #define ALC662_DIGOUT_NID 0x06 |
| 12777 | #define ALC662_DIGIN_NID 0x0a |
| 12778 | |
| 12779 | static hda_nid_t alc662_dac_nids[4] = { |
| 12780 | /* front, rear, clfe, rear_surr */ |
| 12781 | 0x02, 0x03, 0x04 |
| 12782 | }; |
| 12783 | |
| 12784 | static hda_nid_t alc662_adc_nids[1] = { |
| 12785 | /* ADC1-2 */ |
| 12786 | 0x09, |
| 12787 | }; |
| 12788 | /* input MUX */ |
| 12789 | /* FIXME: should be a matrix-type input source selection */ |
| 12790 | |
| 12791 | static struct hda_input_mux alc662_capture_source = { |
| 12792 | .num_items = 4, |
| 12793 | .items = { |
| 12794 | { "Mic", 0x0 }, |
| 12795 | { "Front Mic", 0x1 }, |
| 12796 | { "Line", 0x2 }, |
| 12797 | { "CD", 0x4 }, |
| 12798 | }, |
| 12799 | }; |
| 12800 | |
| 12801 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 12802 | .num_items = 2, |
| 12803 | .items = { |
| 12804 | { "Mic", 0x1 }, |
| 12805 | { "Line", 0x2 }, |
| 12806 | }, |
| 12807 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12808 | |
| 12809 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 12810 | .num_items = 2, |
| 12811 | .items = { |
| 12812 | { "i-Mic", 0x1 }, |
| 12813 | { "e-Mic", 0x0 }, |
| 12814 | }, |
| 12815 | }; |
| 12816 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12817 | #define alc662_mux_enum_info alc_mux_enum_info |
| 12818 | #define alc662_mux_enum_get alc_mux_enum_get |
| 12819 | |
| 12820 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12821 | struct snd_ctl_elem_value *ucontrol) |
| 12822 | { |
| 12823 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12824 | struct alc_spec *spec = codec->spec; |
| 12825 | const struct hda_input_mux *imux = spec->input_mux; |
| 12826 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12827 | static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12828 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 12829 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 12830 | unsigned int i, idx; |
| 12831 | |
| 12832 | idx = ucontrol->value.enumerated.item[0]; |
| 12833 | if (idx >= imux->num_items) |
| 12834 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 12835 | if (*cur_val == idx) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12836 | return 0; |
| 12837 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12838 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 12839 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 12840 | imux->items[i].index, |
| 12841 | HDA_AMP_MUTE, v); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12842 | } |
| 12843 | *cur_val = idx; |
| 12844 | return 1; |
| 12845 | } |
| 12846 | /* |
| 12847 | * 2ch mode |
| 12848 | */ |
| 12849 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 12850 | { 2, NULL } |
| 12851 | }; |
| 12852 | |
| 12853 | /* |
| 12854 | * 2ch mode |
| 12855 | */ |
| 12856 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 12857 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 12858 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12859 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 12860 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12861 | { } /* end */ |
| 12862 | }; |
| 12863 | |
| 12864 | /* |
| 12865 | * 6ch mode |
| 12866 | */ |
| 12867 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 12868 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12869 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12870 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 12871 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12872 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12873 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12874 | { } /* end */ |
| 12875 | }; |
| 12876 | |
| 12877 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 12878 | { 2, alc662_3ST_ch2_init }, |
| 12879 | { 6, alc662_3ST_ch6_init }, |
| 12880 | }; |
| 12881 | |
| 12882 | /* |
| 12883 | * 2ch mode |
| 12884 | */ |
| 12885 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 12886 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12887 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12888 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12889 | { } /* end */ |
| 12890 | }; |
| 12891 | |
| 12892 | /* |
| 12893 | * 6ch mode |
| 12894 | */ |
| 12895 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 12896 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12897 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12898 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12899 | { } /* end */ |
| 12900 | }; |
| 12901 | |
| 12902 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 12903 | { 2, alc662_sixstack_ch6_init }, |
| 12904 | { 6, alc662_sixstack_ch8_init }, |
| 12905 | }; |
| 12906 | |
| 12907 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12908 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12909 | */ |
| 12910 | |
| 12911 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 12912 | /* output mixer control */ |
| 12913 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12914 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 12915 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12916 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12917 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12918 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12919 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12920 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12921 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12922 | |
| 12923 | /*Input mixer control */ |
| 12924 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 12925 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 12926 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 12927 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 12928 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 12929 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 12930 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 12931 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12932 | { } /* end */ |
| 12933 | }; |
| 12934 | |
| 12935 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 12936 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12937 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12938 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12939 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12940 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12941 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12942 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12943 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12944 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12945 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12946 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12947 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12948 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12949 | { } /* end */ |
| 12950 | }; |
| 12951 | |
| 12952 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 12953 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12954 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12955 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12956 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12957 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12958 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12959 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12960 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12961 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12962 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12963 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12964 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12965 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12966 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12967 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12968 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12969 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12970 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12971 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12972 | { } /* end */ |
| 12973 | }; |
| 12974 | |
| 12975 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 12976 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12977 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 12978 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12979 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12980 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12981 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12982 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12983 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12984 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12985 | { } /* end */ |
| 12986 | }; |
| 12987 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12988 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 12989 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12990 | |
| 12991 | HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12992 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12993 | |
| 12994 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 12995 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12996 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12997 | |
| 12998 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 12999 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13000 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13001 | { } /* end */ |
| 13002 | }; |
| 13003 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13004 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
| 13005 | HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13006 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13007 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13008 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 13009 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13010 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13011 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13012 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13013 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13014 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13015 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13016 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13017 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13018 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13019 | { } /* end */ |
| 13020 | }; |
| 13021 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13022 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 13023 | { |
| 13024 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13025 | .name = "Channel Mode", |
| 13026 | .info = alc_ch_mode_info, |
| 13027 | .get = alc_ch_mode_get, |
| 13028 | .put = alc_ch_mode_put, |
| 13029 | }, |
| 13030 | { } /* end */ |
| 13031 | }; |
| 13032 | |
| 13033 | static struct hda_verb alc662_init_verbs[] = { |
| 13034 | /* ADC: mute amp left and right */ |
| 13035 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13036 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13037 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 13038 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13044 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13045 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13047 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13049 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13050 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13051 | |
| 13052 | /* Front Pin: output 0 (0x0c) */ |
| 13053 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13054 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13055 | |
| 13056 | /* Rear Pin: output 1 (0x0d) */ |
| 13057 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13058 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13059 | |
| 13060 | /* CLFE Pin: output 2 (0x0e) */ |
| 13061 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13062 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13063 | |
| 13064 | /* Mic (rear) pin: input vref at 80% */ |
| 13065 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13066 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13067 | /* Front Mic pin: input vref at 80% */ |
| 13068 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13069 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13070 | /* Line In pin: input */ |
| 13071 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13072 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13073 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13074 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13075 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13076 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13077 | /* CD pin widget for input */ |
| 13078 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13079 | |
| 13080 | /* FIXME: use matrix-type input source selection */ |
| 13081 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13082 | /* Input mixer */ |
| 13083 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13084 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13087 | |
| 13088 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13089 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13090 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13091 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13092 | { } |
| 13093 | }; |
| 13094 | |
| 13095 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 13096 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13097 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13098 | {} |
| 13099 | }; |
| 13100 | |
| 13101 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 13102 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13103 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13104 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13105 | }; |
| 13106 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13107 | /* Set Unsolicited Event*/ |
| 13108 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 13109 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13110 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13111 | {} |
| 13112 | }; |
| 13113 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13114 | /* |
| 13115 | * generic initialization of ADC, input mixers and output mixers |
| 13116 | */ |
| 13117 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 13118 | /* |
| 13119 | * Unmute ADC and set the default input to mic-in |
| 13120 | */ |
| 13121 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13122 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13123 | |
| 13124 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 13125 | * mixer widget |
| 13126 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 13127 | * panel mic (mic 2) |
| 13128 | */ |
| 13129 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13130 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13133 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13135 | |
| 13136 | /* |
| 13137 | * Set up output mixers (0x0c - 0x0f) |
| 13138 | */ |
| 13139 | /* set vol=0 to output mixers */ |
| 13140 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13141 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13142 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13143 | |
| 13144 | /* set up input amps for analog loopback */ |
| 13145 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13146 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13147 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13148 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13149 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13150 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13151 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13152 | |
| 13153 | |
| 13154 | /* FIXME: use matrix-type input source selection */ |
| 13155 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13156 | /* Input mixer */ |
| 13157 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13158 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13159 | { } |
| 13160 | }; |
| 13161 | |
| 13162 | /* capture mixer elements */ |
| 13163 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 13164 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13165 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13166 | { |
| 13167 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13168 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13169 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13170 | */ |
| 13171 | /* .name = "Capture Source", */ |
| 13172 | .name = "Input Source", |
| 13173 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 13174 | .info = alc662_mux_enum_info, |
| 13175 | .get = alc662_mux_enum_get, |
| 13176 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13177 | }, |
| 13178 | { } /* end */ |
| 13179 | }; |
| 13180 | |
| 13181 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 13182 | { |
| 13183 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13184 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13185 | |
| 13186 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13187 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13188 | bits = present ? HDA_AMP_MUTE : 0; |
| 13189 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13190 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13191 | } |
| 13192 | |
| 13193 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 13194 | { |
| 13195 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13196 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13197 | |
| 13198 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13199 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13200 | bits = present ? HDA_AMP_MUTE : 0; |
| 13201 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13202 | HDA_AMP_MUTE, bits); |
| 13203 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13204 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13205 | } |
| 13206 | |
| 13207 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 13208 | unsigned int res) |
| 13209 | { |
| 13210 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13211 | alc662_lenovo_101e_all_automute(codec); |
| 13212 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 13213 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 13214 | } |
| 13215 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13216 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 13217 | { |
| 13218 | unsigned int present; |
| 13219 | |
| 13220 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13221 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13222 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13223 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13224 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13225 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13226 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13227 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13228 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13229 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13230 | } |
| 13231 | |
| 13232 | /* unsolicited event for HP jack sensing */ |
| 13233 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13234 | unsigned int res) |
| 13235 | { |
| 13236 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13237 | alc262_hippo1_automute( codec ); |
| 13238 | |
| 13239 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13240 | alc662_eeepc_mic_automute(codec); |
| 13241 | } |
| 13242 | |
| 13243 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13244 | { |
| 13245 | alc262_hippo1_automute( codec ); |
| 13246 | alc662_eeepc_mic_automute(codec); |
| 13247 | } |
| 13248 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13249 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13250 | { |
| 13251 | unsigned int mute; |
| 13252 | unsigned int present; |
| 13253 | |
| 13254 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13255 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13256 | AC_VERB_GET_PIN_SENSE, 0); |
| 13257 | present = (present & 0x80000000) != 0; |
| 13258 | if (present) { |
| 13259 | /* mute internal speaker */ |
| 13260 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13261 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13262 | } else { |
| 13263 | /* unmute internal speaker if necessary */ |
| 13264 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13265 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13266 | HDA_AMP_MUTE, mute); |
| 13267 | } |
| 13268 | } |
| 13269 | |
| 13270 | /* unsolicited event for HP jack sensing */ |
| 13271 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 13272 | unsigned int res) |
| 13273 | { |
| 13274 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13275 | alc662_eeepc_ep20_automute(codec); |
| 13276 | } |
| 13277 | |
| 13278 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 13279 | { |
| 13280 | alc662_eeepc_ep20_automute(codec); |
| 13281 | } |
| 13282 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13283 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13284 | #define alc662_loopbacks alc880_loopbacks |
| 13285 | #endif |
| 13286 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13287 | |
| 13288 | /* pcm configuration: identiacal with ALC880 */ |
| 13289 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 13290 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 13291 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 13292 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 13293 | |
| 13294 | /* |
| 13295 | * configuration and preset |
| 13296 | */ |
| 13297 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 13298 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 13299 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 13300 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 13301 | [ALC662_5ST_DIG] = "6stack-dig", |
| 13302 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 13303 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13304 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13305 | [ALC662_AUTO] = "auto", |
| 13306 | }; |
| 13307 | |
| 13308 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13309 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13310 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13311 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13312 | {} |
| 13313 | }; |
| 13314 | |
| 13315 | static struct alc_config_preset alc662_presets[] = { |
| 13316 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13317 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13318 | .init_verbs = { alc662_init_verbs }, |
| 13319 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13320 | .dac_nids = alc662_dac_nids, |
| 13321 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 13322 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13323 | .adc_nids = alc662_adc_nids, |
| 13324 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13325 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13326 | .channel_mode = alc662_3ST_2ch_modes, |
| 13327 | .input_mux = &alc662_capture_source, |
| 13328 | }, |
| 13329 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13330 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13331 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13332 | .init_verbs = { alc662_init_verbs }, |
| 13333 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13334 | .dac_nids = alc662_dac_nids, |
| 13335 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 13336 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13337 | .adc_nids = alc662_adc_nids, |
| 13338 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13339 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13340 | .channel_mode = alc662_3ST_6ch_modes, |
| 13341 | .need_dac_fix = 1, |
| 13342 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13343 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13344 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13345 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13346 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13347 | .init_verbs = { alc662_init_verbs }, |
| 13348 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13349 | .dac_nids = alc662_dac_nids, |
| 13350 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13351 | .adc_nids = alc662_adc_nids, |
| 13352 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13353 | .channel_mode = alc662_3ST_6ch_modes, |
| 13354 | .need_dac_fix = 1, |
| 13355 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13356 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13357 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13358 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13359 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13360 | .init_verbs = { alc662_init_verbs }, |
| 13361 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13362 | .dac_nids = alc662_dac_nids, |
| 13363 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 13364 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13365 | .adc_nids = alc662_adc_nids, |
| 13366 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13367 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 13368 | .channel_mode = alc662_5stack_modes, |
| 13369 | .input_mux = &alc662_capture_source, |
| 13370 | }, |
| 13371 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13372 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13373 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 13374 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13375 | .dac_nids = alc662_dac_nids, |
| 13376 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13377 | .adc_nids = alc662_adc_nids, |
| 13378 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13379 | .channel_mode = alc662_3ST_2ch_modes, |
| 13380 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13381 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 13382 | .init_hook = alc662_lenovo_101e_all_automute, |
| 13383 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13384 | [ALC662_ASUS_EEEPC_P701] = { |
| 13385 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 13386 | .init_verbs = { alc662_init_verbs, |
| 13387 | alc662_eeepc_sue_init_verbs }, |
| 13388 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13389 | .dac_nids = alc662_dac_nids, |
| 13390 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 13391 | .adc_nids = alc662_adc_nids, |
| 13392 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13393 | .channel_mode = alc662_3ST_2ch_modes, |
| 13394 | .input_mux = &alc662_eeepc_capture_source, |
| 13395 | .unsol_event = alc662_eeepc_unsol_event, |
| 13396 | .init_hook = alc662_eeepc_inithook, |
| 13397 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13398 | [ALC662_ASUS_EEEPC_EP20] = { |
| 13399 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 13400 | alc662_chmode_mixer }, |
| 13401 | .init_verbs = { alc662_init_verbs, |
| 13402 | alc662_eeepc_ep20_sue_init_verbs }, |
| 13403 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13404 | .dac_nids = alc662_dac_nids, |
| 13405 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13406 | .adc_nids = alc662_adc_nids, |
| 13407 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13408 | .channel_mode = alc662_3ST_6ch_modes, |
| 13409 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13410 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 13411 | .init_hook = alc662_eeepc_ep20_inithook, |
| 13412 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13413 | |
| 13414 | }; |
| 13415 | |
| 13416 | |
| 13417 | /* |
| 13418 | * BIOS auto configuration |
| 13419 | */ |
| 13420 | |
| 13421 | /* add playback controls from the parsed DAC table */ |
| 13422 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13423 | const struct auto_pin_cfg *cfg) |
| 13424 | { |
| 13425 | char name[32]; |
| 13426 | static const char *chname[4] = { |
| 13427 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13428 | }; |
| 13429 | hda_nid_t nid; |
| 13430 | int i, err; |
| 13431 | |
| 13432 | for (i = 0; i < cfg->line_outs; i++) { |
| 13433 | if (!spec->multiout.dac_nids[i]) |
| 13434 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13435 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13436 | if (i == 2) { |
| 13437 | /* Center/LFE */ |
| 13438 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13439 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13440 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13441 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13442 | if (err < 0) |
| 13443 | return err; |
| 13444 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13445 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13446 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13447 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13448 | if (err < 0) |
| 13449 | return err; |
| 13450 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13451 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13452 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13453 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13454 | if (err < 0) |
| 13455 | return err; |
| 13456 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13457 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13458 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13459 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13460 | if (err < 0) |
| 13461 | return err; |
| 13462 | } else { |
| 13463 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13464 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13465 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13466 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13467 | if (err < 0) |
| 13468 | return err; |
| 13469 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13470 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13471 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13472 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13473 | if (err < 0) |
| 13474 | return err; |
| 13475 | } |
| 13476 | } |
| 13477 | return 0; |
| 13478 | } |
| 13479 | |
| 13480 | /* add playback controls for speaker and HP outputs */ |
| 13481 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13482 | const char *pfx) |
| 13483 | { |
| 13484 | hda_nid_t nid; |
| 13485 | int err; |
| 13486 | char name[32]; |
| 13487 | |
| 13488 | if (!pin) |
| 13489 | return 0; |
| 13490 | |
| 13491 | if (alc880_is_fixed_pin(pin)) { |
| 13492 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13493 | /* printk("DAC nid=%x\n",nid); */ |
| 13494 | /* specify the DAC as the extra output */ |
| 13495 | if (!spec->multiout.hp_nid) |
| 13496 | spec->multiout.hp_nid = nid; |
| 13497 | else |
| 13498 | spec->multiout.extra_out_nid[0] = nid; |
| 13499 | /* control HP volume/switch on the output mixer amp */ |
| 13500 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13501 | sprintf(name, "%s Playback Volume", pfx); |
| 13502 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13503 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13504 | if (err < 0) |
| 13505 | return err; |
| 13506 | sprintf(name, "%s Playback Switch", pfx); |
| 13507 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13508 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13509 | if (err < 0) |
| 13510 | return err; |
| 13511 | } else if (alc880_is_multi_pin(pin)) { |
| 13512 | /* set manual connection */ |
| 13513 | /* we have only a switch on HP-out PIN */ |
| 13514 | sprintf(name, "%s Playback Switch", pfx); |
| 13515 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13516 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13517 | if (err < 0) |
| 13518 | return err; |
| 13519 | } |
| 13520 | return 0; |
| 13521 | } |
| 13522 | |
| 13523 | /* create playback/capture controls for input pins */ |
| 13524 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13525 | const struct auto_pin_cfg *cfg) |
| 13526 | { |
| 13527 | struct hda_input_mux *imux = &spec->private_imux; |
| 13528 | int i, err, idx; |
| 13529 | |
| 13530 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13531 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13532 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13533 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13534 | auto_pin_cfg_labels[i], |
| 13535 | idx, 0x0b); |
| 13536 | if (err < 0) |
| 13537 | return err; |
| 13538 | imux->items[imux->num_items].label = |
| 13539 | auto_pin_cfg_labels[i]; |
| 13540 | imux->items[imux->num_items].index = |
| 13541 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13542 | imux->num_items++; |
| 13543 | } |
| 13544 | } |
| 13545 | return 0; |
| 13546 | } |
| 13547 | |
| 13548 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13549 | hda_nid_t nid, int pin_type, |
| 13550 | int dac_idx) |
| 13551 | { |
| 13552 | /* set as output */ |
| 13553 | snd_hda_codec_write(codec, nid, 0, |
| 13554 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 13555 | snd_hda_codec_write(codec, nid, 0, |
| 13556 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 13557 | /* need the manual connection? */ |
| 13558 | if (alc880_is_multi_pin(nid)) { |
| 13559 | struct alc_spec *spec = codec->spec; |
| 13560 | int idx = alc880_multi_pin_idx(nid); |
| 13561 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13562 | AC_VERB_SET_CONNECT_SEL, |
| 13563 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13564 | } |
| 13565 | } |
| 13566 | |
| 13567 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13568 | { |
| 13569 | struct alc_spec *spec = codec->spec; |
| 13570 | int i; |
| 13571 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13572 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13573 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13574 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13575 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13576 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13577 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13578 | i); |
| 13579 | } |
| 13580 | } |
| 13581 | |
| 13582 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13583 | { |
| 13584 | struct alc_spec *spec = codec->spec; |
| 13585 | hda_nid_t pin; |
| 13586 | |
| 13587 | pin = spec->autocfg.hp_pins[0]; |
| 13588 | if (pin) /* connect to front */ |
| 13589 | /* use dac 0 */ |
| 13590 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 13591 | } |
| 13592 | |
| 13593 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13594 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13595 | |
| 13596 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13597 | { |
| 13598 | struct alc_spec *spec = codec->spec; |
| 13599 | int i; |
| 13600 | |
| 13601 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13602 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13603 | if (alc662_is_input_pin(nid)) { |
| 13604 | snd_hda_codec_write(codec, nid, 0, |
| 13605 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13606 | (i <= AUTO_PIN_FRONT_MIC ? |
| 13607 | PIN_VREF80 : PIN_IN)); |
| 13608 | if (nid != ALC662_PIN_CD_NID) |
| 13609 | snd_hda_codec_write(codec, nid, 0, |
| 13610 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13611 | AMP_OUT_MUTE); |
| 13612 | } |
| 13613 | } |
| 13614 | } |
| 13615 | |
| 13616 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 13617 | { |
| 13618 | struct alc_spec *spec = codec->spec; |
| 13619 | int err; |
| 13620 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 13621 | |
| 13622 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13623 | alc662_ignore); |
| 13624 | if (err < 0) |
| 13625 | return err; |
| 13626 | if (!spec->autocfg.line_outs) |
| 13627 | return 0; /* can't find valid BIOS pin config */ |
| 13628 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13629 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13630 | if (err < 0) |
| 13631 | return err; |
| 13632 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13633 | if (err < 0) |
| 13634 | return err; |
| 13635 | err = alc662_auto_create_extra_out(spec, |
| 13636 | spec->autocfg.speaker_pins[0], |
| 13637 | "Speaker"); |
| 13638 | if (err < 0) |
| 13639 | return err; |
| 13640 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 13641 | "Headphone"); |
| 13642 | if (err < 0) |
| 13643 | return err; |
| 13644 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13645 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13646 | return err; |
| 13647 | |
| 13648 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13649 | |
| 13650 | if (spec->autocfg.dig_out_pin) |
| 13651 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 13652 | |
| 13653 | if (spec->kctl_alloc) |
| 13654 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13655 | |
| 13656 | spec->num_mux_defs = 1; |
| 13657 | spec->input_mux = &spec->private_imux; |
| 13658 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13659 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13660 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 13661 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13662 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13663 | } |
| 13664 | |
| 13665 | /* additional initialization for auto-configuration model */ |
| 13666 | static void alc662_auto_init(struct hda_codec *codec) |
| 13667 | { |
| 13668 | alc662_auto_init_multi_out(codec); |
| 13669 | alc662_auto_init_hp_out(codec); |
| 13670 | alc662_auto_init_analog_input(codec); |
| 13671 | } |
| 13672 | |
| 13673 | static int patch_alc662(struct hda_codec *codec) |
| 13674 | { |
| 13675 | struct alc_spec *spec; |
| 13676 | int err, board_config; |
| 13677 | |
| 13678 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13679 | if (!spec) |
| 13680 | return -ENOMEM; |
| 13681 | |
| 13682 | codec->spec = spec; |
| 13683 | |
| 13684 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 13685 | alc662_models, |
| 13686 | alc662_cfg_tbl); |
| 13687 | if (board_config < 0) { |
| 13688 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 13689 | "trying auto-probe from BIOS...\n"); |
| 13690 | board_config = ALC662_AUTO; |
| 13691 | } |
| 13692 | |
| 13693 | if (board_config == ALC662_AUTO) { |
| 13694 | /* automatic parse from the BIOS config */ |
| 13695 | err = alc662_parse_auto_config(codec); |
| 13696 | if (err < 0) { |
| 13697 | alc_free(codec); |
| 13698 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13699 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13700 | printk(KERN_INFO |
| 13701 | "hda_codec: Cannot set up configuration " |
| 13702 | "from BIOS. Using base mode...\n"); |
| 13703 | board_config = ALC662_3ST_2ch_DIG; |
| 13704 | } |
| 13705 | } |
| 13706 | |
| 13707 | if (board_config != ALC662_AUTO) |
| 13708 | setup_preset(spec, &alc662_presets[board_config]); |
| 13709 | |
| 13710 | spec->stream_name_analog = "ALC662 Analog"; |
| 13711 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 13712 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 13713 | |
| 13714 | spec->stream_name_digital = "ALC662 Digital"; |
| 13715 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 13716 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 13717 | |
| 13718 | if (!spec->adc_nids && spec->input_mux) { |
| 13719 | spec->adc_nids = alc662_adc_nids; |
| 13720 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 13721 | } |
| 13722 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13723 | spec->vmaster_nid = 0x02; |
| 13724 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13725 | codec->patch_ops = alc_patch_ops; |
| 13726 | if (board_config == ALC662_AUTO) |
| 13727 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13728 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13729 | if (!spec->loopback.amplist) |
| 13730 | spec->loopback.amplist = alc662_loopbacks; |
| 13731 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13732 | |
| 13733 | return 0; |
| 13734 | } |
| 13735 | |
| 13736 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13737 | * patch entries |
| 13738 | */ |
| 13739 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 13740 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13741 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13742 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13743 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13744 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13745 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13746 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13747 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 13748 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 13749 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13750 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 13751 | .patch = patch_alc883 }, |
| 13752 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 13753 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13754 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13755 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13756 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13757 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13758 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13759 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13760 | {} /* terminator */ |
| 13761 | }; |