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, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 109 | #ifdef CONFIG_SND_DEBUG |
| 110 | ALC268_TEST, |
| 111 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 112 | ALC268_AUTO, |
| 113 | ALC268_MODEL_LAST /* last tag */ |
| 114 | }; |
| 115 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 116 | /* ALC269 models */ |
| 117 | enum { |
| 118 | ALC269_BASIC, |
| 119 | ALC269_AUTO, |
| 120 | ALC269_MODEL_LAST /* last tag */ |
| 121 | }; |
| 122 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 123 | /* ALC861 models */ |
| 124 | enum { |
| 125 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 126 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 127 | ALC861_3ST_DIG, |
| 128 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 129 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 130 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 131 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 132 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 133 | ALC861_AUTO, |
| 134 | ALC861_MODEL_LAST, |
| 135 | }; |
| 136 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 137 | /* ALC861-VD models */ |
| 138 | enum { |
| 139 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 140 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 141 | ALC861VD_3ST, |
| 142 | ALC861VD_3ST_DIG, |
| 143 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 144 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 145 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 146 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 147 | ALC861VD_AUTO, |
| 148 | ALC861VD_MODEL_LAST, |
| 149 | }; |
| 150 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 151 | /* ALC662 models */ |
| 152 | enum { |
| 153 | ALC662_3ST_2ch_DIG, |
| 154 | ALC662_3ST_6ch_DIG, |
| 155 | ALC662_3ST_6ch, |
| 156 | ALC662_5ST_DIG, |
| 157 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 158 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 159 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 160 | ALC662_AUTO, |
| 161 | ALC662_MODEL_LAST, |
| 162 | }; |
| 163 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 164 | /* ALC882 models */ |
| 165 | enum { |
| 166 | ALC882_3ST_DIG, |
| 167 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 168 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 169 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 170 | ALC882_TARGA, |
| 171 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 172 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 173 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 174 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 175 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 176 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 177 | ALC882_MODEL_LAST, |
| 178 | }; |
| 179 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 180 | /* ALC883 models */ |
| 181 | enum { |
| 182 | ALC883_3ST_2ch_DIG, |
| 183 | ALC883_3ST_6ch_DIG, |
| 184 | ALC883_3ST_6ch, |
| 185 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 186 | ALC883_TARGA_DIG, |
| 187 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 188 | ALC883_ACER, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 189 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 190 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 191 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 192 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 193 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 194 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 195 | ALC888_LENOVO_MS7195_DIG, |
| 196 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 197 | ALC888_6ST_HP, |
| 198 | ALC888_3ST_HP, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 199 | ALC883_MITAC, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 200 | ALC883_AUTO, |
| 201 | ALC883_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* for GPIO Poll */ |
| 205 | #define GPIO_MASK 0x03 |
| 206 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | struct alc_spec { |
| 208 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 209 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | unsigned int num_mixers; |
| 211 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 212 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 213 | * don't forget NULL |
| 214 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 215 | */ |
| 216 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 218 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | struct hda_pcm_stream *stream_analog_playback; |
| 220 | struct hda_pcm_stream *stream_analog_capture; |
| 221 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 222 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | struct hda_pcm_stream *stream_digital_playback; |
| 224 | struct hda_pcm_stream *stream_digital_capture; |
| 225 | |
| 226 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 227 | struct hda_multi_out multiout; /* playback set-up |
| 228 | * max_channels, dacs must be set |
| 229 | * dig_out_nid and hp_nid are optional |
| 230 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | |
| 232 | /* capture */ |
| 233 | unsigned int num_adc_nids; |
| 234 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 235 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | |
| 237 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 238 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | const struct hda_input_mux *input_mux; |
| 240 | unsigned int cur_mux[3]; |
| 241 | |
| 242 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 243 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 245 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | |
| 247 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 248 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 249 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 250 | /* dynamic controls, init_verbs and input_mux */ |
| 251 | struct auto_pin_cfg autocfg; |
| 252 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 253 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 254 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 255 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 256 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 257 | /* hooks */ |
| 258 | void (*init_hook)(struct hda_codec *codec); |
| 259 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 260 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 261 | /* for pin sensing */ |
| 262 | unsigned int sense_updated: 1; |
| 263 | unsigned int jack_present: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 264 | |
| 265 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 266 | struct hda_loopback_check loopback; |
| 267 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 268 | }; |
| 269 | |
| 270 | /* |
| 271 | * configuration template - to be copied to the spec instance |
| 272 | */ |
| 273 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 274 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 275 | * with spec |
| 276 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 277 | const struct hda_verb *init_verbs[5]; |
| 278 | unsigned int num_dacs; |
| 279 | hda_nid_t *dac_nids; |
| 280 | hda_nid_t dig_out_nid; /* optional */ |
| 281 | hda_nid_t hp_nid; /* optional */ |
| 282 | unsigned int num_adc_nids; |
| 283 | hda_nid_t *adc_nids; |
| 284 | hda_nid_t dig_in_nid; |
| 285 | unsigned int num_channel_mode; |
| 286 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 287 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 288 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 289 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 290 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 291 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 292 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 293 | struct hda_amp_list *loopbacks; |
| 294 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | }; |
| 296 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | |
| 298 | /* |
| 299 | * input MUX handling |
| 300 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 301 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 302 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | { |
| 304 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 305 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 306 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 307 | if (mux_idx >= spec->num_mux_defs) |
| 308 | mux_idx = 0; |
| 309 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | } |
| 311 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 312 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 313 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | { |
| 315 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 316 | struct alc_spec *spec = codec->spec; |
| 317 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 318 | |
| 319 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 320 | return 0; |
| 321 | } |
| 322 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 323 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 324 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | { |
| 326 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 327 | struct alc_spec *spec = codec->spec; |
| 328 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 329 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 330 | 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] | 331 | spec->adc_nids[adc_idx], |
| 332 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | } |
| 334 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 335 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | /* |
| 337 | * channel mode setting |
| 338 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 339 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 340 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | { |
| 342 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 343 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 344 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 345 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | } |
| 347 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 348 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 349 | struct snd_ctl_elem_value *ucontrol) |
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_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 354 | spec->num_channel_mode, |
| 355 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | } |
| 357 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 358 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 359 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | { |
| 361 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 362 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 363 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 364 | spec->num_channel_mode, |
| 365 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 366 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 367 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 368 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | } |
| 370 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 372 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 373 | * instead of "%" to avoid consequences of accidently treating the % as |
| 374 | * being part of a format specifier. Maximum allowed length of a value is |
| 375 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 376 | * |
| 377 | * Note: some retasking pin complexes seem to ignore requests for input |
| 378 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 379 | * are requested. Therefore order this list so that this behaviour will not |
| 380 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 381 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 382 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 383 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 384 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 385 | "Mic 50pc bias", "Mic 80pc bias", |
| 386 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 387 | }; |
| 388 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 389 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 390 | }; |
| 391 | /* 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] | 392 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 393 | * addition, "input" pins may or may not process the mic bias option |
| 394 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 395 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 396 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 397 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 398 | #define ALC_PIN_DIR_IN 0x00 |
| 399 | #define ALC_PIN_DIR_OUT 0x01 |
| 400 | #define ALC_PIN_DIR_INOUT 0x02 |
| 401 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 402 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 403 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 404 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 405 | * For each direction the minimum and maximum values are given. |
| 406 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 407 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 408 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 409 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 410 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 411 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 412 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 413 | }; |
| 414 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 415 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 416 | #define alc_pin_mode_n_items(_dir) \ |
| 417 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 418 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 419 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 420 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 421 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 422 | unsigned int item_num = uinfo->value.enumerated.item; |
| 423 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 424 | |
| 425 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 426 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 427 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 428 | |
| 429 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 430 | item_num = alc_pin_mode_min(dir); |
| 431 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 432 | return 0; |
| 433 | } |
| 434 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 435 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 436 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 437 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 438 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 439 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 440 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 441 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 442 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 443 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 444 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 445 | 0x00); |
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 | /* Find enumerated value for current pinctl setting */ |
| 448 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 449 | 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] | 450 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 451 | *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] | 452 | return 0; |
| 453 | } |
| 454 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 455 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 456 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 457 | { |
| 458 | signed int change; |
| 459 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 460 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 461 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 462 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 463 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 464 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 465 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 466 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 467 | 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] | 468 | val = alc_pin_mode_min(dir); |
| 469 | |
| 470 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 471 | if (change) { |
| 472 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 473 | snd_hda_codec_write_cache(codec, nid, 0, |
| 474 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 475 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 476 | |
| 477 | /* Also enable the retasking pin's input/output as required |
| 478 | * for the requested pin mode. Enum values of 2 or less are |
| 479 | * input modes. |
| 480 | * |
| 481 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 482 | * reduces noise slightly (particularly on input) so we'll |
| 483 | * do it. However, having both input and output buffers |
| 484 | * enabled simultaneously doesn't seem to be problematic if |
| 485 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 486 | */ |
| 487 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 488 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 489 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 490 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 491 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 492 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 493 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 494 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 495 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 496 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 497 | } |
| 498 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 499 | return change; |
| 500 | } |
| 501 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 502 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 503 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 504 | .info = alc_pin_mode_info, \ |
| 505 | .get = alc_pin_mode_get, \ |
| 506 | .put = alc_pin_mode_put, \ |
| 507 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 508 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 509 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 510 | * together using a mask with more than one bit set. This control is |
| 511 | * currently used only by the ALC260 test model. At this stage they are not |
| 512 | * needed for any "production" models. |
| 513 | */ |
| 514 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 515 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 516 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 517 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 518 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 519 | { |
| 520 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 521 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 522 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 523 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 524 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 525 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 526 | |
| 527 | *valp = (val & mask) != 0; |
| 528 | return 0; |
| 529 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 530 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 531 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 532 | { |
| 533 | signed int change; |
| 534 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 535 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 536 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 537 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 538 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 539 | AC_VERB_GET_GPIO_DATA, |
| 540 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 541 | |
| 542 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 543 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 544 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 545 | gpio_data &= ~mask; |
| 546 | else |
| 547 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 548 | snd_hda_codec_write_cache(codec, nid, 0, |
| 549 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 550 | |
| 551 | return change; |
| 552 | } |
| 553 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 554 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 555 | .info = alc_gpio_data_info, \ |
| 556 | .get = alc_gpio_data_get, \ |
| 557 | .put = alc_gpio_data_put, \ |
| 558 | .private_value = nid | (mask<<16) } |
| 559 | #endif /* CONFIG_SND_DEBUG */ |
| 560 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 561 | /* A switch control to allow the enabling of the digital IO pins on the |
| 562 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 563 | * to provide something in the test model allowing digital outputs to be |
| 564 | * identified if present. If models are found which can utilise these |
| 565 | * outputs a more complete mixer control can be devised for those models if |
| 566 | * necessary. |
| 567 | */ |
| 568 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 569 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 570 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 571 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 572 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 573 | { |
| 574 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 575 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 576 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 577 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 578 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 579 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 580 | |
| 581 | *valp = (val & mask) != 0; |
| 582 | return 0; |
| 583 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 584 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 585 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 586 | { |
| 587 | signed int change; |
| 588 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 589 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 590 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 591 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 592 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 593 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 594 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 595 | |
| 596 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 597 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 598 | if (val==0) |
| 599 | ctrl_data &= ~mask; |
| 600 | else |
| 601 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 602 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 603 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 604 | |
| 605 | return change; |
| 606 | } |
| 607 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 608 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 609 | .info = alc_spdif_ctrl_info, \ |
| 610 | .get = alc_spdif_ctrl_get, \ |
| 611 | .put = alc_spdif_ctrl_put, \ |
| 612 | .private_value = nid | (mask<<16) } |
| 613 | #endif /* CONFIG_SND_DEBUG */ |
| 614 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 615 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 616 | * Again, this is only used in the ALC26x test models to help identify when |
| 617 | * the EAPD line must be asserted for features to work. |
| 618 | */ |
| 619 | #ifdef CONFIG_SND_DEBUG |
| 620 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 621 | |
| 622 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 623 | struct snd_ctl_elem_value *ucontrol) |
| 624 | { |
| 625 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 626 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 627 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 628 | long *valp = ucontrol->value.integer.value; |
| 629 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 630 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 631 | |
| 632 | *valp = (val & mask) != 0; |
| 633 | return 0; |
| 634 | } |
| 635 | |
| 636 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 637 | struct snd_ctl_elem_value *ucontrol) |
| 638 | { |
| 639 | int change; |
| 640 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 641 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 642 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 643 | long val = *ucontrol->value.integer.value; |
| 644 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 645 | AC_VERB_GET_EAPD_BTLENABLE, |
| 646 | 0x00); |
| 647 | |
| 648 | /* Set/unset the masked control bit(s) as needed */ |
| 649 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 650 | if (!val) |
| 651 | ctrl_data &= ~mask; |
| 652 | else |
| 653 | ctrl_data |= mask; |
| 654 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 655 | ctrl_data); |
| 656 | |
| 657 | return change; |
| 658 | } |
| 659 | |
| 660 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 661 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 662 | .info = alc_eapd_ctrl_info, \ |
| 663 | .get = alc_eapd_ctrl_get, \ |
| 664 | .put = alc_eapd_ctrl_put, \ |
| 665 | .private_value = nid | (mask<<16) } |
| 666 | #endif /* CONFIG_SND_DEBUG */ |
| 667 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 668 | /* |
| 669 | * set up from the preset table |
| 670 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 671 | static void setup_preset(struct alc_spec *spec, |
| 672 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 673 | { |
| 674 | int i; |
| 675 | |
| 676 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 677 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 678 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 679 | i++) |
| 680 | spec->init_verbs[spec->num_init_verbs++] = |
| 681 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 682 | |
| 683 | spec->channel_mode = preset->channel_mode; |
| 684 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 685 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 686 | |
| 687 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 688 | |
| 689 | spec->multiout.num_dacs = preset->num_dacs; |
| 690 | spec->multiout.dac_nids = preset->dac_nids; |
| 691 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 692 | spec->multiout.hp_nid = preset->hp_nid; |
| 693 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 694 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 695 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 696 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 697 | spec->input_mux = preset->input_mux; |
| 698 | |
| 699 | spec->num_adc_nids = preset->num_adc_nids; |
| 700 | spec->adc_nids = preset->adc_nids; |
| 701 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 702 | |
| 703 | spec->unsol_event = preset->unsol_event; |
| 704 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 705 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 706 | spec->loopback.amplist = preset->loopbacks; |
| 707 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 708 | } |
| 709 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 710 | /* Enable GPIO mask and set output */ |
| 711 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 712 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 713 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 714 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 715 | { } |
| 716 | }; |
| 717 | |
| 718 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 719 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 720 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 721 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 722 | { } |
| 723 | }; |
| 724 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 725 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 726 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 727 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 728 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 729 | { } |
| 730 | }; |
| 731 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 732 | static void alc_sku_automute(struct hda_codec *codec) |
| 733 | { |
| 734 | struct alc_spec *spec = codec->spec; |
| 735 | unsigned int mute; |
| 736 | unsigned int present; |
| 737 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 738 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 739 | |
| 740 | /* need to execute and sync at first */ |
| 741 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 742 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 743 | AC_VERB_GET_PIN_SENSE, 0); |
| 744 | spec->jack_present = (present & 0x80000000) != 0; |
| 745 | if (spec->jack_present) { |
| 746 | /* mute internal speaker */ |
| 747 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, |
| 748 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 749 | } else { |
| 750 | /* unmute internal speaker if necessary */ |
| 751 | mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0); |
| 752 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, |
| 753 | HDA_AMP_MUTE, mute); |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | /* unsolicited event for HP jack sensing */ |
| 758 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 759 | { |
| 760 | if (codec->vendor_id == 0x10ec0880) |
| 761 | res >>= 28; |
| 762 | else |
| 763 | res >>= 26; |
| 764 | if (res != ALC880_HP_EVENT) |
| 765 | return; |
| 766 | |
| 767 | alc_sku_automute(codec); |
| 768 | } |
| 769 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 770 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 771 | * 31 ~ 16 : Manufacture ID |
| 772 | * 15 ~ 8 : SKU ID |
| 773 | * 7 ~ 0 : Assembly ID |
| 774 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 775 | */ |
| 776 | static void alc_subsystem_id(struct hda_codec *codec, |
| 777 | unsigned int porta, unsigned int porte, |
| 778 | unsigned int portd) |
| 779 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 780 | unsigned int ass, tmp, i; |
| 781 | unsigned nid; |
| 782 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 783 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 784 | ass = codec->subsystem_id & 0xffff; |
| 785 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 786 | goto do_sku; |
| 787 | |
| 788 | /* |
| 789 | * 31~30 : port conetcivity |
| 790 | * 29~21 : reserve |
| 791 | * 20 : PCBEEP input |
| 792 | * 19~16 : Check sum (15:1) |
| 793 | * 15~1 : Custom |
| 794 | * 0 : override |
| 795 | */ |
| 796 | nid = 0x1d; |
| 797 | if (codec->vendor_id == 0x10ec0260) |
| 798 | nid = 0x17; |
| 799 | ass = snd_hda_codec_read(codec, nid, 0, |
| 800 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 801 | if (!(ass & 1) && !(ass & 0x100000)) |
| 802 | return; |
| 803 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 804 | return; |
| 805 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 806 | /* check sum */ |
| 807 | tmp = 0; |
| 808 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 809 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 810 | tmp++; |
| 811 | } |
| 812 | if (((ass >> 16) & 0xf) != tmp) |
| 813 | return; |
| 814 | do_sku: |
| 815 | /* |
| 816 | * 0 : override |
| 817 | * 1 : Swap Jack |
| 818 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 819 | * 3~5 : External Amplifier control |
| 820 | * 7~6 : Reserved |
| 821 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 822 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 823 | switch (tmp) { |
| 824 | case 1: |
| 825 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 826 | break; |
| 827 | case 3: |
| 828 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 829 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 830 | case 7: |
| 831 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 832 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 833 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 834 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 835 | case 0x10ec0260: |
| 836 | snd_hda_codec_write(codec, 0x0f, 0, |
| 837 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 838 | snd_hda_codec_write(codec, 0x10, 0, |
| 839 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 840 | break; |
| 841 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 842 | case 0x10ec0267: |
| 843 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 844 | case 0x10ec0269: |
| 845 | case 0x10ec0862: |
| 846 | case 0x10ec0662: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 847 | snd_hda_codec_write(codec, 0x14, 0, |
| 848 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 849 | snd_hda_codec_write(codec, 0x15, 0, |
| 850 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 851 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 852 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 853 | switch (codec->vendor_id) { |
| 854 | case 0x10ec0260: |
| 855 | snd_hda_codec_write(codec, 0x1a, 0, |
| 856 | AC_VERB_SET_COEF_INDEX, 7); |
| 857 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 858 | AC_VERB_GET_PROC_COEF, 0); |
| 859 | snd_hda_codec_write(codec, 0x1a, 0, |
| 860 | AC_VERB_SET_COEF_INDEX, 7); |
| 861 | snd_hda_codec_write(codec, 0x1a, 0, |
| 862 | AC_VERB_SET_PROC_COEF, |
| 863 | tmp | 0x2010); |
| 864 | break; |
| 865 | case 0x10ec0262: |
| 866 | case 0x10ec0880: |
| 867 | case 0x10ec0882: |
| 868 | case 0x10ec0883: |
| 869 | case 0x10ec0885: |
| 870 | case 0x10ec0888: |
| 871 | snd_hda_codec_write(codec, 0x20, 0, |
| 872 | AC_VERB_SET_COEF_INDEX, 7); |
| 873 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 874 | AC_VERB_GET_PROC_COEF, 0); |
| 875 | snd_hda_codec_write(codec, 0x20, 0, |
| 876 | AC_VERB_SET_COEF_INDEX, 7); |
| 877 | snd_hda_codec_write(codec, 0x20, 0, |
| 878 | AC_VERB_SET_PROC_COEF, |
| 879 | tmp | 0x2010); |
| 880 | break; |
| 881 | case 0x10ec0267: |
| 882 | case 0x10ec0268: |
| 883 | snd_hda_codec_write(codec, 0x20, 0, |
| 884 | AC_VERB_SET_COEF_INDEX, 7); |
| 885 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 886 | AC_VERB_GET_PROC_COEF, 0); |
| 887 | snd_hda_codec_write(codec, 0x20, 0, |
| 888 | AC_VERB_SET_COEF_INDEX, 7); |
| 889 | snd_hda_codec_write(codec, 0x20, 0, |
| 890 | AC_VERB_SET_PROC_COEF, |
| 891 | tmp | 0x3000); |
| 892 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 893 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 894 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 895 | break; |
| 896 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 897 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 898 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 899 | * when the external headphone out jack is plugged" |
| 900 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 901 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 902 | return; |
| 903 | /* |
| 904 | * 10~8 : Jack location |
| 905 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 906 | * 14~13: Resvered |
| 907 | * 15 : 1 --> enable the function "Mute internal speaker |
| 908 | * when the external headphone out jack is plugged" |
| 909 | */ |
| 910 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 911 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 912 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 913 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 914 | else |
| 915 | return; |
| 916 | } |
| 917 | |
| 918 | if (!spec->autocfg.hp_pins[0]) { |
| 919 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 920 | if (tmp == 0) |
| 921 | spec->autocfg.hp_pins[0] = porta; |
| 922 | else if (tmp == 1) |
| 923 | spec->autocfg.hp_pins[0] = porte; |
| 924 | else if (tmp == 2) |
| 925 | spec->autocfg.hp_pins[0] = portd; |
| 926 | else |
| 927 | return; |
| 928 | } |
| 929 | |
| 930 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 931 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 932 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 933 | spec->unsol_event = alc_sku_unsol_event; |
| 934 | spec->init_hook = alc_sku_automute; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 935 | } |
| 936 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 937 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 938 | * Fix-up pin default configurations |
| 939 | */ |
| 940 | |
| 941 | struct alc_pincfg { |
| 942 | hda_nid_t nid; |
| 943 | u32 val; |
| 944 | }; |
| 945 | |
| 946 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 947 | const struct snd_pci_quirk *quirk, |
| 948 | const struct alc_pincfg **pinfix) |
| 949 | { |
| 950 | const struct alc_pincfg *cfg; |
| 951 | |
| 952 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 953 | if (!quirk) |
| 954 | return; |
| 955 | |
| 956 | cfg = pinfix[quirk->value]; |
| 957 | for (; cfg->nid; cfg++) { |
| 958 | int i; |
| 959 | u32 val = cfg->val; |
| 960 | for (i = 0; i < 4; i++) { |
| 961 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 962 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 963 | val & 0xff); |
| 964 | val >>= 8; |
| 965 | } |
| 966 | } |
| 967 | } |
| 968 | |
| 969 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 970 | * ALC880 3-stack model |
| 971 | * |
| 972 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 973 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 974 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 975 | */ |
| 976 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 977 | static hda_nid_t alc880_dac_nids[4] = { |
| 978 | /* front, rear, clfe, rear_surr */ |
| 979 | 0x02, 0x05, 0x04, 0x03 |
| 980 | }; |
| 981 | |
| 982 | static hda_nid_t alc880_adc_nids[3] = { |
| 983 | /* ADC0-2 */ |
| 984 | 0x07, 0x08, 0x09, |
| 985 | }; |
| 986 | |
| 987 | /* The datasheet says the node 0x07 is connected from inputs, |
| 988 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 989 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 990 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 991 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 992 | /* ADC1-2 */ |
| 993 | 0x08, 0x09, |
| 994 | }; |
| 995 | |
| 996 | #define ALC880_DIGOUT_NID 0x06 |
| 997 | #define ALC880_DIGIN_NID 0x0a |
| 998 | |
| 999 | static struct hda_input_mux alc880_capture_source = { |
| 1000 | .num_items = 4, |
| 1001 | .items = { |
| 1002 | { "Mic", 0x0 }, |
| 1003 | { "Front Mic", 0x3 }, |
| 1004 | { "Line", 0x2 }, |
| 1005 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1006 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1007 | }; |
| 1008 | |
| 1009 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1010 | /* 2ch mode */ |
| 1011 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1012 | /* set line-in to input, mute it */ |
| 1013 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1014 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1015 | /* set mic-in to input vref 80%, mute it */ |
| 1016 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1017 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1018 | { } /* end */ |
| 1019 | }; |
| 1020 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1021 | /* 6ch mode */ |
| 1022 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1023 | /* set line-in to output, unmute it */ |
| 1024 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1025 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1026 | /* set mic-in to output, unmute it */ |
| 1027 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1028 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1029 | { } /* end */ |
| 1030 | }; |
| 1031 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1032 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1033 | { 2, alc880_threestack_ch2_init }, |
| 1034 | { 6, alc880_threestack_ch6_init }, |
| 1035 | }; |
| 1036 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1037 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1038 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1039 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1040 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1041 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1042 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1043 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1044 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1045 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1046 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1047 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1048 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1049 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1050 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1051 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1052 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1053 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1054 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1055 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1056 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1057 | { |
| 1058 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1059 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1060 | .info = alc_ch_mode_info, |
| 1061 | .get = alc_ch_mode_get, |
| 1062 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1063 | }, |
| 1064 | { } /* end */ |
| 1065 | }; |
| 1066 | |
| 1067 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1068 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1069 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1070 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1071 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1072 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1073 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1074 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1075 | { |
| 1076 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1077 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1078 | * So call somewhat different.. |
| 1079 | * FIXME: the controls appear in the "playback" view! |
| 1080 | */ |
| 1081 | /* .name = "Capture Source", */ |
| 1082 | .name = "Input Source", |
| 1083 | .count = 3, |
| 1084 | .info = alc_mux_enum_info, |
| 1085 | .get = alc_mux_enum_get, |
| 1086 | .put = alc_mux_enum_put, |
| 1087 | }, |
| 1088 | { } /* end */ |
| 1089 | }; |
| 1090 | |
| 1091 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1092 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1093 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1094 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1095 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1096 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1097 | { |
| 1098 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1099 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1100 | * So call somewhat different.. |
| 1101 | * FIXME: the controls appear in the "playback" view! |
| 1102 | */ |
| 1103 | /* .name = "Capture Source", */ |
| 1104 | .name = "Input Source", |
| 1105 | .count = 2, |
| 1106 | .info = alc_mux_enum_info, |
| 1107 | .get = alc_mux_enum_get, |
| 1108 | .put = alc_mux_enum_put, |
| 1109 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1110 | { } /* end */ |
| 1111 | }; |
| 1112 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1113 | |
| 1114 | |
| 1115 | /* |
| 1116 | * ALC880 5-stack model |
| 1117 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1118 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1119 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1120 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1121 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1122 | */ |
| 1123 | |
| 1124 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1125 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1126 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1127 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1128 | { } /* end */ |
| 1129 | }; |
| 1130 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1131 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1132 | /* 6ch mode */ |
| 1133 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1134 | /* set line-in to input, mute it */ |
| 1135 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1136 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1137 | { } /* end */ |
| 1138 | }; |
| 1139 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1140 | /* 8ch mode */ |
| 1141 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1142 | /* set line-in to output, unmute it */ |
| 1143 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1144 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1145 | { } /* end */ |
| 1146 | }; |
| 1147 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1148 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1149 | { 6, alc880_fivestack_ch6_init }, |
| 1150 | { 8, alc880_fivestack_ch8_init }, |
| 1151 | }; |
| 1152 | |
| 1153 | |
| 1154 | /* |
| 1155 | * ALC880 6-stack model |
| 1156 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1157 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1158 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1159 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1160 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1161 | */ |
| 1162 | |
| 1163 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1164 | /* front, rear, clfe, rear_surr */ |
| 1165 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1166 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1167 | |
| 1168 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1169 | .num_items = 4, |
| 1170 | .items = { |
| 1171 | { "Mic", 0x0 }, |
| 1172 | { "Front Mic", 0x1 }, |
| 1173 | { "Line", 0x2 }, |
| 1174 | { "CD", 0x4 }, |
| 1175 | }, |
| 1176 | }; |
| 1177 | |
| 1178 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1179 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1180 | { 8, NULL }, |
| 1181 | }; |
| 1182 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1183 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1184 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1185 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1186 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1187 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1188 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1189 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1190 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1191 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1192 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1193 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1194 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1195 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1196 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1197 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1200 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1201 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1202 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1203 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1204 | { |
| 1205 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1206 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1207 | .info = alc_ch_mode_info, |
| 1208 | .get = alc_ch_mode_get, |
| 1209 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1210 | }, |
| 1211 | { } /* end */ |
| 1212 | }; |
| 1213 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1214 | |
| 1215 | /* |
| 1216 | * ALC880 W810 model |
| 1217 | * |
| 1218 | * W810 has rear IO for: |
| 1219 | * Front (DAC 02) |
| 1220 | * Surround (DAC 03) |
| 1221 | * Center/LFE (DAC 04) |
| 1222 | * Digital out (06) |
| 1223 | * |
| 1224 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1225 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1226 | * |
| 1227 | * There is a variable resistor to control the speaker or headphone |
| 1228 | * volume. This is a hardware-only device without a software API. |
| 1229 | * |
| 1230 | * Plugging headphones in will disable the internal speakers. This is |
| 1231 | * implemented in hardware, not via the driver using jack sense. In |
| 1232 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1233 | * disable both the speakers and headphones. |
| 1234 | * |
| 1235 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1236 | * These may not do anything useful with this driver yet, because I |
| 1237 | * haven't setup any initialization verbs for these yet... |
| 1238 | */ |
| 1239 | |
| 1240 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1241 | /* front, rear/surround, clfe */ |
| 1242 | 0x02, 0x03, 0x04 |
| 1243 | }; |
| 1244 | |
| 1245 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1246 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1247 | { 6, NULL } |
| 1248 | }; |
| 1249 | |
| 1250 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1251 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1252 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1253 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1254 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1255 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1256 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1257 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1258 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1259 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1260 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1261 | { } /* end */ |
| 1262 | }; |
| 1263 | |
| 1264 | |
| 1265 | /* |
| 1266 | * Z710V model |
| 1267 | * |
| 1268 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1269 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1270 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1271 | */ |
| 1272 | |
| 1273 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1274 | 0x02 |
| 1275 | }; |
| 1276 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1277 | |
| 1278 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1279 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1280 | { 2, NULL } |
| 1281 | }; |
| 1282 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1283 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1284 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1285 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1286 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1287 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1288 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1289 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1290 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1291 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1292 | { } /* end */ |
| 1293 | }; |
| 1294 | |
| 1295 | |
| 1296 | /* FIXME! */ |
| 1297 | /* |
| 1298 | * ALC880 F1734 model |
| 1299 | * |
| 1300 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1301 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1302 | */ |
| 1303 | |
| 1304 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1305 | 0x03 |
| 1306 | }; |
| 1307 | #define ALC880_F1734_HP_DAC 0x02 |
| 1308 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1309 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1310 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1311 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1312 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1313 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1314 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1315 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1316 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1317 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1318 | { } /* end */ |
| 1319 | }; |
| 1320 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1321 | |
| 1322 | /* FIXME! */ |
| 1323 | /* |
| 1324 | * ALC880 ASUS model |
| 1325 | * |
| 1326 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1327 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1328 | * Mic = 0x18, Line = 0x1a |
| 1329 | */ |
| 1330 | |
| 1331 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1332 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1333 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1334 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1335 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1336 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1337 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1338 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1339 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1340 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1341 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1342 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1343 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1344 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1345 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1346 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1347 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1348 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1349 | { |
| 1350 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1351 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1352 | .info = alc_ch_mode_info, |
| 1353 | .get = alc_ch_mode_get, |
| 1354 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1355 | }, |
| 1356 | { } /* end */ |
| 1357 | }; |
| 1358 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1359 | /* FIXME! */ |
| 1360 | /* |
| 1361 | * ALC880 ASUS W1V model |
| 1362 | * |
| 1363 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1364 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1365 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1366 | */ |
| 1367 | |
| 1368 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1369 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1370 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1371 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1372 | { } /* end */ |
| 1373 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1374 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1375 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1376 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1377 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1378 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1379 | { } /* end */ |
| 1380 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1381 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1382 | /* TCL S700 */ |
| 1383 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1384 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1385 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1386 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1387 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1388 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1389 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1390 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1391 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1392 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1393 | { |
| 1394 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1395 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1396 | * So call somewhat different.. |
| 1397 | * FIXME: the controls appear in the "playback" view! |
| 1398 | */ |
| 1399 | /* .name = "Capture Source", */ |
| 1400 | .name = "Input Source", |
| 1401 | .count = 1, |
| 1402 | .info = alc_mux_enum_info, |
| 1403 | .get = alc_mux_enum_get, |
| 1404 | .put = alc_mux_enum_put, |
| 1405 | }, |
| 1406 | { } /* end */ |
| 1407 | }; |
| 1408 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1409 | /* Uniwill */ |
| 1410 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
| 1411 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1412 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1413 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1414 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1415 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1416 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1417 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1418 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1419 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1420 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1421 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1422 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1423 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1424 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1425 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1426 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1427 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1428 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1429 | { |
| 1430 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1431 | .name = "Channel Mode", |
| 1432 | .info = alc_ch_mode_info, |
| 1433 | .get = alc_ch_mode_get, |
| 1434 | .put = alc_ch_mode_put, |
| 1435 | }, |
| 1436 | { } /* end */ |
| 1437 | }; |
| 1438 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1439 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1440 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1441 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1442 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1443 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1444 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1445 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1446 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1447 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1448 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1449 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1450 | { } /* end */ |
| 1451 | }; |
| 1452 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1453 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
| 1454 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1455 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1456 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1457 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1458 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1459 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1460 | { } /* end */ |
| 1461 | }; |
| 1462 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1463 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1464 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1465 | */ |
| 1466 | static int alc_build_controls(struct hda_codec *codec) |
| 1467 | { |
| 1468 | struct alc_spec *spec = codec->spec; |
| 1469 | int err; |
| 1470 | int i; |
| 1471 | |
| 1472 | for (i = 0; i < spec->num_mixers; i++) { |
| 1473 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1474 | if (err < 0) |
| 1475 | return err; |
| 1476 | } |
| 1477 | |
| 1478 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1479 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1480 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1481 | if (err < 0) |
| 1482 | return err; |
| 1483 | } |
| 1484 | if (spec->dig_in_nid) { |
| 1485 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1486 | if (err < 0) |
| 1487 | return err; |
| 1488 | } |
| 1489 | return 0; |
| 1490 | } |
| 1491 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1492 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1493 | /* |
| 1494 | * initialize the codec volumes, etc |
| 1495 | */ |
| 1496 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1497 | /* |
| 1498 | * generic initialization of ADC, input mixers and output mixers |
| 1499 | */ |
| 1500 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1501 | /* |
| 1502 | * Unmute ADC0-2 and set the default input to mic-in |
| 1503 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1504 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1505 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1506 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1507 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1508 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1509 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1510 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1511 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1512 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1513 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1514 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1515 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1516 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1517 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1520 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1521 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1522 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1523 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1524 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1525 | /* |
| 1526 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1527 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1528 | /* set vol=0 to output mixers */ |
| 1529 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1530 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1531 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1532 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1533 | /* set up input amps for analog loopback */ |
| 1534 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1535 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1536 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1537 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1538 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1539 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1540 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1541 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1542 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1543 | |
| 1544 | { } |
| 1545 | }; |
| 1546 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1547 | /* |
| 1548 | * 3-stack pin configuration: |
| 1549 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1550 | */ |
| 1551 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1552 | /* |
| 1553 | * preset connection lists of input pins |
| 1554 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1555 | */ |
| 1556 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1557 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1558 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1559 | |
| 1560 | /* |
| 1561 | * Set pin mode and muting |
| 1562 | */ |
| 1563 | /* set front pin widgets 0x14 for output */ |
| 1564 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1565 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1566 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1567 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1568 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1569 | /* Mic2 (as headphone out) for HP output */ |
| 1570 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1571 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1572 | /* Line In pin widget for input */ |
| 1573 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1574 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1575 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1576 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1577 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1578 | /* CD pin widget for input */ |
| 1579 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1580 | |
| 1581 | { } |
| 1582 | }; |
| 1583 | |
| 1584 | /* |
| 1585 | * 5-stack pin configuration: |
| 1586 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1587 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1588 | */ |
| 1589 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1590 | /* |
| 1591 | * preset connection lists of input pins |
| 1592 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1593 | */ |
| 1594 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1595 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1596 | |
| 1597 | /* |
| 1598 | * Set pin mode and muting |
| 1599 | */ |
| 1600 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1602 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1603 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1604 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1605 | /* unmute pins for output (no gain on this amp) */ |
| 1606 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1607 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1608 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1609 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1610 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1611 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1612 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1613 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1614 | /* Mic2 (as headphone out) for HP output */ |
| 1615 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1616 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1617 | /* Line In pin widget for input */ |
| 1618 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1619 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1620 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1621 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1622 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1623 | /* CD pin widget for input */ |
| 1624 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1625 | |
| 1626 | { } |
| 1627 | }; |
| 1628 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1629 | /* |
| 1630 | * W810 pin configuration: |
| 1631 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1632 | */ |
| 1633 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1634 | /* hphone/speaker input selector: front DAC */ |
| 1635 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1636 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1638 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1639 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1640 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1641 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1642 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1643 | |
| 1644 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1645 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1646 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1647 | { } |
| 1648 | }; |
| 1649 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1650 | /* |
| 1651 | * Z71V pin configuration: |
| 1652 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1653 | */ |
| 1654 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1655 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1656 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1657 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1658 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1659 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1660 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1661 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1662 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1663 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1664 | |
| 1665 | { } |
| 1666 | }; |
| 1667 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1668 | /* |
| 1669 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1670 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1671 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1672 | */ |
| 1673 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1674 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1675 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1676 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1677 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1678 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1679 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1680 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1681 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1682 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1683 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1684 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1685 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1686 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1687 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1688 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1689 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1690 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1691 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1692 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1693 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1694 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1695 | { } |
| 1696 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1697 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1698 | /* |
| 1699 | * Uniwill pin configuration: |
| 1700 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1701 | * line = 0x1a |
| 1702 | */ |
| 1703 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1704 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1705 | |
| 1706 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1707 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1708 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1709 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1710 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1711 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1712 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1713 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1714 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1715 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1716 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1717 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1718 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1719 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1720 | |
| 1721 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1722 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1723 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1724 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1725 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1726 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1727 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1728 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1729 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1730 | |
| 1731 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1732 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1733 | |
| 1734 | { } |
| 1735 | }; |
| 1736 | |
| 1737 | /* |
| 1738 | * Uniwill P53 |
| 1739 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1740 | */ |
| 1741 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1742 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1743 | |
| 1744 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1745 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1746 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1747 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1748 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1749 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1750 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1751 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1752 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1753 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1754 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1755 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1756 | |
| 1757 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1758 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1759 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1760 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1761 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1762 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1763 | |
| 1764 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1765 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1766 | |
| 1767 | { } |
| 1768 | }; |
| 1769 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1770 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1771 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1772 | { } |
| 1773 | }; |
| 1774 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1775 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1776 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1777 | { |
| 1778 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1779 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1780 | |
| 1781 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1782 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1783 | bits = present ? HDA_AMP_MUTE : 0; |
| 1784 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1785 | HDA_AMP_MUTE, bits); |
| 1786 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1787 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1788 | } |
| 1789 | |
| 1790 | /* auto-toggle front mic */ |
| 1791 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1792 | { |
| 1793 | unsigned int present; |
| 1794 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1795 | |
| 1796 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1797 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1798 | bits = present ? HDA_AMP_MUTE : 0; |
| 1799 | 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] | 1800 | } |
| 1801 | |
| 1802 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1803 | { |
| 1804 | alc880_uniwill_hp_automute(codec); |
| 1805 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1806 | } |
| 1807 | |
| 1808 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1809 | unsigned int res) |
| 1810 | { |
| 1811 | /* Looks like the unsol event is incompatible with the standard |
| 1812 | * definition. 4bit tag is placed at 28 bit! |
| 1813 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1814 | switch (res >> 28) { |
| 1815 | case ALC880_HP_EVENT: |
| 1816 | alc880_uniwill_hp_automute(codec); |
| 1817 | break; |
| 1818 | case ALC880_MIC_EVENT: |
| 1819 | alc880_uniwill_mic_automute(codec); |
| 1820 | break; |
| 1821 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1822 | } |
| 1823 | |
| 1824 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1825 | { |
| 1826 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1827 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1828 | |
| 1829 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1830 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1831 | bits = present ? HDA_AMP_MUTE : 0; |
| 1832 | 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] | 1833 | } |
| 1834 | |
| 1835 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1836 | { |
| 1837 | unsigned int present; |
| 1838 | |
| 1839 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1840 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1841 | present &= HDA_AMP_VOLMASK; |
| 1842 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1843 | HDA_AMP_VOLMASK, present); |
| 1844 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1845 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1846 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1847 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1848 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1849 | unsigned int res) |
| 1850 | { |
| 1851 | /* Looks like the unsol event is incompatible with the standard |
| 1852 | * definition. 4bit tag is placed at 28 bit! |
| 1853 | */ |
| 1854 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1855 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1856 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1857 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1858 | } |
| 1859 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1860 | /* FIXME! */ |
| 1861 | /* |
| 1862 | * F1734 pin configuration: |
| 1863 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1864 | */ |
| 1865 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1866 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1867 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1868 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1869 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1870 | |
| 1871 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1872 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1873 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1875 | |
| 1876 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1877 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1878 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1879 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1880 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1881 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1882 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1883 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1884 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1885 | |
| 1886 | { } |
| 1887 | }; |
| 1888 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1889 | /* FIXME! */ |
| 1890 | /* |
| 1891 | * ASUS pin configuration: |
| 1892 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1893 | */ |
| 1894 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1895 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1896 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1897 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1898 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1899 | |
| 1900 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1901 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1902 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1903 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1904 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1905 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1906 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1907 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1908 | |
| 1909 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1910 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1911 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1912 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1913 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1914 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1915 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1916 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1917 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1918 | |
| 1919 | { } |
| 1920 | }; |
| 1921 | |
| 1922 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1923 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1924 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1925 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1926 | /* Clevo m520g init */ |
| 1927 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1928 | /* headphone output */ |
| 1929 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1930 | /* line-out */ |
| 1931 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1932 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1933 | /* Line-in */ |
| 1934 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1935 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1936 | /* CD */ |
| 1937 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1938 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1939 | /* Mic1 (rear panel) */ |
| 1940 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1941 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1942 | /* Mic2 (front panel) */ |
| 1943 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1944 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1945 | /* headphone */ |
| 1946 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1947 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1948 | /* change to EAPD mode */ |
| 1949 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1950 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1951 | |
| 1952 | { } |
| 1953 | }; |
| 1954 | |
| 1955 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 1956 | /* change to EAPD mode */ |
| 1957 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1958 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1959 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1960 | /* Headphone output */ |
| 1961 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1962 | /* Front output*/ |
| 1963 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1964 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1965 | |
| 1966 | /* Line In pin widget for input */ |
| 1967 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1968 | /* CD pin widget for input */ |
| 1969 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1970 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1971 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1972 | |
| 1973 | /* change to EAPD mode */ |
| 1974 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1975 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 1976 | |
| 1977 | { } |
| 1978 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1979 | |
| 1980 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1981 | * LG m1 express dual |
| 1982 | * |
| 1983 | * Pin assignment: |
| 1984 | * Rear Line-In/Out (blue): 0x14 |
| 1985 | * Build-in Mic-In: 0x15 |
| 1986 | * Speaker-out: 0x17 |
| 1987 | * HP-Out (green): 0x1b |
| 1988 | * Mic-In/Out (red): 0x19 |
| 1989 | * SPDIF-Out: 0x1e |
| 1990 | */ |
| 1991 | |
| 1992 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 1993 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 1994 | 0x05, 0x02, 0x03 |
| 1995 | }; |
| 1996 | |
| 1997 | /* seems analog CD is not working */ |
| 1998 | static struct hda_input_mux alc880_lg_capture_source = { |
| 1999 | .num_items = 3, |
| 2000 | .items = { |
| 2001 | { "Mic", 0x1 }, |
| 2002 | { "Line", 0x5 }, |
| 2003 | { "Internal Mic", 0x6 }, |
| 2004 | }, |
| 2005 | }; |
| 2006 | |
| 2007 | /* 2,4,6 channel modes */ |
| 2008 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2009 | /* set line-in and mic-in to input */ |
| 2010 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2011 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2012 | { } |
| 2013 | }; |
| 2014 | |
| 2015 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2016 | /* set line-in to out and mic-in to input */ |
| 2017 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2018 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2019 | { } |
| 2020 | }; |
| 2021 | |
| 2022 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2023 | /* set line-in and mic-in to output */ |
| 2024 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2025 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2026 | { } |
| 2027 | }; |
| 2028 | |
| 2029 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2030 | { 2, alc880_lg_ch2_init }, |
| 2031 | { 4, alc880_lg_ch4_init }, |
| 2032 | { 6, alc880_lg_ch6_init }, |
| 2033 | }; |
| 2034 | |
| 2035 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
| 2036 | /* FIXME: it's not really "master" but front channels */ |
| 2037 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2038 | HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2039 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2040 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2041 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2042 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2043 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2044 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2045 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2047 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2048 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2049 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2050 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2051 | { |
| 2052 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2053 | .name = "Channel Mode", |
| 2054 | .info = alc_ch_mode_info, |
| 2055 | .get = alc_ch_mode_get, |
| 2056 | .put = alc_ch_mode_put, |
| 2057 | }, |
| 2058 | { } /* end */ |
| 2059 | }; |
| 2060 | |
| 2061 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2062 | /* set capture source to mic-in */ |
| 2063 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2064 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2065 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2066 | /* mute all amp mixer inputs */ |
| 2067 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2068 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2069 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2070 | /* line-in to input */ |
| 2071 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2072 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2073 | /* built-in mic */ |
| 2074 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2075 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2076 | /* speaker-out */ |
| 2077 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2078 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2079 | /* mic-in to input */ |
| 2080 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2081 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2082 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2083 | /* HP-out */ |
| 2084 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2085 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2086 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2087 | /* jack sense */ |
| 2088 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2089 | { } |
| 2090 | }; |
| 2091 | |
| 2092 | /* toggle speaker-output according to the hp-jack state */ |
| 2093 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2094 | { |
| 2095 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2096 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2097 | |
| 2098 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2099 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2100 | bits = present ? HDA_AMP_MUTE : 0; |
| 2101 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2102 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2103 | } |
| 2104 | |
| 2105 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2106 | { |
| 2107 | /* Looks like the unsol event is incompatible with the standard |
| 2108 | * definition. 4bit tag is placed at 28 bit! |
| 2109 | */ |
| 2110 | if ((res >> 28) == 0x01) |
| 2111 | alc880_lg_automute(codec); |
| 2112 | } |
| 2113 | |
| 2114 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2115 | * LG LW20 |
| 2116 | * |
| 2117 | * Pin assignment: |
| 2118 | * Speaker-out: 0x14 |
| 2119 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2120 | * Built-in Mic-In: 0x19 |
| 2121 | * Line-In: 0x1b |
| 2122 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2123 | * SPDIF-Out: 0x1e |
| 2124 | */ |
| 2125 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2126 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2127 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2128 | .items = { |
| 2129 | { "Mic", 0x0 }, |
| 2130 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2131 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2132 | }, |
| 2133 | }; |
| 2134 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2135 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2136 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2137 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2138 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2139 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2140 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2141 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2142 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2143 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2144 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2145 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2146 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2147 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2148 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2149 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2150 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2151 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2152 | { |
| 2153 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2154 | .name = "Channel Mode", |
| 2155 | .info = alc_ch_mode_info, |
| 2156 | .get = alc_ch_mode_get, |
| 2157 | .put = alc_ch_mode_put, |
| 2158 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2159 | { } /* end */ |
| 2160 | }; |
| 2161 | |
| 2162 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2163 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2164 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2165 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2166 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2167 | /* set capture source to mic-in */ |
| 2168 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2169 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2170 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2171 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2172 | /* speaker-out */ |
| 2173 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2174 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2175 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2176 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2177 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2178 | /* mic-in to input */ |
| 2179 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2180 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2181 | /* built-in mic */ |
| 2182 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2183 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2184 | /* jack sense */ |
| 2185 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2186 | { } |
| 2187 | }; |
| 2188 | |
| 2189 | /* toggle speaker-output according to the hp-jack state */ |
| 2190 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2191 | { |
| 2192 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2193 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2194 | |
| 2195 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2196 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2197 | bits = present ? HDA_AMP_MUTE : 0; |
| 2198 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2199 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2200 | } |
| 2201 | |
| 2202 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2203 | { |
| 2204 | /* Looks like the unsol event is incompatible with the standard |
| 2205 | * definition. 4bit tag is placed at 28 bit! |
| 2206 | */ |
| 2207 | if ((res >> 28) == 0x01) |
| 2208 | alc880_lg_lw_automute(codec); |
| 2209 | } |
| 2210 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2211 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2212 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2213 | { 0x0b, HDA_INPUT, 0 }, |
| 2214 | { 0x0b, HDA_INPUT, 1 }, |
| 2215 | { 0x0b, HDA_INPUT, 2 }, |
| 2216 | { 0x0b, HDA_INPUT, 3 }, |
| 2217 | { 0x0b, HDA_INPUT, 4 }, |
| 2218 | { } /* end */ |
| 2219 | }; |
| 2220 | |
| 2221 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2222 | { 0x0b, HDA_INPUT, 1 }, |
| 2223 | { 0x0b, HDA_INPUT, 6 }, |
| 2224 | { 0x0b, HDA_INPUT, 7 }, |
| 2225 | { } /* end */ |
| 2226 | }; |
| 2227 | #endif |
| 2228 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2229 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2230 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2231 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2232 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2233 | static int alc_init(struct hda_codec *codec) |
| 2234 | { |
| 2235 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2236 | unsigned int i; |
| 2237 | |
| 2238 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2239 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2240 | |
| 2241 | if (spec->init_hook) |
| 2242 | spec->init_hook(codec); |
| 2243 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2244 | return 0; |
| 2245 | } |
| 2246 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2247 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2248 | { |
| 2249 | struct alc_spec *spec = codec->spec; |
| 2250 | |
| 2251 | if (spec->unsol_event) |
| 2252 | spec->unsol_event(codec, res); |
| 2253 | } |
| 2254 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2255 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2256 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2257 | { |
| 2258 | struct alc_spec *spec = codec->spec; |
| 2259 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2260 | } |
| 2261 | #endif |
| 2262 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2263 | /* |
| 2264 | * Analog playback callbacks |
| 2265 | */ |
| 2266 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2267 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2268 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2269 | { |
| 2270 | struct alc_spec *spec = codec->spec; |
| 2271 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 2272 | } |
| 2273 | |
| 2274 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2275 | struct hda_codec *codec, |
| 2276 | unsigned int stream_tag, |
| 2277 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2278 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2279 | { |
| 2280 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2281 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2282 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2283 | } |
| 2284 | |
| 2285 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2286 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2287 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2288 | { |
| 2289 | struct alc_spec *spec = codec->spec; |
| 2290 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2291 | } |
| 2292 | |
| 2293 | /* |
| 2294 | * Digital out |
| 2295 | */ |
| 2296 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2297 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2298 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2299 | { |
| 2300 | struct alc_spec *spec = codec->spec; |
| 2301 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2302 | } |
| 2303 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2304 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2305 | struct hda_codec *codec, |
| 2306 | unsigned int stream_tag, |
| 2307 | unsigned int format, |
| 2308 | struct snd_pcm_substream *substream) |
| 2309 | { |
| 2310 | struct alc_spec *spec = codec->spec; |
| 2311 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2312 | stream_tag, format, substream); |
| 2313 | } |
| 2314 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2315 | static int alc880_dig_playback_pcm_close(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_dig_close(codec, &spec->multiout); |
| 2321 | } |
| 2322 | |
| 2323 | /* |
| 2324 | * Analog capture |
| 2325 | */ |
| 2326 | static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2327 | struct hda_codec *codec, |
| 2328 | unsigned int stream_tag, |
| 2329 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2330 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2331 | { |
| 2332 | struct alc_spec *spec = codec->spec; |
| 2333 | |
| 2334 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2335 | stream_tag, 0, format); |
| 2336 | return 0; |
| 2337 | } |
| 2338 | |
| 2339 | static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2340 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2341 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2342 | { |
| 2343 | struct alc_spec *spec = codec->spec; |
| 2344 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2345 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2346 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2347 | return 0; |
| 2348 | } |
| 2349 | |
| 2350 | |
| 2351 | /* |
| 2352 | */ |
| 2353 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2354 | .substreams = 1, |
| 2355 | .channels_min = 2, |
| 2356 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2357 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2358 | .ops = { |
| 2359 | .open = alc880_playback_pcm_open, |
| 2360 | .prepare = alc880_playback_pcm_prepare, |
| 2361 | .cleanup = alc880_playback_pcm_cleanup |
| 2362 | }, |
| 2363 | }; |
| 2364 | |
| 2365 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
| 2366 | .substreams = 2, |
| 2367 | .channels_min = 2, |
| 2368 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2369 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2370 | .ops = { |
| 2371 | .prepare = alc880_capture_pcm_prepare, |
| 2372 | .cleanup = alc880_capture_pcm_cleanup |
| 2373 | }, |
| 2374 | }; |
| 2375 | |
| 2376 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2377 | .substreams = 1, |
| 2378 | .channels_min = 2, |
| 2379 | .channels_max = 2, |
| 2380 | /* NID is set in alc_build_pcms */ |
| 2381 | .ops = { |
| 2382 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2383 | .close = alc880_dig_playback_pcm_close, |
| 2384 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2385 | }, |
| 2386 | }; |
| 2387 | |
| 2388 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2389 | .substreams = 1, |
| 2390 | .channels_min = 2, |
| 2391 | .channels_max = 2, |
| 2392 | /* NID is set in alc_build_pcms */ |
| 2393 | }; |
| 2394 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2395 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
| 2396 | static struct hda_pcm_stream alc_pcm_null_playback = { |
| 2397 | .substreams = 0, |
| 2398 | .channels_min = 0, |
| 2399 | .channels_max = 0, |
| 2400 | }; |
| 2401 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2402 | static int alc_build_pcms(struct hda_codec *codec) |
| 2403 | { |
| 2404 | struct alc_spec *spec = codec->spec; |
| 2405 | struct hda_pcm *info = spec->pcm_rec; |
| 2406 | int i; |
| 2407 | |
| 2408 | codec->num_pcms = 1; |
| 2409 | codec->pcm_info = info; |
| 2410 | |
| 2411 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2412 | if (spec->stream_analog_playback) { |
| 2413 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2414 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2415 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2416 | } |
| 2417 | if (spec->stream_analog_capture) { |
| 2418 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2419 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2420 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2421 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2422 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2423 | if (spec->channel_mode) { |
| 2424 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2425 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2426 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2427 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2428 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2429 | } |
| 2430 | } |
| 2431 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2432 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2433 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2434 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2435 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2436 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2437 | if (spec->multiout.dig_out_nid && |
| 2438 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2439 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2440 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2441 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2442 | if (spec->dig_in_nid && |
| 2443 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2444 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2445 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2446 | } |
| 2447 | } |
| 2448 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2449 | /* If the use of more than one ADC is requested for the current |
| 2450 | * model, configure a second analog capture-only PCM. |
| 2451 | */ |
| 2452 | /* Additional Analaog capture for index #2 */ |
| 2453 | if (spec->num_adc_nids > 1 && spec->stream_analog_capture && |
| 2454 | spec->adc_nids) { |
| 2455 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2456 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2457 | info->name = spec->stream_name_analog; |
| 2458 | /* No playback stream for second PCM */ |
| 2459 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; |
| 2460 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2461 | if (spec->stream_analog_capture) { |
| 2462 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2463 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; |
| 2464 | } |
| 2465 | } |
| 2466 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2467 | return 0; |
| 2468 | } |
| 2469 | |
| 2470 | static void alc_free(struct hda_codec *codec) |
| 2471 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2472 | struct alc_spec *spec = codec->spec; |
| 2473 | unsigned int i; |
| 2474 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2475 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2476 | return; |
| 2477 | |
| 2478 | if (spec->kctl_alloc) { |
| 2479 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2480 | kfree(spec->kctl_alloc[i].name); |
| 2481 | kfree(spec->kctl_alloc); |
| 2482 | } |
| 2483 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2484 | } |
| 2485 | |
| 2486 | /* |
| 2487 | */ |
| 2488 | static struct hda_codec_ops alc_patch_ops = { |
| 2489 | .build_controls = alc_build_controls, |
| 2490 | .build_pcms = alc_build_pcms, |
| 2491 | .init = alc_init, |
| 2492 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2493 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2494 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2495 | .check_power_status = alc_check_power_status, |
| 2496 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2497 | }; |
| 2498 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2499 | |
| 2500 | /* |
| 2501 | * Test configuration for debugging |
| 2502 | * |
| 2503 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2504 | * enum controls. |
| 2505 | */ |
| 2506 | #ifdef CONFIG_SND_DEBUG |
| 2507 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2508 | 0x02, 0x03, 0x04, 0x05 |
| 2509 | }; |
| 2510 | |
| 2511 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2512 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2513 | .items = { |
| 2514 | { "In-1", 0x0 }, |
| 2515 | { "In-2", 0x1 }, |
| 2516 | { "In-3", 0x2 }, |
| 2517 | { "In-4", 0x3 }, |
| 2518 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2519 | { "Front", 0x5 }, |
| 2520 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2521 | }, |
| 2522 | }; |
| 2523 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2524 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2525 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2526 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2527 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2528 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2529 | }; |
| 2530 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2531 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2532 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2533 | { |
| 2534 | static char *texts[] = { |
| 2535 | "N/A", "Line Out", "HP Out", |
| 2536 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2537 | }; |
| 2538 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2539 | uinfo->count = 1; |
| 2540 | uinfo->value.enumerated.items = 8; |
| 2541 | if (uinfo->value.enumerated.item >= 8) |
| 2542 | uinfo->value.enumerated.item = 7; |
| 2543 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2544 | return 0; |
| 2545 | } |
| 2546 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2547 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2548 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2549 | { |
| 2550 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2551 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2552 | unsigned int pin_ctl, item = 0; |
| 2553 | |
| 2554 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2555 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2556 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2557 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2558 | item = 2; |
| 2559 | else |
| 2560 | item = 1; |
| 2561 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2562 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2563 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2564 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2565 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2566 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2567 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2568 | } |
| 2569 | } |
| 2570 | ucontrol->value.enumerated.item[0] = item; |
| 2571 | return 0; |
| 2572 | } |
| 2573 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2574 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2575 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2576 | { |
| 2577 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2578 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2579 | static unsigned int ctls[] = { |
| 2580 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2581 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2582 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2583 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2584 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2585 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2586 | }; |
| 2587 | unsigned int old_ctl, new_ctl; |
| 2588 | |
| 2589 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2590 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2591 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2592 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2593 | int val; |
| 2594 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2595 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2596 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2597 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2598 | HDA_AMP_MUTE : 0; |
| 2599 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2600 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2601 | return 1; |
| 2602 | } |
| 2603 | return 0; |
| 2604 | } |
| 2605 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2606 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2607 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2608 | { |
| 2609 | static char *texts[] = { |
| 2610 | "Front", "Surround", "CLFE", "Side" |
| 2611 | }; |
| 2612 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2613 | uinfo->count = 1; |
| 2614 | uinfo->value.enumerated.items = 4; |
| 2615 | if (uinfo->value.enumerated.item >= 4) |
| 2616 | uinfo->value.enumerated.item = 3; |
| 2617 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2618 | return 0; |
| 2619 | } |
| 2620 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2621 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2622 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2623 | { |
| 2624 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2625 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2626 | unsigned int sel; |
| 2627 | |
| 2628 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2629 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2630 | return 0; |
| 2631 | } |
| 2632 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2633 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2634 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2635 | { |
| 2636 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2637 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2638 | unsigned int sel; |
| 2639 | |
| 2640 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2641 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2642 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2643 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2644 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2645 | return 1; |
| 2646 | } |
| 2647 | return 0; |
| 2648 | } |
| 2649 | |
| 2650 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2651 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2652 | .name = xname, \ |
| 2653 | .info = alc_test_pin_ctl_info, \ |
| 2654 | .get = alc_test_pin_ctl_get, \ |
| 2655 | .put = alc_test_pin_ctl_put, \ |
| 2656 | .private_value = nid \ |
| 2657 | } |
| 2658 | |
| 2659 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2660 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2661 | .name = xname, \ |
| 2662 | .info = alc_test_pin_src_info, \ |
| 2663 | .get = alc_test_pin_src_get, \ |
| 2664 | .put = alc_test_pin_src_put, \ |
| 2665 | .private_value = nid \ |
| 2666 | } |
| 2667 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2668 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2669 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2670 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2671 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2672 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2673 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2674 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2675 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2676 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2677 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2678 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2679 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2680 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2681 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2682 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2683 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2684 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2685 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2686 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2687 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2688 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2689 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2690 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2691 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2692 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2693 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2694 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2695 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2696 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2697 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2698 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2699 | { |
| 2700 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2701 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2702 | .info = alc_ch_mode_info, |
| 2703 | .get = alc_ch_mode_get, |
| 2704 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2705 | }, |
| 2706 | { } /* end */ |
| 2707 | }; |
| 2708 | |
| 2709 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2710 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2711 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2712 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2713 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2714 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2715 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2716 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2717 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2718 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2719 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2720 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2721 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2722 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2723 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2724 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2725 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2726 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2727 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2728 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2729 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2730 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2731 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2732 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2733 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2734 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2735 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2736 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2737 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2738 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2739 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2740 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2741 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2742 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2743 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2744 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2745 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2746 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2747 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2748 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2749 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2750 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2751 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2752 | /* Analog input/passthru */ |
| 2753 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2754 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2755 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2756 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2757 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2758 | { } |
| 2759 | }; |
| 2760 | #endif |
| 2761 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2762 | /* |
| 2763 | */ |
| 2764 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2765 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2766 | [ALC880_3ST] = "3stack", |
| 2767 | [ALC880_TCL_S700] = "tcl", |
| 2768 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2769 | [ALC880_CLEVO] = "clevo", |
| 2770 | [ALC880_5ST] = "5stack", |
| 2771 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2772 | [ALC880_W810] = "w810", |
| 2773 | [ALC880_Z71V] = "z71v", |
| 2774 | [ALC880_6ST] = "6stack", |
| 2775 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2776 | [ALC880_ASUS] = "asus", |
| 2777 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2778 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2779 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2780 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2781 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2782 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2783 | [ALC880_F1734] = "F1734", |
| 2784 | [ALC880_LG] = "lg", |
| 2785 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2786 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2787 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2788 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2789 | [ALC880_AUTO] = "auto", |
| 2790 | }; |
| 2791 | |
| 2792 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2793 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2794 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2795 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2796 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2797 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2798 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2799 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2800 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2801 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2802 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2803 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2804 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2805 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2806 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2807 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2808 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2809 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2810 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2811 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2812 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2813 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2814 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2815 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2816 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2817 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2818 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2819 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2820 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2821 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2822 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2823 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2824 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2825 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2826 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2827 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2828 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2829 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2830 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2831 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2832 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2833 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2834 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2835 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2836 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2837 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2838 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2839 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2840 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2841 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2842 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2843 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2844 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2845 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2846 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2847 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 2848 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2849 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2850 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2851 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2852 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2853 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2854 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2855 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2856 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2857 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2858 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2859 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 2860 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2861 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2862 | {} |
| 2863 | }; |
| 2864 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2865 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2866 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2867 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2868 | static struct alc_config_preset alc880_presets[] = { |
| 2869 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2870 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2871 | .init_verbs = { alc880_volume_init_verbs, |
| 2872 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2873 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2874 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2875 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2876 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2877 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2878 | .input_mux = &alc880_capture_source, |
| 2879 | }, |
| 2880 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2881 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2882 | .init_verbs = { alc880_volume_init_verbs, |
| 2883 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2884 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2885 | .dac_nids = alc880_dac_nids, |
| 2886 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2887 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2888 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2889 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2890 | .input_mux = &alc880_capture_source, |
| 2891 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2892 | [ALC880_TCL_S700] = { |
| 2893 | .mixers = { alc880_tcl_s700_mixer }, |
| 2894 | .init_verbs = { alc880_volume_init_verbs, |
| 2895 | alc880_pin_tcl_S700_init_verbs, |
| 2896 | alc880_gpio2_init_verbs }, |
| 2897 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2898 | .dac_nids = alc880_dac_nids, |
| 2899 | .hp_nid = 0x03, |
| 2900 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2901 | .channel_mode = alc880_2_jack_modes, |
| 2902 | .input_mux = &alc880_capture_source, |
| 2903 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2904 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2905 | .mixers = { alc880_three_stack_mixer, |
| 2906 | alc880_five_stack_mixer}, |
| 2907 | .init_verbs = { alc880_volume_init_verbs, |
| 2908 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2909 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2910 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2911 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2912 | .channel_mode = alc880_fivestack_modes, |
| 2913 | .input_mux = &alc880_capture_source, |
| 2914 | }, |
| 2915 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2916 | .mixers = { alc880_three_stack_mixer, |
| 2917 | alc880_five_stack_mixer }, |
| 2918 | .init_verbs = { alc880_volume_init_verbs, |
| 2919 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2920 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2921 | .dac_nids = alc880_dac_nids, |
| 2922 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2923 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2924 | .channel_mode = alc880_fivestack_modes, |
| 2925 | .input_mux = &alc880_capture_source, |
| 2926 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2927 | [ALC880_6ST] = { |
| 2928 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2929 | .init_verbs = { alc880_volume_init_verbs, |
| 2930 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2931 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2932 | .dac_nids = alc880_6st_dac_nids, |
| 2933 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2934 | .channel_mode = alc880_sixstack_modes, |
| 2935 | .input_mux = &alc880_6stack_capture_source, |
| 2936 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2937 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2938 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2939 | .init_verbs = { alc880_volume_init_verbs, |
| 2940 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2941 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2942 | .dac_nids = alc880_6st_dac_nids, |
| 2943 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2944 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2945 | .channel_mode = alc880_sixstack_modes, |
| 2946 | .input_mux = &alc880_6stack_capture_source, |
| 2947 | }, |
| 2948 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2949 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2950 | .init_verbs = { alc880_volume_init_verbs, |
| 2951 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2952 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2953 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 2954 | .dac_nids = alc880_w810_dac_nids, |
| 2955 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2956 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 2957 | .channel_mode = alc880_w810_modes, |
| 2958 | .input_mux = &alc880_capture_source, |
| 2959 | }, |
| 2960 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2961 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2962 | .init_verbs = { alc880_volume_init_verbs, |
| 2963 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2964 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 2965 | .dac_nids = alc880_z71v_dac_nids, |
| 2966 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2967 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2968 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2969 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2970 | .input_mux = &alc880_capture_source, |
| 2971 | }, |
| 2972 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2973 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2974 | .init_verbs = { alc880_volume_init_verbs, |
| 2975 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2976 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 2977 | .dac_nids = alc880_f1734_dac_nids, |
| 2978 | .hp_nid = 0x02, |
| 2979 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2980 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2981 | .input_mux = &alc880_capture_source, |
| 2982 | }, |
| 2983 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2984 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2985 | .init_verbs = { alc880_volume_init_verbs, |
| 2986 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2987 | alc880_gpio1_init_verbs }, |
| 2988 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2989 | .dac_nids = alc880_asus_dac_nids, |
| 2990 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2991 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2992 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2993 | .input_mux = &alc880_capture_source, |
| 2994 | }, |
| 2995 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2996 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2997 | .init_verbs = { alc880_volume_init_verbs, |
| 2998 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2999 | alc880_gpio1_init_verbs }, |
| 3000 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3001 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3002 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3003 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3004 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3005 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3006 | .input_mux = &alc880_capture_source, |
| 3007 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3008 | [ALC880_ASUS_DIG2] = { |
| 3009 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3010 | .init_verbs = { alc880_volume_init_verbs, |
| 3011 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3012 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3013 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3014 | .dac_nids = alc880_asus_dac_nids, |
| 3015 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3016 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3017 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3018 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3019 | .input_mux = &alc880_capture_source, |
| 3020 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3021 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3022 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3023 | .init_verbs = { alc880_volume_init_verbs, |
| 3024 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3025 | alc880_gpio1_init_verbs }, |
| 3026 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3027 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3028 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3029 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3030 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3031 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3032 | .input_mux = &alc880_capture_source, |
| 3033 | }, |
| 3034 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3035 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3036 | .init_verbs = { alc880_volume_init_verbs, |
| 3037 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3038 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3039 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3040 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3041 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3042 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3043 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3044 | .input_mux = &alc880_capture_source, |
| 3045 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3046 | [ALC880_UNIWILL] = { |
| 3047 | .mixers = { alc880_uniwill_mixer }, |
| 3048 | .init_verbs = { alc880_volume_init_verbs, |
| 3049 | alc880_uniwill_init_verbs }, |
| 3050 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3051 | .dac_nids = alc880_asus_dac_nids, |
| 3052 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3053 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3054 | .channel_mode = alc880_threestack_modes, |
| 3055 | .need_dac_fix = 1, |
| 3056 | .input_mux = &alc880_capture_source, |
| 3057 | .unsol_event = alc880_uniwill_unsol_event, |
| 3058 | .init_hook = alc880_uniwill_automute, |
| 3059 | }, |
| 3060 | [ALC880_UNIWILL_P53] = { |
| 3061 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3062 | .init_verbs = { alc880_volume_init_verbs, |
| 3063 | alc880_uniwill_p53_init_verbs }, |
| 3064 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3065 | .dac_nids = alc880_asus_dac_nids, |
| 3066 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3067 | .channel_mode = alc880_threestack_modes, |
| 3068 | .input_mux = &alc880_capture_source, |
| 3069 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3070 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3071 | }, |
| 3072 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3073 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3074 | alc880_pcbeep_mixer, }, |
| 3075 | .init_verbs = { alc880_volume_init_verbs, |
| 3076 | alc880_uniwill_p53_init_verbs, |
| 3077 | alc880_beep_init_verbs }, |
| 3078 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3079 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3080 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3081 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3082 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3083 | .input_mux = &alc880_capture_source, |
| 3084 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3085 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3086 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3087 | [ALC880_CLEVO] = { |
| 3088 | .mixers = { alc880_three_stack_mixer }, |
| 3089 | .init_verbs = { alc880_volume_init_verbs, |
| 3090 | alc880_pin_clevo_init_verbs }, |
| 3091 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3092 | .dac_nids = alc880_dac_nids, |
| 3093 | .hp_nid = 0x03, |
| 3094 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3095 | .channel_mode = alc880_threestack_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 | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3099 | [ALC880_LG] = { |
| 3100 | .mixers = { alc880_lg_mixer }, |
| 3101 | .init_verbs = { alc880_volume_init_verbs, |
| 3102 | alc880_lg_init_verbs }, |
| 3103 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3104 | .dac_nids = alc880_lg_dac_nids, |
| 3105 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3106 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3107 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3108 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3109 | .input_mux = &alc880_lg_capture_source, |
| 3110 | .unsol_event = alc880_lg_unsol_event, |
| 3111 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3112 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3113 | .loopbacks = alc880_lg_loopbacks, |
| 3114 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3115 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3116 | [ALC880_LG_LW] = { |
| 3117 | .mixers = { alc880_lg_lw_mixer }, |
| 3118 | .init_verbs = { alc880_volume_init_verbs, |
| 3119 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3120 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3121 | .dac_nids = alc880_dac_nids, |
| 3122 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3123 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3124 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3125 | .input_mux = &alc880_lg_lw_capture_source, |
| 3126 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3127 | .init_hook = alc880_lg_lw_automute, |
| 3128 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3129 | #ifdef CONFIG_SND_DEBUG |
| 3130 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3131 | .mixers = { alc880_test_mixer }, |
| 3132 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3133 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3134 | .dac_nids = alc880_test_dac_nids, |
| 3135 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3136 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3137 | .channel_mode = alc880_test_modes, |
| 3138 | .input_mux = &alc880_test_capture_source, |
| 3139 | }, |
| 3140 | #endif |
| 3141 | }; |
| 3142 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3143 | /* |
| 3144 | * Automatic parse of I/O pins from the BIOS configuration |
| 3145 | */ |
| 3146 | |
| 3147 | #define NUM_CONTROL_ALLOC 32 |
| 3148 | #define NUM_VERB_ALLOC 32 |
| 3149 | |
| 3150 | enum { |
| 3151 | ALC_CTL_WIDGET_VOL, |
| 3152 | ALC_CTL_WIDGET_MUTE, |
| 3153 | ALC_CTL_BIND_MUTE, |
| 3154 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3155 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3156 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3157 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3158 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3159 | }; |
| 3160 | |
| 3161 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3162 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3163 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3164 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3165 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3166 | |
| 3167 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3168 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3169 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3170 | /* array + terminator */ |
| 3171 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3172 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3173 | return -ENOMEM; |
| 3174 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3175 | memcpy(knew, spec->kctl_alloc, |
| 3176 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3177 | kfree(spec->kctl_alloc); |
| 3178 | } |
| 3179 | spec->kctl_alloc = knew; |
| 3180 | spec->num_kctl_alloc = num; |
| 3181 | } |
| 3182 | |
| 3183 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3184 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3185 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3186 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3187 | return -ENOMEM; |
| 3188 | knew->private_value = val; |
| 3189 | spec->num_kctl_used++; |
| 3190 | return 0; |
| 3191 | } |
| 3192 | |
| 3193 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3194 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3195 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3196 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3197 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3198 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3199 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3200 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3201 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3202 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3203 | #define ALC880_PIN_CD_NID 0x1c |
| 3204 | |
| 3205 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3206 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3207 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3208 | { |
| 3209 | hda_nid_t nid; |
| 3210 | int assigned[4]; |
| 3211 | int i, j; |
| 3212 | |
| 3213 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3214 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3215 | |
| 3216 | /* check the pins hardwired to audio widget */ |
| 3217 | for (i = 0; i < cfg->line_outs; i++) { |
| 3218 | nid = cfg->line_out_pins[i]; |
| 3219 | if (alc880_is_fixed_pin(nid)) { |
| 3220 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3221 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3222 | assigned[idx] = 1; |
| 3223 | } |
| 3224 | } |
| 3225 | /* left pins can be connect to any audio widget */ |
| 3226 | for (i = 0; i < cfg->line_outs; i++) { |
| 3227 | nid = cfg->line_out_pins[i]; |
| 3228 | if (alc880_is_fixed_pin(nid)) |
| 3229 | continue; |
| 3230 | /* search for an empty channel */ |
| 3231 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3232 | if (!assigned[j]) { |
| 3233 | spec->multiout.dac_nids[i] = |
| 3234 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3235 | assigned[j] = 1; |
| 3236 | break; |
| 3237 | } |
| 3238 | } |
| 3239 | } |
| 3240 | spec->multiout.num_dacs = cfg->line_outs; |
| 3241 | return 0; |
| 3242 | } |
| 3243 | |
| 3244 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3245 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3246 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3247 | { |
| 3248 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3249 | static const char *chname[4] = { |
| 3250 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3251 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3252 | hda_nid_t nid; |
| 3253 | int i, err; |
| 3254 | |
| 3255 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3256 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3257 | continue; |
| 3258 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3259 | if (i == 2) { |
| 3260 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3261 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3262 | "Center Playback Volume", |
| 3263 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3264 | HDA_OUTPUT)); |
| 3265 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3266 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3267 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3268 | "LFE Playback Volume", |
| 3269 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3270 | HDA_OUTPUT)); |
| 3271 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3272 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3273 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3274 | "Center Playback Switch", |
| 3275 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3276 | HDA_INPUT)); |
| 3277 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3278 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3279 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3280 | "LFE Playback Switch", |
| 3281 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3282 | HDA_INPUT)); |
| 3283 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3284 | return err; |
| 3285 | } else { |
| 3286 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3287 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3288 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3289 | HDA_OUTPUT)); |
| 3290 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3291 | return err; |
| 3292 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3293 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3294 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3295 | HDA_INPUT)); |
| 3296 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3297 | return err; |
| 3298 | } |
| 3299 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3300 | return 0; |
| 3301 | } |
| 3302 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3303 | /* add playback controls for speaker and HP outputs */ |
| 3304 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3305 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3306 | { |
| 3307 | hda_nid_t nid; |
| 3308 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3309 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3310 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3311 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3312 | return 0; |
| 3313 | |
| 3314 | if (alc880_is_fixed_pin(pin)) { |
| 3315 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3316 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3317 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3318 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3319 | else |
| 3320 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3321 | /* control HP volume/switch on the output mixer amp */ |
| 3322 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3323 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3324 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3325 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3326 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3327 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3328 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3329 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3330 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3331 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3332 | return err; |
| 3333 | } else if (alc880_is_multi_pin(pin)) { |
| 3334 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3335 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3336 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3337 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3338 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3339 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3340 | return err; |
| 3341 | } |
| 3342 | return 0; |
| 3343 | } |
| 3344 | |
| 3345 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3346 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3347 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3348 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3349 | { |
| 3350 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3351 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3352 | |
| 3353 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3354 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3355 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3356 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3357 | return err; |
| 3358 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3359 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3360 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3361 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3362 | return err; |
| 3363 | return 0; |
| 3364 | } |
| 3365 | |
| 3366 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3367 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3368 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3369 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3370 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3371 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3372 | |
| 3373 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3374 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3375 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3376 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3377 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3378 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3379 | if (err < 0) |
| 3380 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3381 | imux->items[imux->num_items].label = |
| 3382 | auto_pin_cfg_labels[i]; |
| 3383 | imux->items[imux->num_items].index = |
| 3384 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3385 | imux->num_items++; |
| 3386 | } |
| 3387 | } |
| 3388 | return 0; |
| 3389 | } |
| 3390 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3391 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3392 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3393 | int dac_idx) |
| 3394 | { |
| 3395 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3396 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3397 | pin_type); |
| 3398 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3399 | AMP_OUT_UNMUTE); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3400 | /* need the manual connection? */ |
| 3401 | if (alc880_is_multi_pin(nid)) { |
| 3402 | struct alc_spec *spec = codec->spec; |
| 3403 | int idx = alc880_multi_pin_idx(nid); |
| 3404 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3405 | AC_VERB_SET_CONNECT_SEL, |
| 3406 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3407 | } |
| 3408 | } |
| 3409 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3410 | static int get_pin_type(int line_out_type) |
| 3411 | { |
| 3412 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3413 | return PIN_HP; |
| 3414 | else |
| 3415 | return PIN_OUT; |
| 3416 | } |
| 3417 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3418 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3419 | { |
| 3420 | struct alc_spec *spec = codec->spec; |
| 3421 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3422 | |
| 3423 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3424 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3425 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3426 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3427 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3428 | } |
| 3429 | } |
| 3430 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3431 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3432 | { |
| 3433 | struct alc_spec *spec = codec->spec; |
| 3434 | hda_nid_t pin; |
| 3435 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3436 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3437 | if (pin) /* connect to front */ |
| 3438 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3439 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3440 | if (pin) /* connect to front */ |
| 3441 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3442 | } |
| 3443 | |
| 3444 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3445 | { |
| 3446 | struct alc_spec *spec = codec->spec; |
| 3447 | int i; |
| 3448 | |
| 3449 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3450 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3451 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3452 | snd_hda_codec_write(codec, nid, 0, |
| 3453 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3454 | i <= AUTO_PIN_FRONT_MIC ? |
| 3455 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3456 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3457 | snd_hda_codec_write(codec, nid, 0, |
| 3458 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3459 | AMP_OUT_MUTE); |
| 3460 | } |
| 3461 | } |
| 3462 | } |
| 3463 | |
| 3464 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3465 | /* return 1 if successful, 0 if the proper config is not found, |
| 3466 | * or a negative error code |
| 3467 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3468 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3469 | { |
| 3470 | struct alc_spec *spec = codec->spec; |
| 3471 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3472 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3473 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3474 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3475 | alc880_ignore); |
| 3476 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3477 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3478 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3479 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3480 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3481 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3482 | if (err < 0) |
| 3483 | return err; |
| 3484 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3485 | if (err < 0) |
| 3486 | return err; |
| 3487 | err = alc880_auto_create_extra_out(spec, |
| 3488 | spec->autocfg.speaker_pins[0], |
| 3489 | "Speaker"); |
| 3490 | if (err < 0) |
| 3491 | return err; |
| 3492 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3493 | "Headphone"); |
| 3494 | if (err < 0) |
| 3495 | return err; |
| 3496 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3497 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3498 | return err; |
| 3499 | |
| 3500 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3501 | |
| 3502 | if (spec->autocfg.dig_out_pin) |
| 3503 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3504 | if (spec->autocfg.dig_in_pin) |
| 3505 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3506 | |
| 3507 | if (spec->kctl_alloc) |
| 3508 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3509 | |
| 3510 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3511 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3512 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3513 | spec->input_mux = &spec->private_imux; |
| 3514 | |
| 3515 | return 1; |
| 3516 | } |
| 3517 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3518 | /* additional initialization for auto-configuration model */ |
| 3519 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3520 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3521 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3522 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3523 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3524 | } |
| 3525 | |
| 3526 | /* |
| 3527 | * OK, here we have finally the patch for ALC880 |
| 3528 | */ |
| 3529 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3530 | static int patch_alc880(struct hda_codec *codec) |
| 3531 | { |
| 3532 | struct alc_spec *spec; |
| 3533 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3534 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3535 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3536 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3537 | if (spec == NULL) |
| 3538 | return -ENOMEM; |
| 3539 | |
| 3540 | codec->spec = spec; |
| 3541 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3542 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3543 | alc880_models, |
| 3544 | alc880_cfg_tbl); |
| 3545 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3546 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3547 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3548 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3549 | } |
| 3550 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3551 | if (board_config == ALC880_AUTO) { |
| 3552 | /* automatic parse from the BIOS config */ |
| 3553 | err = alc880_parse_auto_config(codec); |
| 3554 | if (err < 0) { |
| 3555 | alc_free(codec); |
| 3556 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3557 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3558 | printk(KERN_INFO |
| 3559 | "hda_codec: Cannot set up configuration " |
| 3560 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3561 | board_config = ALC880_3ST; |
| 3562 | } |
| 3563 | } |
| 3564 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3565 | if (board_config != ALC880_AUTO) |
| 3566 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3567 | |
| 3568 | spec->stream_name_analog = "ALC880 Analog"; |
| 3569 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3570 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
| 3571 | |
| 3572 | spec->stream_name_digital = "ALC880 Digital"; |
| 3573 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3574 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3575 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3576 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3577 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3578 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3579 | /* get type */ |
| 3580 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3581 | if (wcap != AC_WID_AUD_IN) { |
| 3582 | spec->adc_nids = alc880_adc_nids_alt; |
| 3583 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3584 | spec->mixers[spec->num_mixers] = |
| 3585 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3586 | spec->num_mixers++; |
| 3587 | } else { |
| 3588 | spec->adc_nids = alc880_adc_nids; |
| 3589 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3590 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3591 | spec->num_mixers++; |
| 3592 | } |
| 3593 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3594 | |
| 3595 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3596 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3597 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3598 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3599 | if (!spec->loopback.amplist) |
| 3600 | spec->loopback.amplist = alc880_loopbacks; |
| 3601 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3602 | |
| 3603 | return 0; |
| 3604 | } |
| 3605 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3606 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3607 | /* |
| 3608 | * ALC260 support |
| 3609 | */ |
| 3610 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3611 | static hda_nid_t alc260_dac_nids[1] = { |
| 3612 | /* front */ |
| 3613 | 0x02, |
| 3614 | }; |
| 3615 | |
| 3616 | static hda_nid_t alc260_adc_nids[1] = { |
| 3617 | /* ADC0 */ |
| 3618 | 0x04, |
| 3619 | }; |
| 3620 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3621 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3622 | /* ADC1 */ |
| 3623 | 0x05, |
| 3624 | }; |
| 3625 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3626 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3627 | /* ADC1, 0 */ |
| 3628 | 0x05, 0x04 |
| 3629 | }; |
| 3630 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3631 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3632 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3633 | */ |
| 3634 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3635 | /* ADC0, ADC1 */ |
| 3636 | 0x04, 0x05 |
| 3637 | }; |
| 3638 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3639 | #define ALC260_DIGOUT_NID 0x03 |
| 3640 | #define ALC260_DIGIN_NID 0x06 |
| 3641 | |
| 3642 | static struct hda_input_mux alc260_capture_source = { |
| 3643 | .num_items = 4, |
| 3644 | .items = { |
| 3645 | { "Mic", 0x0 }, |
| 3646 | { "Front Mic", 0x1 }, |
| 3647 | { "Line", 0x2 }, |
| 3648 | { "CD", 0x4 }, |
| 3649 | }, |
| 3650 | }; |
| 3651 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3652 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3653 | * headphone jack and the internal CD lines since these are the only pins at |
| 3654 | * which audio can appear. For flexibility, also allow the option of |
| 3655 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3656 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3657 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3658 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3659 | { |
| 3660 | .num_items = 3, |
| 3661 | .items = { |
| 3662 | { "Mic/Line", 0x0 }, |
| 3663 | { "CD", 0x4 }, |
| 3664 | { "Headphone", 0x2 }, |
| 3665 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3666 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3667 | { |
| 3668 | .num_items = 4, |
| 3669 | .items = { |
| 3670 | { "Mic/Line", 0x0 }, |
| 3671 | { "CD", 0x4 }, |
| 3672 | { "Headphone", 0x2 }, |
| 3673 | { "Mixer", 0x5 }, |
| 3674 | }, |
| 3675 | }, |
| 3676 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3677 | }; |
| 3678 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3679 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3680 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3681 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3682 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3683 | { |
| 3684 | .num_items = 4, |
| 3685 | .items = { |
| 3686 | { "Mic", 0x0 }, |
| 3687 | { "Line", 0x2 }, |
| 3688 | { "CD", 0x4 }, |
| 3689 | { "Headphone", 0x5 }, |
| 3690 | }, |
| 3691 | }, |
| 3692 | { |
| 3693 | .num_items = 5, |
| 3694 | .items = { |
| 3695 | { "Mic", 0x0 }, |
| 3696 | { "Line", 0x2 }, |
| 3697 | { "CD", 0x4 }, |
| 3698 | { "Headphone", 0x6 }, |
| 3699 | { "Mixer", 0x5 }, |
| 3700 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3701 | }, |
| 3702 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3703 | /* |
| 3704 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3705 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3706 | * element which allows changing the channel mode, so the verb list is |
| 3707 | * never used. |
| 3708 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3709 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3710 | { 2, NULL }, |
| 3711 | }; |
| 3712 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3713 | |
| 3714 | /* Mixer combinations |
| 3715 | * |
| 3716 | * basic: base_output + input + pc_beep + capture |
| 3717 | * HP: base_output + input + capture_alt |
| 3718 | * HP_3013: hp_3013 + input + capture |
| 3719 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3720 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3721 | */ |
| 3722 | |
| 3723 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3724 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3725 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3726 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3727 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3728 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3729 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3730 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3731 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3732 | |
| 3733 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3734 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3735 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3736 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3737 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3738 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3739 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3740 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3741 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3742 | { } /* end */ |
| 3743 | }; |
| 3744 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3745 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3746 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3747 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3748 | { } /* end */ |
| 3749 | }; |
| 3750 | |
| 3751 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
| 3752 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3753 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3754 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3755 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3756 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3757 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 3758 | HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3759 | HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3760 | { } /* end */ |
| 3761 | }; |
| 3762 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3763 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3764 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3765 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3766 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3767 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3768 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3769 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3770 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3771 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3772 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3773 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3774 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3775 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3776 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3777 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3778 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3779 | { } /* end */ |
| 3780 | }; |
| 3781 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3782 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3783 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3784 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3785 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3786 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3787 | * revisions available in early 2006. Therefore for now allow the |
| 3788 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3789 | * that the lack of mic bias for this NID is intentional we could change the |
| 3790 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3791 | * |
| 3792 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3793 | * don't appear to make the mic bias available from the "line" jack, even |
| 3794 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3795 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3796 | * and the output jack. If this turns out to be the case for all such |
| 3797 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3798 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3799 | * |
| 3800 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 3801 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 3802 | * controls for such models. On models without a "mono speaker" the control |
| 3803 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3804 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3805 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 3806 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3807 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3808 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3809 | HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3810 | HDA_OUTPUT), |
| 3811 | HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, |
| 3812 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3813 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3814 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3815 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3816 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3817 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3818 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3819 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3820 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3821 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3822 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3823 | { } /* end */ |
| 3824 | }; |
| 3825 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3826 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 3827 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 3828 | */ |
| 3829 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 3830 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3831 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3832 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3833 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3834 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3835 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3836 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3837 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3838 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3839 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3840 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3841 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3842 | { } /* end */ |
| 3843 | }; |
| 3844 | |
| 3845 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 3846 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 3847 | */ |
| 3848 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 3849 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3850 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3851 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3852 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3853 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3854 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 3855 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 3856 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3857 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3858 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3859 | { } /* end */ |
| 3860 | }; |
| 3861 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3862 | /* capture mixer elements */ |
| 3863 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3864 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 3865 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3866 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 3867 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3868 | { |
| 3869 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3870 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3871 | * So call somewhat different.. |
| 3872 | * FIXME: the controls appear in the "playback" view! |
| 3873 | */ |
| 3874 | /* .name = "Capture Source", */ |
| 3875 | .name = "Input Source", |
| 3876 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3877 | .info = alc_mux_enum_info, |
| 3878 | .get = alc_mux_enum_get, |
| 3879 | .put = alc_mux_enum_put, |
| 3880 | }, |
| 3881 | { } /* end */ |
| 3882 | }; |
| 3883 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3884 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 3885 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 3886 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 3887 | { |
| 3888 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3889 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3890 | * So call somewhat different.. |
| 3891 | * FIXME: the controls appear in the "playback" view! |
| 3892 | */ |
| 3893 | /* .name = "Capture Source", */ |
| 3894 | .name = "Input Source", |
| 3895 | .count = 1, |
| 3896 | .info = alc_mux_enum_info, |
| 3897 | .get = alc_mux_enum_get, |
| 3898 | .put = alc_mux_enum_put, |
| 3899 | }, |
| 3900 | { } /* end */ |
| 3901 | }; |
| 3902 | |
| 3903 | /* |
| 3904 | * initialization verbs |
| 3905 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3906 | static struct hda_verb alc260_init_verbs[] = { |
| 3907 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3908 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3909 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3910 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3911 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3912 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3913 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3914 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3915 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3916 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3917 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 3918 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3919 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3920 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3921 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3922 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3923 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3924 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3925 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3926 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3927 | /* set connection select to line in (default select for this ADC) */ |
| 3928 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3929 | /* mute capture amp left and right */ |
| 3930 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3931 | /* set connection select to line in (default select for this ADC) */ |
| 3932 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3933 | /* set vol=0 Line-Out mixer amp left and right */ |
| 3934 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3935 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3936 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3937 | /* set vol=0 HP mixer amp left and right */ |
| 3938 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3939 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3940 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3941 | /* set vol=0 Mono mixer amp left and right */ |
| 3942 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3943 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3944 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3945 | /* unmute LINE-2 out pin */ |
| 3946 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3947 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3948 | * Line In 2 = 0x03 |
| 3949 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3950 | /* mute analog inputs */ |
| 3951 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3952 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3953 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3954 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3955 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3956 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3957 | /* mute Front out path */ |
| 3958 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3959 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3960 | /* mute Headphone out path */ |
| 3961 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3962 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3963 | /* mute Mono out path */ |
| 3964 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3965 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3966 | { } |
| 3967 | }; |
| 3968 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3969 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3970 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 3971 | /* Headphone and output */ |
| 3972 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3973 | /* mono output */ |
| 3974 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3975 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3976 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3977 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3978 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3979 | /* Line In pin widget for input */ |
| 3980 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3981 | /* Line-2 pin widget for output */ |
| 3982 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3983 | /* CD pin widget for input */ |
| 3984 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3985 | /* unmute amp left and right */ |
| 3986 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3987 | /* set connection select to line in (default select for this ADC) */ |
| 3988 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3989 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3990 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3991 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3992 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3993 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3994 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3995 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3996 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3997 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3998 | * Line In 2 = 0x03 |
| 3999 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4000 | /* mute analog inputs */ |
| 4001 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4002 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4003 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4005 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4006 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4007 | /* Unmute Front out path */ |
| 4008 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4009 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4010 | /* Unmute Headphone out path */ |
| 4011 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4012 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4013 | /* Unmute Mono out path */ |
| 4014 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4015 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4016 | { } |
| 4017 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4018 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4019 | |
| 4020 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4021 | /* Line out and output */ |
| 4022 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4023 | /* mono output */ |
| 4024 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4025 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4026 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4027 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4028 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4029 | /* Line In pin widget for input */ |
| 4030 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4031 | /* Headphone pin widget for output */ |
| 4032 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4033 | /* CD pin widget for input */ |
| 4034 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4035 | /* unmute amp left and right */ |
| 4036 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4037 | /* set connection select to line in (default select for this ADC) */ |
| 4038 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4039 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4040 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4041 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4042 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4043 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4044 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4045 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4046 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4047 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4048 | * Line In 2 = 0x03 |
| 4049 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4050 | /* mute analog inputs */ |
| 4051 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4052 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4053 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4054 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4055 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4056 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4057 | /* Unmute Front out path */ |
| 4058 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4059 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4060 | /* Unmute Headphone out path */ |
| 4061 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4062 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4063 | /* Unmute Mono out path */ |
| 4064 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4065 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4066 | { } |
| 4067 | }; |
| 4068 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4069 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4070 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4071 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4072 | */ |
| 4073 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4074 | /* Disable all GPIOs */ |
| 4075 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4076 | /* Internal speaker is connected to headphone pin */ |
| 4077 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4078 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4079 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4080 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4081 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4082 | /* Ensure all other unused pins are disabled and muted. */ |
| 4083 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4084 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4085 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4086 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4087 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4088 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4089 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4090 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4091 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4092 | /* Disable digital (SPDIF) pins */ |
| 4093 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4094 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4095 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4096 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4097 | * when acting as an output. |
| 4098 | */ |
| 4099 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4100 | |
| 4101 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4102 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4103 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4104 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4105 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4106 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4107 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4108 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4109 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4110 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4111 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4112 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4113 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4114 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4115 | * If the pin mode is changed by the user the pin mode control will |
| 4116 | * take care of enabling the pin's input/output buffers as needed. |
| 4117 | * Therefore there's no need to enable the input buffer at this |
| 4118 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4119 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4120 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4121 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4122 | * mixer ctrl) |
| 4123 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4124 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4125 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4126 | /* Mute capture amp left and right */ |
| 4127 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4128 | /* Set ADC connection select to match default mixer setting - line |
| 4129 | * in (on mic1 pin) |
| 4130 | */ |
| 4131 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4132 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4133 | /* Do the same for the second ADC: mute capture input amp and |
| 4134 | * set ADC connection to line in (on mic1 pin) |
| 4135 | */ |
| 4136 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4137 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4138 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4139 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4140 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4141 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4142 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4143 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4144 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4145 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4146 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4147 | {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] | 4148 | |
| 4149 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4150 | }; |
| 4151 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4152 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4153 | * similar laptops (adapted from Fujitsu init verbs). |
| 4154 | */ |
| 4155 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4156 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4157 | * the headphone jack. Turn this on and rely on the standard mute |
| 4158 | * methods whenever the user wants to turn these outputs off. |
| 4159 | */ |
| 4160 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4161 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4162 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4163 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4164 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4165 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4166 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4167 | /* Line In jack is connected to Line1 pin */ |
| 4168 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4169 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4170 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4171 | /* Ensure all other unused pins are disabled and muted. */ |
| 4172 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4173 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4174 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4175 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4176 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4177 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4178 | /* Disable digital (SPDIF) pins */ |
| 4179 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4180 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4181 | |
| 4182 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4183 | * bus when acting as outputs. |
| 4184 | */ |
| 4185 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4186 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4187 | |
| 4188 | /* Start with output sum widgets muted and their output gains at min */ |
| 4189 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4190 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4191 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4192 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4193 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4194 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4195 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4196 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4197 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4198 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4199 | /* Unmute Line-out pin widget amp left and right |
| 4200 | * (no equiv mixer ctrl) |
| 4201 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4202 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4203 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4204 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4205 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4206 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4207 | * will take care of enabling the pin's input/output buffers as needed. |
| 4208 | * Therefore there's no need to enable the input buffer at this |
| 4209 | * stage. |
| 4210 | */ |
| 4211 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4212 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4213 | |
| 4214 | /* Mute capture amp left and right */ |
| 4215 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4216 | /* Set ADC connection select to match default mixer setting - mic |
| 4217 | * (on mic1 pin) |
| 4218 | */ |
| 4219 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4220 | |
| 4221 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4222 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4223 | */ |
| 4224 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4225 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4226 | |
| 4227 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4228 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4231 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4232 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4233 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4234 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4235 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4236 | |
| 4237 | { } |
| 4238 | }; |
| 4239 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4240 | static struct hda_verb alc260_will_verbs[] = { |
| 4241 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4242 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4243 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4244 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4245 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4246 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4247 | {} |
| 4248 | }; |
| 4249 | |
| 4250 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4251 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4252 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4253 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4254 | |
| 4255 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4256 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4257 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4258 | |
| 4259 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4260 | {} |
| 4261 | }; |
| 4262 | |
| 4263 | /* toggle speaker-output according to the hp-jack state */ |
| 4264 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4265 | { |
| 4266 | unsigned int present; |
| 4267 | |
| 4268 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4269 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4270 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4271 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4272 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4273 | AC_VERB_SET_GPIO_DATA, 1); |
| 4274 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4275 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4276 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4277 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4278 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4279 | AC_VERB_SET_GPIO_DATA, 0); |
| 4280 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4281 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4282 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4283 | } |
| 4284 | } |
| 4285 | |
| 4286 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4287 | unsigned int res) |
| 4288 | { |
| 4289 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4290 | alc260_replacer_672v_automute(codec); |
| 4291 | } |
| 4292 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4293 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4294 | * configuration. |
| 4295 | */ |
| 4296 | #ifdef CONFIG_SND_DEBUG |
| 4297 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4298 | 0x02, |
| 4299 | }; |
| 4300 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4301 | 0x04, 0x05, |
| 4302 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4303 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4304 | * the signal assignments are different. This assumes that the first ADC |
| 4305 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4306 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4307 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4308 | { |
| 4309 | .num_items = 7, |
| 4310 | .items = { |
| 4311 | { "MIC1 pin", 0x0 }, |
| 4312 | { "MIC2 pin", 0x1 }, |
| 4313 | { "LINE1 pin", 0x2 }, |
| 4314 | { "LINE2 pin", 0x3 }, |
| 4315 | { "CD pin", 0x4 }, |
| 4316 | { "LINE-OUT pin", 0x5 }, |
| 4317 | { "HP-OUT pin", 0x6 }, |
| 4318 | }, |
| 4319 | }, |
| 4320 | { |
| 4321 | .num_items = 8, |
| 4322 | .items = { |
| 4323 | { "MIC1 pin", 0x0 }, |
| 4324 | { "MIC2 pin", 0x1 }, |
| 4325 | { "LINE1 pin", 0x2 }, |
| 4326 | { "LINE2 pin", 0x3 }, |
| 4327 | { "CD pin", 0x4 }, |
| 4328 | { "Mixer", 0x5 }, |
| 4329 | { "LINE-OUT pin", 0x6 }, |
| 4330 | { "HP-OUT pin", 0x7 }, |
| 4331 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4332 | }, |
| 4333 | }; |
| 4334 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4335 | /* Output driver widgets */ |
| 4336 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4337 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4338 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4339 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4340 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4341 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4342 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4343 | /* Modes for retasking pin widgets |
| 4344 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4345 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4346 | * mention this restriction. At this stage it's not clear whether |
| 4347 | * this behaviour is intentional or is a hardware bug in chip |
| 4348 | * revisions available at least up until early 2006. Therefore for |
| 4349 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4350 | * choices, but if it turns out that the lack of mic bias for these |
| 4351 | * NIDs is intentional we could change their modes from |
| 4352 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4353 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4354 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4355 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4356 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4357 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4358 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4359 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4360 | |
| 4361 | /* Loopback mixer controls */ |
| 4362 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4363 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4364 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4365 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4366 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4367 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4368 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4369 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4370 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4371 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4372 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4373 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4374 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4375 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4376 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4377 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4378 | |
| 4379 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4380 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4381 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4382 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4383 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4384 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4385 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4386 | * is ambigious as to which NID is which; testing on laptops which |
| 4387 | * make this output available should provide clarification. |
| 4388 | */ |
| 4389 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4390 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4391 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4392 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4393 | * this output to turn on an external amplifier. |
| 4394 | */ |
| 4395 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4396 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4397 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4398 | { } /* end */ |
| 4399 | }; |
| 4400 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4401 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4402 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4403 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4404 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4405 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4406 | /* Enable retasking pins as output, initially without power amp */ |
| 4407 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4408 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4409 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4410 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4411 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4412 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4413 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4414 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4415 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4416 | * payload also sets the generation to 0, output to be in "consumer" |
| 4417 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4418 | * control. |
| 4419 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4420 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4421 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4422 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4423 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4424 | * OUT1 sum bus when acting as an output. |
| 4425 | */ |
| 4426 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4427 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4428 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4429 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4430 | |
| 4431 | /* Start with output sum widgets muted and their output gains at min */ |
| 4432 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4433 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4434 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4435 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4436 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4437 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4438 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4439 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4440 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4441 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4442 | /* Unmute retasking pin widget output buffers since the default |
| 4443 | * state appears to be output. As the pin mode is changed by the |
| 4444 | * user the pin mode control will take care of enabling the pin's |
| 4445 | * input/output buffers as needed. |
| 4446 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4447 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4448 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4449 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4450 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4451 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4452 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4453 | /* Also unmute the mono-out pin widget */ |
| 4454 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4455 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4456 | /* Mute capture amp left and right */ |
| 4457 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4458 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4459 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4460 | */ |
| 4461 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4462 | |
| 4463 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4464 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4465 | */ |
| 4466 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4467 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4468 | |
| 4469 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4470 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4471 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4472 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4473 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4474 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4475 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4476 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4477 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4478 | |
| 4479 | { } |
| 4480 | }; |
| 4481 | #endif |
| 4482 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4483 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
| 4484 | .substreams = 1, |
| 4485 | .channels_min = 2, |
| 4486 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4487 | }; |
| 4488 | |
| 4489 | static struct hda_pcm_stream alc260_pcm_analog_capture = { |
| 4490 | .substreams = 1, |
| 4491 | .channels_min = 2, |
| 4492 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4493 | }; |
| 4494 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4495 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4496 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4497 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4498 | /* |
| 4499 | * for BIOS auto-configuration |
| 4500 | */ |
| 4501 | |
| 4502 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4503 | const char *pfx) |
| 4504 | { |
| 4505 | hda_nid_t nid_vol; |
| 4506 | unsigned long vol_val, sw_val; |
| 4507 | char name[32]; |
| 4508 | int err; |
| 4509 | |
| 4510 | if (nid >= 0x0f && nid < 0x11) { |
| 4511 | nid_vol = nid - 0x7; |
| 4512 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4513 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4514 | } else if (nid == 0x11) { |
| 4515 | nid_vol = nid - 0x7; |
| 4516 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4517 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4518 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4519 | nid_vol = 0x08; |
| 4520 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4521 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4522 | } else |
| 4523 | return 0; /* N/A */ |
| 4524 | |
| 4525 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4526 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4527 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4528 | return err; |
| 4529 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4530 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4531 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4532 | return err; |
| 4533 | return 1; |
| 4534 | } |
| 4535 | |
| 4536 | /* add playback controls from the parsed DAC table */ |
| 4537 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4538 | const struct auto_pin_cfg *cfg) |
| 4539 | { |
| 4540 | hda_nid_t nid; |
| 4541 | int err; |
| 4542 | |
| 4543 | spec->multiout.num_dacs = 1; |
| 4544 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4545 | spec->multiout.dac_nids[0] = 0x02; |
| 4546 | |
| 4547 | nid = cfg->line_out_pins[0]; |
| 4548 | if (nid) { |
| 4549 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4550 | if (err < 0) |
| 4551 | return err; |
| 4552 | } |
| 4553 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4554 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4555 | if (nid) { |
| 4556 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4557 | if (err < 0) |
| 4558 | return err; |
| 4559 | } |
| 4560 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4561 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4562 | if (nid) { |
| 4563 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4564 | if (err < 0) |
| 4565 | return err; |
| 4566 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4567 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4568 | } |
| 4569 | |
| 4570 | /* create playback/capture controls for input pins */ |
| 4571 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4572 | const struct auto_pin_cfg *cfg) |
| 4573 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4574 | struct hda_input_mux *imux = &spec->private_imux; |
| 4575 | int i, err, idx; |
| 4576 | |
| 4577 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4578 | if (cfg->input_pins[i] >= 0x12) { |
| 4579 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4580 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4581 | auto_pin_cfg_labels[i], idx, |
| 4582 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4583 | if (err < 0) |
| 4584 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4585 | imux->items[imux->num_items].label = |
| 4586 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4587 | imux->items[imux->num_items].index = idx; |
| 4588 | imux->num_items++; |
| 4589 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4590 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4591 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4592 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4593 | auto_pin_cfg_labels[i], idx, |
| 4594 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4595 | if (err < 0) |
| 4596 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4597 | imux->items[imux->num_items].label = |
| 4598 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4599 | imux->items[imux->num_items].index = idx; |
| 4600 | imux->num_items++; |
| 4601 | } |
| 4602 | } |
| 4603 | return 0; |
| 4604 | } |
| 4605 | |
| 4606 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4607 | hda_nid_t nid, int pin_type, |
| 4608 | int sel_idx) |
| 4609 | { |
| 4610 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4611 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4612 | pin_type); |
| 4613 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4614 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4615 | /* need the manual connection? */ |
| 4616 | if (nid >= 0x12) { |
| 4617 | int idx = nid - 0x12; |
| 4618 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4619 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4620 | } |
| 4621 | } |
| 4622 | |
| 4623 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4624 | { |
| 4625 | struct alc_spec *spec = codec->spec; |
| 4626 | hda_nid_t nid; |
| 4627 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4628 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4629 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4630 | if (nid) { |
| 4631 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4632 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4633 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4634 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4635 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4636 | if (nid) |
| 4637 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4638 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4639 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4640 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4641 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4642 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4643 | |
| 4644 | #define ALC260_PIN_CD_NID 0x16 |
| 4645 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4646 | { |
| 4647 | struct alc_spec *spec = codec->spec; |
| 4648 | int i; |
| 4649 | |
| 4650 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4651 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4652 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4653 | snd_hda_codec_write(codec, nid, 0, |
| 4654 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4655 | i <= AUTO_PIN_FRONT_MIC ? |
| 4656 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4657 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4658 | snd_hda_codec_write(codec, nid, 0, |
| 4659 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4660 | AMP_OUT_MUTE); |
| 4661 | } |
| 4662 | } |
| 4663 | } |
| 4664 | |
| 4665 | /* |
| 4666 | * generic initialization of ADC, input mixers and output mixers |
| 4667 | */ |
| 4668 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4669 | /* |
| 4670 | * Unmute ADC0-1 and set the default input to mic-in |
| 4671 | */ |
| 4672 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4673 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4674 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4675 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4676 | |
| 4677 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4678 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4679 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4680 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4681 | */ |
| 4682 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4683 | /* mute analog inputs */ |
| 4684 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4685 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4686 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4687 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4688 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4689 | |
| 4690 | /* |
| 4691 | * Set up output mixers (0x08 - 0x0a) |
| 4692 | */ |
| 4693 | /* set vol=0 to output mixers */ |
| 4694 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4695 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4696 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4697 | /* set up input amps for analog loopback */ |
| 4698 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4699 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4700 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4701 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4702 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4703 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4704 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4705 | |
| 4706 | { } |
| 4707 | }; |
| 4708 | |
| 4709 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4710 | { |
| 4711 | struct alc_spec *spec = codec->spec; |
| 4712 | unsigned int wcap; |
| 4713 | int err; |
| 4714 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4715 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4716 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4717 | alc260_ignore); |
| 4718 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4719 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4720 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4721 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4722 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4723 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4724 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4725 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4726 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4727 | return err; |
| 4728 | |
| 4729 | spec->multiout.max_channels = 2; |
| 4730 | |
| 4731 | if (spec->autocfg.dig_out_pin) |
| 4732 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4733 | if (spec->kctl_alloc) |
| 4734 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4735 | |
| 4736 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4737 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4738 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4739 | spec->input_mux = &spec->private_imux; |
| 4740 | |
| 4741 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4742 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4743 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4744 | if (wcap != AC_WID_AUD_IN) { |
| 4745 | spec->adc_nids = alc260_adc_nids_alt; |
| 4746 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4747 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4748 | } else { |
| 4749 | spec->adc_nids = alc260_adc_nids; |
| 4750 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4751 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4752 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4753 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4754 | |
| 4755 | return 1; |
| 4756 | } |
| 4757 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4758 | /* additional initialization for auto-configuration model */ |
| 4759 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4760 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4761 | alc260_auto_init_multi_out(codec); |
| 4762 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4763 | } |
| 4764 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4765 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4766 | static struct hda_amp_list alc260_loopbacks[] = { |
| 4767 | { 0x07, HDA_INPUT, 0 }, |
| 4768 | { 0x07, HDA_INPUT, 1 }, |
| 4769 | { 0x07, HDA_INPUT, 2 }, |
| 4770 | { 0x07, HDA_INPUT, 3 }, |
| 4771 | { 0x07, HDA_INPUT, 4 }, |
| 4772 | { } /* end */ |
| 4773 | }; |
| 4774 | #endif |
| 4775 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4776 | /* |
| 4777 | * ALC260 configurations |
| 4778 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4779 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4780 | [ALC260_BASIC] = "basic", |
| 4781 | [ALC260_HP] = "hp", |
| 4782 | [ALC260_HP_3013] = "hp-3013", |
| 4783 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4784 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4785 | [ALC260_WILL] = "will", |
| 4786 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4787 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4788 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4789 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4790 | [ALC260_AUTO] = "auto", |
| 4791 | }; |
| 4792 | |
| 4793 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4794 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4795 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 4796 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 4797 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4798 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 4799 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 4800 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 4801 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 4802 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 4803 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 4804 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 4805 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 4806 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 4807 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 4808 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 4809 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4810 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4811 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4812 | {} |
| 4813 | }; |
| 4814 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4815 | static struct alc_config_preset alc260_presets[] = { |
| 4816 | [ALC260_BASIC] = { |
| 4817 | .mixers = { alc260_base_output_mixer, |
| 4818 | alc260_input_mixer, |
| 4819 | alc260_pc_beep_mixer, |
| 4820 | alc260_capture_mixer }, |
| 4821 | .init_verbs = { alc260_init_verbs }, |
| 4822 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4823 | .dac_nids = alc260_dac_nids, |
| 4824 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4825 | .adc_nids = alc260_adc_nids, |
| 4826 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4827 | .channel_mode = alc260_modes, |
| 4828 | .input_mux = &alc260_capture_source, |
| 4829 | }, |
| 4830 | [ALC260_HP] = { |
| 4831 | .mixers = { alc260_base_output_mixer, |
| 4832 | alc260_input_mixer, |
| 4833 | alc260_capture_alt_mixer }, |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4834 | .init_verbs = { alc260_init_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4835 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4836 | .dac_nids = alc260_dac_nids, |
| 4837 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4838 | .adc_nids = alc260_hp_adc_nids, |
| 4839 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4840 | .channel_mode = alc260_modes, |
| 4841 | .input_mux = &alc260_capture_source, |
| 4842 | }, |
| 4843 | [ALC260_HP_3013] = { |
| 4844 | .mixers = { alc260_hp_3013_mixer, |
| 4845 | alc260_input_mixer, |
| 4846 | alc260_capture_alt_mixer }, |
| 4847 | .init_verbs = { alc260_hp_3013_init_verbs }, |
| 4848 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4849 | .dac_nids = alc260_dac_nids, |
| 4850 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4851 | .adc_nids = alc260_hp_adc_nids, |
| 4852 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4853 | .channel_mode = alc260_modes, |
| 4854 | .input_mux = &alc260_capture_source, |
| 4855 | }, |
| 4856 | [ALC260_FUJITSU_S702X] = { |
| 4857 | .mixers = { alc260_fujitsu_mixer, |
| 4858 | alc260_capture_mixer }, |
| 4859 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 4860 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4861 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4862 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4863 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4864 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4865 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4866 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 4867 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4868 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4869 | [ALC260_ACER] = { |
| 4870 | .mixers = { alc260_acer_mixer, |
| 4871 | alc260_capture_mixer }, |
| 4872 | .init_verbs = { alc260_acer_init_verbs }, |
| 4873 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4874 | .dac_nids = alc260_dac_nids, |
| 4875 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4876 | .adc_nids = alc260_dual_adc_nids, |
| 4877 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4878 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4879 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 4880 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4881 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4882 | [ALC260_WILL] = { |
| 4883 | .mixers = { alc260_will_mixer, |
| 4884 | alc260_capture_mixer }, |
| 4885 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 4886 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4887 | .dac_nids = alc260_dac_nids, |
| 4888 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4889 | .adc_nids = alc260_adc_nids, |
| 4890 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4891 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4892 | .channel_mode = alc260_modes, |
| 4893 | .input_mux = &alc260_capture_source, |
| 4894 | }, |
| 4895 | [ALC260_REPLACER_672V] = { |
| 4896 | .mixers = { alc260_replacer_672v_mixer, |
| 4897 | alc260_capture_mixer }, |
| 4898 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 4899 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4900 | .dac_nids = alc260_dac_nids, |
| 4901 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4902 | .adc_nids = alc260_adc_nids, |
| 4903 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4904 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4905 | .channel_mode = alc260_modes, |
| 4906 | .input_mux = &alc260_capture_source, |
| 4907 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 4908 | .init_hook = alc260_replacer_672v_automute, |
| 4909 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4910 | #ifdef CONFIG_SND_DEBUG |
| 4911 | [ALC260_TEST] = { |
| 4912 | .mixers = { alc260_test_mixer, |
| 4913 | alc260_capture_mixer }, |
| 4914 | .init_verbs = { alc260_test_init_verbs }, |
| 4915 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 4916 | .dac_nids = alc260_test_dac_nids, |
| 4917 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 4918 | .adc_nids = alc260_test_adc_nids, |
| 4919 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4920 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4921 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 4922 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4923 | }, |
| 4924 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4925 | }; |
| 4926 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4927 | static int patch_alc260(struct hda_codec *codec) |
| 4928 | { |
| 4929 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4930 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4931 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4932 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4933 | if (spec == NULL) |
| 4934 | return -ENOMEM; |
| 4935 | |
| 4936 | codec->spec = spec; |
| 4937 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4938 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 4939 | alc260_models, |
| 4940 | alc260_cfg_tbl); |
| 4941 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4942 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 4943 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4944 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4945 | } |
| 4946 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4947 | if (board_config == ALC260_AUTO) { |
| 4948 | /* automatic parse from the BIOS config */ |
| 4949 | err = alc260_parse_auto_config(codec); |
| 4950 | if (err < 0) { |
| 4951 | alc_free(codec); |
| 4952 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4953 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4954 | printk(KERN_INFO |
| 4955 | "hda_codec: Cannot set up configuration " |
| 4956 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4957 | board_config = ALC260_BASIC; |
| 4958 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4959 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4961 | if (board_config != ALC260_AUTO) |
| 4962 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4963 | |
| 4964 | spec->stream_name_analog = "ALC260 Analog"; |
| 4965 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 4966 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 4967 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4968 | spec->stream_name_digital = "ALC260 Digital"; |
| 4969 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 4970 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 4971 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4972 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4973 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4974 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4975 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4976 | if (!spec->loopback.amplist) |
| 4977 | spec->loopback.amplist = alc260_loopbacks; |
| 4978 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4979 | |
| 4980 | return 0; |
| 4981 | } |
| 4982 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4983 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4984 | /* |
| 4985 | * ALC882 support |
| 4986 | * |
| 4987 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 4988 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 4989 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 4990 | * 6-channel independent captures. |
| 4991 | * |
| 4992 | * In addition, an independent DAC for the multi-playback (not used in this |
| 4993 | * driver yet). |
| 4994 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4995 | #define ALC882_DIGOUT_NID 0x06 |
| 4996 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4997 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4998 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4999 | { 8, NULL } |
| 5000 | }; |
| 5001 | |
| 5002 | static hda_nid_t alc882_dac_nids[4] = { |
| 5003 | /* front, rear, clfe, rear_surr */ |
| 5004 | 0x02, 0x03, 0x04, 0x05 |
| 5005 | }; |
| 5006 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5007 | /* identical with ALC880 */ |
| 5008 | #define alc882_adc_nids alc880_adc_nids |
| 5009 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5010 | |
| 5011 | /* input MUX */ |
| 5012 | /* FIXME: should be a matrix-type input source selection */ |
| 5013 | |
| 5014 | static struct hda_input_mux alc882_capture_source = { |
| 5015 | .num_items = 4, |
| 5016 | .items = { |
| 5017 | { "Mic", 0x0 }, |
| 5018 | { "Front Mic", 0x1 }, |
| 5019 | { "Line", 0x2 }, |
| 5020 | { "CD", 0x4 }, |
| 5021 | }, |
| 5022 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5023 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5024 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5025 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5026 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5027 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5028 | { |
| 5029 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5030 | struct alc_spec *spec = codec->spec; |
| 5031 | const struct hda_input_mux *imux = spec->input_mux; |
| 5032 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 5033 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 5034 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 5035 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5036 | unsigned int i, idx; |
| 5037 | |
| 5038 | idx = ucontrol->value.enumerated.item[0]; |
| 5039 | if (idx >= imux->num_items) |
| 5040 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5041 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5042 | return 0; |
| 5043 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5044 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5045 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5046 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5047 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5048 | } |
| 5049 | *cur_val = idx; |
| 5050 | return 1; |
| 5051 | } |
| 5052 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5053 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5054 | * 2ch mode |
| 5055 | */ |
| 5056 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5057 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5058 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5059 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5060 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5061 | { } /* end */ |
| 5062 | }; |
| 5063 | |
| 5064 | /* |
| 5065 | * 6ch mode |
| 5066 | */ |
| 5067 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5068 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5069 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5070 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5071 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5072 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5073 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5074 | { } /* end */ |
| 5075 | }; |
| 5076 | |
| 5077 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5078 | { 2, alc882_3ST_ch2_init }, |
| 5079 | { 6, alc882_3ST_ch6_init }, |
| 5080 | }; |
| 5081 | |
| 5082 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5083 | * 6ch mode |
| 5084 | */ |
| 5085 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5086 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5087 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5088 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5089 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5090 | { } /* end */ |
| 5091 | }; |
| 5092 | |
| 5093 | /* |
| 5094 | * 8ch mode |
| 5095 | */ |
| 5096 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5097 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5098 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5099 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5100 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5101 | { } /* end */ |
| 5102 | }; |
| 5103 | |
| 5104 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5105 | { 6, alc882_sixstack_ch6_init }, |
| 5106 | { 8, alc882_sixstack_ch8_init }, |
| 5107 | }; |
| 5108 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5109 | /* |
| 5110 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5111 | */ |
| 5112 | |
| 5113 | /* |
| 5114 | * 2ch mode |
| 5115 | */ |
| 5116 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5117 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5118 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5119 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5120 | { } /* end */ |
| 5121 | }; |
| 5122 | |
| 5123 | /* |
| 5124 | * 6ch mode |
| 5125 | */ |
| 5126 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5127 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5128 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5129 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5130 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5131 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5132 | { } /* end */ |
| 5133 | }; |
| 5134 | |
| 5135 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5136 | { 2, alc885_mbp_ch2_init }, |
| 5137 | { 6, alc885_mbp_ch6_init }, |
| 5138 | }; |
| 5139 | |
| 5140 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5141 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5142 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5143 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5144 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5145 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5146 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5147 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5148 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5149 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5150 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5151 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5152 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5153 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5154 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5155 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5156 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5157 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5158 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5159 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5160 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5161 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5162 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5163 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5164 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5165 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5166 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5167 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5168 | { } /* end */ |
| 5169 | }; |
| 5170 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5171 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
| 5172 | HDA_CODEC_VOLUME("Master Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5173 | HDA_BIND_MUTE ("Master Switch", 0x0c, 0x02, HDA_INPUT), |
| 5174 | HDA_CODEC_MUTE ("Speaker Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5175 | HDA_CODEC_VOLUME("Line Out Volume", 0x0d,0x00, HDA_OUTPUT), |
| 5176 | HDA_CODEC_VOLUME("Line In Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5177 | HDA_CODEC_MUTE ("Line In Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5178 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5179 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 5180 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0x00, HDA_INPUT), |
| 5181 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5182 | { } /* end */ |
| 5183 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5184 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5185 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5186 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5187 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5188 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5189 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5190 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5191 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5192 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5194 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5195 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5196 | { } /* end */ |
| 5197 | }; |
| 5198 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5199 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5200 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5201 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5202 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5203 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5204 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5205 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5206 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5207 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5208 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5209 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5210 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5211 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5212 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5213 | { } /* end */ |
| 5214 | }; |
| 5215 | |
| 5216 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5217 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5218 | */ |
| 5219 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5220 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5221 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5222 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5223 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5224 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5225 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5226 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5227 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5228 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5229 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5230 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5231 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5232 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5233 | { } /* end */ |
| 5234 | }; |
| 5235 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5236 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5237 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5238 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5239 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5240 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5241 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5242 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5243 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5244 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5245 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5246 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5247 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5248 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5249 | { } /* end */ |
| 5250 | }; |
| 5251 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5252 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5253 | { |
| 5254 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5255 | .name = "Channel Mode", |
| 5256 | .info = alc_ch_mode_info, |
| 5257 | .get = alc_ch_mode_get, |
| 5258 | .put = alc_ch_mode_put, |
| 5259 | }, |
| 5260 | { } /* end */ |
| 5261 | }; |
| 5262 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5263 | static struct hda_verb alc882_init_verbs[] = { |
| 5264 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5265 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5266 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5267 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5268 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5269 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5270 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5271 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5272 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5273 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5274 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5275 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5276 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5277 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5278 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5279 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5280 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5281 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5282 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5283 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5284 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5285 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5286 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5287 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5288 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5289 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5290 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5291 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5292 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5293 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5294 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5295 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5296 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5297 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5298 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5299 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5300 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5301 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5302 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5303 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5304 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5305 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5306 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5307 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5308 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5309 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5310 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5311 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5312 | |
| 5313 | /* FIXME: use matrix-type input source selection */ |
| 5314 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5315 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5316 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5317 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5318 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5319 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5320 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5321 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5322 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5323 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5324 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5325 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5326 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5327 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5328 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5329 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5330 | /* ADC1: mute amp left and right */ |
| 5331 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5332 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5333 | /* ADC2: mute amp left and right */ |
| 5334 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5335 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5336 | /* ADC3: mute amp left and right */ |
| 5337 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5338 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5339 | |
| 5340 | { } |
| 5341 | }; |
| 5342 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5343 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5344 | /* change to EAPD mode */ |
| 5345 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5346 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5347 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5348 | }; |
| 5349 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5350 | /* Mac Pro test */ |
| 5351 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5352 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5353 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5354 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5355 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5356 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5357 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5358 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5359 | { } /* end */ |
| 5360 | }; |
| 5361 | |
| 5362 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5363 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5364 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5365 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5367 | /* Front Pin: output 0 (0x0c) */ |
| 5368 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5369 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5371 | /* Front Mic pin: input vref at 80% */ |
| 5372 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5373 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5374 | /* Speaker: output */ |
| 5375 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5376 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5377 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5378 | /* Headphone output (output 0 - 0x0c) */ |
| 5379 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5380 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5381 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5382 | |
| 5383 | /* FIXME: use matrix-type input source selection */ |
| 5384 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5385 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5386 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5387 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5388 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5389 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5390 | /* Input mixer2 */ |
| 5391 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5393 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5394 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5395 | /* Input mixer3 */ |
| 5396 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5400 | /* ADC1: mute amp left and right */ |
| 5401 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5402 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5403 | /* ADC2: mute amp left and right */ |
| 5404 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5405 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5406 | /* ADC3: mute amp left and right */ |
| 5407 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5408 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5409 | |
| 5410 | { } |
| 5411 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5412 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5413 | /* Macbook Pro rev3 */ |
| 5414 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5415 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5416 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5417 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5418 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5419 | /* Rear mixer */ |
| 5420 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5421 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5422 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5423 | /* Front Pin: output 0 (0x0c) */ |
| 5424 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5425 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5426 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5427 | /* HP Pin: output 0 (0x0d) */ |
| 5428 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5429 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5430 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5431 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5432 | /* Mic (rear) pin: input vref at 80% */ |
| 5433 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5434 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5435 | /* Front Mic pin: input vref at 80% */ |
| 5436 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5437 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5438 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5439 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5440 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5441 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5442 | |
| 5443 | /* FIXME: use matrix-type input source selection */ |
| 5444 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5445 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5446 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5447 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5448 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5449 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5450 | /* Input mixer2 */ |
| 5451 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5452 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5453 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5454 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5455 | /* Input mixer3 */ |
| 5456 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5457 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5459 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5460 | /* ADC1: mute amp left and right */ |
| 5461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5462 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5463 | /* ADC2: mute amp left and right */ |
| 5464 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5465 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5466 | /* ADC3: mute amp left and right */ |
| 5467 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5468 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5469 | |
| 5470 | { } |
| 5471 | }; |
| 5472 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5473 | /* iMac 24 mixer. */ |
| 5474 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5475 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5476 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5477 | { } /* end */ |
| 5478 | }; |
| 5479 | |
| 5480 | /* iMac 24 init verbs. */ |
| 5481 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5482 | /* Internal speakers: output 0 (0x0c) */ |
| 5483 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5484 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5485 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5486 | /* Internal speakers: output 0 (0x0c) */ |
| 5487 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5488 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5489 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5490 | /* Headphone: output 0 (0x0c) */ |
| 5491 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5492 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5493 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5494 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5495 | /* Front Mic: input vref at 80% */ |
| 5496 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5497 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5498 | { } |
| 5499 | }; |
| 5500 | |
| 5501 | /* Toggle speaker-output according to the hp-jack state */ |
| 5502 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5503 | { |
| 5504 | unsigned int present; |
| 5505 | |
| 5506 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5507 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5508 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5509 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5510 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5511 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5512 | } |
| 5513 | |
| 5514 | /* Processes unsolicited events. */ |
| 5515 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5516 | unsigned int res) |
| 5517 | { |
| 5518 | /* Headphone insertion or removal. */ |
| 5519 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5520 | alc885_imac24_automute(codec); |
| 5521 | } |
| 5522 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5523 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5524 | { |
| 5525 | unsigned int present; |
| 5526 | |
| 5527 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5528 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5529 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5530 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5531 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5532 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5533 | |
| 5534 | } |
| 5535 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5536 | unsigned int res) |
| 5537 | { |
| 5538 | /* Headphone insertion or removal. */ |
| 5539 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5540 | alc885_mbp3_automute(codec); |
| 5541 | } |
| 5542 | |
| 5543 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5544 | static struct hda_verb alc882_targa_verbs[] = { |
| 5545 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5546 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5547 | |
| 5548 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5549 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5550 | |
| 5551 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5552 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5553 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5554 | |
| 5555 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5556 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5557 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5558 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5559 | { } /* end */ |
| 5560 | }; |
| 5561 | |
| 5562 | /* toggle speaker-output according to the hp-jack state */ |
| 5563 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5564 | { |
| 5565 | unsigned int present; |
| 5566 | |
| 5567 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5568 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5569 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5570 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5571 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5572 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5573 | } |
| 5574 | |
| 5575 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5576 | { |
| 5577 | /* Looks like the unsol event is incompatible with the standard |
| 5578 | * definition. 4bit tag is placed at 26 bit! |
| 5579 | */ |
| 5580 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5581 | alc882_targa_automute(codec); |
| 5582 | } |
| 5583 | } |
| 5584 | |
| 5585 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5586 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5587 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5588 | |
| 5589 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5590 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5591 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5592 | |
| 5593 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5594 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5595 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5596 | |
| 5597 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5598 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5599 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5600 | { } /* end */ |
| 5601 | }; |
| 5602 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5603 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5604 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5605 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5606 | |
| 5607 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5608 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5609 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5610 | |
| 5611 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5612 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5613 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5614 | |
| 5615 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5616 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5617 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5618 | { } /* end */ |
| 5619 | }; |
| 5620 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5621 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5622 | { |
| 5623 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5624 | |
| 5625 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5626 | AC_VERB_GET_GPIO_DATA, 0); |
| 5627 | |
| 5628 | if (!muted) |
| 5629 | gpiostate |= (1 << pin); |
| 5630 | else |
| 5631 | gpiostate &= ~(1 << pin); |
| 5632 | |
| 5633 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5634 | AC_VERB_GET_GPIO_MASK, 0); |
| 5635 | gpiomask |= (1 << pin); |
| 5636 | |
| 5637 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5638 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5639 | gpiodir |= (1 << pin); |
| 5640 | |
| 5641 | |
| 5642 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5643 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5644 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5645 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5646 | |
| 5647 | msleep(1); |
| 5648 | |
| 5649 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5650 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5651 | } |
| 5652 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5653 | /* set up GPIO at initialization */ |
| 5654 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5655 | { |
| 5656 | alc882_gpio_mute(codec, 0, 0); |
| 5657 | alc882_gpio_mute(codec, 1, 0); |
| 5658 | } |
| 5659 | |
| 5660 | /* set up GPIO and update auto-muting at initialization */ |
| 5661 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5662 | { |
| 5663 | alc885_macpro_init_hook(codec); |
| 5664 | alc885_imac24_automute(codec); |
| 5665 | } |
| 5666 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5667 | /* |
| 5668 | * generic initialization of ADC, input mixers and output mixers |
| 5669 | */ |
| 5670 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5671 | /* |
| 5672 | * Unmute ADC0-2 and set the default input to mic-in |
| 5673 | */ |
| 5674 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5675 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5676 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5677 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5678 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5679 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5680 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5681 | /* 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] | 5682 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5683 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5684 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5685 | */ |
| 5686 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5687 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5688 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5689 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5690 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5691 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5692 | |
| 5693 | /* |
| 5694 | * Set up output mixers (0x0c - 0x0f) |
| 5695 | */ |
| 5696 | /* set vol=0 to output mixers */ |
| 5697 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5698 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5699 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5700 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5701 | /* set up input amps for analog loopback */ |
| 5702 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5703 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5704 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5705 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5706 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5707 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5708 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5709 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5710 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5711 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5712 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5713 | |
| 5714 | /* FIXME: use matrix-type input source selection */ |
| 5715 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5716 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5717 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5718 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5719 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5720 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5721 | /* Input mixer2 */ |
| 5722 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5723 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5724 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5725 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5726 | /* Input mixer3 */ |
| 5727 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5730 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5731 | |
| 5732 | { } |
| 5733 | }; |
| 5734 | |
| 5735 | /* capture mixer elements */ |
| 5736 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5737 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5738 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5739 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5740 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5741 | { |
| 5742 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5743 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5744 | * So call somewhat different.. |
| 5745 | * FIXME: the controls appear in the "playback" view! |
| 5746 | */ |
| 5747 | /* .name = "Capture Source", */ |
| 5748 | .name = "Input Source", |
| 5749 | .count = 2, |
| 5750 | .info = alc882_mux_enum_info, |
| 5751 | .get = alc882_mux_enum_get, |
| 5752 | .put = alc882_mux_enum_put, |
| 5753 | }, |
| 5754 | { } /* end */ |
| 5755 | }; |
| 5756 | |
| 5757 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5758 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5759 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5760 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5761 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5762 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5763 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5764 | { |
| 5765 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5766 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5767 | * So call somewhat different.. |
| 5768 | * FIXME: the controls appear in the "playback" view! |
| 5769 | */ |
| 5770 | /* .name = "Capture Source", */ |
| 5771 | .name = "Input Source", |
| 5772 | .count = 3, |
| 5773 | .info = alc882_mux_enum_info, |
| 5774 | .get = alc882_mux_enum_get, |
| 5775 | .put = alc882_mux_enum_put, |
| 5776 | }, |
| 5777 | { } /* end */ |
| 5778 | }; |
| 5779 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5780 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5781 | #define alc882_loopbacks alc880_loopbacks |
| 5782 | #endif |
| 5783 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5784 | /* pcm configuration: identiacal with ALC880 */ |
| 5785 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 5786 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 5787 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 5788 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 5789 | |
| 5790 | /* |
| 5791 | * configuration and preset |
| 5792 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5793 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 5794 | [ALC882_3ST_DIG] = "3stack-dig", |
| 5795 | [ALC882_6ST_DIG] = "6stack-dig", |
| 5796 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5797 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 5798 | [ALC882_TARGA] = "targa", |
| 5799 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 5800 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5801 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5802 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5803 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5804 | [ALC882_AUTO] = "auto", |
| 5805 | }; |
| 5806 | |
| 5807 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 5808 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5809 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 5810 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5811 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5812 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 5813 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 5814 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5815 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
| 5816 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 5817 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 5818 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5819 | {} |
| 5820 | }; |
| 5821 | |
| 5822 | static struct alc_config_preset alc882_presets[] = { |
| 5823 | [ALC882_3ST_DIG] = { |
| 5824 | .mixers = { alc882_base_mixer }, |
| 5825 | .init_verbs = { alc882_init_verbs }, |
| 5826 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5827 | .dac_nids = alc882_dac_nids, |
| 5828 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5829 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5830 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5831 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5832 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5833 | .input_mux = &alc882_capture_source, |
| 5834 | }, |
| 5835 | [ALC882_6ST_DIG] = { |
| 5836 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5837 | .init_verbs = { alc882_init_verbs }, |
| 5838 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5839 | .dac_nids = alc882_dac_nids, |
| 5840 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5841 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5842 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5843 | .channel_mode = alc882_sixstack_modes, |
| 5844 | .input_mux = &alc882_capture_source, |
| 5845 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5846 | [ALC882_ARIMA] = { |
| 5847 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5848 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 5849 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5850 | .dac_nids = alc882_dac_nids, |
| 5851 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5852 | .channel_mode = alc882_sixstack_modes, |
| 5853 | .input_mux = &alc882_capture_source, |
| 5854 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5855 | [ALC882_W2JC] = { |
| 5856 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 5857 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5858 | alc880_gpio1_init_verbs }, |
| 5859 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5860 | .dac_nids = alc882_dac_nids, |
| 5861 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5862 | .channel_mode = alc880_threestack_modes, |
| 5863 | .need_dac_fix = 1, |
| 5864 | .input_mux = &alc882_capture_source, |
| 5865 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5866 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5867 | [ALC885_MBP3] = { |
| 5868 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 5869 | .init_verbs = { alc885_mbp3_init_verbs, |
| 5870 | alc880_gpio1_init_verbs }, |
| 5871 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5872 | .dac_nids = alc882_dac_nids, |
| 5873 | .channel_mode = alc885_mbp_6ch_modes, |
| 5874 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 5875 | .input_mux = &alc882_capture_source, |
| 5876 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5877 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5878 | .unsol_event = alc885_mbp3_unsol_event, |
| 5879 | .init_hook = alc885_mbp3_automute, |
| 5880 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5881 | [ALC885_MACPRO] = { |
| 5882 | .mixers = { alc882_macpro_mixer }, |
| 5883 | .init_verbs = { alc882_macpro_init_verbs }, |
| 5884 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5885 | .dac_nids = alc882_dac_nids, |
| 5886 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5887 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5888 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5889 | .channel_mode = alc882_ch_modes, |
| 5890 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5891 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5892 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5893 | [ALC885_IMAC24] = { |
| 5894 | .mixers = { alc885_imac24_mixer }, |
| 5895 | .init_verbs = { alc885_imac24_init_verbs }, |
| 5896 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5897 | .dac_nids = alc882_dac_nids, |
| 5898 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5899 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5900 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5901 | .channel_mode = alc882_ch_modes, |
| 5902 | .input_mux = &alc882_capture_source, |
| 5903 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5904 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5905 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5906 | [ALC882_TARGA] = { |
| 5907 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 5908 | alc882_capture_mixer }, |
| 5909 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 5910 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5911 | .dac_nids = alc882_dac_nids, |
| 5912 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5913 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5914 | .adc_nids = alc882_adc_nids, |
| 5915 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5916 | .channel_mode = alc882_3ST_6ch_modes, |
| 5917 | .need_dac_fix = 1, |
| 5918 | .input_mux = &alc882_capture_source, |
| 5919 | .unsol_event = alc882_targa_unsol_event, |
| 5920 | .init_hook = alc882_targa_automute, |
| 5921 | }, |
| 5922 | [ALC882_ASUS_A7J] = { |
| 5923 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 5924 | alc882_capture_mixer }, |
| 5925 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 5926 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5927 | .dac_nids = alc882_dac_nids, |
| 5928 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5929 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5930 | .adc_nids = alc882_adc_nids, |
| 5931 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5932 | .channel_mode = alc882_3ST_6ch_modes, |
| 5933 | .need_dac_fix = 1, |
| 5934 | .input_mux = &alc882_capture_source, |
| 5935 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5936 | [ALC882_ASUS_A7M] = { |
| 5937 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 5938 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5939 | alc880_gpio1_init_verbs, |
| 5940 | alc882_asus_a7m_verbs }, |
| 5941 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5942 | .dac_nids = alc882_dac_nids, |
| 5943 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5944 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5945 | .channel_mode = alc880_threestack_modes, |
| 5946 | .need_dac_fix = 1, |
| 5947 | .input_mux = &alc882_capture_source, |
| 5948 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5949 | }; |
| 5950 | |
| 5951 | |
| 5952 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 5953 | * Pin config fixes |
| 5954 | */ |
| 5955 | enum { |
| 5956 | PINFIX_ABIT_AW9D_MAX |
| 5957 | }; |
| 5958 | |
| 5959 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 5960 | { 0x15, 0x01080104 }, /* side */ |
| 5961 | { 0x16, 0x01011012 }, /* rear */ |
| 5962 | { 0x17, 0x01016011 }, /* clfe */ |
| 5963 | { } |
| 5964 | }; |
| 5965 | |
| 5966 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 5967 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 5968 | }; |
| 5969 | |
| 5970 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 5971 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 5972 | {} |
| 5973 | }; |
| 5974 | |
| 5975 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5976 | * BIOS auto configuration |
| 5977 | */ |
| 5978 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5979 | hda_nid_t nid, int pin_type, |
| 5980 | int dac_idx) |
| 5981 | { |
| 5982 | /* set as output */ |
| 5983 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5984 | int idx; |
| 5985 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5986 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 5987 | idx = 4; |
| 5988 | else |
| 5989 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 5990 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5991 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5992 | pin_type); |
| 5993 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5994 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5995 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 5996 | |
| 5997 | } |
| 5998 | |
| 5999 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6000 | { |
| 6001 | struct alc_spec *spec = codec->spec; |
| 6002 | int i; |
| 6003 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6004 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6005 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6006 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6007 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6008 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6009 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6010 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6011 | } |
| 6012 | } |
| 6013 | |
| 6014 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6015 | { |
| 6016 | struct alc_spec *spec = codec->spec; |
| 6017 | hda_nid_t pin; |
| 6018 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6019 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6020 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6021 | /* use dac 0 */ |
| 6022 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6023 | } |
| 6024 | |
| 6025 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6026 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6027 | |
| 6028 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6029 | { |
| 6030 | struct alc_spec *spec = codec->spec; |
| 6031 | int i; |
| 6032 | |
| 6033 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6034 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6035 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6036 | snd_hda_codec_write(codec, nid, 0, |
| 6037 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6038 | i <= AUTO_PIN_FRONT_MIC ? |
| 6039 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6040 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6041 | snd_hda_codec_write(codec, nid, 0, |
| 6042 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6043 | AMP_OUT_MUTE); |
| 6044 | } |
| 6045 | } |
| 6046 | } |
| 6047 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6048 | /* add mic boosts if needed */ |
| 6049 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6050 | { |
| 6051 | struct alc_spec *spec = codec->spec; |
| 6052 | int err; |
| 6053 | hda_nid_t nid; |
| 6054 | |
| 6055 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 6056 | if (nid) { |
| 6057 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6058 | "Mic Boost", |
| 6059 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6060 | if (err < 0) |
| 6061 | return err; |
| 6062 | } |
| 6063 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 6064 | if (nid) { |
| 6065 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6066 | "Front Mic Boost", |
| 6067 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6068 | if (err < 0) |
| 6069 | return err; |
| 6070 | } |
| 6071 | return 0; |
| 6072 | } |
| 6073 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6074 | /* almost identical with ALC880 parser... */ |
| 6075 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6076 | { |
| 6077 | struct alc_spec *spec = codec->spec; |
| 6078 | int err = alc880_parse_auto_config(codec); |
| 6079 | |
| 6080 | if (err < 0) |
| 6081 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6082 | else if (!err) |
| 6083 | return 0; /* no config found */ |
| 6084 | |
| 6085 | err = alc_auto_add_mic_boost(codec); |
| 6086 | if (err < 0) |
| 6087 | return err; |
| 6088 | |
| 6089 | /* hack - override the init verbs */ |
| 6090 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6091 | |
| 6092 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6093 | } |
| 6094 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6095 | /* additional initialization for auto-configuration model */ |
| 6096 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6097 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6098 | alc882_auto_init_multi_out(codec); |
| 6099 | alc882_auto_init_hp_out(codec); |
| 6100 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6101 | } |
| 6102 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6103 | static int patch_alc882(struct hda_codec *codec) |
| 6104 | { |
| 6105 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6106 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6107 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6108 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6109 | if (spec == NULL) |
| 6110 | return -ENOMEM; |
| 6111 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6112 | codec->spec = spec; |
| 6113 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6114 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6115 | alc882_models, |
| 6116 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6117 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6118 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6119 | /* Pick up systems that don't supply PCI SSID */ |
| 6120 | switch (codec->subsystem_id) { |
| 6121 | case 0x106b0c00: /* Mac Pro */ |
| 6122 | board_config = ALC885_MACPRO; |
| 6123 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6124 | case 0x106b1000: /* iMac 24 */ |
| 6125 | board_config = ALC885_IMAC24; |
| 6126 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame^] | 6127 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6128 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6129 | board_config = ALC885_MBP3; |
| 6130 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6131 | default: |
| 6132 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6133 | "trying auto-probe from BIOS...\n"); |
| 6134 | board_config = ALC882_AUTO; |
| 6135 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6136 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6137 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6138 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6139 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6140 | if (board_config == ALC882_AUTO) { |
| 6141 | /* automatic parse from the BIOS config */ |
| 6142 | err = alc882_parse_auto_config(codec); |
| 6143 | if (err < 0) { |
| 6144 | alc_free(codec); |
| 6145 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6146 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6147 | printk(KERN_INFO |
| 6148 | "hda_codec: Cannot set up configuration " |
| 6149 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6150 | board_config = ALC882_3ST_DIG; |
| 6151 | } |
| 6152 | } |
| 6153 | |
| 6154 | if (board_config != ALC882_AUTO) |
| 6155 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6156 | |
| 6157 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6158 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6159 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6160 | |
| 6161 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6162 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6163 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6164 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6165 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6166 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6167 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6168 | /* get type */ |
| 6169 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6170 | if (wcap != AC_WID_AUD_IN) { |
| 6171 | spec->adc_nids = alc882_adc_nids_alt; |
| 6172 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6173 | spec->mixers[spec->num_mixers] = |
| 6174 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6175 | spec->num_mixers++; |
| 6176 | } else { |
| 6177 | spec->adc_nids = alc882_adc_nids; |
| 6178 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 6179 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6180 | spec->num_mixers++; |
| 6181 | } |
| 6182 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6183 | |
| 6184 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6185 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6186 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6187 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6188 | if (!spec->loopback.amplist) |
| 6189 | spec->loopback.amplist = alc882_loopbacks; |
| 6190 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6191 | |
| 6192 | return 0; |
| 6193 | } |
| 6194 | |
| 6195 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6196 | * ALC883 support |
| 6197 | * |
| 6198 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6199 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6200 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6201 | * 6-channel independent captures. |
| 6202 | * |
| 6203 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6204 | * driver yet). |
| 6205 | */ |
| 6206 | #define ALC883_DIGOUT_NID 0x06 |
| 6207 | #define ALC883_DIGIN_NID 0x0a |
| 6208 | |
| 6209 | static hda_nid_t alc883_dac_nids[4] = { |
| 6210 | /* front, rear, clfe, rear_surr */ |
| 6211 | 0x02, 0x04, 0x03, 0x05 |
| 6212 | }; |
| 6213 | |
| 6214 | static hda_nid_t alc883_adc_nids[2] = { |
| 6215 | /* ADC1-2 */ |
| 6216 | 0x08, 0x09, |
| 6217 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6218 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6219 | /* input MUX */ |
| 6220 | /* FIXME: should be a matrix-type input source selection */ |
| 6221 | |
| 6222 | static struct hda_input_mux alc883_capture_source = { |
| 6223 | .num_items = 4, |
| 6224 | .items = { |
| 6225 | { "Mic", 0x0 }, |
| 6226 | { "Front Mic", 0x1 }, |
| 6227 | { "Line", 0x2 }, |
| 6228 | { "CD", 0x4 }, |
| 6229 | }, |
| 6230 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6231 | |
| 6232 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6233 | .num_items = 2, |
| 6234 | .items = { |
| 6235 | { "Mic", 0x1 }, |
| 6236 | { "Line", 0x2 }, |
| 6237 | }, |
| 6238 | }; |
| 6239 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6240 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6241 | .num_items = 4, |
| 6242 | .items = { |
| 6243 | { "Mic", 0x0 }, |
| 6244 | { "iMic", 0x1 }, |
| 6245 | { "Line", 0x2 }, |
| 6246 | { "CD", 0x4 }, |
| 6247 | }, |
| 6248 | }; |
| 6249 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6250 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6251 | #define alc883_mux_enum_get alc_mux_enum_get |
| 6252 | |
| 6253 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 6254 | struct snd_ctl_elem_value *ucontrol) |
| 6255 | { |
| 6256 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6257 | struct alc_spec *spec = codec->spec; |
| 6258 | const struct hda_input_mux *imux = spec->input_mux; |
| 6259 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 6260 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 6261 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 6262 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 6263 | unsigned int i, idx; |
| 6264 | |
| 6265 | idx = ucontrol->value.enumerated.item[0]; |
| 6266 | if (idx >= imux->num_items) |
| 6267 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6268 | if (*cur_val == idx) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6269 | return 0; |
| 6270 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6271 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 6272 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6273 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6274 | HDA_AMP_MUTE, v); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6275 | } |
| 6276 | *cur_val = idx; |
| 6277 | return 1; |
| 6278 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6279 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6280 | /* |
| 6281 | * 2ch mode |
| 6282 | */ |
| 6283 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6284 | { 2, NULL } |
| 6285 | }; |
| 6286 | |
| 6287 | /* |
| 6288 | * 2ch mode |
| 6289 | */ |
| 6290 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6291 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6292 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6293 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6294 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6295 | { } /* end */ |
| 6296 | }; |
| 6297 | |
| 6298 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6299 | * 4ch mode |
| 6300 | */ |
| 6301 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6302 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6303 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6304 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6305 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6306 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6307 | { } /* end */ |
| 6308 | }; |
| 6309 | |
| 6310 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6311 | * 6ch mode |
| 6312 | */ |
| 6313 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6314 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6315 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6316 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6317 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6318 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6319 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6320 | { } /* end */ |
| 6321 | }; |
| 6322 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6323 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6324 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6325 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6326 | { 6, alc883_3ST_ch6_init }, |
| 6327 | }; |
| 6328 | |
| 6329 | /* |
| 6330 | * 6ch mode |
| 6331 | */ |
| 6332 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6333 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6334 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6335 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6336 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6337 | { } /* end */ |
| 6338 | }; |
| 6339 | |
| 6340 | /* |
| 6341 | * 8ch mode |
| 6342 | */ |
| 6343 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6344 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6345 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6346 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6347 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6348 | { } /* end */ |
| 6349 | }; |
| 6350 | |
| 6351 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6352 | { 6, alc883_sixstack_ch6_init }, |
| 6353 | { 8, alc883_sixstack_ch8_init }, |
| 6354 | }; |
| 6355 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6356 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6357 | /* eanable EAPD on medion laptop */ |
| 6358 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6359 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6360 | { } |
| 6361 | }; |
| 6362 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6363 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6364 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6365 | */ |
| 6366 | |
| 6367 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6368 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6369 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6370 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6371 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6372 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6373 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6374 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6375 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6376 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6377 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6378 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6379 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6380 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6381 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6382 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6383 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6384 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6385 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6386 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6387 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6388 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6389 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6390 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6391 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6392 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6393 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6394 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6395 | { |
| 6396 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6397 | /* .name = "Capture Source", */ |
| 6398 | .name = "Input Source", |
| 6399 | .count = 2, |
| 6400 | .info = alc883_mux_enum_info, |
| 6401 | .get = alc883_mux_enum_get, |
| 6402 | .put = alc883_mux_enum_put, |
| 6403 | }, |
| 6404 | { } /* end */ |
| 6405 | }; |
| 6406 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6407 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6408 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6409 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6410 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6411 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6412 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6413 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6414 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6415 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6416 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6417 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6418 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6419 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6420 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6421 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6422 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6423 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6424 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6425 | { |
| 6426 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6427 | /* .name = "Capture Source", */ |
| 6428 | .name = "Input Source", |
| 6429 | .count = 2, |
| 6430 | .info = alc883_mux_enum_info, |
| 6431 | .get = alc883_mux_enum_get, |
| 6432 | .put = alc883_mux_enum_put, |
| 6433 | }, |
| 6434 | { } /* end */ |
| 6435 | }; |
| 6436 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6437 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6438 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6439 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6440 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6441 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6442 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6443 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6444 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6445 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6446 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6447 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6448 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6449 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6450 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6451 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6452 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6453 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6454 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6455 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6456 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6457 | { |
| 6458 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6459 | /* .name = "Capture Source", */ |
| 6460 | .name = "Input Source", |
| 6461 | .count = 2, |
| 6462 | .info = alc883_mux_enum_info, |
| 6463 | .get = alc883_mux_enum_get, |
| 6464 | .put = alc883_mux_enum_put, |
| 6465 | }, |
| 6466 | { } /* end */ |
| 6467 | }; |
| 6468 | |
| 6469 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6470 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6471 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6472 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6473 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6474 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6475 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6476 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6477 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6478 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6479 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6480 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6481 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6482 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6483 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6484 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6485 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6486 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6487 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6488 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6489 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6490 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6491 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6492 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6493 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6494 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6495 | { |
| 6496 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6497 | /* .name = "Capture Source", */ |
| 6498 | .name = "Input Source", |
| 6499 | .count = 2, |
| 6500 | .info = alc883_mux_enum_info, |
| 6501 | .get = alc883_mux_enum_get, |
| 6502 | .put = alc883_mux_enum_put, |
| 6503 | }, |
| 6504 | { } /* end */ |
| 6505 | }; |
| 6506 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6507 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6508 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6509 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6510 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6511 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6512 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6513 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6514 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6515 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6516 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6517 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6518 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6519 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6520 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6521 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6522 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6523 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6524 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6525 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6526 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6527 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6528 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6529 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6530 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6531 | |
| 6532 | { |
| 6533 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6534 | /* .name = "Capture Source", */ |
| 6535 | .name = "Input Source", |
| 6536 | .count = 1, |
| 6537 | .info = alc883_mux_enum_info, |
| 6538 | .get = alc883_mux_enum_get, |
| 6539 | .put = alc883_mux_enum_put, |
| 6540 | }, |
| 6541 | { } /* end */ |
| 6542 | }; |
| 6543 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6544 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6545 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6546 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6547 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6548 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6549 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6550 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6551 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6552 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6553 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6554 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6555 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6556 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6557 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6558 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6559 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6560 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6561 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6562 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6563 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6564 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6565 | { |
| 6566 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6567 | /* .name = "Capture Source", */ |
| 6568 | .name = "Input Source", |
| 6569 | .count = 2, |
| 6570 | .info = alc883_mux_enum_info, |
| 6571 | .get = alc883_mux_enum_get, |
| 6572 | .put = alc883_mux_enum_put, |
| 6573 | }, |
| 6574 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6575 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6576 | |
| 6577 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6578 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6579 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6580 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6581 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6582 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6583 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6584 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6585 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6586 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6587 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6588 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6589 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6590 | { |
| 6591 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6592 | /* .name = "Capture Source", */ |
| 6593 | .name = "Input Source", |
| 6594 | .count = 2, |
| 6595 | .info = alc883_mux_enum_info, |
| 6596 | .get = alc883_mux_enum_get, |
| 6597 | .put = alc883_mux_enum_put, |
| 6598 | }, |
| 6599 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6600 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6601 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6602 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6603 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6604 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6605 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6606 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6607 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6608 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6609 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6610 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6611 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6612 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6613 | { |
| 6614 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6615 | /* .name = "Capture Source", */ |
| 6616 | .name = "Input Source", |
| 6617 | .count = 1, |
| 6618 | .info = alc883_mux_enum_info, |
| 6619 | .get = alc883_mux_enum_get, |
| 6620 | .put = alc883_mux_enum_put, |
| 6621 | }, |
| 6622 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6623 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6624 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6625 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6626 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6627 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6628 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6629 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6630 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6631 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6632 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6633 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6634 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6635 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6636 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6637 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6638 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6639 | { |
| 6640 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6641 | /* .name = "Capture Source", */ |
| 6642 | .name = "Input Source", |
| 6643 | .count = 2, |
| 6644 | .info = alc883_mux_enum_info, |
| 6645 | .get = alc883_mux_enum_get, |
| 6646 | .put = alc883_mux_enum_put, |
| 6647 | }, |
| 6648 | { } /* end */ |
| 6649 | }; |
| 6650 | |
| 6651 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6652 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6653 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6654 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6655 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6656 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6657 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6658 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6659 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6660 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6661 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6662 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6663 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6664 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6665 | { |
| 6666 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6667 | /* .name = "Capture Source", */ |
| 6668 | .name = "Input Source", |
| 6669 | .count = 2, |
| 6670 | .info = alc883_mux_enum_info, |
| 6671 | .get = alc883_mux_enum_get, |
| 6672 | .put = alc883_mux_enum_put, |
| 6673 | }, |
| 6674 | { } /* end */ |
| 6675 | }; |
| 6676 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6677 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6678 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6679 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6680 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6681 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6682 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6683 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6684 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6685 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6686 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6687 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6688 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6689 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6690 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6691 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6692 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6693 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6694 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6695 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6696 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6697 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6698 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6699 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6700 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6701 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6702 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6703 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6704 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6705 | { |
| 6706 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6707 | /* .name = "Capture Source", */ |
| 6708 | .name = "Input Source", |
| 6709 | .count = 2, |
| 6710 | .info = alc883_mux_enum_info, |
| 6711 | .get = alc883_mux_enum_get, |
| 6712 | .put = alc883_mux_enum_put, |
| 6713 | }, |
| 6714 | { } /* end */ |
| 6715 | }; |
| 6716 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6717 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6718 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6719 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6720 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6721 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6722 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6723 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6724 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6725 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6726 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6727 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6728 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6729 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6730 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6732 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6733 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6734 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6735 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6736 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6737 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6738 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6739 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6740 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6741 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6742 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6743 | { |
| 6744 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6745 | /* .name = "Capture Source", */ |
| 6746 | .name = "Input Source", |
| 6747 | .count = 2, |
| 6748 | .info = alc883_mux_enum_info, |
| 6749 | .get = alc883_mux_enum_get, |
| 6750 | .put = alc883_mux_enum_put, |
| 6751 | }, |
| 6752 | { } /* end */ |
| 6753 | }; |
| 6754 | |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6755 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6756 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6757 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6758 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6759 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6760 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6761 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6762 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6763 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6764 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6765 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6766 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6767 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6768 | { |
| 6769 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6770 | /* .name = "Capture Source", */ |
| 6771 | .name = "Input Source", |
| 6772 | .count = 2, |
| 6773 | .info = alc883_mux_enum_info, |
| 6774 | .get = alc883_mux_enum_get, |
| 6775 | .put = alc883_mux_enum_put, |
| 6776 | }, |
| 6777 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6778 | }; |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6779 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6780 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 6781 | { |
| 6782 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6783 | .name = "Channel Mode", |
| 6784 | .info = alc_ch_mode_info, |
| 6785 | .get = alc_ch_mode_get, |
| 6786 | .put = alc_ch_mode_put, |
| 6787 | }, |
| 6788 | { } /* end */ |
| 6789 | }; |
| 6790 | |
| 6791 | static struct hda_verb alc883_init_verbs[] = { |
| 6792 | /* ADC1: mute amp left and right */ |
| 6793 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6794 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6795 | /* ADC2: mute amp left and right */ |
| 6796 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6797 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6798 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6799 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6800 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6801 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6802 | /* Rear mixer */ |
| 6803 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6804 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6805 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6806 | /* CLFE mixer */ |
| 6807 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6808 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6809 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6810 | /* Side mixer */ |
| 6811 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6812 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6813 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6814 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6815 | /* mute analog input loopbacks */ |
| 6816 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6817 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6818 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6819 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6820 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6821 | |
| 6822 | /* Front Pin: output 0 (0x0c) */ |
| 6823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6824 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6825 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6826 | /* Rear Pin: output 1 (0x0d) */ |
| 6827 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6828 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6829 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6830 | /* CLFE Pin: output 2 (0x0e) */ |
| 6831 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6832 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6833 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6834 | /* Side Pin: output 3 (0x0f) */ |
| 6835 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6836 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6837 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 6838 | /* Mic (rear) pin: input vref at 80% */ |
| 6839 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6840 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6841 | /* Front Mic pin: input vref at 80% */ |
| 6842 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6843 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6844 | /* Line In pin: input */ |
| 6845 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6846 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6847 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6848 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6849 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6850 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6851 | /* CD pin widget for input */ |
| 6852 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6853 | |
| 6854 | /* FIXME: use matrix-type input source selection */ |
| 6855 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6856 | /* Input mixer2 */ |
| 6857 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6858 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6859 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6860 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6861 | /* Input mixer3 */ |
| 6862 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6863 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6864 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6865 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6866 | { } |
| 6867 | }; |
| 6868 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6869 | /* toggle speaker-output according to the hp-jack state */ |
| 6870 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 6871 | { |
| 6872 | unsigned int present; |
| 6873 | |
| 6874 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6875 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6876 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6877 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6878 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 6879 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6880 | } |
| 6881 | |
| 6882 | /* auto-toggle front mic */ |
| 6883 | /* |
| 6884 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 6885 | { |
| 6886 | unsigned int present; |
| 6887 | unsigned char bits; |
| 6888 | |
| 6889 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 6890 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6891 | bits = present ? HDA_AMP_MUTE : 0; |
| 6892 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 6893 | } |
| 6894 | */ |
| 6895 | |
| 6896 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 6897 | { |
| 6898 | alc883_mitac_hp_automute(codec); |
| 6899 | /* alc883_mitac_mic_automute(codec); */ |
| 6900 | } |
| 6901 | |
| 6902 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 6903 | unsigned int res) |
| 6904 | { |
| 6905 | switch (res >> 26) { |
| 6906 | case ALC880_HP_EVENT: |
| 6907 | alc883_mitac_hp_automute(codec); |
| 6908 | break; |
| 6909 | case ALC880_MIC_EVENT: |
| 6910 | /* alc883_mitac_mic_automute(codec); */ |
| 6911 | break; |
| 6912 | } |
| 6913 | } |
| 6914 | |
| 6915 | static struct hda_verb alc883_mitac_verbs[] = { |
| 6916 | /* HP */ |
| 6917 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6918 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6919 | /* Subwoofer */ |
| 6920 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6921 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6922 | |
| 6923 | /* enable unsolicited event */ |
| 6924 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6925 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 6926 | |
| 6927 | { } /* end */ |
| 6928 | }; |
| 6929 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6930 | static struct hda_verb alc883_tagra_verbs[] = { |
| 6931 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6932 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6933 | |
| 6934 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6935 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6936 | |
| 6937 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6938 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6939 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6940 | |
| 6941 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6942 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6943 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6944 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6945 | |
| 6946 | { } /* end */ |
| 6947 | }; |
| 6948 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6949 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 6950 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6951 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 6952 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 6953 | { } /* end */ |
| 6954 | }; |
| 6955 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6956 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 6957 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6958 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6959 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6960 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6961 | { } /* end */ |
| 6962 | }; |
| 6963 | |
| 6964 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 6965 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6966 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6967 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6968 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 6969 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6970 | { } /* end */ |
| 6971 | }; |
| 6972 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 6973 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 6974 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6975 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6976 | |
| 6977 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6978 | |
| 6979 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6980 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6981 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6982 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6983 | { } /* end */ |
| 6984 | }; |
| 6985 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6986 | static struct hda_verb alc888_6st_hp_verbs[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6987 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 6988 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ |
| 6989 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ |
| 6990 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 6991 | { } |
| 6992 | }; |
| 6993 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6994 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6995 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 6996 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 6997 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
| 6998 | { } |
| 6999 | }; |
| 7000 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7001 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7002 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7003 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7004 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7005 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7006 | { } |
| 7007 | }; |
| 7008 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7009 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7010 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7011 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7012 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7013 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7014 | { } |
| 7015 | }; |
| 7016 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7017 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7018 | { 2, alc888_3st_hp_2ch_init }, |
| 7019 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7020 | }; |
| 7021 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7022 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7023 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7024 | { |
| 7025 | unsigned int present; |
| 7026 | |
| 7027 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7028 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7029 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7030 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7031 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7032 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7033 | } |
| 7034 | |
| 7035 | /* toggle RCA according to the front-jack state */ |
| 7036 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7037 | { |
| 7038 | unsigned int present; |
| 7039 | |
| 7040 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7041 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7042 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7043 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7044 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7045 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7046 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7047 | unsigned int res) |
| 7048 | { |
| 7049 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7050 | alc888_lenovo_ms7195_front_automute(codec); |
| 7051 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7052 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7053 | } |
| 7054 | |
| 7055 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7056 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7057 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7058 | |
| 7059 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7060 | |
| 7061 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7062 | { } /* end */ |
| 7063 | }; |
| 7064 | |
| 7065 | /* toggle speaker-output according to the hp-jack state */ |
| 7066 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7067 | { |
| 7068 | unsigned int present; |
| 7069 | |
| 7070 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7071 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7072 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7073 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7074 | } |
| 7075 | |
| 7076 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7077 | unsigned int res) |
| 7078 | { |
| 7079 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7080 | alc883_medion_md2_automute(codec); |
| 7081 | } |
| 7082 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7083 | /* toggle speaker-output according to the hp-jack state */ |
| 7084 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7085 | { |
| 7086 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7087 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7088 | |
| 7089 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7090 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7091 | bits = present ? HDA_AMP_MUTE : 0; |
| 7092 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7093 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7094 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7095 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7096 | } |
| 7097 | |
| 7098 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7099 | { |
| 7100 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7101 | alc883_tagra_automute(codec); |
| 7102 | } |
| 7103 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7104 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7105 | { |
| 7106 | unsigned int present; |
| 7107 | unsigned char bits; |
| 7108 | |
| 7109 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7110 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7111 | bits = present ? 0x80 : 0; |
| 7112 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7113 | 0x80, bits); |
| 7114 | } |
| 7115 | |
| 7116 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7117 | unsigned int res) |
| 7118 | { |
| 7119 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7120 | alc883_haier_w66_automute(codec); |
| 7121 | } |
| 7122 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7123 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7124 | { |
| 7125 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7126 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7127 | |
| 7128 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7129 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7130 | bits = present ? HDA_AMP_MUTE : 0; |
| 7131 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7132 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7133 | } |
| 7134 | |
| 7135 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7136 | { |
| 7137 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7138 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7139 | |
| 7140 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7141 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7142 | bits = present ? HDA_AMP_MUTE : 0; |
| 7143 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7144 | HDA_AMP_MUTE, bits); |
| 7145 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7146 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7147 | } |
| 7148 | |
| 7149 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7150 | unsigned int res) |
| 7151 | { |
| 7152 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7153 | alc883_lenovo_101e_all_automute(codec); |
| 7154 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7155 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7156 | } |
| 7157 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7158 | /* toggle speaker-output according to the hp-jack state */ |
| 7159 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7160 | { |
| 7161 | unsigned int present; |
| 7162 | |
| 7163 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7164 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7165 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7166 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7167 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7168 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7169 | } |
| 7170 | |
| 7171 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7172 | unsigned int res) |
| 7173 | { |
| 7174 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7175 | alc883_acer_aspire_automute(codec); |
| 7176 | } |
| 7177 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7178 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7179 | /* HP Pin: output 0 (0x0c) */ |
| 7180 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7181 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7182 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7183 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7184 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7185 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7186 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7187 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7188 | /* eanable EAPD on medion laptop */ |
| 7189 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7190 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7191 | /* enable unsolicited event */ |
| 7192 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7193 | { } |
| 7194 | }; |
| 7195 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7196 | /* |
| 7197 | * generic initialization of ADC, input mixers and output mixers |
| 7198 | */ |
| 7199 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7200 | /* |
| 7201 | * Unmute ADC0-2 and set the default input to mic-in |
| 7202 | */ |
| 7203 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7204 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7205 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7206 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7207 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7208 | /* 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] | 7209 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7210 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7211 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7212 | */ |
| 7213 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7214 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7215 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7216 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7217 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7218 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7219 | |
| 7220 | /* |
| 7221 | * Set up output mixers (0x0c - 0x0f) |
| 7222 | */ |
| 7223 | /* set vol=0 to output mixers */ |
| 7224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7225 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7226 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7227 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7228 | /* set up input amps for analog loopback */ |
| 7229 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7231 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7232 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7233 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7234 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7235 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7236 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7237 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7238 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7239 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7240 | |
| 7241 | /* FIXME: use matrix-type input source selection */ |
| 7242 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7243 | /* Input mixer1 */ |
| 7244 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7245 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7246 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7247 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7248 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7249 | /* Input mixer2 */ |
| 7250 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7251 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7252 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7253 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7254 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7255 | |
| 7256 | { } |
| 7257 | }; |
| 7258 | |
| 7259 | /* capture mixer elements */ |
| 7260 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7261 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7262 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7263 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7264 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7265 | { |
| 7266 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7267 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7268 | * So call somewhat different.. |
| 7269 | * FIXME: the controls appear in the "playback" view! |
| 7270 | */ |
| 7271 | /* .name = "Capture Source", */ |
| 7272 | .name = "Input Source", |
| 7273 | .count = 2, |
| 7274 | .info = alc882_mux_enum_info, |
| 7275 | .get = alc882_mux_enum_get, |
| 7276 | .put = alc882_mux_enum_put, |
| 7277 | }, |
| 7278 | { } /* end */ |
| 7279 | }; |
| 7280 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7281 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7282 | #define alc883_loopbacks alc880_loopbacks |
| 7283 | #endif |
| 7284 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7285 | /* pcm configuration: identiacal with ALC880 */ |
| 7286 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7287 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
| 7288 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7289 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7290 | |
| 7291 | /* |
| 7292 | * configuration and preset |
| 7293 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7294 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7295 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7296 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7297 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7298 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7299 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7300 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7301 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7302 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7303 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7304 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7305 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7306 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7307 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7308 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7309 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7310 | [ALC888_6ST_HP] = "6stack-hp", |
| 7311 | [ALC888_3ST_HP] = "3stack-hp", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7312 | [ALC883_MITAC] = "mitac", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7313 | [ALC883_AUTO] = "auto", |
| 7314 | }; |
| 7315 | |
| 7316 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7317 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7318 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7319 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7320 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7321 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7322 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7323 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7324 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 7325 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 7326 | 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] | 7327 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7328 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7329 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7330 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7331 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7332 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7333 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7334 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
| 7335 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
| 7336 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7337 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7338 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7339 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7340 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7341 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7342 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7343 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7344 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7345 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7346 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7347 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7348 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7349 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7350 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7351 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
| 7352 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7353 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7354 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7355 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7356 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7357 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7358 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7359 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7360 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7361 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7362 | {} |
| 7363 | }; |
| 7364 | |
| 7365 | static struct alc_config_preset alc883_presets[] = { |
| 7366 | [ALC883_3ST_2ch_DIG] = { |
| 7367 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7368 | .init_verbs = { alc883_init_verbs }, |
| 7369 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7370 | .dac_nids = alc883_dac_nids, |
| 7371 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7372 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7373 | .adc_nids = alc883_adc_nids, |
| 7374 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7375 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7376 | .channel_mode = alc883_3ST_2ch_modes, |
| 7377 | .input_mux = &alc883_capture_source, |
| 7378 | }, |
| 7379 | [ALC883_3ST_6ch_DIG] = { |
| 7380 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7381 | .init_verbs = { alc883_init_verbs }, |
| 7382 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7383 | .dac_nids = alc883_dac_nids, |
| 7384 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7385 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7386 | .adc_nids = alc883_adc_nids, |
| 7387 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7388 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7389 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7390 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7391 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7392 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7393 | [ALC883_3ST_6ch] = { |
| 7394 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7395 | .init_verbs = { alc883_init_verbs }, |
| 7396 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7397 | .dac_nids = alc883_dac_nids, |
| 7398 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7399 | .adc_nids = alc883_adc_nids, |
| 7400 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7401 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7402 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7403 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7404 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7405 | [ALC883_6ST_DIG] = { |
| 7406 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7407 | .init_verbs = { alc883_init_verbs }, |
| 7408 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7409 | .dac_nids = alc883_dac_nids, |
| 7410 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7411 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7412 | .adc_nids = alc883_adc_nids, |
| 7413 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7414 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7415 | .channel_mode = alc883_sixstack_modes, |
| 7416 | .input_mux = &alc883_capture_source, |
| 7417 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7418 | [ALC883_TARGA_DIG] = { |
| 7419 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7420 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7421 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7422 | .dac_nids = alc883_dac_nids, |
| 7423 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7424 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7425 | .adc_nids = alc883_adc_nids, |
| 7426 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7427 | .channel_mode = alc883_3ST_6ch_modes, |
| 7428 | .need_dac_fix = 1, |
| 7429 | .input_mux = &alc883_capture_source, |
| 7430 | .unsol_event = alc883_tagra_unsol_event, |
| 7431 | .init_hook = alc883_tagra_automute, |
| 7432 | }, |
| 7433 | [ALC883_TARGA_2ch_DIG] = { |
| 7434 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7435 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7436 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7437 | .dac_nids = alc883_dac_nids, |
| 7438 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7439 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7440 | .adc_nids = alc883_adc_nids, |
| 7441 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7442 | .channel_mode = alc883_3ST_2ch_modes, |
| 7443 | .input_mux = &alc883_capture_source, |
| 7444 | .unsol_event = alc883_tagra_unsol_event, |
| 7445 | .init_hook = alc883_tagra_automute, |
| 7446 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7447 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7448 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7449 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7450 | * and the headphone jack. Turn this on and rely on the |
| 7451 | * standard mute methods whenever the user wants to turn |
| 7452 | * these outputs off. |
| 7453 | */ |
| 7454 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7455 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7456 | .dac_nids = alc883_dac_nids, |
| 7457 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7458 | .adc_nids = alc883_adc_nids, |
| 7459 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7460 | .channel_mode = alc883_3ST_2ch_modes, |
| 7461 | .input_mux = &alc883_capture_source, |
| 7462 | }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7463 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7464 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7465 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7466 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7467 | .dac_nids = alc883_dac_nids, |
| 7468 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7469 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7470 | .adc_nids = alc883_adc_nids, |
| 7471 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7472 | .channel_mode = alc883_3ST_2ch_modes, |
| 7473 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7474 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7475 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7476 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7477 | [ALC883_MEDION] = { |
| 7478 | .mixers = { alc883_fivestack_mixer, |
| 7479 | alc883_chmode_mixer }, |
| 7480 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7481 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7482 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7483 | .dac_nids = alc883_dac_nids, |
| 7484 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7485 | .adc_nids = alc883_adc_nids, |
| 7486 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7487 | .channel_mode = alc883_sixstack_modes, |
| 7488 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7489 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7490 | [ALC883_MEDION_MD2] = { |
| 7491 | .mixers = { alc883_medion_md2_mixer}, |
| 7492 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7493 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7494 | .dac_nids = alc883_dac_nids, |
| 7495 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7496 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7497 | .adc_nids = alc883_adc_nids, |
| 7498 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7499 | .channel_mode = alc883_3ST_2ch_modes, |
| 7500 | .input_mux = &alc883_capture_source, |
| 7501 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7502 | .init_hook = alc883_medion_md2_automute, |
| 7503 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7504 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7505 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7506 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7507 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7508 | .dac_nids = alc883_dac_nids, |
| 7509 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7510 | .adc_nids = alc883_adc_nids, |
| 7511 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7512 | .channel_mode = alc883_3ST_2ch_modes, |
| 7513 | .input_mux = &alc883_capture_source, |
| 7514 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7515 | [ALC883_LENOVO_101E_2ch] = { |
| 7516 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7517 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7518 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7519 | .dac_nids = alc883_dac_nids, |
| 7520 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7521 | .adc_nids = alc883_adc_nids, |
| 7522 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7523 | .channel_mode = alc883_3ST_2ch_modes, |
| 7524 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7525 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7526 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7527 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7528 | [ALC883_LENOVO_NB0763] = { |
| 7529 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7530 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7531 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7532 | .dac_nids = alc883_dac_nids, |
| 7533 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7534 | .adc_nids = alc883_adc_nids, |
| 7535 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7536 | .channel_mode = alc883_3ST_2ch_modes, |
| 7537 | .need_dac_fix = 1, |
| 7538 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7539 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7540 | .init_hook = alc883_medion_md2_automute, |
| 7541 | }, |
| 7542 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7543 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7544 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7545 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7546 | .dac_nids = alc883_dac_nids, |
| 7547 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7548 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7549 | .adc_nids = alc883_adc_nids, |
| 7550 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7551 | .channel_mode = alc883_3ST_6ch_modes, |
| 7552 | .need_dac_fix = 1, |
| 7553 | .input_mux = &alc883_capture_source, |
| 7554 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7555 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7556 | }, |
| 7557 | [ALC883_HAIER_W66] = { |
| 7558 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7559 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7560 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7561 | .dac_nids = alc883_dac_nids, |
| 7562 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7563 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7564 | .adc_nids = alc883_adc_nids, |
| 7565 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7566 | .channel_mode = alc883_3ST_2ch_modes, |
| 7567 | .input_mux = &alc883_capture_source, |
| 7568 | .unsol_event = alc883_haier_w66_unsol_event, |
| 7569 | .init_hook = alc883_haier_w66_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7570 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7571 | [ALC888_6ST_HP] = { |
| 7572 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
| 7573 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7574 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7575 | .dac_nids = alc883_dac_nids, |
| 7576 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7577 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7578 | .adc_nids = alc883_adc_nids, |
| 7579 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7580 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7581 | .channel_mode = alc883_sixstack_modes, |
| 7582 | .input_mux = &alc883_capture_source, |
| 7583 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7584 | [ALC888_3ST_HP] = { |
| 7585 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 7586 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7587 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7588 | .dac_nids = alc883_dac_nids, |
| 7589 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7590 | .adc_nids = alc883_adc_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7591 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 7592 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7593 | .need_dac_fix = 1, |
| 7594 | .input_mux = &alc883_capture_source, |
| 7595 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7596 | [ALC883_MITAC] = { |
| 7597 | .mixers = { alc883_mitac_mixer }, |
| 7598 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 7599 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7600 | .dac_nids = alc883_dac_nids, |
| 7601 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7602 | .adc_nids = alc883_adc_nids, |
| 7603 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7604 | .channel_mode = alc883_3ST_2ch_modes, |
| 7605 | .input_mux = &alc883_capture_source, |
| 7606 | .unsol_event = alc883_mitac_unsol_event, |
| 7607 | .init_hook = alc883_mitac_automute, |
| 7608 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7609 | }; |
| 7610 | |
| 7611 | |
| 7612 | /* |
| 7613 | * BIOS auto configuration |
| 7614 | */ |
| 7615 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7616 | hda_nid_t nid, int pin_type, |
| 7617 | int dac_idx) |
| 7618 | { |
| 7619 | /* set as output */ |
| 7620 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7621 | int idx; |
| 7622 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7623 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7624 | idx = 4; |
| 7625 | else |
| 7626 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 7627 | |
| 7628 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7629 | pin_type); |
| 7630 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 7631 | AMP_OUT_UNMUTE); |
| 7632 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7633 | |
| 7634 | } |
| 7635 | |
| 7636 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 7637 | { |
| 7638 | struct alc_spec *spec = codec->spec; |
| 7639 | int i; |
| 7640 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7641 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7642 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7643 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7644 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7645 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7646 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7647 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7648 | } |
| 7649 | } |
| 7650 | |
| 7651 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 7652 | { |
| 7653 | struct alc_spec *spec = codec->spec; |
| 7654 | hda_nid_t pin; |
| 7655 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7656 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7657 | if (pin) /* connect to front */ |
| 7658 | /* use dac 0 */ |
| 7659 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 7660 | } |
| 7661 | |
| 7662 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7663 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 7664 | |
| 7665 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 7666 | { |
| 7667 | struct alc_spec *spec = codec->spec; |
| 7668 | int i; |
| 7669 | |
| 7670 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7671 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 7672 | if (alc883_is_input_pin(nid)) { |
| 7673 | snd_hda_codec_write(codec, nid, 0, |
| 7674 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7675 | (i <= AUTO_PIN_FRONT_MIC ? |
| 7676 | PIN_VREF80 : PIN_IN)); |
| 7677 | if (nid != ALC883_PIN_CD_NID) |
| 7678 | snd_hda_codec_write(codec, nid, 0, |
| 7679 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7680 | AMP_OUT_MUTE); |
| 7681 | } |
| 7682 | } |
| 7683 | } |
| 7684 | |
| 7685 | /* almost identical with ALC880 parser... */ |
| 7686 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 7687 | { |
| 7688 | struct alc_spec *spec = codec->spec; |
| 7689 | int err = alc880_parse_auto_config(codec); |
| 7690 | |
| 7691 | if (err < 0) |
| 7692 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7693 | else if (!err) |
| 7694 | return 0; /* no config found */ |
| 7695 | |
| 7696 | err = alc_auto_add_mic_boost(codec); |
| 7697 | if (err < 0) |
| 7698 | return err; |
| 7699 | |
| 7700 | /* hack - override the init verbs */ |
| 7701 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7702 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 7703 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7704 | |
| 7705 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7706 | } |
| 7707 | |
| 7708 | /* additional initialization for auto-configuration model */ |
| 7709 | static void alc883_auto_init(struct hda_codec *codec) |
| 7710 | { |
| 7711 | alc883_auto_init_multi_out(codec); |
| 7712 | alc883_auto_init_hp_out(codec); |
| 7713 | alc883_auto_init_analog_input(codec); |
| 7714 | } |
| 7715 | |
| 7716 | static int patch_alc883(struct hda_codec *codec) |
| 7717 | { |
| 7718 | struct alc_spec *spec; |
| 7719 | int err, board_config; |
| 7720 | |
| 7721 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 7722 | if (spec == NULL) |
| 7723 | return -ENOMEM; |
| 7724 | |
| 7725 | codec->spec = spec; |
| 7726 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7727 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 7728 | alc883_models, |
| 7729 | alc883_cfg_tbl); |
| 7730 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7731 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 7732 | "trying auto-probe from BIOS...\n"); |
| 7733 | board_config = ALC883_AUTO; |
| 7734 | } |
| 7735 | |
| 7736 | if (board_config == ALC883_AUTO) { |
| 7737 | /* automatic parse from the BIOS config */ |
| 7738 | err = alc883_parse_auto_config(codec); |
| 7739 | if (err < 0) { |
| 7740 | alc_free(codec); |
| 7741 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7742 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7743 | printk(KERN_INFO |
| 7744 | "hda_codec: Cannot set up configuration " |
| 7745 | "from BIOS. Using base mode...\n"); |
| 7746 | board_config = ALC883_3ST_2ch_DIG; |
| 7747 | } |
| 7748 | } |
| 7749 | |
| 7750 | if (board_config != ALC883_AUTO) |
| 7751 | setup_preset(spec, &alc883_presets[board_config]); |
| 7752 | |
| 7753 | spec->stream_name_analog = "ALC883 Analog"; |
| 7754 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 7755 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
| 7756 | |
| 7757 | spec->stream_name_digital = "ALC883 Digital"; |
| 7758 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 7759 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 7760 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7761 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7762 | spec->adc_nids = alc883_adc_nids; |
| 7763 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 7764 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7765 | |
| 7766 | codec->patch_ops = alc_patch_ops; |
| 7767 | if (board_config == ALC883_AUTO) |
| 7768 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7769 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7770 | if (!spec->loopback.amplist) |
| 7771 | spec->loopback.amplist = alc883_loopbacks; |
| 7772 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7773 | |
| 7774 | return 0; |
| 7775 | } |
| 7776 | |
| 7777 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7778 | * ALC262 support |
| 7779 | */ |
| 7780 | |
| 7781 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 7782 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 7783 | |
| 7784 | #define alc262_dac_nids alc260_dac_nids |
| 7785 | #define alc262_adc_nids alc882_adc_nids |
| 7786 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 7787 | |
| 7788 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 7789 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7790 | |
| 7791 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 7792 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7793 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7794 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7795 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7796 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7797 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7800 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7801 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7802 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7803 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7804 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7805 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7806 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 7807 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7808 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7809 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7810 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7811 | }; |
| 7812 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7813 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 7814 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7815 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7816 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7817 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7818 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7819 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7820 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7821 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7822 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7823 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7824 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7825 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7826 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7827 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7828 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 7829 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7830 | { } /* end */ |
| 7831 | }; |
| 7832 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7833 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
| 7834 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7835 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7837 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7838 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7839 | |
| 7840 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7841 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7842 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7843 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7844 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7845 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7846 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7847 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7848 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7849 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7850 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7851 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7852 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 7853 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 7854 | { } /* end */ |
| 7855 | }; |
| 7856 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7857 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
| 7858 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7859 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7860 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7861 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7862 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7863 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 7864 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7865 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7866 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7867 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7868 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7869 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7870 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7871 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7872 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7873 | { } /* end */ |
| 7874 | }; |
| 7875 | |
| 7876 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 7877 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7878 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7879 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7880 | { } /* end */ |
| 7881 | }; |
| 7882 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 7883 | static struct hda_bind_ctls alc262_hp_t5735_bind_front_vol = { |
| 7884 | .ops = &snd_hda_bind_vol, |
| 7885 | .values = { |
| 7886 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 7887 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 7888 | 0 |
| 7889 | }, |
| 7890 | }; |
| 7891 | |
| 7892 | static struct hda_bind_ctls alc262_hp_t5735_bind_front_sw = { |
| 7893 | .ops = &snd_hda_bind_sw, |
| 7894 | .values = { |
| 7895 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 7896 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 7897 | 0 |
| 7898 | }, |
| 7899 | }; |
| 7900 | |
| 7901 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 7902 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 7903 | { |
| 7904 | struct alc_spec *spec = codec->spec; |
| 7905 | unsigned int mute; |
| 7906 | |
| 7907 | if (force || !spec->sense_updated) { |
| 7908 | unsigned int present; |
| 7909 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7910 | AC_VERB_GET_PIN_SENSE, 0); |
| 7911 | spec->jack_present = (present & 0x80000000) != 0; |
| 7912 | spec->sense_updated = 1; |
| 7913 | } |
| 7914 | if (spec->jack_present) |
| 7915 | mute = (0x7080 | ((0)<<8)); /* mute internal speaker */ |
| 7916 | else /* unmute internal speaker if necessary */ |
| 7917 | mute = (0x7000 | ((0)<<8)); |
| 7918 | snd_hda_codec_write(codec, 0x0c, 0, |
| 7919 | AC_VERB_SET_AMP_GAIN_MUTE, mute ); |
| 7920 | } |
| 7921 | |
| 7922 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 7923 | unsigned int res) |
| 7924 | { |
| 7925 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7926 | return; |
| 7927 | alc262_hp_t5735_automute(codec, 1); |
| 7928 | } |
| 7929 | |
| 7930 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 7931 | { |
| 7932 | alc262_hp_t5735_automute(codec, 1); |
| 7933 | } |
| 7934 | |
| 7935 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
| 7936 | HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_t5735_bind_front_vol), |
| 7937 | HDA_BIND_SW("PCM Playback Switch",&alc262_hp_t5735_bind_front_sw), |
| 7938 | HDA_CODEC_VOLUME("LineOut Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7939 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7940 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7941 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7942 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7943 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7944 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7945 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7946 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7947 | { } /* end */ |
| 7948 | }; |
| 7949 | |
| 7950 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 7951 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7952 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7953 | |
| 7954 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7955 | { } |
| 7956 | }; |
| 7957 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 7958 | static struct hda_bind_ctls alc262_hp_rp5700_bind_front_vol = { |
| 7959 | .ops = &snd_hda_bind_vol, |
| 7960 | .values = { |
| 7961 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 7962 | HDA_COMPOSE_AMP_VAL(0x0e, 3, 0, HDA_OUTPUT), |
| 7963 | 0 |
| 7964 | }, |
| 7965 | }; |
| 7966 | |
| 7967 | static struct hda_bind_ctls alc262_hp_rp5700_bind_front_sw = { |
| 7968 | .ops = &snd_hda_bind_sw, |
| 7969 | .values = { |
| 7970 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 7971 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 7972 | 0 |
| 7973 | }, |
| 7974 | }; |
| 7975 | |
| 7976 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
| 7977 | HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_rp5700_bind_front_vol), |
| 7978 | HDA_BIND_SW("PCM Playback Switch", &alc262_hp_rp5700_bind_front_sw), |
| 7979 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7980 | HDA_CODEC_MUTE("Master Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7981 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7982 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7983 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7984 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7985 | { } /* end */ |
| 7986 | }; |
| 7987 | |
| 7988 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 7989 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7990 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7991 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7992 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7993 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7994 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7996 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7997 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 7998 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 7999 | {} |
| 8000 | }; |
| 8001 | |
| 8002 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8003 | .num_items = 1, |
| 8004 | .items = { |
| 8005 | { "Line", 0x1 }, |
| 8006 | }, |
| 8007 | }; |
| 8008 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8009 | /* bind hp and internal speaker mute (with plug check) */ |
| 8010 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8011 | struct snd_ctl_elem_value *ucontrol) |
| 8012 | { |
| 8013 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8014 | long *valp = ucontrol->value.integer.value; |
| 8015 | int change; |
| 8016 | |
| 8017 | /* change hp mute */ |
| 8018 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8019 | HDA_AMP_MUTE, |
| 8020 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8021 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8022 | HDA_AMP_MUTE, |
| 8023 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8024 | if (change) { |
| 8025 | /* change speaker according to HP jack state */ |
| 8026 | struct alc_spec *spec = codec->spec; |
| 8027 | unsigned int mute; |
| 8028 | if (spec->jack_present) |
| 8029 | mute = HDA_AMP_MUTE; |
| 8030 | else |
| 8031 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8032 | HDA_OUTPUT, 0); |
| 8033 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8034 | HDA_AMP_MUTE, mute); |
| 8035 | } |
| 8036 | return change; |
| 8037 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8038 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8039 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8040 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8041 | { |
| 8042 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8043 | .name = "Master Playback Switch", |
| 8044 | .info = snd_hda_mixer_amp_switch_info, |
| 8045 | .get = snd_hda_mixer_amp_switch_get, |
| 8046 | .put = alc262_sony_master_sw_put, |
| 8047 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8048 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8049 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8050 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8051 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8052 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8053 | { } /* end */ |
| 8054 | }; |
| 8055 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8056 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8057 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8058 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8059 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8060 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8061 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8062 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8063 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8064 | { } /* end */ |
| 8065 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8066 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8067 | #define alc262_capture_mixer alc882_capture_mixer |
| 8068 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8069 | |
| 8070 | /* |
| 8071 | * generic initialization of ADC, input mixers and output mixers |
| 8072 | */ |
| 8073 | static struct hda_verb alc262_init_verbs[] = { |
| 8074 | /* |
| 8075 | * Unmute ADC0-2 and set the default input to mic-in |
| 8076 | */ |
| 8077 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8078 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8079 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8080 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8081 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8082 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8083 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8084 | /* 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] | 8085 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8086 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8087 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8088 | */ |
| 8089 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8090 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8091 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8092 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8093 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8094 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8095 | |
| 8096 | /* |
| 8097 | * Set up output mixers (0x0c - 0x0e) |
| 8098 | */ |
| 8099 | /* set vol=0 to output mixers */ |
| 8100 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8101 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8102 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8103 | /* set up input amps for analog loopback */ |
| 8104 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8105 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8106 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8107 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8108 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8109 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8110 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8111 | |
| 8112 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8113 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8114 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8115 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8116 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8117 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8118 | |
| 8119 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8120 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8121 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8122 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8123 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8124 | |
| 8125 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8126 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8127 | |
| 8128 | /* FIXME: use matrix-type input source selection */ |
| 8129 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8130 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8131 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8132 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8133 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8134 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8135 | /* Input mixer2 */ |
| 8136 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8137 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8138 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8139 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8140 | /* Input mixer3 */ |
| 8141 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8142 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8143 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8144 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8145 | |
| 8146 | { } |
| 8147 | }; |
| 8148 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8149 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8150 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8151 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8152 | {} |
| 8153 | }; |
| 8154 | |
| 8155 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8156 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8157 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8158 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8159 | |
| 8160 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8161 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8162 | {} |
| 8163 | }; |
| 8164 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8165 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8166 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8167 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8168 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8169 | |
| 8170 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8171 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8172 | }; |
| 8173 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8174 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8175 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8176 | { |
| 8177 | struct alc_spec *spec = codec->spec; |
| 8178 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8179 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8180 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8181 | /* need to execute and sync at first */ |
| 8182 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8183 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8184 | AC_VERB_GET_PIN_SENSE, 0); |
| 8185 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8186 | if (spec->jack_present) { |
| 8187 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8188 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8189 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8190 | } else { |
| 8191 | /* unmute internal speaker if necessary */ |
| 8192 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8193 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8194 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8195 | } |
| 8196 | } |
| 8197 | |
| 8198 | /* unsolicited event for HP jack sensing */ |
| 8199 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8200 | unsigned int res) |
| 8201 | { |
| 8202 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8203 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8204 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8205 | } |
| 8206 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8207 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8208 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8209 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8210 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8211 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8212 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8213 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8214 | AC_VERB_GET_PIN_SENSE, 0); |
| 8215 | present = (present & 0x80000000) != 0; |
| 8216 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8217 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8218 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8219 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8220 | } else { |
| 8221 | /* unmute internal speaker if necessary */ |
| 8222 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8223 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8224 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8225 | } |
| 8226 | } |
| 8227 | |
| 8228 | /* unsolicited event for HP jack sensing */ |
| 8229 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8230 | unsigned int res) |
| 8231 | { |
| 8232 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8233 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8234 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8235 | } |
| 8236 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8237 | /* |
| 8238 | * fujitsu model |
| 8239 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 8240 | */ |
| 8241 | |
| 8242 | #define ALC_HP_EVENT 0x37 |
| 8243 | |
| 8244 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8245 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8246 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8247 | {} |
| 8248 | }; |
| 8249 | |
| 8250 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8251 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8252 | .items = { |
| 8253 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8254 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8255 | { "CD", 0x4 }, |
| 8256 | }, |
| 8257 | }; |
| 8258 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8259 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8260 | .num_items = 5, |
| 8261 | .items = { |
| 8262 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8263 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8264 | { "Line", 0x2 }, |
| 8265 | { "CD", 0x4 }, |
| 8266 | { "AUX IN", 0x6 }, |
| 8267 | }, |
| 8268 | }; |
| 8269 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8270 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8271 | .num_items = 4, |
| 8272 | .items = { |
| 8273 | { "Mic", 0x0 }, |
| 8274 | { "Front Mic", 0x2 }, |
| 8275 | { "Line", 0x1 }, |
| 8276 | { "CD", 0x4 }, |
| 8277 | }, |
| 8278 | }; |
| 8279 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8280 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8281 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8282 | { |
| 8283 | struct alc_spec *spec = codec->spec; |
| 8284 | unsigned int mute; |
| 8285 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8286 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8287 | unsigned int present; |
| 8288 | /* need to execute and sync at first */ |
| 8289 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8290 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8291 | AC_VERB_GET_PIN_SENSE, 0); |
| 8292 | spec->jack_present = (present & 0x80000000) != 0; |
| 8293 | spec->sense_updated = 1; |
| 8294 | } |
| 8295 | if (spec->jack_present) { |
| 8296 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8297 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8298 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8299 | } else { |
| 8300 | /* unmute internal speaker if necessary */ |
| 8301 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8302 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8303 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8304 | } |
| 8305 | } |
| 8306 | |
| 8307 | /* unsolicited event for HP jack sensing */ |
| 8308 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8309 | unsigned int res) |
| 8310 | { |
| 8311 | if ((res >> 26) != ALC_HP_EVENT) |
| 8312 | return; |
| 8313 | alc262_fujitsu_automute(codec, 1); |
| 8314 | } |
| 8315 | |
| 8316 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8317 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8318 | .ops = &snd_hda_bind_vol, |
| 8319 | .values = { |
| 8320 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8321 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8322 | 0 |
| 8323 | }, |
| 8324 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8325 | |
| 8326 | /* bind hp and internal speaker mute (with plug check) */ |
| 8327 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8328 | struct snd_ctl_elem_value *ucontrol) |
| 8329 | { |
| 8330 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8331 | long *valp = ucontrol->value.integer.value; |
| 8332 | int change; |
| 8333 | |
| 8334 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8335 | HDA_AMP_MUTE, |
| 8336 | valp[0] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8337 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8338 | HDA_AMP_MUTE, |
| 8339 | valp[1] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8340 | if (change) |
| 8341 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8342 | return change; |
| 8343 | } |
| 8344 | |
| 8345 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8346 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8347 | { |
| 8348 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8349 | .name = "Master Playback Switch", |
| 8350 | .info = snd_hda_mixer_amp_switch_info, |
| 8351 | .get = snd_hda_mixer_amp_switch_get, |
| 8352 | .put = alc262_fujitsu_master_sw_put, |
| 8353 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8354 | }, |
| 8355 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8356 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8357 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8358 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8359 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8360 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8361 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8362 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8363 | { } /* end */ |
| 8364 | }; |
| 8365 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8366 | /* additional init verbs for Benq laptops */ |
| 8367 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8368 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8369 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8370 | {} |
| 8371 | }; |
| 8372 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8373 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8374 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8375 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8376 | |
| 8377 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8378 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8379 | {} |
| 8380 | }; |
| 8381 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8382 | /* Samsung Q1 Ultra Vista model setup */ |
| 8383 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
| 8384 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8385 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8386 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8387 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8388 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8389 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8390 | { } /* end */ |
| 8391 | }; |
| 8392 | |
| 8393 | static struct hda_verb alc262_ultra_verbs[] = { |
| 8394 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8395 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8396 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8397 | /* Mic is on Node 0x19 */ |
| 8398 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8399 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8400 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8401 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8402 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8403 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8404 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8405 | {} |
| 8406 | }; |
| 8407 | |
| 8408 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 8409 | .num_items = 1, |
| 8410 | .items = { |
| 8411 | { "Mic", 0x1 }, |
| 8412 | }, |
| 8413 | }; |
| 8414 | |
| 8415 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8416 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 8417 | { |
| 8418 | struct alc_spec *spec = codec->spec; |
| 8419 | unsigned int mute; |
| 8420 | unsigned int present; |
| 8421 | |
| 8422 | /* need to execute and sync at first */ |
| 8423 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8424 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8425 | AC_VERB_GET_PIN_SENSE, 0); |
| 8426 | spec->jack_present = (present & 0x80000000) != 0; |
| 8427 | if (spec->jack_present) { |
| 8428 | /* mute internal speaker */ |
| 8429 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8430 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8431 | } else { |
| 8432 | /* unmute internal speaker if necessary */ |
| 8433 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 8434 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8435 | HDA_AMP_MUTE, mute); |
| 8436 | } |
| 8437 | } |
| 8438 | |
| 8439 | /* unsolicited event for HP jack sensing */ |
| 8440 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 8441 | unsigned int res) |
| 8442 | { |
| 8443 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8444 | return; |
| 8445 | alc262_ultra_automute(codec); |
| 8446 | } |
| 8447 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8448 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8449 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8450 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8451 | { |
| 8452 | hda_nid_t nid; |
| 8453 | int err; |
| 8454 | |
| 8455 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 8456 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8457 | spec->multiout.dac_nids[0] = 2; |
| 8458 | |
| 8459 | nid = cfg->line_out_pins[0]; |
| 8460 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8461 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8462 | "Front Playback Volume", |
| 8463 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 8464 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8465 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8466 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8467 | "Front Playback Switch", |
| 8468 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 8469 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8470 | return err; |
| 8471 | } |
| 8472 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 8473 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8474 | if (nid) { |
| 8475 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8476 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8477 | "Speaker Playback Volume", |
| 8478 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8479 | HDA_OUTPUT)); |
| 8480 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8481 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8482 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8483 | "Speaker Playback Switch", |
| 8484 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8485 | HDA_OUTPUT)); |
| 8486 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8487 | return err; |
| 8488 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8489 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8490 | "Speaker Playback Switch", |
| 8491 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8492 | HDA_OUTPUT)); |
| 8493 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8494 | return err; |
| 8495 | } |
| 8496 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8497 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8498 | if (nid) { |
| 8499 | /* spec->multiout.hp_nid = 2; */ |
| 8500 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8501 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8502 | "Headphone Playback Volume", |
| 8503 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8504 | HDA_OUTPUT)); |
| 8505 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8506 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8507 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8508 | "Headphone Playback Switch", |
| 8509 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8510 | HDA_OUTPUT)); |
| 8511 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8512 | return err; |
| 8513 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8514 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8515 | "Headphone Playback Switch", |
| 8516 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8517 | HDA_OUTPUT)); |
| 8518 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8519 | return err; |
| 8520 | } |
| 8521 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8522 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8523 | } |
| 8524 | |
| 8525 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8526 | #define alc262_auto_create_analog_input_ctls \ |
| 8527 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8528 | |
| 8529 | /* |
| 8530 | * generic initialization of ADC, input mixers and output mixers |
| 8531 | */ |
| 8532 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 8533 | /* |
| 8534 | * Unmute ADC0-2 and set the default input to mic-in |
| 8535 | */ |
| 8536 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8537 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8538 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8539 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8540 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8541 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8542 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8543 | /* 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] | 8544 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8545 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8546 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8547 | */ |
| 8548 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8549 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8550 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8551 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8552 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8553 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8554 | |
| 8555 | /* |
| 8556 | * Set up output mixers (0x0c - 0x0f) |
| 8557 | */ |
| 8558 | /* set vol=0 to output mixers */ |
| 8559 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8560 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8561 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8562 | |
| 8563 | /* set up input amps for analog loopback */ |
| 8564 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8565 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8566 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8567 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8568 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8569 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8570 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8571 | |
| 8572 | /* FIXME: use matrix-type input source selection */ |
| 8573 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8574 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8575 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8576 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8577 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8578 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8579 | /* Input mixer2 */ |
| 8580 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8581 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8582 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8583 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8584 | /* Input mixer3 */ |
| 8585 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8586 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8587 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8588 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8589 | |
| 8590 | { } |
| 8591 | }; |
| 8592 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8593 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 8594 | /* |
| 8595 | * Unmute ADC0-2 and set the default input to mic-in |
| 8596 | */ |
| 8597 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8598 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8599 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8600 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8601 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8602 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8603 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8604 | /* 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] | 8605 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8606 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8607 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8608 | */ |
| 8609 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8610 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8611 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8612 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8613 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8614 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8615 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8616 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8617 | |
| 8618 | /* |
| 8619 | * Set up output mixers (0x0c - 0x0e) |
| 8620 | */ |
| 8621 | /* set vol=0 to output mixers */ |
| 8622 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8623 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8624 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8625 | |
| 8626 | /* set up input amps for analog loopback */ |
| 8627 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8628 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8629 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8630 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8631 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8632 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8633 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8634 | |
| 8635 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8636 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8637 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8638 | |
| 8639 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8640 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8641 | |
| 8642 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8643 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8644 | |
| 8645 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8646 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8647 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8648 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8649 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8650 | |
| 8651 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8652 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8653 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8654 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8655 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8656 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8657 | |
| 8658 | |
| 8659 | /* FIXME: use matrix-type input source selection */ |
| 8660 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8661 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8662 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8663 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8664 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8665 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8666 | /* Input mixer2 */ |
| 8667 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8668 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8669 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8670 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8671 | /* Input mixer3 */ |
| 8672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8675 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8676 | |
| 8677 | { } |
| 8678 | }; |
| 8679 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8680 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 8681 | /* |
| 8682 | * Unmute ADC0-2 and set the default input to mic-in |
| 8683 | */ |
| 8684 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8685 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8686 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8687 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8688 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8689 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8690 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8691 | /* 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] | 8692 | * mixer widget |
| 8693 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 8694 | * panel mic (mic 2) |
| 8695 | */ |
| 8696 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8697 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8698 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8699 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8700 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8701 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8702 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8703 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 8704 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8705 | /* |
| 8706 | * Set up output mixers (0x0c - 0x0e) |
| 8707 | */ |
| 8708 | /* set vol=0 to output mixers */ |
| 8709 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8710 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8711 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8712 | |
| 8713 | /* set up input amps for analog loopback */ |
| 8714 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8715 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8716 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8717 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8718 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8719 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8720 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8721 | |
| 8722 | |
| 8723 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 8724 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 8725 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 8726 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 8727 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 8728 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 8729 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 8730 | |
| 8731 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8732 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8733 | |
| 8734 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8735 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8736 | |
| 8737 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 8738 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8739 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8740 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8741 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8742 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8743 | |
| 8744 | /* FIXME: use matrix-type input source selection */ |
| 8745 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8746 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8747 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 8748 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 8749 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 8750 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 8751 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 8752 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8753 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 8754 | /* Input mixer2 */ |
| 8755 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8756 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8757 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8758 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8759 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8760 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8761 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 8762 | /* Input mixer3 */ |
| 8763 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8764 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8765 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8766 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8767 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8768 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8769 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 8770 | |
| 8771 | { } |
| 8772 | }; |
| 8773 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8774 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8775 | #define alc262_loopbacks alc880_loopbacks |
| 8776 | #endif |
| 8777 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8778 | /* pcm configuration: identiacal with ALC880 */ |
| 8779 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 8780 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 8781 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 8782 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 8783 | |
| 8784 | /* |
| 8785 | * BIOS auto configuration |
| 8786 | */ |
| 8787 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 8788 | { |
| 8789 | struct alc_spec *spec = codec->spec; |
| 8790 | int err; |
| 8791 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 8792 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8793 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 8794 | alc262_ignore); |
| 8795 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8796 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8797 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8798 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8799 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 8800 | if (err < 0) |
| 8801 | return err; |
| 8802 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 8803 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8804 | return err; |
| 8805 | |
| 8806 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 8807 | |
| 8808 | if (spec->autocfg.dig_out_pin) |
| 8809 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 8810 | if (spec->autocfg.dig_in_pin) |
| 8811 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 8812 | |
| 8813 | if (spec->kctl_alloc) |
| 8814 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 8815 | |
| 8816 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 8817 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8818 | spec->input_mux = &spec->private_imux; |
| 8819 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8820 | err = alc_auto_add_mic_boost(codec); |
| 8821 | if (err < 0) |
| 8822 | return err; |
| 8823 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8824 | return 1; |
| 8825 | } |
| 8826 | |
| 8827 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 8828 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 8829 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 8830 | |
| 8831 | |
| 8832 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8833 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8834 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8835 | alc262_auto_init_multi_out(codec); |
| 8836 | alc262_auto_init_hp_out(codec); |
| 8837 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8838 | } |
| 8839 | |
| 8840 | /* |
| 8841 | * configuration and preset |
| 8842 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8843 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 8844 | [ALC262_BASIC] = "basic", |
| 8845 | [ALC262_HIPPO] = "hippo", |
| 8846 | [ALC262_HIPPO_1] = "hippo_1", |
| 8847 | [ALC262_FUJITSU] = "fujitsu", |
| 8848 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8849 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 8850 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8851 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8852 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 8853 | [ALC262_BENQ_T31] = "benq-t31", |
| 8854 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8855 | [ALC262_ULTRA] = "ultra", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8856 | [ALC262_AUTO] = "auto", |
| 8857 | }; |
| 8858 | |
| 8859 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 8860 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 8861 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 8862 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8863 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 8864 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 8865 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 8866 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 8867 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 8868 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8869 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8870 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8871 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8872 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8873 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8874 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8875 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8876 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8877 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 8878 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 8879 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8880 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 8881 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8882 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8883 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8884 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8885 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 8886 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 8887 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8888 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8889 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8890 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8891 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8892 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8893 | {} |
| 8894 | }; |
| 8895 | |
| 8896 | static struct alc_config_preset alc262_presets[] = { |
| 8897 | [ALC262_BASIC] = { |
| 8898 | .mixers = { alc262_base_mixer }, |
| 8899 | .init_verbs = { alc262_init_verbs }, |
| 8900 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8901 | .dac_nids = alc262_dac_nids, |
| 8902 | .hp_nid = 0x03, |
| 8903 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8904 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 8905 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8906 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8907 | [ALC262_HIPPO] = { |
| 8908 | .mixers = { alc262_base_mixer }, |
| 8909 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 8910 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8911 | .dac_nids = alc262_dac_nids, |
| 8912 | .hp_nid = 0x03, |
| 8913 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8914 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8915 | .channel_mode = alc262_modes, |
| 8916 | .input_mux = &alc262_capture_source, |
| 8917 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8918 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8919 | }, |
| 8920 | [ALC262_HIPPO_1] = { |
| 8921 | .mixers = { alc262_hippo1_mixer }, |
| 8922 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 8923 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8924 | .dac_nids = alc262_dac_nids, |
| 8925 | .hp_nid = 0x02, |
| 8926 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8927 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8928 | .channel_mode = alc262_modes, |
| 8929 | .input_mux = &alc262_capture_source, |
| 8930 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8931 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8932 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8933 | [ALC262_FUJITSU] = { |
| 8934 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8935 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 8936 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8937 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8938 | .dac_nids = alc262_dac_nids, |
| 8939 | .hp_nid = 0x03, |
| 8940 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 8941 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8942 | .channel_mode = alc262_modes, |
| 8943 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8944 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8945 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8946 | [ALC262_HP_BPC] = { |
| 8947 | .mixers = { alc262_HP_BPC_mixer }, |
| 8948 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 8949 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8950 | .dac_nids = alc262_dac_nids, |
| 8951 | .hp_nid = 0x03, |
| 8952 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8953 | .channel_mode = alc262_modes, |
| 8954 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8955 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8956 | [ALC262_HP_BPC_D7000_WF] = { |
| 8957 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 8958 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 8959 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8960 | .dac_nids = alc262_dac_nids, |
| 8961 | .hp_nid = 0x03, |
| 8962 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8963 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8964 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8965 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8966 | [ALC262_HP_BPC_D7000_WL] = { |
| 8967 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 8968 | alc262_HP_BPC_WildWest_option_mixer }, |
| 8969 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 8970 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8971 | .dac_nids = alc262_dac_nids, |
| 8972 | .hp_nid = 0x03, |
| 8973 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8974 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8975 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8976 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8977 | [ALC262_HP_TC_T5735] = { |
| 8978 | .mixers = { alc262_hp_t5735_mixer }, |
| 8979 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 8980 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8981 | .dac_nids = alc262_dac_nids, |
| 8982 | .hp_nid = 0x03, |
| 8983 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8984 | .channel_mode = alc262_modes, |
| 8985 | .input_mux = &alc262_capture_source, |
| 8986 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 8987 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8988 | }, |
| 8989 | [ALC262_HP_RP5700] = { |
| 8990 | .mixers = { alc262_hp_rp5700_mixer }, |
| 8991 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 8992 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 8993 | .dac_nids = alc262_dac_nids, |
| 8994 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 8995 | .channel_mode = alc262_modes, |
| 8996 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8997 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8998 | [ALC262_BENQ_ED8] = { |
| 8999 | .mixers = { alc262_base_mixer }, |
| 9000 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9001 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9002 | .dac_nids = alc262_dac_nids, |
| 9003 | .hp_nid = 0x03, |
| 9004 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9005 | .channel_mode = alc262_modes, |
| 9006 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9007 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9008 | [ALC262_SONY_ASSAMD] = { |
| 9009 | .mixers = { alc262_sony_mixer }, |
| 9010 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9011 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9012 | .dac_nids = alc262_dac_nids, |
| 9013 | .hp_nid = 0x02, |
| 9014 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9015 | .channel_mode = alc262_modes, |
| 9016 | .input_mux = &alc262_capture_source, |
| 9017 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9018 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9019 | }, |
| 9020 | [ALC262_BENQ_T31] = { |
| 9021 | .mixers = { alc262_benq_t31_mixer }, |
| 9022 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9023 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9024 | .dac_nids = alc262_dac_nids, |
| 9025 | .hp_nid = 0x03, |
| 9026 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9027 | .channel_mode = alc262_modes, |
| 9028 | .input_mux = &alc262_capture_source, |
| 9029 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9030 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9031 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9032 | [ALC262_ULTRA] = { |
| 9033 | .mixers = { alc262_ultra_mixer }, |
| 9034 | .init_verbs = { alc262_init_verbs, alc262_ultra_verbs }, |
| 9035 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9036 | .dac_nids = alc262_dac_nids, |
| 9037 | .hp_nid = 0x03, |
| 9038 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9039 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9040 | .channel_mode = alc262_modes, |
| 9041 | .input_mux = &alc262_ultra_capture_source, |
| 9042 | .unsol_event = alc262_ultra_unsol_event, |
| 9043 | .init_hook = alc262_ultra_automute, |
| 9044 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9045 | }; |
| 9046 | |
| 9047 | static int patch_alc262(struct hda_codec *codec) |
| 9048 | { |
| 9049 | struct alc_spec *spec; |
| 9050 | int board_config; |
| 9051 | int err; |
| 9052 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9053 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9054 | if (spec == NULL) |
| 9055 | return -ENOMEM; |
| 9056 | |
| 9057 | codec->spec = spec; |
| 9058 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9059 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9060 | * under-run |
| 9061 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9062 | { |
| 9063 | int tmp; |
| 9064 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9065 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9066 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9067 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9068 | } |
| 9069 | #endif |
| 9070 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9071 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9072 | alc262_models, |
| 9073 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9074 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9075 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9076 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9077 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9078 | board_config = ALC262_AUTO; |
| 9079 | } |
| 9080 | |
| 9081 | if (board_config == ALC262_AUTO) { |
| 9082 | /* automatic parse from the BIOS config */ |
| 9083 | err = alc262_parse_auto_config(codec); |
| 9084 | if (err < 0) { |
| 9085 | alc_free(codec); |
| 9086 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9087 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9088 | printk(KERN_INFO |
| 9089 | "hda_codec: Cannot set up configuration " |
| 9090 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9091 | board_config = ALC262_BASIC; |
| 9092 | } |
| 9093 | } |
| 9094 | |
| 9095 | if (board_config != ALC262_AUTO) |
| 9096 | setup_preset(spec, &alc262_presets[board_config]); |
| 9097 | |
| 9098 | spec->stream_name_analog = "ALC262 Analog"; |
| 9099 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9100 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9101 | |
| 9102 | spec->stream_name_digital = "ALC262 Digital"; |
| 9103 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9104 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9105 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9106 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9107 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9108 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9109 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9110 | /* get type */ |
| 9111 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9112 | if (wcap != AC_WID_AUD_IN) { |
| 9113 | spec->adc_nids = alc262_adc_nids_alt; |
| 9114 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9115 | spec->mixers[spec->num_mixers] = |
| 9116 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9117 | spec->num_mixers++; |
| 9118 | } else { |
| 9119 | spec->adc_nids = alc262_adc_nids; |
| 9120 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 9121 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9122 | spec->num_mixers++; |
| 9123 | } |
| 9124 | } |
| 9125 | |
| 9126 | codec->patch_ops = alc_patch_ops; |
| 9127 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9128 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9129 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9130 | if (!spec->loopback.amplist) |
| 9131 | spec->loopback.amplist = alc262_loopbacks; |
| 9132 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9133 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9134 | return 0; |
| 9135 | } |
| 9136 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9137 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9138 | * ALC268 channel source setting (2 channel) |
| 9139 | */ |
| 9140 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9141 | #define alc268_modes alc260_modes |
| 9142 | |
| 9143 | static hda_nid_t alc268_dac_nids[2] = { |
| 9144 | /* front, hp */ |
| 9145 | 0x02, 0x03 |
| 9146 | }; |
| 9147 | |
| 9148 | static hda_nid_t alc268_adc_nids[2] = { |
| 9149 | /* ADC0-1 */ |
| 9150 | 0x08, 0x07 |
| 9151 | }; |
| 9152 | |
| 9153 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9154 | /* ADC0 */ |
| 9155 | 0x08 |
| 9156 | }; |
| 9157 | |
| 9158 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9159 | /* output mixer control */ |
| 9160 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9161 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9162 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9163 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9164 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9165 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9166 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9167 | { } |
| 9168 | }; |
| 9169 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9170 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9171 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9172 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9173 | { } |
| 9174 | }; |
| 9175 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9176 | /* Toshiba specific */ |
| 9177 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9178 | |
| 9179 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9180 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9181 | { } /* end */ |
| 9182 | }; |
| 9183 | |
| 9184 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9185 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9186 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9187 | .ops = &snd_hda_bind_vol, |
| 9188 | .values = { |
| 9189 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9190 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9191 | 0 |
| 9192 | }, |
| 9193 | }; |
| 9194 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9195 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9196 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9197 | { |
| 9198 | struct alc_spec *spec = codec->spec; |
| 9199 | unsigned int mute; |
| 9200 | |
| 9201 | if (force || !spec->sense_updated) { |
| 9202 | unsigned int present; |
| 9203 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9204 | AC_VERB_GET_PIN_SENSE, 0); |
| 9205 | spec->jack_present = (present & 0x80000000) != 0; |
| 9206 | spec->sense_updated = 1; |
| 9207 | } |
| 9208 | if (spec->jack_present) |
| 9209 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9210 | else /* unmute internal speaker if necessary */ |
| 9211 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9212 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9213 | HDA_AMP_MUTE, mute); |
| 9214 | } |
| 9215 | |
| 9216 | |
| 9217 | /* bind hp and internal speaker mute (with plug check) */ |
| 9218 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9219 | struct snd_ctl_elem_value *ucontrol) |
| 9220 | { |
| 9221 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9222 | long *valp = ucontrol->value.integer.value; |
| 9223 | int change; |
| 9224 | |
| 9225 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9226 | HDA_AMP_MUTE, |
| 9227 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9228 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9229 | HDA_AMP_MUTE, |
| 9230 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9231 | if (change) |
| 9232 | alc268_acer_automute(codec, 0); |
| 9233 | return change; |
| 9234 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9235 | |
| 9236 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9237 | /* output mixer control */ |
| 9238 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9239 | { |
| 9240 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9241 | .name = "Master Playback Switch", |
| 9242 | .info = snd_hda_mixer_amp_switch_info, |
| 9243 | .get = snd_hda_mixer_amp_switch_get, |
| 9244 | .put = alc268_acer_master_sw_put, |
| 9245 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9246 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9247 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9248 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9249 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9250 | { } |
| 9251 | }; |
| 9252 | |
| 9253 | static struct hda_verb alc268_acer_verbs[] = { |
| 9254 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9255 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9256 | |
| 9257 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9258 | { } |
| 9259 | }; |
| 9260 | |
| 9261 | /* unsolicited event for HP jack sensing */ |
| 9262 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9263 | unsigned int res) |
| 9264 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9265 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9266 | return; |
| 9267 | alc268_toshiba_automute(codec); |
| 9268 | } |
| 9269 | |
| 9270 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9271 | unsigned int res) |
| 9272 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9273 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9274 | return; |
| 9275 | alc268_acer_automute(codec, 1); |
| 9276 | } |
| 9277 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9278 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9279 | { |
| 9280 | alc268_acer_automute(codec, 1); |
| 9281 | } |
| 9282 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9283 | /* |
| 9284 | * generic initialization of ADC, input mixers and output mixers |
| 9285 | */ |
| 9286 | static struct hda_verb alc268_base_init_verbs[] = { |
| 9287 | /* Unmute DAC0-1 and set vol = 0 */ |
| 9288 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9289 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9290 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9291 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9292 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9293 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9294 | |
| 9295 | /* |
| 9296 | * Set up output mixers (0x0c - 0x0e) |
| 9297 | */ |
| 9298 | /* set vol=0 to output mixers */ |
| 9299 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9300 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9301 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9302 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9303 | |
| 9304 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9305 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9306 | |
| 9307 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9308 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9309 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9310 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9311 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9312 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9313 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9314 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9315 | |
| 9316 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9317 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9318 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9319 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9320 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9321 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9322 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9323 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9324 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9325 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 9326 | |
| 9327 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9328 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9329 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9330 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9331 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9332 | { } |
| 9333 | }; |
| 9334 | |
| 9335 | /* |
| 9336 | * generic initialization of ADC, input mixers and output mixers |
| 9337 | */ |
| 9338 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 9339 | /* set output DAC */ |
| 9340 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9341 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9342 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9343 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9344 | |
| 9345 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9346 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9347 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9348 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9349 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9350 | |
| 9351 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9352 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9353 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9354 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9355 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9356 | |
| 9357 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9358 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9359 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9360 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9361 | |
| 9362 | /* set PCBEEP vol = 0 */ |
| 9363 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, |
| 9364 | |
| 9365 | { } |
| 9366 | }; |
| 9367 | |
| 9368 | #define alc268_mux_enum_info alc_mux_enum_info |
| 9369 | #define alc268_mux_enum_get alc_mux_enum_get |
| 9370 | |
| 9371 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9372 | struct snd_ctl_elem_value *ucontrol) |
| 9373 | { |
| 9374 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9375 | struct alc_spec *spec = codec->spec; |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9376 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9377 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 9378 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; |
| 9379 | hda_nid_t nid = capture_mixers[adc_idx]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9380 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9381 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
| 9382 | nid, |
| 9383 | &spec->cur_mux[adc_idx]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9384 | } |
| 9385 | |
| 9386 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 9387 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9388 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9389 | { |
| 9390 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9391 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9392 | * So call somewhat different.. |
| 9393 | * FIXME: the controls appear in the "playback" view! |
| 9394 | */ |
| 9395 | /* .name = "Capture Source", */ |
| 9396 | .name = "Input Source", |
| 9397 | .count = 1, |
| 9398 | .info = alc268_mux_enum_info, |
| 9399 | .get = alc268_mux_enum_get, |
| 9400 | .put = alc268_mux_enum_put, |
| 9401 | }, |
| 9402 | { } /* end */ |
| 9403 | }; |
| 9404 | |
| 9405 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 9406 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9407 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9408 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9409 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9410 | { |
| 9411 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9412 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9413 | * So call somewhat different.. |
| 9414 | * FIXME: the controls appear in the "playback" view! |
| 9415 | */ |
| 9416 | /* .name = "Capture Source", */ |
| 9417 | .name = "Input Source", |
| 9418 | .count = 2, |
| 9419 | .info = alc268_mux_enum_info, |
| 9420 | .get = alc268_mux_enum_get, |
| 9421 | .put = alc268_mux_enum_put, |
| 9422 | }, |
| 9423 | { } /* end */ |
| 9424 | }; |
| 9425 | |
| 9426 | static struct hda_input_mux alc268_capture_source = { |
| 9427 | .num_items = 4, |
| 9428 | .items = { |
| 9429 | { "Mic", 0x0 }, |
| 9430 | { "Front Mic", 0x1 }, |
| 9431 | { "Line", 0x2 }, |
| 9432 | { "CD", 0x3 }, |
| 9433 | }, |
| 9434 | }; |
| 9435 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9436 | #ifdef CONFIG_SND_DEBUG |
| 9437 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
| 9438 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9439 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9440 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9441 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9442 | |
| 9443 | /* Volume widgets */ |
| 9444 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9445 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9446 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9447 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9448 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 9449 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 9450 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 9451 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 9452 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 9453 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 9454 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 9455 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 9456 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
| 9457 | HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 9458 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9459 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 9460 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 9461 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 9462 | |
| 9463 | /* Modes for retasking pin widgets */ |
| 9464 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 9465 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 9466 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 9467 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 9468 | |
| 9469 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 9470 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 9471 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 9472 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 9473 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 9474 | |
| 9475 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 9476 | * The ALC268 does not have an SPDIF input. |
| 9477 | */ |
| 9478 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 9479 | |
| 9480 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 9481 | * this output to turn on an external amplifier. |
| 9482 | */ |
| 9483 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 9484 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 9485 | |
| 9486 | { } /* end */ |
| 9487 | }; |
| 9488 | #endif |
| 9489 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9490 | /* create input playback/capture controls for the given pin */ |
| 9491 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 9492 | const char *ctlname, int idx) |
| 9493 | { |
| 9494 | char name[32]; |
| 9495 | int err; |
| 9496 | |
| 9497 | sprintf(name, "%s Playback Volume", ctlname); |
| 9498 | if (nid == 0x14) { |
| 9499 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9500 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 9501 | HDA_OUTPUT)); |
| 9502 | if (err < 0) |
| 9503 | return err; |
| 9504 | } else if (nid == 0x15) { |
| 9505 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9506 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 9507 | HDA_OUTPUT)); |
| 9508 | if (err < 0) |
| 9509 | return err; |
| 9510 | } else |
| 9511 | return -1; |
| 9512 | sprintf(name, "%s Playback Switch", ctlname); |
| 9513 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 9514 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 9515 | if (err < 0) |
| 9516 | return err; |
| 9517 | return 0; |
| 9518 | } |
| 9519 | |
| 9520 | /* add playback controls from the parsed DAC table */ |
| 9521 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9522 | const struct auto_pin_cfg *cfg) |
| 9523 | { |
| 9524 | hda_nid_t nid; |
| 9525 | int err; |
| 9526 | |
| 9527 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 9528 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9529 | spec->multiout.dac_nids[0] = 2; |
| 9530 | spec->multiout.dac_nids[1] = 3; |
| 9531 | |
| 9532 | nid = cfg->line_out_pins[0]; |
| 9533 | if (nid) |
| 9534 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 9535 | |
| 9536 | nid = cfg->speaker_pins[0]; |
| 9537 | if (nid == 0x1d) { |
| 9538 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9539 | "Speaker Playback Volume", |
| 9540 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9541 | if (err < 0) |
| 9542 | return err; |
| 9543 | } |
| 9544 | nid = cfg->hp_pins[0]; |
| 9545 | if (nid) |
| 9546 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 9547 | |
| 9548 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 9549 | if (nid == 0x16) { |
| 9550 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9551 | "Mono Playback Switch", |
| 9552 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 9553 | if (err < 0) |
| 9554 | return err; |
| 9555 | } |
| 9556 | return 0; |
| 9557 | } |
| 9558 | |
| 9559 | /* create playback/capture controls for input pins */ |
| 9560 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 9561 | const struct auto_pin_cfg *cfg) |
| 9562 | { |
| 9563 | struct hda_input_mux *imux = &spec->private_imux; |
| 9564 | int i, idx1; |
| 9565 | |
| 9566 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9567 | switch(cfg->input_pins[i]) { |
| 9568 | case 0x18: |
| 9569 | idx1 = 0; /* Mic 1 */ |
| 9570 | break; |
| 9571 | case 0x19: |
| 9572 | idx1 = 1; /* Mic 2 */ |
| 9573 | break; |
| 9574 | case 0x1a: |
| 9575 | idx1 = 2; /* Line In */ |
| 9576 | break; |
| 9577 | case 0x1c: |
| 9578 | idx1 = 3; /* CD */ |
| 9579 | break; |
| 9580 | default: |
| 9581 | continue; |
| 9582 | } |
| 9583 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 9584 | imux->items[imux->num_items].index = idx1; |
| 9585 | imux->num_items++; |
| 9586 | } |
| 9587 | return 0; |
| 9588 | } |
| 9589 | |
| 9590 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 9591 | { |
| 9592 | struct alc_spec *spec = codec->spec; |
| 9593 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9594 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9595 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9596 | unsigned int dac_vol1, dac_vol2; |
| 9597 | |
| 9598 | if (speaker_nid) { |
| 9599 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 9600 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 9601 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9602 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9603 | AMP_IN_UNMUTE(1)); |
| 9604 | snd_hda_codec_write(codec, 0x10, 0, |
| 9605 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9606 | AMP_IN_UNMUTE(1)); |
| 9607 | } else { |
| 9608 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9609 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9610 | snd_hda_codec_write(codec, 0x10, 0, |
| 9611 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9612 | } |
| 9613 | |
| 9614 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 9615 | if (line_nid == 0x14) |
| 9616 | dac_vol2 = AMP_OUT_ZERO; |
| 9617 | else if (line_nid == 0x15) |
| 9618 | dac_vol1 = AMP_OUT_ZERO; |
| 9619 | if (hp_nid == 0x14) |
| 9620 | dac_vol2 = AMP_OUT_ZERO; |
| 9621 | else if (hp_nid == 0x15) |
| 9622 | dac_vol1 = AMP_OUT_ZERO; |
| 9623 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 9624 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 9625 | spec->autocfg.line_out_pins[2] != 0x16) |
| 9626 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 9627 | |
| 9628 | snd_hda_codec_write(codec, 0x02, 0, |
| 9629 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 9630 | snd_hda_codec_write(codec, 0x03, 0, |
| 9631 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 9632 | } |
| 9633 | |
| 9634 | /* pcm configuration: identiacal with ALC880 */ |
| 9635 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 9636 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
| 9637 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 9638 | |
| 9639 | /* |
| 9640 | * BIOS auto configuration |
| 9641 | */ |
| 9642 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 9643 | { |
| 9644 | struct alc_spec *spec = codec->spec; |
| 9645 | int err; |
| 9646 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 9647 | |
| 9648 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9649 | alc268_ignore); |
| 9650 | if (err < 0) |
| 9651 | return err; |
| 9652 | if (!spec->autocfg.line_outs) |
| 9653 | return 0; /* can't find valid BIOS pin config */ |
| 9654 | |
| 9655 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9656 | if (err < 0) |
| 9657 | return err; |
| 9658 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9659 | if (err < 0) |
| 9660 | return err; |
| 9661 | |
| 9662 | spec->multiout.max_channels = 2; |
| 9663 | |
| 9664 | /* digital only support output */ |
| 9665 | if (spec->autocfg.dig_out_pin) |
| 9666 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 9667 | |
| 9668 | if (spec->kctl_alloc) |
| 9669 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9670 | |
| 9671 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 9672 | spec->num_mux_defs = 1; |
| 9673 | spec->input_mux = &spec->private_imux; |
| 9674 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9675 | err = alc_auto_add_mic_boost(codec); |
| 9676 | if (err < 0) |
| 9677 | return err; |
| 9678 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9679 | return 1; |
| 9680 | } |
| 9681 | |
| 9682 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 9683 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 9684 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 9685 | |
| 9686 | /* init callback for auto-configuration model -- overriding the default init */ |
| 9687 | static void alc268_auto_init(struct hda_codec *codec) |
| 9688 | { |
| 9689 | alc268_auto_init_multi_out(codec); |
| 9690 | alc268_auto_init_hp_out(codec); |
| 9691 | alc268_auto_init_mono_speaker_out(codec); |
| 9692 | alc268_auto_init_analog_input(codec); |
| 9693 | } |
| 9694 | |
| 9695 | /* |
| 9696 | * configuration and preset |
| 9697 | */ |
| 9698 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 9699 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 9700 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9701 | [ALC268_ACER] = "acer", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9702 | #ifdef CONFIG_SND_DEBUG |
| 9703 | [ALC268_TEST] = "test", |
| 9704 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9705 | [ALC268_AUTO] = "auto", |
| 9706 | }; |
| 9707 | |
| 9708 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9709 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
| 9710 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
| 9711 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9712 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9713 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 9714 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 9715 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9716 | {} |
| 9717 | }; |
| 9718 | |
| 9719 | static struct alc_config_preset alc268_presets[] = { |
| 9720 | [ALC268_3ST] = { |
| 9721 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 9722 | .init_verbs = { alc268_base_init_verbs }, |
| 9723 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9724 | .dac_nids = alc268_dac_nids, |
| 9725 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9726 | .adc_nids = alc268_adc_nids_alt, |
| 9727 | .hp_nid = 0x03, |
| 9728 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 9729 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9730 | .channel_mode = alc268_modes, |
| 9731 | .input_mux = &alc268_capture_source, |
| 9732 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9733 | [ALC268_TOSHIBA] = { |
| 9734 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9735 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9736 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9737 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9738 | .dac_nids = alc268_dac_nids, |
| 9739 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9740 | .adc_nids = alc268_adc_nids_alt, |
| 9741 | .hp_nid = 0x03, |
| 9742 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9743 | .channel_mode = alc268_modes, |
| 9744 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9745 | .unsol_event = alc268_toshiba_unsol_event, |
| 9746 | .init_hook = alc268_toshiba_automute, |
| 9747 | }, |
| 9748 | [ALC268_ACER] = { |
| 9749 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer }, |
| 9750 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9751 | alc268_acer_verbs }, |
| 9752 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9753 | .dac_nids = alc268_dac_nids, |
| 9754 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9755 | .adc_nids = alc268_adc_nids_alt, |
| 9756 | .hp_nid = 0x02, |
| 9757 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9758 | .channel_mode = alc268_modes, |
| 9759 | .input_mux = &alc268_capture_source, |
| 9760 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9761 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9762 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9763 | #ifdef CONFIG_SND_DEBUG |
| 9764 | [ALC268_TEST] = { |
| 9765 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 9766 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9767 | alc268_volume_init_verbs }, |
| 9768 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9769 | .dac_nids = alc268_dac_nids, |
| 9770 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9771 | .adc_nids = alc268_adc_nids_alt, |
| 9772 | .hp_nid = 0x03, |
| 9773 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 9774 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9775 | .channel_mode = alc268_modes, |
| 9776 | .input_mux = &alc268_capture_source, |
| 9777 | }, |
| 9778 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9779 | }; |
| 9780 | |
| 9781 | static int patch_alc268(struct hda_codec *codec) |
| 9782 | { |
| 9783 | struct alc_spec *spec; |
| 9784 | int board_config; |
| 9785 | int err; |
| 9786 | |
| 9787 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 9788 | if (spec == NULL) |
| 9789 | return -ENOMEM; |
| 9790 | |
| 9791 | codec->spec = spec; |
| 9792 | |
| 9793 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 9794 | alc268_models, |
| 9795 | alc268_cfg_tbl); |
| 9796 | |
| 9797 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 9798 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 9799 | "trying auto-probe from BIOS...\n"); |
| 9800 | board_config = ALC268_AUTO; |
| 9801 | } |
| 9802 | |
| 9803 | if (board_config == ALC268_AUTO) { |
| 9804 | /* automatic parse from the BIOS config */ |
| 9805 | err = alc268_parse_auto_config(codec); |
| 9806 | if (err < 0) { |
| 9807 | alc_free(codec); |
| 9808 | return err; |
| 9809 | } else if (!err) { |
| 9810 | printk(KERN_INFO |
| 9811 | "hda_codec: Cannot set up configuration " |
| 9812 | "from BIOS. Using base mode...\n"); |
| 9813 | board_config = ALC268_3ST; |
| 9814 | } |
| 9815 | } |
| 9816 | |
| 9817 | if (board_config != ALC268_AUTO) |
| 9818 | setup_preset(spec, &alc268_presets[board_config]); |
| 9819 | |
| 9820 | spec->stream_name_analog = "ALC268 Analog"; |
| 9821 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 9822 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
| 9823 | |
| 9824 | spec->stream_name_digital = "ALC268 Digital"; |
| 9825 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 9826 | |
| 9827 | if (board_config == ALC268_AUTO) { |
| 9828 | if (!spec->adc_nids && spec->input_mux) { |
| 9829 | /* check whether NID 0x07 is valid */ |
| 9830 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9831 | |
| 9832 | /* get type */ |
| 9833 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 9834 | if (wcap != AC_WID_AUD_IN) { |
| 9835 | spec->adc_nids = alc268_adc_nids_alt; |
| 9836 | spec->num_adc_nids = |
| 9837 | ARRAY_SIZE(alc268_adc_nids_alt); |
| 9838 | spec->mixers[spec->num_mixers] = |
| 9839 | alc268_capture_alt_mixer; |
| 9840 | spec->num_mixers++; |
| 9841 | } else { |
| 9842 | spec->adc_nids = alc268_adc_nids; |
| 9843 | spec->num_adc_nids = |
| 9844 | ARRAY_SIZE(alc268_adc_nids); |
| 9845 | spec->mixers[spec->num_mixers] = |
| 9846 | alc268_capture_mixer; |
| 9847 | spec->num_mixers++; |
| 9848 | } |
| 9849 | } |
| 9850 | } |
| 9851 | codec->patch_ops = alc_patch_ops; |
| 9852 | if (board_config == ALC268_AUTO) |
| 9853 | spec->init_hook = alc268_auto_init; |
| 9854 | |
| 9855 | return 0; |
| 9856 | } |
| 9857 | |
| 9858 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 9859 | * ALC269 channel source setting (2 channel) |
| 9860 | */ |
| 9861 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 9862 | |
| 9863 | #define alc269_dac_nids alc260_dac_nids |
| 9864 | |
| 9865 | static hda_nid_t alc269_adc_nids[1] = { |
| 9866 | /* ADC1 */ |
| 9867 | 0x07, |
| 9868 | }; |
| 9869 | |
| 9870 | #define alc269_modes alc260_modes |
| 9871 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 9872 | |
| 9873 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 9874 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9875 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9876 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9877 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9880 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9881 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9882 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9883 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9884 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9885 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 9886 | { } /* end */ |
| 9887 | }; |
| 9888 | |
| 9889 | /* capture mixer elements */ |
| 9890 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 9891 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9892 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9893 | { |
| 9894 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9895 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9896 | * So call somewhat different.. |
| 9897 | * FIXME: the controls appear in the "playback" view! |
| 9898 | */ |
| 9899 | /* .name = "Capture Source", */ |
| 9900 | .name = "Input Source", |
| 9901 | .count = 1, |
| 9902 | .info = alc_mux_enum_info, |
| 9903 | .get = alc_mux_enum_get, |
| 9904 | .put = alc_mux_enum_put, |
| 9905 | }, |
| 9906 | { } /* end */ |
| 9907 | }; |
| 9908 | |
| 9909 | /* |
| 9910 | * generic initialization of ADC, input mixers and output mixers |
| 9911 | */ |
| 9912 | static struct hda_verb alc269_init_verbs[] = { |
| 9913 | /* |
| 9914 | * Unmute ADC0 and set the default input to mic-in |
| 9915 | */ |
| 9916 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9917 | |
| 9918 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 9919 | * analog-loopback mixer widget |
| 9920 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9921 | * front panel mic (mic 2) |
| 9922 | */ |
| 9923 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 9924 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9925 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9928 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9929 | |
| 9930 | /* |
| 9931 | * Set up output mixers (0x0c - 0x0e) |
| 9932 | */ |
| 9933 | /* set vol=0 to output mixers */ |
| 9934 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9935 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9936 | |
| 9937 | /* set up input amps for analog loopback */ |
| 9938 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9939 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9940 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9941 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9942 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9943 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9944 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9945 | |
| 9946 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9947 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9948 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9949 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9950 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9951 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9952 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9953 | |
| 9954 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9955 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9956 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9957 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9958 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9959 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9960 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9961 | |
| 9962 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9963 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9964 | |
| 9965 | /* FIXME: use matrix-type input source selection */ |
| 9966 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 9967 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9968 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9969 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9970 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9971 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9972 | |
| 9973 | /* set EAPD */ |
| 9974 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9975 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9976 | { } |
| 9977 | }; |
| 9978 | |
| 9979 | /* add playback controls from the parsed DAC table */ |
| 9980 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9981 | const struct auto_pin_cfg *cfg) |
| 9982 | { |
| 9983 | hda_nid_t nid; |
| 9984 | int err; |
| 9985 | |
| 9986 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9987 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9988 | spec->multiout.dac_nids[0] = 2; |
| 9989 | |
| 9990 | nid = cfg->line_out_pins[0]; |
| 9991 | if (nid) { |
| 9992 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9993 | "Front Playback Volume", |
| 9994 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 9995 | if (err < 0) |
| 9996 | return err; |
| 9997 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9998 | "Front Playback Switch", |
| 9999 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10000 | if (err < 0) |
| 10001 | return err; |
| 10002 | } |
| 10003 | |
| 10004 | nid = cfg->speaker_pins[0]; |
| 10005 | if (nid) { |
| 10006 | if (!cfg->line_out_pins[0]) { |
| 10007 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10008 | "Speaker Playback Volume", |
| 10009 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10010 | HDA_OUTPUT)); |
| 10011 | if (err < 0) |
| 10012 | return err; |
| 10013 | } |
| 10014 | if (nid == 0x16) { |
| 10015 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10016 | "Speaker Playback Switch", |
| 10017 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10018 | HDA_OUTPUT)); |
| 10019 | if (err < 0) |
| 10020 | return err; |
| 10021 | } else { |
| 10022 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10023 | "Speaker Playback Switch", |
| 10024 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10025 | HDA_OUTPUT)); |
| 10026 | if (err < 0) |
| 10027 | return err; |
| 10028 | } |
| 10029 | } |
| 10030 | nid = cfg->hp_pins[0]; |
| 10031 | if (nid) { |
| 10032 | /* spec->multiout.hp_nid = 2; */ |
| 10033 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10034 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10035 | "Headphone Playback Volume", |
| 10036 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10037 | HDA_OUTPUT)); |
| 10038 | if (err < 0) |
| 10039 | return err; |
| 10040 | } |
| 10041 | if (nid == 0x16) { |
| 10042 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10043 | "Headphone Playback Switch", |
| 10044 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10045 | HDA_OUTPUT)); |
| 10046 | if (err < 0) |
| 10047 | return err; |
| 10048 | } else { |
| 10049 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10050 | "Headphone Playback Switch", |
| 10051 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10052 | HDA_OUTPUT)); |
| 10053 | if (err < 0) |
| 10054 | return err; |
| 10055 | } |
| 10056 | } |
| 10057 | return 0; |
| 10058 | } |
| 10059 | |
| 10060 | #define alc269_auto_create_analog_input_ctls \ |
| 10061 | alc880_auto_create_analog_input_ctls |
| 10062 | |
| 10063 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10064 | #define alc269_loopbacks alc880_loopbacks |
| 10065 | #endif |
| 10066 | |
| 10067 | /* pcm configuration: identiacal with ALC880 */ |
| 10068 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10069 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10070 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10071 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10072 | |
| 10073 | /* |
| 10074 | * BIOS auto configuration |
| 10075 | */ |
| 10076 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10077 | { |
| 10078 | struct alc_spec *spec = codec->spec; |
| 10079 | int err; |
| 10080 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10081 | |
| 10082 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10083 | alc269_ignore); |
| 10084 | if (err < 0) |
| 10085 | return err; |
| 10086 | |
| 10087 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10088 | if (err < 0) |
| 10089 | return err; |
| 10090 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10091 | if (err < 0) |
| 10092 | return err; |
| 10093 | |
| 10094 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10095 | |
| 10096 | if (spec->autocfg.dig_out_pin) |
| 10097 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10098 | |
| 10099 | if (spec->kctl_alloc) |
| 10100 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10101 | |
| 10102 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10103 | spec->num_mux_defs = 1; |
| 10104 | spec->input_mux = &spec->private_imux; |
| 10105 | |
| 10106 | err = alc_auto_add_mic_boost(codec); |
| 10107 | if (err < 0) |
| 10108 | return err; |
| 10109 | |
| 10110 | return 1; |
| 10111 | } |
| 10112 | |
| 10113 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10114 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10115 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10116 | |
| 10117 | |
| 10118 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10119 | static void alc269_auto_init(struct hda_codec *codec) |
| 10120 | { |
| 10121 | alc269_auto_init_multi_out(codec); |
| 10122 | alc269_auto_init_hp_out(codec); |
| 10123 | alc269_auto_init_analog_input(codec); |
| 10124 | } |
| 10125 | |
| 10126 | /* |
| 10127 | * configuration and preset |
| 10128 | */ |
| 10129 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 10130 | [ALC269_BASIC] = "basic", |
| 10131 | }; |
| 10132 | |
| 10133 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 10134 | {} |
| 10135 | }; |
| 10136 | |
| 10137 | static struct alc_config_preset alc269_presets[] = { |
| 10138 | [ALC269_BASIC] = { |
| 10139 | .mixers = { alc269_base_mixer }, |
| 10140 | .init_verbs = { alc269_init_verbs }, |
| 10141 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 10142 | .dac_nids = alc269_dac_nids, |
| 10143 | .hp_nid = 0x03, |
| 10144 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 10145 | .channel_mode = alc269_modes, |
| 10146 | .input_mux = &alc269_capture_source, |
| 10147 | }, |
| 10148 | }; |
| 10149 | |
| 10150 | static int patch_alc269(struct hda_codec *codec) |
| 10151 | { |
| 10152 | struct alc_spec *spec; |
| 10153 | int board_config; |
| 10154 | int err; |
| 10155 | |
| 10156 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10157 | if (spec == NULL) |
| 10158 | return -ENOMEM; |
| 10159 | |
| 10160 | codec->spec = spec; |
| 10161 | |
| 10162 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 10163 | alc269_models, |
| 10164 | alc269_cfg_tbl); |
| 10165 | |
| 10166 | if (board_config < 0) { |
| 10167 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 10168 | "trying auto-probe from BIOS...\n"); |
| 10169 | board_config = ALC269_AUTO; |
| 10170 | } |
| 10171 | |
| 10172 | if (board_config == ALC269_AUTO) { |
| 10173 | /* automatic parse from the BIOS config */ |
| 10174 | err = alc269_parse_auto_config(codec); |
| 10175 | if (err < 0) { |
| 10176 | alc_free(codec); |
| 10177 | return err; |
| 10178 | } else if (!err) { |
| 10179 | printk(KERN_INFO |
| 10180 | "hda_codec: Cannot set up configuration " |
| 10181 | "from BIOS. Using base mode...\n"); |
| 10182 | board_config = ALC269_BASIC; |
| 10183 | } |
| 10184 | } |
| 10185 | |
| 10186 | if (board_config != ALC269_AUTO) |
| 10187 | setup_preset(spec, &alc269_presets[board_config]); |
| 10188 | |
| 10189 | spec->stream_name_analog = "ALC269 Analog"; |
| 10190 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 10191 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 10192 | |
| 10193 | spec->stream_name_digital = "ALC269 Digital"; |
| 10194 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 10195 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 10196 | |
| 10197 | spec->adc_nids = alc269_adc_nids; |
| 10198 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 10199 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 10200 | spec->num_mixers++; |
| 10201 | |
| 10202 | codec->patch_ops = alc_patch_ops; |
| 10203 | if (board_config == ALC269_AUTO) |
| 10204 | spec->init_hook = alc269_auto_init; |
| 10205 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10206 | if (!spec->loopback.amplist) |
| 10207 | spec->loopback.amplist = alc269_loopbacks; |
| 10208 | #endif |
| 10209 | |
| 10210 | return 0; |
| 10211 | } |
| 10212 | |
| 10213 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10214 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 10215 | */ |
| 10216 | |
| 10217 | /* |
| 10218 | * set the path ways for 2 channel output |
| 10219 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 10220 | */ |
| 10221 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 10222 | /* set pin widget 1Ah (line in) for input */ |
| 10223 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10224 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10225 | * the vref |
| 10226 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10227 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10228 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10229 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10230 | #if 0 |
| 10231 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10232 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10233 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10234 | { } /* end */ |
| 10235 | }; |
| 10236 | /* |
| 10237 | * 6ch mode |
| 10238 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 10239 | */ |
| 10240 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 10241 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10242 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10243 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10244 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10245 | |
| 10246 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10247 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10248 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10249 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10250 | #if 0 |
| 10251 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10252 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10253 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10254 | { } /* end */ |
| 10255 | }; |
| 10256 | |
| 10257 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 10258 | { 2, alc861_threestack_ch2_init }, |
| 10259 | { 6, alc861_threestack_ch6_init }, |
| 10260 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10261 | /* Set mic1 as input and unmute the mixer */ |
| 10262 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 10263 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10264 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10265 | { } /* end */ |
| 10266 | }; |
| 10267 | /* Set mic1 as output and mute mixer */ |
| 10268 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 10269 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10270 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10271 | { } /* end */ |
| 10272 | }; |
| 10273 | |
| 10274 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 10275 | { 2, alc861_uniwill_m31_ch2_init }, |
| 10276 | { 4, alc861_uniwill_m31_ch4_init }, |
| 10277 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10278 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10279 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 10280 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 10281 | /* set pin widget 1Ah (line in) for input */ |
| 10282 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10283 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10284 | * the vref |
| 10285 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10286 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10287 | |
| 10288 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10289 | #if 0 |
| 10290 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10291 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10292 | #endif |
| 10293 | { } /* end */ |
| 10294 | }; |
| 10295 | /* Set mic1 nad line-in as output and mute mixer */ |
| 10296 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 10297 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10298 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10299 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10300 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10301 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10302 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10303 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10304 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10305 | |
| 10306 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10307 | #if 0 |
| 10308 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10309 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10310 | #endif |
| 10311 | { } /* end */ |
| 10312 | }; |
| 10313 | |
| 10314 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 10315 | { 2, alc861_asus_ch2_init }, |
| 10316 | { 6, alc861_asus_ch6_init }, |
| 10317 | }; |
| 10318 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10319 | /* patch-ALC861 */ |
| 10320 | |
| 10321 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 10322 | /* output mixer control */ |
| 10323 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10324 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10325 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10326 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10327 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10328 | |
| 10329 | /*Input mixer control */ |
| 10330 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10331 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10332 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10333 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10334 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10335 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10336 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10337 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10338 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10339 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10340 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10341 | /* Capture mixer control */ |
| 10342 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10343 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10344 | { |
| 10345 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10346 | .name = "Capture Source", |
| 10347 | .count = 1, |
| 10348 | .info = alc_mux_enum_info, |
| 10349 | .get = alc_mux_enum_get, |
| 10350 | .put = alc_mux_enum_put, |
| 10351 | }, |
| 10352 | { } /* end */ |
| 10353 | }; |
| 10354 | |
| 10355 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 10356 | /* output mixer control */ |
| 10357 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10358 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10359 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10360 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10361 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10362 | |
| 10363 | /* Input mixer control */ |
| 10364 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10365 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10366 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10367 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10368 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10369 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10370 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10371 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10372 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10373 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10374 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10375 | /* Capture mixer control */ |
| 10376 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10377 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10378 | { |
| 10379 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10380 | .name = "Capture Source", |
| 10381 | .count = 1, |
| 10382 | .info = alc_mux_enum_info, |
| 10383 | .get = alc_mux_enum_get, |
| 10384 | .put = alc_mux_enum_put, |
| 10385 | }, |
| 10386 | { |
| 10387 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10388 | .name = "Channel Mode", |
| 10389 | .info = alc_ch_mode_info, |
| 10390 | .get = alc_ch_mode_get, |
| 10391 | .put = alc_ch_mode_put, |
| 10392 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 10393 | }, |
| 10394 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10395 | }; |
| 10396 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10397 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10398 | /* output mixer control */ |
| 10399 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10400 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10401 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10402 | |
| 10403 | /*Capture mixer control */ |
| 10404 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10405 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10406 | { |
| 10407 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10408 | .name = "Capture Source", |
| 10409 | .count = 1, |
| 10410 | .info = alc_mux_enum_info, |
| 10411 | .get = alc_mux_enum_get, |
| 10412 | .put = alc_mux_enum_put, |
| 10413 | }, |
| 10414 | |
| 10415 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10416 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10417 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10418 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 10419 | /* output mixer control */ |
| 10420 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10421 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10422 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10423 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10424 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10425 | |
| 10426 | /* Input mixer control */ |
| 10427 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10428 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10429 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10430 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10431 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10432 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10433 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10434 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10435 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10436 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10437 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10438 | /* Capture mixer control */ |
| 10439 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10440 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10441 | { |
| 10442 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10443 | .name = "Capture Source", |
| 10444 | .count = 1, |
| 10445 | .info = alc_mux_enum_info, |
| 10446 | .get = alc_mux_enum_get, |
| 10447 | .put = alc_mux_enum_put, |
| 10448 | }, |
| 10449 | { |
| 10450 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10451 | .name = "Channel Mode", |
| 10452 | .info = alc_ch_mode_info, |
| 10453 | .get = alc_ch_mode_get, |
| 10454 | .put = alc_ch_mode_put, |
| 10455 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 10456 | }, |
| 10457 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10458 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10459 | |
| 10460 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 10461 | /* output mixer control */ |
| 10462 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10463 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10464 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10465 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10466 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10467 | |
| 10468 | /* Input mixer control */ |
| 10469 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10470 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10471 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10472 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10473 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10474 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10475 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10476 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10477 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10478 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 10479 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10480 | /* Capture mixer control */ |
| 10481 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10482 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10483 | { |
| 10484 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10485 | .name = "Capture Source", |
| 10486 | .count = 1, |
| 10487 | .info = alc_mux_enum_info, |
| 10488 | .get = alc_mux_enum_get, |
| 10489 | .put = alc_mux_enum_put, |
| 10490 | }, |
| 10491 | { |
| 10492 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10493 | .name = "Channel Mode", |
| 10494 | .info = alc_ch_mode_info, |
| 10495 | .get = alc_ch_mode_get, |
| 10496 | .put = alc_ch_mode_put, |
| 10497 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 10498 | }, |
| 10499 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10500 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10501 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10502 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10503 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10504 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10505 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10506 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10507 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10508 | { } |
| 10509 | }; |
| 10510 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10511 | /* |
| 10512 | * generic initialization of ADC, input mixers and output mixers |
| 10513 | */ |
| 10514 | static struct hda_verb alc861_base_init_verbs[] = { |
| 10515 | /* |
| 10516 | * Unmute ADC0 and set the default input to mic-in |
| 10517 | */ |
| 10518 | /* port-A for surround (rear panel) */ |
| 10519 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10520 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10521 | /* port-B for mic-in (rear panel) with vref */ |
| 10522 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10523 | /* port-C for line-in (rear panel) */ |
| 10524 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10525 | /* port-D for Front */ |
| 10526 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10527 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10528 | /* port-E for HP out (front panel) */ |
| 10529 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 10530 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10531 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10532 | /* port-F for mic-in (front panel) with vref */ |
| 10533 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10534 | /* port-G for CLFE (rear panel) */ |
| 10535 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10536 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10537 | /* port-H for side (rear panel) */ |
| 10538 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10539 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10540 | /* CD-in */ |
| 10541 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10542 | /* route front mic to ADC1*/ |
| 10543 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10544 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10545 | |
| 10546 | /* Unmute DAC0~3 & spdif out*/ |
| 10547 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10548 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10549 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10550 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10552 | |
| 10553 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10554 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10555 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10556 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10557 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10558 | |
| 10559 | /* Unmute Stereo Mixer 15 */ |
| 10560 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10561 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10562 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10563 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10564 | |
| 10565 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10566 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10567 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10568 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10569 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10570 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10571 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10572 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10573 | /* hp used DAC 3 (Front) */ |
| 10574 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10575 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10576 | |
| 10577 | { } |
| 10578 | }; |
| 10579 | |
| 10580 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 10581 | /* |
| 10582 | * Unmute ADC0 and set the default input to mic-in |
| 10583 | */ |
| 10584 | /* port-A for surround (rear panel) */ |
| 10585 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10586 | /* port-B for mic-in (rear panel) with vref */ |
| 10587 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10588 | /* port-C for line-in (rear panel) */ |
| 10589 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10590 | /* port-D for Front */ |
| 10591 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10592 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10593 | /* port-E for HP out (front panel) */ |
| 10594 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 10595 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10596 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10597 | /* port-F for mic-in (front panel) with vref */ |
| 10598 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10599 | /* port-G for CLFE (rear panel) */ |
| 10600 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10601 | /* port-H for side (rear panel) */ |
| 10602 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10603 | /* CD-in */ |
| 10604 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10605 | /* route front mic to ADC1*/ |
| 10606 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10607 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10608 | /* Unmute DAC0~3 & spdif out*/ |
| 10609 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10610 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10611 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10612 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10613 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10614 | |
| 10615 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10616 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10617 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10618 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10619 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10620 | |
| 10621 | /* Unmute Stereo Mixer 15 */ |
| 10622 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10623 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10625 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10626 | |
| 10627 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10628 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10629 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10630 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10631 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10632 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10633 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10634 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10635 | /* hp used DAC 3 (Front) */ |
| 10636 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10637 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10638 | { } |
| 10639 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10640 | |
| 10641 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 10642 | /* |
| 10643 | * Unmute ADC0 and set the default input to mic-in |
| 10644 | */ |
| 10645 | /* port-A for surround (rear panel) */ |
| 10646 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10647 | /* port-B for mic-in (rear panel) with vref */ |
| 10648 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10649 | /* port-C for line-in (rear panel) */ |
| 10650 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10651 | /* port-D for Front */ |
| 10652 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10653 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10654 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10655 | /* this has to be set to VREF80 */ |
| 10656 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10657 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10658 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10659 | /* port-F for mic-in (front panel) with vref */ |
| 10660 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10661 | /* port-G for CLFE (rear panel) */ |
| 10662 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10663 | /* port-H for side (rear panel) */ |
| 10664 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10665 | /* CD-in */ |
| 10666 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10667 | /* route front mic to ADC1*/ |
| 10668 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10669 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10670 | /* Unmute DAC0~3 & spdif out*/ |
| 10671 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10672 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10673 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10674 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10675 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10676 | |
| 10677 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10678 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10679 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10680 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10681 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10682 | |
| 10683 | /* Unmute Stereo Mixer 15 */ |
| 10684 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10685 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10686 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10687 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10688 | |
| 10689 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10690 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10691 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10692 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10693 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10694 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10695 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10696 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10697 | /* hp used DAC 3 (Front) */ |
| 10698 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10699 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10700 | { } |
| 10701 | }; |
| 10702 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10703 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 10704 | /* |
| 10705 | * Unmute ADC0 and set the default input to mic-in |
| 10706 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10707 | /* port-A for surround (rear panel) |
| 10708 | * according to codec#0 this is the HP jack |
| 10709 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10710 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 10711 | /* route front PCM to HP */ |
| 10712 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 10713 | /* port-B for mic-in (rear panel) with vref */ |
| 10714 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10715 | /* port-C for line-in (rear panel) */ |
| 10716 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10717 | /* port-D for Front */ |
| 10718 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10719 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10720 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10721 | /* this has to be set to VREF80 */ |
| 10722 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10723 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10724 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10725 | /* port-F for mic-in (front panel) with vref */ |
| 10726 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10727 | /* port-G for CLFE (rear panel) */ |
| 10728 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10729 | /* port-H for side (rear panel) */ |
| 10730 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10731 | /* CD-in */ |
| 10732 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10733 | /* route front mic to ADC1*/ |
| 10734 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10735 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10736 | /* Unmute DAC0~3 & spdif out*/ |
| 10737 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10738 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10739 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10740 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10741 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10742 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10743 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10744 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10745 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10746 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10747 | |
| 10748 | /* Unmute Stereo Mixer 15 */ |
| 10749 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10750 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10751 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10752 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10753 | |
| 10754 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10755 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10756 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10757 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10758 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10759 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10760 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10761 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10762 | /* hp used DAC 3 (Front) */ |
| 10763 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10764 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10765 | { } |
| 10766 | }; |
| 10767 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10768 | /* additional init verbs for ASUS laptops */ |
| 10769 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 10770 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 10771 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 10772 | { } |
| 10773 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10774 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10775 | /* |
| 10776 | * generic initialization of ADC, input mixers and output mixers |
| 10777 | */ |
| 10778 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 10779 | /* |
| 10780 | * Unmute ADC0 and set the default input to mic-in |
| 10781 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10782 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10783 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10784 | |
| 10785 | /* Unmute DAC0~3 & spdif out*/ |
| 10786 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10787 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10788 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10789 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10790 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10791 | |
| 10792 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10793 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10794 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10795 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10796 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10797 | |
| 10798 | /* Unmute Stereo Mixer 15 */ |
| 10799 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10800 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10801 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10802 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 10803 | |
| 10804 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10805 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10806 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10807 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10808 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10809 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10810 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10811 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10812 | |
| 10813 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10814 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10815 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10816 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10817 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10818 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10819 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10820 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10821 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10822 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10823 | |
| 10824 | { } |
| 10825 | }; |
| 10826 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10827 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 10828 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10829 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10830 | { } |
| 10831 | }; |
| 10832 | |
| 10833 | /* toggle speaker-output according to the hp-jack state */ |
| 10834 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 10835 | { |
| 10836 | unsigned int present; |
| 10837 | |
| 10838 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 10839 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 10840 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 10841 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 10842 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 10843 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10844 | } |
| 10845 | |
| 10846 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 10847 | unsigned int res) |
| 10848 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10849 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10850 | alc861_toshiba_automute(codec); |
| 10851 | } |
| 10852 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10853 | /* pcm configuration: identiacal with ALC880 */ |
| 10854 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 10855 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 10856 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 10857 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 10858 | |
| 10859 | |
| 10860 | #define ALC861_DIGOUT_NID 0x07 |
| 10861 | |
| 10862 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 10863 | { 8, NULL } |
| 10864 | }; |
| 10865 | |
| 10866 | static hda_nid_t alc861_dac_nids[4] = { |
| 10867 | /* front, surround, clfe, side */ |
| 10868 | 0x03, 0x06, 0x05, 0x04 |
| 10869 | }; |
| 10870 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10871 | static hda_nid_t alc660_dac_nids[3] = { |
| 10872 | /* front, clfe, surround */ |
| 10873 | 0x03, 0x05, 0x06 |
| 10874 | }; |
| 10875 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10876 | static hda_nid_t alc861_adc_nids[1] = { |
| 10877 | /* ADC0-2 */ |
| 10878 | 0x08, |
| 10879 | }; |
| 10880 | |
| 10881 | static struct hda_input_mux alc861_capture_source = { |
| 10882 | .num_items = 5, |
| 10883 | .items = { |
| 10884 | { "Mic", 0x0 }, |
| 10885 | { "Front Mic", 0x3 }, |
| 10886 | { "Line", 0x1 }, |
| 10887 | { "CD", 0x4 }, |
| 10888 | { "Mixer", 0x5 }, |
| 10889 | }, |
| 10890 | }; |
| 10891 | |
| 10892 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10893 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 10894 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10895 | { |
| 10896 | int i; |
| 10897 | hda_nid_t nid; |
| 10898 | |
| 10899 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10900 | for (i = 0; i < cfg->line_outs; i++) { |
| 10901 | nid = cfg->line_out_pins[i]; |
| 10902 | if (nid) { |
| 10903 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 10904 | continue; |
| 10905 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 10906 | } |
| 10907 | } |
| 10908 | spec->multiout.num_dacs = cfg->line_outs; |
| 10909 | return 0; |
| 10910 | } |
| 10911 | |
| 10912 | /* add playback controls from the parsed DAC table */ |
| 10913 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10914 | const struct auto_pin_cfg *cfg) |
| 10915 | { |
| 10916 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10917 | static const char *chname[4] = { |
| 10918 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 10919 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10920 | hda_nid_t nid; |
| 10921 | int i, idx, err; |
| 10922 | |
| 10923 | for (i = 0; i < cfg->line_outs; i++) { |
| 10924 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10925 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10926 | continue; |
| 10927 | if (nid == 0x05) { |
| 10928 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10929 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10930 | "Center Playback Switch", |
| 10931 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 10932 | HDA_OUTPUT)); |
| 10933 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10934 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10935 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10936 | "LFE Playback Switch", |
| 10937 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10938 | HDA_OUTPUT)); |
| 10939 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10940 | return err; |
| 10941 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10942 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 10943 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10944 | if (nid == alc861_dac_nids[idx]) |
| 10945 | break; |
| 10946 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10947 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 10948 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10949 | HDA_OUTPUT)); |
| 10950 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10951 | return err; |
| 10952 | } |
| 10953 | } |
| 10954 | return 0; |
| 10955 | } |
| 10956 | |
| 10957 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 10958 | { |
| 10959 | int err; |
| 10960 | hda_nid_t nid; |
| 10961 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10962 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10963 | return 0; |
| 10964 | |
| 10965 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 10966 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10967 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10968 | "Headphone Playback Switch", |
| 10969 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10970 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10971 | return err; |
| 10972 | spec->multiout.hp_nid = nid; |
| 10973 | } |
| 10974 | return 0; |
| 10975 | } |
| 10976 | |
| 10977 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10978 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10979 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10980 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10981 | struct hda_input_mux *imux = &spec->private_imux; |
| 10982 | int i, err, idx, idx1; |
| 10983 | |
| 10984 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10985 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10986 | case 0x0c: |
| 10987 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10988 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10989 | break; |
| 10990 | case 0x0f: |
| 10991 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10992 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10993 | break; |
| 10994 | case 0x0d: |
| 10995 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10996 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10997 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10998 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10999 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11000 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11001 | break; |
| 11002 | case 0x11: |
| 11003 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11004 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11005 | break; |
| 11006 | default: |
| 11007 | continue; |
| 11008 | } |
| 11009 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11010 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11011 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11012 | if (err < 0) |
| 11013 | return err; |
| 11014 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11015 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11016 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11017 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11018 | } |
| 11019 | return 0; |
| 11020 | } |
| 11021 | |
| 11022 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11023 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11024 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11025 | |
| 11026 | { |
| 11027 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11028 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11029 | * So call somewhat different.. |
| 11030 | *FIXME: the controls appear in the "playback" view! |
| 11031 | */ |
| 11032 | /* .name = "Capture Source", */ |
| 11033 | .name = "Input Source", |
| 11034 | .count = 1, |
| 11035 | .info = alc_mux_enum_info, |
| 11036 | .get = alc_mux_enum_get, |
| 11037 | .put = alc_mux_enum_put, |
| 11038 | }, |
| 11039 | { } /* end */ |
| 11040 | }; |
| 11041 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11042 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11043 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11044 | int pin_type, int dac_idx) |
| 11045 | { |
| 11046 | /* set as output */ |
| 11047 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11048 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11049 | pin_type); |
| 11050 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11051 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11052 | |
| 11053 | } |
| 11054 | |
| 11055 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11056 | { |
| 11057 | struct alc_spec *spec = codec->spec; |
| 11058 | int i; |
| 11059 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11060 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11061 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11062 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11063 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11064 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11065 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11066 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11067 | } |
| 11068 | } |
| 11069 | |
| 11070 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11071 | { |
| 11072 | struct alc_spec *spec = codec->spec; |
| 11073 | hda_nid_t pin; |
| 11074 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11075 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11076 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11077 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11078 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11079 | } |
| 11080 | |
| 11081 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11082 | { |
| 11083 | struct alc_spec *spec = codec->spec; |
| 11084 | int i; |
| 11085 | |
| 11086 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11087 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11088 | if (nid >= 0x0c && nid <= 0x11) { |
| 11089 | snd_hda_codec_write(codec, nid, 0, |
| 11090 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11091 | i <= AUTO_PIN_FRONT_MIC ? |
| 11092 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11093 | } |
| 11094 | } |
| 11095 | } |
| 11096 | |
| 11097 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11098 | /* return 1 if successful, 0 if the proper config is not found, |
| 11099 | * or a negative error code |
| 11100 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11101 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11102 | { |
| 11103 | struct alc_spec *spec = codec->spec; |
| 11104 | int err; |
| 11105 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11106 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11107 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11108 | alc861_ignore); |
| 11109 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11110 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11111 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11112 | return 0; /* can't find valid BIOS pin config */ |
| 11113 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11114 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11115 | if (err < 0) |
| 11116 | return err; |
| 11117 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11118 | if (err < 0) |
| 11119 | return err; |
| 11120 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11121 | if (err < 0) |
| 11122 | return err; |
| 11123 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11124 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11125 | return err; |
| 11126 | |
| 11127 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11128 | |
| 11129 | if (spec->autocfg.dig_out_pin) |
| 11130 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 11131 | |
| 11132 | if (spec->kctl_alloc) |
| 11133 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11134 | |
| 11135 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 11136 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11137 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11138 | spec->input_mux = &spec->private_imux; |
| 11139 | |
| 11140 | spec->adc_nids = alc861_adc_nids; |
| 11141 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 11142 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 11143 | spec->num_mixers++; |
| 11144 | |
| 11145 | return 1; |
| 11146 | } |
| 11147 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11148 | /* additional initialization for auto-configuration model */ |
| 11149 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11150 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11151 | alc861_auto_init_multi_out(codec); |
| 11152 | alc861_auto_init_hp_out(codec); |
| 11153 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11154 | } |
| 11155 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11156 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11157 | static struct hda_amp_list alc861_loopbacks[] = { |
| 11158 | { 0x15, HDA_INPUT, 0 }, |
| 11159 | { 0x15, HDA_INPUT, 1 }, |
| 11160 | { 0x15, HDA_INPUT, 2 }, |
| 11161 | { 0x15, HDA_INPUT, 3 }, |
| 11162 | { } /* end */ |
| 11163 | }; |
| 11164 | #endif |
| 11165 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11166 | |
| 11167 | /* |
| 11168 | * configuration and preset |
| 11169 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11170 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 11171 | [ALC861_3ST] = "3stack", |
| 11172 | [ALC660_3ST] = "3stack-660", |
| 11173 | [ALC861_3ST_DIG] = "3stack-dig", |
| 11174 | [ALC861_6ST_DIG] = "6stack-dig", |
| 11175 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 11176 | [ALC861_TOSHIBA] = "toshiba", |
| 11177 | [ALC861_ASUS] = "asus", |
| 11178 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 11179 | [ALC861_AUTO] = "auto", |
| 11180 | }; |
| 11181 | |
| 11182 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 11183 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11184 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11185 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11186 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11187 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11188 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 11189 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 11190 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 11191 | * Any other models that need this preset? |
| 11192 | */ |
| 11193 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 11194 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 11195 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11196 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 11197 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 11198 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 11199 | /* FIXME: the below seems conflict */ |
| 11200 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 11201 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 11202 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11203 | {} |
| 11204 | }; |
| 11205 | |
| 11206 | static struct alc_config_preset alc861_presets[] = { |
| 11207 | [ALC861_3ST] = { |
| 11208 | .mixers = { alc861_3ST_mixer }, |
| 11209 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11210 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11211 | .dac_nids = alc861_dac_nids, |
| 11212 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11213 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11214 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11215 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11216 | .adc_nids = alc861_adc_nids, |
| 11217 | .input_mux = &alc861_capture_source, |
| 11218 | }, |
| 11219 | [ALC861_3ST_DIG] = { |
| 11220 | .mixers = { alc861_base_mixer }, |
| 11221 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11222 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11223 | .dac_nids = alc861_dac_nids, |
| 11224 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11225 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11226 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11227 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11228 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11229 | .adc_nids = alc861_adc_nids, |
| 11230 | .input_mux = &alc861_capture_source, |
| 11231 | }, |
| 11232 | [ALC861_6ST_DIG] = { |
| 11233 | .mixers = { alc861_base_mixer }, |
| 11234 | .init_verbs = { alc861_base_init_verbs }, |
| 11235 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11236 | .dac_nids = alc861_dac_nids, |
| 11237 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11238 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 11239 | .channel_mode = alc861_8ch_modes, |
| 11240 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11241 | .adc_nids = alc861_adc_nids, |
| 11242 | .input_mux = &alc861_capture_source, |
| 11243 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11244 | [ALC660_3ST] = { |
| 11245 | .mixers = { alc861_3ST_mixer }, |
| 11246 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11247 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 11248 | .dac_nids = alc660_dac_nids, |
| 11249 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11250 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11251 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11252 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11253 | .adc_nids = alc861_adc_nids, |
| 11254 | .input_mux = &alc861_capture_source, |
| 11255 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11256 | [ALC861_UNIWILL_M31] = { |
| 11257 | .mixers = { alc861_uniwill_m31_mixer }, |
| 11258 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 11259 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11260 | .dac_nids = alc861_dac_nids, |
| 11261 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11262 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11263 | .channel_mode = alc861_uniwill_m31_modes, |
| 11264 | .need_dac_fix = 1, |
| 11265 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11266 | .adc_nids = alc861_adc_nids, |
| 11267 | .input_mux = &alc861_capture_source, |
| 11268 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11269 | [ALC861_TOSHIBA] = { |
| 11270 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11271 | .init_verbs = { alc861_base_init_verbs, |
| 11272 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11273 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11274 | .dac_nids = alc861_dac_nids, |
| 11275 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11276 | .channel_mode = alc883_3ST_2ch_modes, |
| 11277 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11278 | .adc_nids = alc861_adc_nids, |
| 11279 | .input_mux = &alc861_capture_source, |
| 11280 | .unsol_event = alc861_toshiba_unsol_event, |
| 11281 | .init_hook = alc861_toshiba_automute, |
| 11282 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11283 | [ALC861_ASUS] = { |
| 11284 | .mixers = { alc861_asus_mixer }, |
| 11285 | .init_verbs = { alc861_asus_init_verbs }, |
| 11286 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11287 | .dac_nids = alc861_dac_nids, |
| 11288 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11289 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 11290 | .channel_mode = alc861_asus_modes, |
| 11291 | .need_dac_fix = 1, |
| 11292 | .hp_nid = 0x06, |
| 11293 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11294 | .adc_nids = alc861_adc_nids, |
| 11295 | .input_mux = &alc861_capture_source, |
| 11296 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11297 | [ALC861_ASUS_LAPTOP] = { |
| 11298 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 11299 | .init_verbs = { alc861_asus_init_verbs, |
| 11300 | alc861_asus_laptop_init_verbs }, |
| 11301 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11302 | .dac_nids = alc861_dac_nids, |
| 11303 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11304 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11305 | .channel_mode = alc883_3ST_2ch_modes, |
| 11306 | .need_dac_fix = 1, |
| 11307 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11308 | .adc_nids = alc861_adc_nids, |
| 11309 | .input_mux = &alc861_capture_source, |
| 11310 | }, |
| 11311 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11312 | |
| 11313 | |
| 11314 | static int patch_alc861(struct hda_codec *codec) |
| 11315 | { |
| 11316 | struct alc_spec *spec; |
| 11317 | int board_config; |
| 11318 | int err; |
| 11319 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11320 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11321 | if (spec == NULL) |
| 11322 | return -ENOMEM; |
| 11323 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11324 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11325 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11326 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 11327 | alc861_models, |
| 11328 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11329 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11330 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11331 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 11332 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11333 | board_config = ALC861_AUTO; |
| 11334 | } |
| 11335 | |
| 11336 | if (board_config == ALC861_AUTO) { |
| 11337 | /* automatic parse from the BIOS config */ |
| 11338 | err = alc861_parse_auto_config(codec); |
| 11339 | if (err < 0) { |
| 11340 | alc_free(codec); |
| 11341 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11342 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11343 | printk(KERN_INFO |
| 11344 | "hda_codec: Cannot set up configuration " |
| 11345 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11346 | board_config = ALC861_3ST_DIG; |
| 11347 | } |
| 11348 | } |
| 11349 | |
| 11350 | if (board_config != ALC861_AUTO) |
| 11351 | setup_preset(spec, &alc861_presets[board_config]); |
| 11352 | |
| 11353 | spec->stream_name_analog = "ALC861 Analog"; |
| 11354 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 11355 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 11356 | |
| 11357 | spec->stream_name_digital = "ALC861 Digital"; |
| 11358 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 11359 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 11360 | |
| 11361 | codec->patch_ops = alc_patch_ops; |
| 11362 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11363 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11364 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11365 | if (!spec->loopback.amplist) |
| 11366 | spec->loopback.amplist = alc861_loopbacks; |
| 11367 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11368 | |
| 11369 | return 0; |
| 11370 | } |
| 11371 | |
| 11372 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11373 | * ALC861-VD support |
| 11374 | * |
| 11375 | * Based on ALC882 |
| 11376 | * |
| 11377 | * In addition, an independent DAC |
| 11378 | */ |
| 11379 | #define ALC861VD_DIGOUT_NID 0x06 |
| 11380 | |
| 11381 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 11382 | /* front, surr, clfe, side surr */ |
| 11383 | 0x02, 0x03, 0x04, 0x05 |
| 11384 | }; |
| 11385 | |
| 11386 | /* dac_nids for ALC660vd are in a different order - according to |
| 11387 | * Realtek's driver. |
| 11388 | * This should probably tesult in a different mixer for 6stack models |
| 11389 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 11390 | * - and it is the same as in 861vd. |
| 11391 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 11392 | */ |
| 11393 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 11394 | /* front, rear, clfe, rear_surr */ |
| 11395 | 0x02, 0x04, 0x03 |
| 11396 | }; |
| 11397 | |
| 11398 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 11399 | /* ADC0 */ |
| 11400 | 0x09, |
| 11401 | }; |
| 11402 | |
| 11403 | /* input MUX */ |
| 11404 | /* FIXME: should be a matrix-type input source selection */ |
| 11405 | static struct hda_input_mux alc861vd_capture_source = { |
| 11406 | .num_items = 4, |
| 11407 | .items = { |
| 11408 | { "Mic", 0x0 }, |
| 11409 | { "Front Mic", 0x1 }, |
| 11410 | { "Line", 0x2 }, |
| 11411 | { "CD", 0x4 }, |
| 11412 | }, |
| 11413 | }; |
| 11414 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11415 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 11416 | .num_items = 3, |
| 11417 | .items = { |
| 11418 | { "Front Mic", 0x0 }, |
| 11419 | { "ATAPI Mic", 0x1 }, |
| 11420 | { "Line In", 0x5 }, |
| 11421 | }, |
| 11422 | }; |
| 11423 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11424 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 11425 | .num_items = 2, |
| 11426 | .items = { |
| 11427 | { "Front Mic", 0x0 }, |
| 11428 | { "ATAPI Mic", 0x1 }, |
| 11429 | }, |
| 11430 | }; |
| 11431 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11432 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 11433 | #define alc861vd_mux_enum_get alc_mux_enum_get |
| 11434 | |
| 11435 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11436 | struct snd_ctl_elem_value *ucontrol) |
| 11437 | { |
| 11438 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11439 | struct alc_spec *spec = codec->spec; |
| 11440 | const struct hda_input_mux *imux = spec->input_mux; |
| 11441 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 11442 | static hda_nid_t capture_mixers[1] = { 0x22 }; |
| 11443 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 11444 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 11445 | unsigned int i, idx; |
| 11446 | |
| 11447 | idx = ucontrol->value.enumerated.item[0]; |
| 11448 | if (idx >= imux->num_items) |
| 11449 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11450 | if (*cur_val == idx) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11451 | return 0; |
| 11452 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11453 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 11454 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 11455 | imux->items[i].index, |
| 11456 | HDA_AMP_MUTE, v); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11457 | } |
| 11458 | *cur_val = idx; |
| 11459 | return 1; |
| 11460 | } |
| 11461 | |
| 11462 | /* |
| 11463 | * 2ch mode |
| 11464 | */ |
| 11465 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 11466 | { 2, NULL } |
| 11467 | }; |
| 11468 | |
| 11469 | /* |
| 11470 | * 6ch mode |
| 11471 | */ |
| 11472 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 11473 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11474 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11475 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11476 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11477 | { } /* end */ |
| 11478 | }; |
| 11479 | |
| 11480 | /* |
| 11481 | * 8ch mode |
| 11482 | */ |
| 11483 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 11484 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11485 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11486 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11487 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11488 | { } /* end */ |
| 11489 | }; |
| 11490 | |
| 11491 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 11492 | { 6, alc861vd_6stack_ch6_init }, |
| 11493 | { 8, alc861vd_6stack_ch8_init }, |
| 11494 | }; |
| 11495 | |
| 11496 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 11497 | { |
| 11498 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11499 | .name = "Channel Mode", |
| 11500 | .info = alc_ch_mode_info, |
| 11501 | .get = alc_ch_mode_get, |
| 11502 | .put = alc_ch_mode_put, |
| 11503 | }, |
| 11504 | { } /* end */ |
| 11505 | }; |
| 11506 | |
| 11507 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 11508 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11509 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11510 | |
| 11511 | { |
| 11512 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11513 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11514 | * So call somewhat different.. |
| 11515 | *FIXME: the controls appear in the "playback" view! |
| 11516 | */ |
| 11517 | /* .name = "Capture Source", */ |
| 11518 | .name = "Input Source", |
| 11519 | .count = 1, |
| 11520 | .info = alc861vd_mux_enum_info, |
| 11521 | .get = alc861vd_mux_enum_get, |
| 11522 | .put = alc861vd_mux_enum_put, |
| 11523 | }, |
| 11524 | { } /* end */ |
| 11525 | }; |
| 11526 | |
| 11527 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 11528 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 11529 | */ |
| 11530 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 11531 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11532 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11533 | |
| 11534 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11535 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11536 | |
| 11537 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 11538 | HDA_OUTPUT), |
| 11539 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 11540 | HDA_OUTPUT), |
| 11541 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11542 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 11543 | |
| 11544 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 11545 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11546 | |
| 11547 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11548 | |
| 11549 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11552 | |
| 11553 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11554 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11555 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11556 | |
| 11557 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11558 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11559 | |
| 11560 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11561 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11562 | |
| 11563 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11564 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11565 | |
| 11566 | { } /* end */ |
| 11567 | }; |
| 11568 | |
| 11569 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 11570 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11571 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11572 | |
| 11573 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11574 | |
| 11575 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11576 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11577 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11578 | |
| 11579 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11580 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11581 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11582 | |
| 11583 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11584 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11585 | |
| 11586 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11587 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11588 | |
| 11589 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11590 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11591 | |
| 11592 | { } /* end */ |
| 11593 | }; |
| 11594 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11595 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 11596 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11597 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 11598 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11599 | |
| 11600 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11601 | |
| 11602 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11603 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11604 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11605 | |
| 11606 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11607 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11608 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11609 | |
| 11610 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11611 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11612 | |
| 11613 | { } /* end */ |
| 11614 | }; |
| 11615 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11616 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 11617 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 11618 | */ |
| 11619 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 11620 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11621 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11622 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11623 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11624 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11625 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11626 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11627 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11628 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11629 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11630 | { } /* end */ |
| 11631 | }; |
| 11632 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11633 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 11634 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 11635 | */ |
| 11636 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 11637 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11638 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11639 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11640 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11641 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11642 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11643 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11644 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11645 | |
| 11646 | { } /* end */ |
| 11647 | }; |
| 11648 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11649 | /* |
| 11650 | * generic initialization of ADC, input mixers and output mixers |
| 11651 | */ |
| 11652 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 11653 | /* |
| 11654 | * Unmute ADC0 and set the default input to mic-in |
| 11655 | */ |
| 11656 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11657 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11658 | |
| 11659 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 11660 | * the analog-loopback mixer widget |
| 11661 | */ |
| 11662 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11663 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11664 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11665 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11666 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11667 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11668 | |
| 11669 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11670 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11671 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11674 | |
| 11675 | /* |
| 11676 | * Set up output mixers (0x02 - 0x05) |
| 11677 | */ |
| 11678 | /* set vol=0 to output mixers */ |
| 11679 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11680 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11681 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11682 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11683 | |
| 11684 | /* set up input amps for analog loopback */ |
| 11685 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11686 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11687 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11688 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11689 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11690 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11691 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11692 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11693 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11694 | |
| 11695 | { } |
| 11696 | }; |
| 11697 | |
| 11698 | /* |
| 11699 | * 3-stack pin configuration: |
| 11700 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 11701 | */ |
| 11702 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 11703 | /* |
| 11704 | * Set pin mode and muting |
| 11705 | */ |
| 11706 | /* set front pin widgets 0x14 for output */ |
| 11707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11708 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11709 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11710 | |
| 11711 | /* Mic (rear) pin: input vref at 80% */ |
| 11712 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11713 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11714 | /* Front Mic pin: input vref at 80% */ |
| 11715 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11716 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11717 | /* Line In pin: input */ |
| 11718 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11719 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11720 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 11721 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11722 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11723 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11724 | /* CD pin widget for input */ |
| 11725 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11726 | |
| 11727 | { } |
| 11728 | }; |
| 11729 | |
| 11730 | /* |
| 11731 | * 6-stack pin configuration: |
| 11732 | */ |
| 11733 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 11734 | /* |
| 11735 | * Set pin mode and muting |
| 11736 | */ |
| 11737 | /* set front pin widgets 0x14 for output */ |
| 11738 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11739 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11740 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11741 | |
| 11742 | /* Rear Pin: output 1 (0x0d) */ |
| 11743 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11744 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11745 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11746 | /* CLFE Pin: output 2 (0x0e) */ |
| 11747 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11748 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11749 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 11750 | /* Side Pin: output 3 (0x0f) */ |
| 11751 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11752 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11753 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 11754 | |
| 11755 | /* Mic (rear) pin: input vref at 80% */ |
| 11756 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11757 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11758 | /* Front Mic pin: input vref at 80% */ |
| 11759 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11760 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11761 | /* Line In pin: input */ |
| 11762 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11763 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11764 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 11765 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11766 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11767 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11768 | /* CD pin widget for input */ |
| 11769 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11770 | |
| 11771 | { } |
| 11772 | }; |
| 11773 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11774 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 11775 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11776 | { } |
| 11777 | }; |
| 11778 | |
| 11779 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 11780 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11781 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11782 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11783 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11784 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11785 | {} |
| 11786 | }; |
| 11787 | |
| 11788 | /* toggle speaker-output according to the hp-jack state */ |
| 11789 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 11790 | { |
| 11791 | unsigned int present; |
| 11792 | unsigned char bits; |
| 11793 | |
| 11794 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 11795 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11796 | bits = present ? HDA_AMP_MUTE : 0; |
| 11797 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11798 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11799 | } |
| 11800 | |
| 11801 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 11802 | { |
| 11803 | unsigned int present; |
| 11804 | unsigned char bits; |
| 11805 | |
| 11806 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11807 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11808 | bits = present ? HDA_AMP_MUTE : 0; |
| 11809 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 11810 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11811 | } |
| 11812 | |
| 11813 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 11814 | { |
| 11815 | alc861vd_lenovo_hp_automute(codec); |
| 11816 | alc861vd_lenovo_mic_automute(codec); |
| 11817 | } |
| 11818 | |
| 11819 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 11820 | unsigned int res) |
| 11821 | { |
| 11822 | switch (res >> 26) { |
| 11823 | case ALC880_HP_EVENT: |
| 11824 | alc861vd_lenovo_hp_automute(codec); |
| 11825 | break; |
| 11826 | case ALC880_MIC_EVENT: |
| 11827 | alc861vd_lenovo_mic_automute(codec); |
| 11828 | break; |
| 11829 | } |
| 11830 | } |
| 11831 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11832 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 11833 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11834 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11835 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11836 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11837 | |
| 11838 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11839 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11840 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11841 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11842 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11843 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11844 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11845 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11846 | |
| 11847 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11848 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11849 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11850 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11851 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11852 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11853 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11854 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11855 | |
| 11856 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11857 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11858 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11859 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11860 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11861 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11862 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11863 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11864 | |
| 11865 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11866 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11867 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11868 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11869 | |
| 11870 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11871 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11872 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11873 | |
| 11874 | { } /* end */ |
| 11875 | }; |
| 11876 | |
| 11877 | /* toggle speaker-output according to the hp-jack state */ |
| 11878 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 11879 | { |
| 11880 | unsigned int present; |
| 11881 | |
| 11882 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11883 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11884 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11885 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11886 | } |
| 11887 | |
| 11888 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11889 | { |
| 11890 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11891 | alc861vd_dallas_automute(codec); |
| 11892 | } |
| 11893 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11894 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11895 | #define alc861vd_loopbacks alc880_loopbacks |
| 11896 | #endif |
| 11897 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11898 | /* pcm configuration: identiacal with ALC880 */ |
| 11899 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 11900 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 11901 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 11902 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 11903 | |
| 11904 | /* |
| 11905 | * configuration and preset |
| 11906 | */ |
| 11907 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 11908 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11909 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11910 | [ALC861VD_3ST] = "3stack", |
| 11911 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 11912 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11913 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11914 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11915 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11916 | [ALC861VD_AUTO] = "auto", |
| 11917 | }; |
| 11918 | |
| 11919 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11920 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 11921 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 11922 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11923 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 11924 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11925 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11926 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 11927 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11928 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 11929 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 11930 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11931 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 11932 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 11933 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11934 | {} |
| 11935 | }; |
| 11936 | |
| 11937 | static struct alc_config_preset alc861vd_presets[] = { |
| 11938 | [ALC660VD_3ST] = { |
| 11939 | .mixers = { alc861vd_3st_mixer }, |
| 11940 | .init_verbs = { alc861vd_volume_init_verbs, |
| 11941 | alc861vd_3stack_init_verbs }, |
| 11942 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 11943 | .dac_nids = alc660vd_dac_nids, |
| 11944 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 11945 | .adc_nids = alc861vd_adc_nids, |
| 11946 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 11947 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 11948 | .input_mux = &alc861vd_capture_source, |
| 11949 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 11950 | [ALC660VD_3ST_DIG] = { |
| 11951 | .mixers = { alc861vd_3st_mixer }, |
| 11952 | .init_verbs = { alc861vd_volume_init_verbs, |
| 11953 | alc861vd_3stack_init_verbs }, |
| 11954 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 11955 | .dac_nids = alc660vd_dac_nids, |
| 11956 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 11957 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 11958 | .adc_nids = alc861vd_adc_nids, |
| 11959 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 11960 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 11961 | .input_mux = &alc861vd_capture_source, |
| 11962 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11963 | [ALC861VD_3ST] = { |
| 11964 | .mixers = { alc861vd_3st_mixer }, |
| 11965 | .init_verbs = { alc861vd_volume_init_verbs, |
| 11966 | alc861vd_3stack_init_verbs }, |
| 11967 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 11968 | .dac_nids = alc861vd_dac_nids, |
| 11969 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 11970 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 11971 | .input_mux = &alc861vd_capture_source, |
| 11972 | }, |
| 11973 | [ALC861VD_3ST_DIG] = { |
| 11974 | .mixers = { alc861vd_3st_mixer }, |
| 11975 | .init_verbs = { alc861vd_volume_init_verbs, |
| 11976 | alc861vd_3stack_init_verbs }, |
| 11977 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 11978 | .dac_nids = alc861vd_dac_nids, |
| 11979 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 11980 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 11981 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 11982 | .input_mux = &alc861vd_capture_source, |
| 11983 | }, |
| 11984 | [ALC861VD_6ST_DIG] = { |
| 11985 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 11986 | .init_verbs = { alc861vd_volume_init_verbs, |
| 11987 | alc861vd_6stack_init_verbs }, |
| 11988 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 11989 | .dac_nids = alc861vd_dac_nids, |
| 11990 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 11991 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 11992 | .channel_mode = alc861vd_6stack_modes, |
| 11993 | .input_mux = &alc861vd_capture_source, |
| 11994 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11995 | [ALC861VD_LENOVO] = { |
| 11996 | .mixers = { alc861vd_lenovo_mixer }, |
| 11997 | .init_verbs = { alc861vd_volume_init_verbs, |
| 11998 | alc861vd_3stack_init_verbs, |
| 11999 | alc861vd_eapd_verbs, |
| 12000 | alc861vd_lenovo_unsol_verbs }, |
| 12001 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12002 | .dac_nids = alc660vd_dac_nids, |
| 12003 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12004 | .adc_nids = alc861vd_adc_nids, |
| 12005 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12006 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12007 | .input_mux = &alc861vd_capture_source, |
| 12008 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12009 | .init_hook = alc861vd_lenovo_automute, |
| 12010 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12011 | [ALC861VD_DALLAS] = { |
| 12012 | .mixers = { alc861vd_dallas_mixer }, |
| 12013 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12014 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12015 | .dac_nids = alc861vd_dac_nids, |
| 12016 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12017 | .adc_nids = alc861vd_adc_nids, |
| 12018 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12019 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12020 | .input_mux = &alc861vd_dallas_capture_source, |
| 12021 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12022 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12023 | }, |
| 12024 | [ALC861VD_HP] = { |
| 12025 | .mixers = { alc861vd_hp_mixer }, |
| 12026 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12027 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12028 | .dac_nids = alc861vd_dac_nids, |
| 12029 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12030 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12031 | .adc_nids = alc861vd_adc_nids, |
| 12032 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12033 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12034 | .input_mux = &alc861vd_hp_capture_source, |
| 12035 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12036 | .init_hook = alc861vd_dallas_automute, |
| 12037 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12038 | }; |
| 12039 | |
| 12040 | /* |
| 12041 | * BIOS auto configuration |
| 12042 | */ |
| 12043 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12044 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12045 | { |
| 12046 | /* set as output */ |
| 12047 | snd_hda_codec_write(codec, nid, 0, |
| 12048 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 12049 | snd_hda_codec_write(codec, nid, 0, |
| 12050 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 12051 | } |
| 12052 | |
| 12053 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12054 | { |
| 12055 | struct alc_spec *spec = codec->spec; |
| 12056 | int i; |
| 12057 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12058 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12059 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12060 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12061 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12062 | if (nid) |
| 12063 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12064 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12065 | } |
| 12066 | } |
| 12067 | |
| 12068 | |
| 12069 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12070 | { |
| 12071 | struct alc_spec *spec = codec->spec; |
| 12072 | hda_nid_t pin; |
| 12073 | |
| 12074 | pin = spec->autocfg.hp_pins[0]; |
| 12075 | if (pin) /* connect to front and use dac 0 */ |
| 12076 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 12077 | } |
| 12078 | |
| 12079 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12080 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12081 | |
| 12082 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12083 | { |
| 12084 | struct alc_spec *spec = codec->spec; |
| 12085 | int i; |
| 12086 | |
| 12087 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12088 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12089 | if (alc861vd_is_input_pin(nid)) { |
| 12090 | snd_hda_codec_write(codec, nid, 0, |
| 12091 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12092 | i <= AUTO_PIN_FRONT_MIC ? |
| 12093 | PIN_VREF80 : PIN_IN); |
| 12094 | if (nid != ALC861VD_PIN_CD_NID) |
| 12095 | snd_hda_codec_write(codec, nid, 0, |
| 12096 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12097 | AMP_OUT_MUTE); |
| 12098 | } |
| 12099 | } |
| 12100 | } |
| 12101 | |
| 12102 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12103 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12104 | |
| 12105 | /* add playback controls from the parsed DAC table */ |
| 12106 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12107 | * different NIDs for mute/unmute switch and volume control */ |
| 12108 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12109 | const struct auto_pin_cfg *cfg) |
| 12110 | { |
| 12111 | char name[32]; |
| 12112 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12113 | hda_nid_t nid_v, nid_s; |
| 12114 | int i, err; |
| 12115 | |
| 12116 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12117 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12118 | continue; |
| 12119 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12120 | alc880_dac_to_idx( |
| 12121 | spec->multiout.dac_nids[i])); |
| 12122 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12123 | alc880_dac_to_idx( |
| 12124 | spec->multiout.dac_nids[i])); |
| 12125 | |
| 12126 | if (i == 2) { |
| 12127 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12128 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12129 | "Center Playback Volume", |
| 12130 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12131 | HDA_OUTPUT)); |
| 12132 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12133 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12134 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12135 | "LFE Playback Volume", |
| 12136 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12137 | HDA_OUTPUT)); |
| 12138 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12139 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12140 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12141 | "Center Playback Switch", |
| 12142 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12143 | HDA_INPUT)); |
| 12144 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12145 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12146 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12147 | "LFE Playback Switch", |
| 12148 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12149 | HDA_INPUT)); |
| 12150 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12151 | return err; |
| 12152 | } else { |
| 12153 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12154 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12155 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 12156 | HDA_OUTPUT)); |
| 12157 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12158 | return err; |
| 12159 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12160 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12161 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12162 | HDA_INPUT)); |
| 12163 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12164 | return err; |
| 12165 | } |
| 12166 | } |
| 12167 | return 0; |
| 12168 | } |
| 12169 | |
| 12170 | /* add playback controls for speaker and HP outputs */ |
| 12171 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12172 | * different NIDs for mute/unmute switch and volume control */ |
| 12173 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 12174 | hda_nid_t pin, const char *pfx) |
| 12175 | { |
| 12176 | hda_nid_t nid_v, nid_s; |
| 12177 | int err; |
| 12178 | char name[32]; |
| 12179 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12180 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12181 | return 0; |
| 12182 | |
| 12183 | if (alc880_is_fixed_pin(pin)) { |
| 12184 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 12185 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12186 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12187 | spec->multiout.hp_nid = nid_v; |
| 12188 | else |
| 12189 | spec->multiout.extra_out_nid[0] = nid_v; |
| 12190 | /* control HP volume/switch on the output mixer amp */ |
| 12191 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12192 | alc880_fixed_pin_idx(pin)); |
| 12193 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12194 | alc880_fixed_pin_idx(pin)); |
| 12195 | |
| 12196 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12197 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12198 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 12199 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12200 | return err; |
| 12201 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12202 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12203 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 12204 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12205 | return err; |
| 12206 | } else if (alc880_is_multi_pin(pin)) { |
| 12207 | /* set manual connection */ |
| 12208 | /* we have only a switch on HP-out PIN */ |
| 12209 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12210 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12211 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 12212 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12213 | return err; |
| 12214 | } |
| 12215 | return 0; |
| 12216 | } |
| 12217 | |
| 12218 | /* parse the BIOS configuration and set up the alc_spec |
| 12219 | * return 1 if successful, 0 if the proper config is not found, |
| 12220 | * or a negative error code |
| 12221 | * Based on ALC880 version - had to change it to override |
| 12222 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 12223 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 12224 | { |
| 12225 | struct alc_spec *spec = codec->spec; |
| 12226 | int err; |
| 12227 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 12228 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12229 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12230 | alc861vd_ignore); |
| 12231 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12232 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12233 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12234 | return 0; /* can't find valid BIOS pin config */ |
| 12235 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12236 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12237 | if (err < 0) |
| 12238 | return err; |
| 12239 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12240 | if (err < 0) |
| 12241 | return err; |
| 12242 | err = alc861vd_auto_create_extra_out(spec, |
| 12243 | spec->autocfg.speaker_pins[0], |
| 12244 | "Speaker"); |
| 12245 | if (err < 0) |
| 12246 | return err; |
| 12247 | err = alc861vd_auto_create_extra_out(spec, |
| 12248 | spec->autocfg.hp_pins[0], |
| 12249 | "Headphone"); |
| 12250 | if (err < 0) |
| 12251 | return err; |
| 12252 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12253 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12254 | return err; |
| 12255 | |
| 12256 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12257 | |
| 12258 | if (spec->autocfg.dig_out_pin) |
| 12259 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 12260 | |
| 12261 | if (spec->kctl_alloc) |
| 12262 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12263 | |
| 12264 | spec->init_verbs[spec->num_init_verbs++] |
| 12265 | = alc861vd_volume_init_verbs; |
| 12266 | |
| 12267 | spec->num_mux_defs = 1; |
| 12268 | spec->input_mux = &spec->private_imux; |
| 12269 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12270 | err = alc_auto_add_mic_boost(codec); |
| 12271 | if (err < 0) |
| 12272 | return err; |
| 12273 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12274 | return 1; |
| 12275 | } |
| 12276 | |
| 12277 | /* additional initialization for auto-configuration model */ |
| 12278 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 12279 | { |
| 12280 | alc861vd_auto_init_multi_out(codec); |
| 12281 | alc861vd_auto_init_hp_out(codec); |
| 12282 | alc861vd_auto_init_analog_input(codec); |
| 12283 | } |
| 12284 | |
| 12285 | static int patch_alc861vd(struct hda_codec *codec) |
| 12286 | { |
| 12287 | struct alc_spec *spec; |
| 12288 | int err, board_config; |
| 12289 | |
| 12290 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12291 | if (spec == NULL) |
| 12292 | return -ENOMEM; |
| 12293 | |
| 12294 | codec->spec = spec; |
| 12295 | |
| 12296 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 12297 | alc861vd_models, |
| 12298 | alc861vd_cfg_tbl); |
| 12299 | |
| 12300 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 12301 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 12302 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 12303 | board_config = ALC861VD_AUTO; |
| 12304 | } |
| 12305 | |
| 12306 | if (board_config == ALC861VD_AUTO) { |
| 12307 | /* automatic parse from the BIOS config */ |
| 12308 | err = alc861vd_parse_auto_config(codec); |
| 12309 | if (err < 0) { |
| 12310 | alc_free(codec); |
| 12311 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12312 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12313 | printk(KERN_INFO |
| 12314 | "hda_codec: Cannot set up configuration " |
| 12315 | "from BIOS. Using base mode...\n"); |
| 12316 | board_config = ALC861VD_3ST; |
| 12317 | } |
| 12318 | } |
| 12319 | |
| 12320 | if (board_config != ALC861VD_AUTO) |
| 12321 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 12322 | |
| 12323 | spec->stream_name_analog = "ALC861VD Analog"; |
| 12324 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 12325 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 12326 | |
| 12327 | spec->stream_name_digital = "ALC861VD Digital"; |
| 12328 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 12329 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 12330 | |
| 12331 | spec->adc_nids = alc861vd_adc_nids; |
| 12332 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 12333 | |
| 12334 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 12335 | spec->num_mixers++; |
| 12336 | |
| 12337 | codec->patch_ops = alc_patch_ops; |
| 12338 | |
| 12339 | if (board_config == ALC861VD_AUTO) |
| 12340 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12341 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12342 | if (!spec->loopback.amplist) |
| 12343 | spec->loopback.amplist = alc861vd_loopbacks; |
| 12344 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12345 | |
| 12346 | return 0; |
| 12347 | } |
| 12348 | |
| 12349 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12350 | * ALC662 support |
| 12351 | * |
| 12352 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 12353 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 12354 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 12355 | * 6-channel independent captures. |
| 12356 | * |
| 12357 | * In addition, an independent DAC for the multi-playback (not used in this |
| 12358 | * driver yet). |
| 12359 | */ |
| 12360 | #define ALC662_DIGOUT_NID 0x06 |
| 12361 | #define ALC662_DIGIN_NID 0x0a |
| 12362 | |
| 12363 | static hda_nid_t alc662_dac_nids[4] = { |
| 12364 | /* front, rear, clfe, rear_surr */ |
| 12365 | 0x02, 0x03, 0x04 |
| 12366 | }; |
| 12367 | |
| 12368 | static hda_nid_t alc662_adc_nids[1] = { |
| 12369 | /* ADC1-2 */ |
| 12370 | 0x09, |
| 12371 | }; |
| 12372 | /* input MUX */ |
| 12373 | /* FIXME: should be a matrix-type input source selection */ |
| 12374 | |
| 12375 | static struct hda_input_mux alc662_capture_source = { |
| 12376 | .num_items = 4, |
| 12377 | .items = { |
| 12378 | { "Mic", 0x0 }, |
| 12379 | { "Front Mic", 0x1 }, |
| 12380 | { "Line", 0x2 }, |
| 12381 | { "CD", 0x4 }, |
| 12382 | }, |
| 12383 | }; |
| 12384 | |
| 12385 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 12386 | .num_items = 2, |
| 12387 | .items = { |
| 12388 | { "Mic", 0x1 }, |
| 12389 | { "Line", 0x2 }, |
| 12390 | }, |
| 12391 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12392 | |
| 12393 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 12394 | .num_items = 2, |
| 12395 | .items = { |
| 12396 | { "i-Mic", 0x1 }, |
| 12397 | { "e-Mic", 0x0 }, |
| 12398 | }, |
| 12399 | }; |
| 12400 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12401 | #define alc662_mux_enum_info alc_mux_enum_info |
| 12402 | #define alc662_mux_enum_get alc_mux_enum_get |
| 12403 | |
| 12404 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12405 | struct snd_ctl_elem_value *ucontrol) |
| 12406 | { |
| 12407 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12408 | struct alc_spec *spec = codec->spec; |
| 12409 | const struct hda_input_mux *imux = spec->input_mux; |
| 12410 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12411 | static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12412 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 12413 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 12414 | unsigned int i, idx; |
| 12415 | |
| 12416 | idx = ucontrol->value.enumerated.item[0]; |
| 12417 | if (idx >= imux->num_items) |
| 12418 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 12419 | if (*cur_val == idx) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12420 | return 0; |
| 12421 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12422 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 12423 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 12424 | imux->items[i].index, |
| 12425 | HDA_AMP_MUTE, v); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12426 | } |
| 12427 | *cur_val = idx; |
| 12428 | return 1; |
| 12429 | } |
| 12430 | /* |
| 12431 | * 2ch mode |
| 12432 | */ |
| 12433 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 12434 | { 2, NULL } |
| 12435 | }; |
| 12436 | |
| 12437 | /* |
| 12438 | * 2ch mode |
| 12439 | */ |
| 12440 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 12441 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 12442 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12443 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 12444 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12445 | { } /* end */ |
| 12446 | }; |
| 12447 | |
| 12448 | /* |
| 12449 | * 6ch mode |
| 12450 | */ |
| 12451 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 12452 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12453 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12454 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 12455 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12456 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12457 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12458 | { } /* end */ |
| 12459 | }; |
| 12460 | |
| 12461 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 12462 | { 2, alc662_3ST_ch2_init }, |
| 12463 | { 6, alc662_3ST_ch6_init }, |
| 12464 | }; |
| 12465 | |
| 12466 | /* |
| 12467 | * 2ch mode |
| 12468 | */ |
| 12469 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 12470 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12471 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12472 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12473 | { } /* end */ |
| 12474 | }; |
| 12475 | |
| 12476 | /* |
| 12477 | * 6ch mode |
| 12478 | */ |
| 12479 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 12480 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12481 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12482 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12483 | { } /* end */ |
| 12484 | }; |
| 12485 | |
| 12486 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 12487 | { 2, alc662_sixstack_ch6_init }, |
| 12488 | { 6, alc662_sixstack_ch8_init }, |
| 12489 | }; |
| 12490 | |
| 12491 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12492 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12493 | */ |
| 12494 | |
| 12495 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 12496 | /* output mixer control */ |
| 12497 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12498 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 12499 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12500 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12501 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12502 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12503 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12504 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12505 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12506 | |
| 12507 | /*Input mixer control */ |
| 12508 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 12509 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 12510 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 12511 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 12512 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 12513 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 12514 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 12515 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12516 | { } /* end */ |
| 12517 | }; |
| 12518 | |
| 12519 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 12520 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12521 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12522 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12523 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12524 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12525 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12526 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12527 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12528 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12529 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12530 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12531 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12532 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12533 | { } /* end */ |
| 12534 | }; |
| 12535 | |
| 12536 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 12537 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12538 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12539 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12540 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12541 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12542 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12543 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12544 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12545 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12546 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12547 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12548 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12549 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12552 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12553 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12554 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12555 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12556 | { } /* end */ |
| 12557 | }; |
| 12558 | |
| 12559 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 12560 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12561 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12562 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12563 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT), |
| 12564 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12565 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12566 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12567 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12568 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12569 | { } /* end */ |
| 12570 | }; |
| 12571 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12572 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
| 12573 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12574 | |
| 12575 | HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12576 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12577 | |
| 12578 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 12579 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12580 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12581 | |
| 12582 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 12583 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12584 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12585 | { } /* end */ |
| 12586 | }; |
| 12587 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12588 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
| 12589 | HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12590 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12591 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12592 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12593 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12594 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12595 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12596 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12597 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12598 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12599 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12600 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12601 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12602 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12603 | { } /* end */ |
| 12604 | }; |
| 12605 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12606 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 12607 | { |
| 12608 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12609 | .name = "Channel Mode", |
| 12610 | .info = alc_ch_mode_info, |
| 12611 | .get = alc_ch_mode_get, |
| 12612 | .put = alc_ch_mode_put, |
| 12613 | }, |
| 12614 | { } /* end */ |
| 12615 | }; |
| 12616 | |
| 12617 | static struct hda_verb alc662_init_verbs[] = { |
| 12618 | /* ADC: mute amp left and right */ |
| 12619 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12620 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12621 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 12622 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12623 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12624 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12625 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12626 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12627 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12628 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 12629 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12630 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12631 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12632 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12633 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12634 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12635 | |
| 12636 | /* Front Pin: output 0 (0x0c) */ |
| 12637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12638 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12639 | |
| 12640 | /* Rear Pin: output 1 (0x0d) */ |
| 12641 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12642 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12643 | |
| 12644 | /* CLFE Pin: output 2 (0x0e) */ |
| 12645 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12646 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12647 | |
| 12648 | /* Mic (rear) pin: input vref at 80% */ |
| 12649 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12650 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12651 | /* Front Mic pin: input vref at 80% */ |
| 12652 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12653 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12654 | /* Line In pin: input */ |
| 12655 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12656 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12657 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12658 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12659 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12660 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12661 | /* CD pin widget for input */ |
| 12662 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12663 | |
| 12664 | /* FIXME: use matrix-type input source selection */ |
| 12665 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12666 | /* Input mixer */ |
| 12667 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12668 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12669 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12670 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12671 | |
| 12672 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12673 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12674 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12675 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12676 | { } |
| 12677 | }; |
| 12678 | |
| 12679 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 12680 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 12681 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12682 | {} |
| 12683 | }; |
| 12684 | |
| 12685 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 12686 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12687 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12688 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12689 | }; |
| 12690 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12691 | /* Set Unsolicited Event*/ |
| 12692 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 12693 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12694 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12695 | {} |
| 12696 | }; |
| 12697 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12698 | /* |
| 12699 | * generic initialization of ADC, input mixers and output mixers |
| 12700 | */ |
| 12701 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 12702 | /* |
| 12703 | * Unmute ADC and set the default input to mic-in |
| 12704 | */ |
| 12705 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12706 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12707 | |
| 12708 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 12709 | * mixer widget |
| 12710 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12711 | * panel mic (mic 2) |
| 12712 | */ |
| 12713 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12714 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12715 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12716 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12717 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12718 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12719 | |
| 12720 | /* |
| 12721 | * Set up output mixers (0x0c - 0x0f) |
| 12722 | */ |
| 12723 | /* set vol=0 to output mixers */ |
| 12724 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12725 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12726 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12727 | |
| 12728 | /* set up input amps for analog loopback */ |
| 12729 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 12730 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12731 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12732 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12733 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12734 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12735 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12736 | |
| 12737 | |
| 12738 | /* FIXME: use matrix-type input source selection */ |
| 12739 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12740 | /* Input mixer */ |
| 12741 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12742 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12743 | { } |
| 12744 | }; |
| 12745 | |
| 12746 | /* capture mixer elements */ |
| 12747 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 12748 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 12749 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 12750 | { |
| 12751 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12752 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12753 | * So call somewhat different.. |
| 12754 | * FIXME: the controls appear in the "playback" view! |
| 12755 | */ |
| 12756 | /* .name = "Capture Source", */ |
| 12757 | .name = "Input Source", |
| 12758 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 12759 | .info = alc662_mux_enum_info, |
| 12760 | .get = alc662_mux_enum_get, |
| 12761 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12762 | }, |
| 12763 | { } /* end */ |
| 12764 | }; |
| 12765 | |
| 12766 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 12767 | { |
| 12768 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12769 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12770 | |
| 12771 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 12772 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12773 | bits = present ? HDA_AMP_MUTE : 0; |
| 12774 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12775 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12776 | } |
| 12777 | |
| 12778 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 12779 | { |
| 12780 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12781 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12782 | |
| 12783 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12784 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12785 | bits = present ? HDA_AMP_MUTE : 0; |
| 12786 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12787 | HDA_AMP_MUTE, bits); |
| 12788 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12789 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12790 | } |
| 12791 | |
| 12792 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 12793 | unsigned int res) |
| 12794 | { |
| 12795 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12796 | alc662_lenovo_101e_all_automute(codec); |
| 12797 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 12798 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 12799 | } |
| 12800 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12801 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 12802 | { |
| 12803 | unsigned int present; |
| 12804 | |
| 12805 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12806 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12807 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12808 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12809 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12810 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12811 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12812 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12813 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12814 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12815 | } |
| 12816 | |
| 12817 | /* unsolicited event for HP jack sensing */ |
| 12818 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 12819 | unsigned int res) |
| 12820 | { |
| 12821 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12822 | alc262_hippo1_automute( codec ); |
| 12823 | |
| 12824 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12825 | alc662_eeepc_mic_automute(codec); |
| 12826 | } |
| 12827 | |
| 12828 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 12829 | { |
| 12830 | alc262_hippo1_automute( codec ); |
| 12831 | alc662_eeepc_mic_automute(codec); |
| 12832 | } |
| 12833 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12834 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 12835 | { |
| 12836 | unsigned int mute; |
| 12837 | unsigned int present; |
| 12838 | |
| 12839 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 12840 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 12841 | AC_VERB_GET_PIN_SENSE, 0); |
| 12842 | present = (present & 0x80000000) != 0; |
| 12843 | if (present) { |
| 12844 | /* mute internal speaker */ |
| 12845 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 12846 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 12847 | } else { |
| 12848 | /* unmute internal speaker if necessary */ |
| 12849 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12850 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 12851 | HDA_AMP_MUTE, mute); |
| 12852 | } |
| 12853 | } |
| 12854 | |
| 12855 | /* unsolicited event for HP jack sensing */ |
| 12856 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 12857 | unsigned int res) |
| 12858 | { |
| 12859 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12860 | alc662_eeepc_ep20_automute(codec); |
| 12861 | } |
| 12862 | |
| 12863 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 12864 | { |
| 12865 | alc662_eeepc_ep20_automute(codec); |
| 12866 | } |
| 12867 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12868 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12869 | #define alc662_loopbacks alc880_loopbacks |
| 12870 | #endif |
| 12871 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12872 | |
| 12873 | /* pcm configuration: identiacal with ALC880 */ |
| 12874 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 12875 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 12876 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 12877 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 12878 | |
| 12879 | /* |
| 12880 | * configuration and preset |
| 12881 | */ |
| 12882 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 12883 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 12884 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 12885 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 12886 | [ALC662_5ST_DIG] = "6stack-dig", |
| 12887 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 12888 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12889 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12890 | [ALC662_AUTO] = "auto", |
| 12891 | }; |
| 12892 | |
| 12893 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12894 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12895 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12896 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12897 | {} |
| 12898 | }; |
| 12899 | |
| 12900 | static struct alc_config_preset alc662_presets[] = { |
| 12901 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12902 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12903 | .init_verbs = { alc662_init_verbs }, |
| 12904 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 12905 | .dac_nids = alc662_dac_nids, |
| 12906 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 12907 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 12908 | .adc_nids = alc662_adc_nids, |
| 12909 | .dig_in_nid = ALC662_DIGIN_NID, |
| 12910 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 12911 | .channel_mode = alc662_3ST_2ch_modes, |
| 12912 | .input_mux = &alc662_capture_source, |
| 12913 | }, |
| 12914 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12915 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 12916 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12917 | .init_verbs = { alc662_init_verbs }, |
| 12918 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 12919 | .dac_nids = alc662_dac_nids, |
| 12920 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 12921 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 12922 | .adc_nids = alc662_adc_nids, |
| 12923 | .dig_in_nid = ALC662_DIGIN_NID, |
| 12924 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 12925 | .channel_mode = alc662_3ST_6ch_modes, |
| 12926 | .need_dac_fix = 1, |
| 12927 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12928 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12929 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12930 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 12931 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12932 | .init_verbs = { alc662_init_verbs }, |
| 12933 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 12934 | .dac_nids = alc662_dac_nids, |
| 12935 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 12936 | .adc_nids = alc662_adc_nids, |
| 12937 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 12938 | .channel_mode = alc662_3ST_6ch_modes, |
| 12939 | .need_dac_fix = 1, |
| 12940 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12941 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12942 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12943 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 12944 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12945 | .init_verbs = { alc662_init_verbs }, |
| 12946 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 12947 | .dac_nids = alc662_dac_nids, |
| 12948 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 12949 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 12950 | .adc_nids = alc662_adc_nids, |
| 12951 | .dig_in_nid = ALC662_DIGIN_NID, |
| 12952 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 12953 | .channel_mode = alc662_5stack_modes, |
| 12954 | .input_mux = &alc662_capture_source, |
| 12955 | }, |
| 12956 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12957 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12958 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 12959 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 12960 | .dac_nids = alc662_dac_nids, |
| 12961 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 12962 | .adc_nids = alc662_adc_nids, |
| 12963 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 12964 | .channel_mode = alc662_3ST_2ch_modes, |
| 12965 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 12966 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 12967 | .init_hook = alc662_lenovo_101e_all_automute, |
| 12968 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12969 | [ALC662_ASUS_EEEPC_P701] = { |
| 12970 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 12971 | .init_verbs = { alc662_init_verbs, |
| 12972 | alc662_eeepc_sue_init_verbs }, |
| 12973 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 12974 | .dac_nids = alc662_dac_nids, |
| 12975 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12976 | .adc_nids = alc662_adc_nids, |
| 12977 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 12978 | .channel_mode = alc662_3ST_2ch_modes, |
| 12979 | .input_mux = &alc662_eeepc_capture_source, |
| 12980 | .unsol_event = alc662_eeepc_unsol_event, |
| 12981 | .init_hook = alc662_eeepc_inithook, |
| 12982 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12983 | [ALC662_ASUS_EEEPC_EP20] = { |
| 12984 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 12985 | alc662_chmode_mixer }, |
| 12986 | .init_verbs = { alc662_init_verbs, |
| 12987 | alc662_eeepc_ep20_sue_init_verbs }, |
| 12988 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 12989 | .dac_nids = alc662_dac_nids, |
| 12990 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 12991 | .adc_nids = alc662_adc_nids, |
| 12992 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 12993 | .channel_mode = alc662_3ST_6ch_modes, |
| 12994 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 12995 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 12996 | .init_hook = alc662_eeepc_ep20_inithook, |
| 12997 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12998 | |
| 12999 | }; |
| 13000 | |
| 13001 | |
| 13002 | /* |
| 13003 | * BIOS auto configuration |
| 13004 | */ |
| 13005 | |
| 13006 | /* add playback controls from the parsed DAC table */ |
| 13007 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13008 | const struct auto_pin_cfg *cfg) |
| 13009 | { |
| 13010 | char name[32]; |
| 13011 | static const char *chname[4] = { |
| 13012 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13013 | }; |
| 13014 | hda_nid_t nid; |
| 13015 | int i, err; |
| 13016 | |
| 13017 | for (i = 0; i < cfg->line_outs; i++) { |
| 13018 | if (!spec->multiout.dac_nids[i]) |
| 13019 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13020 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13021 | if (i == 2) { |
| 13022 | /* Center/LFE */ |
| 13023 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13024 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13025 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13026 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13027 | if (err < 0) |
| 13028 | return err; |
| 13029 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13030 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13031 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13032 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13033 | if (err < 0) |
| 13034 | return err; |
| 13035 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13036 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13037 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13038 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13039 | if (err < 0) |
| 13040 | return err; |
| 13041 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13042 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13043 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13044 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13045 | if (err < 0) |
| 13046 | return err; |
| 13047 | } else { |
| 13048 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13049 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13050 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13051 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13052 | if (err < 0) |
| 13053 | return err; |
| 13054 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13055 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13056 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13057 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13058 | if (err < 0) |
| 13059 | return err; |
| 13060 | } |
| 13061 | } |
| 13062 | return 0; |
| 13063 | } |
| 13064 | |
| 13065 | /* add playback controls for speaker and HP outputs */ |
| 13066 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13067 | const char *pfx) |
| 13068 | { |
| 13069 | hda_nid_t nid; |
| 13070 | int err; |
| 13071 | char name[32]; |
| 13072 | |
| 13073 | if (!pin) |
| 13074 | return 0; |
| 13075 | |
| 13076 | if (alc880_is_fixed_pin(pin)) { |
| 13077 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13078 | /* printk("DAC nid=%x\n",nid); */ |
| 13079 | /* specify the DAC as the extra output */ |
| 13080 | if (!spec->multiout.hp_nid) |
| 13081 | spec->multiout.hp_nid = nid; |
| 13082 | else |
| 13083 | spec->multiout.extra_out_nid[0] = nid; |
| 13084 | /* control HP volume/switch on the output mixer amp */ |
| 13085 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13086 | sprintf(name, "%s Playback Volume", pfx); |
| 13087 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13088 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13089 | if (err < 0) |
| 13090 | return err; |
| 13091 | sprintf(name, "%s Playback Switch", pfx); |
| 13092 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13093 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13094 | if (err < 0) |
| 13095 | return err; |
| 13096 | } else if (alc880_is_multi_pin(pin)) { |
| 13097 | /* set manual connection */ |
| 13098 | /* we have only a switch on HP-out PIN */ |
| 13099 | sprintf(name, "%s Playback Switch", pfx); |
| 13100 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13101 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13102 | if (err < 0) |
| 13103 | return err; |
| 13104 | } |
| 13105 | return 0; |
| 13106 | } |
| 13107 | |
| 13108 | /* create playback/capture controls for input pins */ |
| 13109 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13110 | const struct auto_pin_cfg *cfg) |
| 13111 | { |
| 13112 | struct hda_input_mux *imux = &spec->private_imux; |
| 13113 | int i, err, idx; |
| 13114 | |
| 13115 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13116 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13117 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13118 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13119 | auto_pin_cfg_labels[i], |
| 13120 | idx, 0x0b); |
| 13121 | if (err < 0) |
| 13122 | return err; |
| 13123 | imux->items[imux->num_items].label = |
| 13124 | auto_pin_cfg_labels[i]; |
| 13125 | imux->items[imux->num_items].index = |
| 13126 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13127 | imux->num_items++; |
| 13128 | } |
| 13129 | } |
| 13130 | return 0; |
| 13131 | } |
| 13132 | |
| 13133 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13134 | hda_nid_t nid, int pin_type, |
| 13135 | int dac_idx) |
| 13136 | { |
| 13137 | /* set as output */ |
| 13138 | snd_hda_codec_write(codec, nid, 0, |
| 13139 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 13140 | snd_hda_codec_write(codec, nid, 0, |
| 13141 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 13142 | /* need the manual connection? */ |
| 13143 | if (alc880_is_multi_pin(nid)) { |
| 13144 | struct alc_spec *spec = codec->spec; |
| 13145 | int idx = alc880_multi_pin_idx(nid); |
| 13146 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13147 | AC_VERB_SET_CONNECT_SEL, |
| 13148 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13149 | } |
| 13150 | } |
| 13151 | |
| 13152 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13153 | { |
| 13154 | struct alc_spec *spec = codec->spec; |
| 13155 | int i; |
| 13156 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13157 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13158 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13159 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13160 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13161 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13162 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13163 | i); |
| 13164 | } |
| 13165 | } |
| 13166 | |
| 13167 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13168 | { |
| 13169 | struct alc_spec *spec = codec->spec; |
| 13170 | hda_nid_t pin; |
| 13171 | |
| 13172 | pin = spec->autocfg.hp_pins[0]; |
| 13173 | if (pin) /* connect to front */ |
| 13174 | /* use dac 0 */ |
| 13175 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 13176 | } |
| 13177 | |
| 13178 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13179 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13180 | |
| 13181 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13182 | { |
| 13183 | struct alc_spec *spec = codec->spec; |
| 13184 | int i; |
| 13185 | |
| 13186 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13187 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13188 | if (alc662_is_input_pin(nid)) { |
| 13189 | snd_hda_codec_write(codec, nid, 0, |
| 13190 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13191 | (i <= AUTO_PIN_FRONT_MIC ? |
| 13192 | PIN_VREF80 : PIN_IN)); |
| 13193 | if (nid != ALC662_PIN_CD_NID) |
| 13194 | snd_hda_codec_write(codec, nid, 0, |
| 13195 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13196 | AMP_OUT_MUTE); |
| 13197 | } |
| 13198 | } |
| 13199 | } |
| 13200 | |
| 13201 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 13202 | { |
| 13203 | struct alc_spec *spec = codec->spec; |
| 13204 | int err; |
| 13205 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 13206 | |
| 13207 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13208 | alc662_ignore); |
| 13209 | if (err < 0) |
| 13210 | return err; |
| 13211 | if (!spec->autocfg.line_outs) |
| 13212 | return 0; /* can't find valid BIOS pin config */ |
| 13213 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13214 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13215 | if (err < 0) |
| 13216 | return err; |
| 13217 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13218 | if (err < 0) |
| 13219 | return err; |
| 13220 | err = alc662_auto_create_extra_out(spec, |
| 13221 | spec->autocfg.speaker_pins[0], |
| 13222 | "Speaker"); |
| 13223 | if (err < 0) |
| 13224 | return err; |
| 13225 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 13226 | "Headphone"); |
| 13227 | if (err < 0) |
| 13228 | return err; |
| 13229 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13230 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13231 | return err; |
| 13232 | |
| 13233 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13234 | |
| 13235 | if (spec->autocfg.dig_out_pin) |
| 13236 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 13237 | |
| 13238 | if (spec->kctl_alloc) |
| 13239 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13240 | |
| 13241 | spec->num_mux_defs = 1; |
| 13242 | spec->input_mux = &spec->private_imux; |
| 13243 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13244 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13245 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 13246 | spec->num_mixers++; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13247 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13248 | } |
| 13249 | |
| 13250 | /* additional initialization for auto-configuration model */ |
| 13251 | static void alc662_auto_init(struct hda_codec *codec) |
| 13252 | { |
| 13253 | alc662_auto_init_multi_out(codec); |
| 13254 | alc662_auto_init_hp_out(codec); |
| 13255 | alc662_auto_init_analog_input(codec); |
| 13256 | } |
| 13257 | |
| 13258 | static int patch_alc662(struct hda_codec *codec) |
| 13259 | { |
| 13260 | struct alc_spec *spec; |
| 13261 | int err, board_config; |
| 13262 | |
| 13263 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13264 | if (!spec) |
| 13265 | return -ENOMEM; |
| 13266 | |
| 13267 | codec->spec = spec; |
| 13268 | |
| 13269 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 13270 | alc662_models, |
| 13271 | alc662_cfg_tbl); |
| 13272 | if (board_config < 0) { |
| 13273 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 13274 | "trying auto-probe from BIOS...\n"); |
| 13275 | board_config = ALC662_AUTO; |
| 13276 | } |
| 13277 | |
| 13278 | if (board_config == ALC662_AUTO) { |
| 13279 | /* automatic parse from the BIOS config */ |
| 13280 | err = alc662_parse_auto_config(codec); |
| 13281 | if (err < 0) { |
| 13282 | alc_free(codec); |
| 13283 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13284 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13285 | printk(KERN_INFO |
| 13286 | "hda_codec: Cannot set up configuration " |
| 13287 | "from BIOS. Using base mode...\n"); |
| 13288 | board_config = ALC662_3ST_2ch_DIG; |
| 13289 | } |
| 13290 | } |
| 13291 | |
| 13292 | if (board_config != ALC662_AUTO) |
| 13293 | setup_preset(spec, &alc662_presets[board_config]); |
| 13294 | |
| 13295 | spec->stream_name_analog = "ALC662 Analog"; |
| 13296 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 13297 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 13298 | |
| 13299 | spec->stream_name_digital = "ALC662 Digital"; |
| 13300 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 13301 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 13302 | |
| 13303 | if (!spec->adc_nids && spec->input_mux) { |
| 13304 | spec->adc_nids = alc662_adc_nids; |
| 13305 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 13306 | } |
| 13307 | |
| 13308 | codec->patch_ops = alc_patch_ops; |
| 13309 | if (board_config == ALC662_AUTO) |
| 13310 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13311 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13312 | if (!spec->loopback.amplist) |
| 13313 | spec->loopback.amplist = alc662_loopbacks; |
| 13314 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13315 | |
| 13316 | return 0; |
| 13317 | } |
| 13318 | |
| 13319 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13320 | * patch entries |
| 13321 | */ |
| 13322 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 13323 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13324 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13325 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13326 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13327 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13328 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13329 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13330 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 13331 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 13332 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13333 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 13334 | .patch = patch_alc883 }, |
| 13335 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 13336 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13337 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13338 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13339 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13340 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13341 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13342 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13343 | {} /* terminator */ |
| 13344 | }; |