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 | |
| 26 | #include <sound/driver.h> |
| 27 | #include <linux/init.h> |
| 28 | #include <linux/delay.h> |
| 29 | #include <linux/slab.h> |
| 30 | #include <linux/pci.h> |
| 31 | #include <sound/core.h> |
| 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
| 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 63 | #ifdef CONFIG_SND_DEBUG |
| 64 | ALC880_TEST, |
| 65 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 66 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 67 | ALC880_MODEL_LAST /* last tag */ |
| 68 | }; |
| 69 | |
| 70 | /* ALC260 models */ |
| 71 | enum { |
| 72 | ALC260_BASIC, |
| 73 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 74 | ALC260_HP_3013, |
| 75 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 76 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 77 | ALC260_WILL, |
| 78 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 79 | #ifdef CONFIG_SND_DEBUG |
| 80 | ALC260_TEST, |
| 81 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 82 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 83 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | }; |
| 85 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | /* ALC262 models */ |
| 87 | enum { |
| 88 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 89 | ALC262_HIPPO, |
| 90 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 91 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 92 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 93 | ALC262_HP_BPC_D7000_WL, |
| 94 | ALC262_HP_BPC_D7000_WF, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 95 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 96 | ALC262_SONY_ASSAMD, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 97 | ALC262_AUTO, |
| 98 | ALC262_MODEL_LAST /* last tag */ |
| 99 | }; |
| 100 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 101 | /* ALC268 models */ |
| 102 | enum { |
| 103 | ALC268_3ST, |
| 104 | ALC268_AUTO, |
| 105 | ALC268_MODEL_LAST /* last tag */ |
| 106 | }; |
| 107 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 108 | /* ALC861 models */ |
| 109 | enum { |
| 110 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 111 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 112 | ALC861_3ST_DIG, |
| 113 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 114 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 115 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 116 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 117 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 118 | ALC861_AUTO, |
| 119 | ALC861_MODEL_LAST, |
| 120 | }; |
| 121 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 122 | /* ALC861-VD models */ |
| 123 | enum { |
| 124 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 125 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 126 | ALC861VD_3ST, |
| 127 | ALC861VD_3ST_DIG, |
| 128 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 129 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 130 | ALC861VD_DALLAS, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 131 | ALC861VD_AUTO, |
| 132 | ALC861VD_MODEL_LAST, |
| 133 | }; |
| 134 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 135 | /* ALC662 models */ |
| 136 | enum { |
| 137 | ALC662_3ST_2ch_DIG, |
| 138 | ALC662_3ST_6ch_DIG, |
| 139 | ALC662_3ST_6ch, |
| 140 | ALC662_5ST_DIG, |
| 141 | ALC662_LENOVO_101E, |
| 142 | ALC662_AUTO, |
| 143 | ALC662_MODEL_LAST, |
| 144 | }; |
| 145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | /* ALC882 models */ |
| 147 | enum { |
| 148 | ALC882_3ST_DIG, |
| 149 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 150 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 151 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 152 | ALC882_TARGA, |
| 153 | ALC882_ASUS_A7J, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 154 | ALC885_MACPRO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 155 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 156 | ALC882_MODEL_LAST, |
| 157 | }; |
| 158 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 159 | /* ALC883 models */ |
| 160 | enum { |
| 161 | ALC883_3ST_2ch_DIG, |
| 162 | ALC883_3ST_6ch_DIG, |
| 163 | ALC883_3ST_6ch, |
| 164 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 165 | ALC883_TARGA_DIG, |
| 166 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 167 | ALC883_ACER, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 168 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 169 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 170 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 171 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 172 | ALC883_LENOVO_NB0763, |
| 173 | ALC888_LENOVO_MS7195_DIG, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 174 | ALC883_AUTO, |
| 175 | ALC883_MODEL_LAST, |
| 176 | }; |
| 177 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 178 | /* for GPIO Poll */ |
| 179 | #define GPIO_MASK 0x03 |
| 180 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | struct alc_spec { |
| 182 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 183 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | unsigned int num_mixers; |
| 185 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 186 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 187 | * don't forget NULL |
| 188 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 189 | */ |
| 190 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 192 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | struct hda_pcm_stream *stream_analog_playback; |
| 194 | struct hda_pcm_stream *stream_analog_capture; |
| 195 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 196 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | struct hda_pcm_stream *stream_digital_playback; |
| 198 | struct hda_pcm_stream *stream_digital_capture; |
| 199 | |
| 200 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 201 | struct hda_multi_out multiout; /* playback set-up |
| 202 | * max_channels, dacs must be set |
| 203 | * dig_out_nid and hp_nid are optional |
| 204 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
| 206 | /* capture */ |
| 207 | unsigned int num_adc_nids; |
| 208 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 209 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | |
| 211 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 212 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | const struct hda_input_mux *input_mux; |
| 214 | unsigned int cur_mux[3]; |
| 215 | |
| 216 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 217 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 219 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | |
| 221 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 222 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 223 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 224 | /* dynamic controls, init_verbs and input_mux */ |
| 225 | struct auto_pin_cfg autocfg; |
| 226 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 227 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 228 | struct hda_input_mux private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 229 | hda_nid_t private_dac_nids[5]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 230 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 231 | /* hooks */ |
| 232 | void (*init_hook)(struct hda_codec *codec); |
| 233 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 234 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 235 | /* for pin sensing */ |
| 236 | unsigned int sense_updated: 1; |
| 237 | unsigned int jack_present: 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 238 | }; |
| 239 | |
| 240 | /* |
| 241 | * configuration template - to be copied to the spec instance |
| 242 | */ |
| 243 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 244 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 245 | * with spec |
| 246 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 247 | const struct hda_verb *init_verbs[5]; |
| 248 | unsigned int num_dacs; |
| 249 | hda_nid_t *dac_nids; |
| 250 | hda_nid_t dig_out_nid; /* optional */ |
| 251 | hda_nid_t hp_nid; /* optional */ |
| 252 | unsigned int num_adc_nids; |
| 253 | hda_nid_t *adc_nids; |
| 254 | hda_nid_t dig_in_nid; |
| 255 | unsigned int num_channel_mode; |
| 256 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 257 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 258 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 259 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 260 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 261 | void (*init_hook)(struct hda_codec *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | }; |
| 263 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | |
| 265 | /* |
| 266 | * input MUX handling |
| 267 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 268 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 269 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | { |
| 271 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 272 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 273 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 274 | if (mux_idx >= spec->num_mux_defs) |
| 275 | mux_idx = 0; |
| 276 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | } |
| 278 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 279 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 280 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | { |
| 282 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 283 | struct alc_spec *spec = codec->spec; |
| 284 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 285 | |
| 286 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 287 | return 0; |
| 288 | } |
| 289 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 290 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 291 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | { |
| 293 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 294 | struct alc_spec *spec = codec->spec; |
| 295 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 296 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 297 | 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] | 298 | spec->adc_nids[adc_idx], |
| 299 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | } |
| 301 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 302 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | /* |
| 304 | * channel mode setting |
| 305 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 306 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 307 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | { |
| 309 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 310 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 311 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 312 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | } |
| 314 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 315 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 316 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | { |
| 318 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 319 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 320 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 321 | spec->num_channel_mode, |
| 322 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | } |
| 324 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 325 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 326 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | { |
| 328 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 329 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 330 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 331 | spec->num_channel_mode, |
| 332 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 333 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 334 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 335 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | } |
| 337 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 339 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 340 | * instead of "%" to avoid consequences of accidently treating the % as |
| 341 | * being part of a format specifier. Maximum allowed length of a value is |
| 342 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 343 | * |
| 344 | * Note: some retasking pin complexes seem to ignore requests for input |
| 345 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 346 | * are requested. Therefore order this list so that this behaviour will not |
| 347 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 348 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 349 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 350 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 351 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 352 | "Mic 50pc bias", "Mic 80pc bias", |
| 353 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 354 | }; |
| 355 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 356 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 357 | }; |
| 358 | /* 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] | 359 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 360 | * addition, "input" pins may or may not process the mic bias option |
| 361 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 362 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 363 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 364 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 365 | #define ALC_PIN_DIR_IN 0x00 |
| 366 | #define ALC_PIN_DIR_OUT 0x01 |
| 367 | #define ALC_PIN_DIR_INOUT 0x02 |
| 368 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 369 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 370 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 371 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 372 | * For each direction the minimum and maximum values are given. |
| 373 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 374 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 375 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 376 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 377 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 378 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 379 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 380 | }; |
| 381 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 382 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 383 | #define alc_pin_mode_n_items(_dir) \ |
| 384 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 385 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 386 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 387 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 388 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 389 | unsigned int item_num = uinfo->value.enumerated.item; |
| 390 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 391 | |
| 392 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 393 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 394 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 395 | |
| 396 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 397 | item_num = alc_pin_mode_min(dir); |
| 398 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 399 | return 0; |
| 400 | } |
| 401 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 402 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 403 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 404 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 405 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 406 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 407 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 408 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 409 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 410 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 411 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 412 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 413 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 414 | /* Find enumerated value for current pinctl setting */ |
| 415 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 416 | 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] | 417 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 418 | *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] | 419 | return 0; |
| 420 | } |
| 421 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 422 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 423 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 424 | { |
| 425 | signed int change; |
| 426 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 427 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 428 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 429 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 430 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 431 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 432 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 433 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 434 | 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] | 435 | val = alc_pin_mode_min(dir); |
| 436 | |
| 437 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 438 | if (change) { |
| 439 | /* Set pin mode to that requested */ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 440 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 441 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 442 | |
| 443 | /* Also enable the retasking pin's input/output as required |
| 444 | * for the requested pin mode. Enum values of 2 or less are |
| 445 | * input modes. |
| 446 | * |
| 447 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 448 | * reduces noise slightly (particularly on input) so we'll |
| 449 | * do it. However, having both input and output buffers |
| 450 | * enabled simultaneously doesn't seem to be problematic if |
| 451 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 452 | */ |
| 453 | if (val <= 2) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 454 | snd_hda_codec_write(codec, nid, 0, |
| 455 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 456 | AMP_OUT_MUTE); |
| 457 | snd_hda_codec_write(codec, nid, 0, |
| 458 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 459 | AMP_IN_UNMUTE(0)); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 460 | } else { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 461 | snd_hda_codec_write(codec, nid, 0, |
| 462 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 463 | AMP_IN_MUTE(0)); |
| 464 | snd_hda_codec_write(codec, nid, 0, |
| 465 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 466 | AMP_OUT_UNMUTE); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 467 | } |
| 468 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 469 | return change; |
| 470 | } |
| 471 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 472 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 473 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 474 | .info = alc_pin_mode_info, \ |
| 475 | .get = alc_pin_mode_get, \ |
| 476 | .put = alc_pin_mode_put, \ |
| 477 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 478 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 479 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 480 | * together using a mask with more than one bit set. This control is |
| 481 | * currently used only by the ALC260 test model. At this stage they are not |
| 482 | * needed for any "production" models. |
| 483 | */ |
| 484 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 485 | static int alc_gpio_data_info(struct snd_kcontrol *kcontrol, |
| 486 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 487 | { |
| 488 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
| 489 | uinfo->count = 1; |
| 490 | uinfo->value.integer.min = 0; |
| 491 | uinfo->value.integer.max = 1; |
| 492 | return 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 493 | } |
| 494 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 495 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 496 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 497 | { |
| 498 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 499 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 500 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 501 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 502 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 503 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 504 | |
| 505 | *valp = (val & mask) != 0; |
| 506 | return 0; |
| 507 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 508 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 509 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 510 | { |
| 511 | signed int change; |
| 512 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 513 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 514 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 515 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 516 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 517 | AC_VERB_GET_GPIO_DATA, |
| 518 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 519 | |
| 520 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 521 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 522 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 523 | gpio_data &= ~mask; |
| 524 | else |
| 525 | gpio_data |= mask; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 526 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 527 | |
| 528 | return change; |
| 529 | } |
| 530 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 531 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 532 | .info = alc_gpio_data_info, \ |
| 533 | .get = alc_gpio_data_get, \ |
| 534 | .put = alc_gpio_data_put, \ |
| 535 | .private_value = nid | (mask<<16) } |
| 536 | #endif /* CONFIG_SND_DEBUG */ |
| 537 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 538 | /* A switch control to allow the enabling of the digital IO pins on the |
| 539 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 540 | * to provide something in the test model allowing digital outputs to be |
| 541 | * identified if present. If models are found which can utilise these |
| 542 | * outputs a more complete mixer control can be devised for those models if |
| 543 | * necessary. |
| 544 | */ |
| 545 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 546 | static int alc_spdif_ctrl_info(struct snd_kcontrol *kcontrol, |
| 547 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 548 | { |
| 549 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
| 550 | uinfo->count = 1; |
| 551 | uinfo->value.integer.min = 0; |
| 552 | uinfo->value.integer.max = 1; |
| 553 | return 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 554 | } |
| 555 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 556 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 557 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 558 | { |
| 559 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 560 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 561 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 562 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 563 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 564 | AC_VERB_GET_DIGI_CONVERT, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 565 | |
| 566 | *valp = (val & mask) != 0; |
| 567 | return 0; |
| 568 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 569 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 570 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 571 | { |
| 572 | signed int change; |
| 573 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 574 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 575 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 576 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 577 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 578 | AC_VERB_GET_DIGI_CONVERT, |
| 579 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 580 | |
| 581 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 582 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 583 | if (val==0) |
| 584 | ctrl_data &= ~mask; |
| 585 | else |
| 586 | ctrl_data |= mask; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 587 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 588 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 589 | |
| 590 | return change; |
| 591 | } |
| 592 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 593 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 594 | .info = alc_spdif_ctrl_info, \ |
| 595 | .get = alc_spdif_ctrl_get, \ |
| 596 | .put = alc_spdif_ctrl_put, \ |
| 597 | .private_value = nid | (mask<<16) } |
| 598 | #endif /* CONFIG_SND_DEBUG */ |
| 599 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 600 | /* |
| 601 | * set up from the preset table |
| 602 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 603 | static void setup_preset(struct alc_spec *spec, |
| 604 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 605 | { |
| 606 | int i; |
| 607 | |
| 608 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 609 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 610 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 611 | i++) |
| 612 | spec->init_verbs[spec->num_init_verbs++] = |
| 613 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 614 | |
| 615 | spec->channel_mode = preset->channel_mode; |
| 616 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 617 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 618 | |
| 619 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 620 | |
| 621 | spec->multiout.num_dacs = preset->num_dacs; |
| 622 | spec->multiout.dac_nids = preset->dac_nids; |
| 623 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 624 | spec->multiout.hp_nid = preset->hp_nid; |
| 625 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 626 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 627 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 628 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 629 | spec->input_mux = preset->input_mux; |
| 630 | |
| 631 | spec->num_adc_nids = preset->num_adc_nids; |
| 632 | spec->adc_nids = preset->adc_nids; |
| 633 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 634 | |
| 635 | spec->unsol_event = preset->unsol_event; |
| 636 | spec->init_hook = preset->init_hook; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 637 | } |
| 638 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 639 | /* Enable GPIO mask and set output */ |
| 640 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 641 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 642 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 643 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 644 | { } |
| 645 | }; |
| 646 | |
| 647 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 648 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 649 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 650 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 651 | { } |
| 652 | }; |
| 653 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 654 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 655 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 656 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 657 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 658 | { } |
| 659 | }; |
| 660 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 661 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 662 | * 31 ~ 16 : Manufacture ID |
| 663 | * 15 ~ 8 : SKU ID |
| 664 | * 7 ~ 0 : Assembly ID |
| 665 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 666 | */ |
| 667 | static void alc_subsystem_id(struct hda_codec *codec, |
| 668 | unsigned int porta, unsigned int porte, |
| 669 | unsigned int portd) |
| 670 | { |
| 671 | unsigned int ass, tmp; |
| 672 | |
| 673 | ass = codec->subsystem_id; |
| 674 | if (!(ass & 1)) |
| 675 | return; |
| 676 | |
| 677 | /* Override */ |
| 678 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 679 | switch (tmp) { |
| 680 | case 1: |
| 681 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 682 | break; |
| 683 | case 3: |
| 684 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 685 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 686 | case 7: |
| 687 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 688 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 689 | case 5: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 690 | switch (codec->vendor_id) { |
| 691 | case 0x10ec0862: |
| 692 | case 0x10ec0660: |
| 693 | case 0x10ec0662: |
| 694 | case 0x10ec0267: |
| 695 | case 0x10ec0268: |
| 696 | snd_hda_codec_write(codec, 0x14, 0, |
| 697 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 698 | snd_hda_codec_write(codec, 0x15, 0, |
| 699 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 700 | return; |
| 701 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 702 | case 6: |
| 703 | if (ass & 4) { /* bit 2 : 0 = Desktop, 1 = Laptop */ |
| 704 | hda_nid_t port = 0; |
| 705 | tmp = (ass & 0x1800) >> 11; |
| 706 | switch (tmp) { |
| 707 | case 0: port = porta; break; |
| 708 | case 1: port = porte; break; |
| 709 | case 2: port = portd; break; |
| 710 | } |
| 711 | if (port) |
| 712 | snd_hda_codec_write(codec, port, 0, |
| 713 | AC_VERB_SET_EAPD_BTLENABLE, |
| 714 | 2); |
| 715 | } |
| 716 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 717 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, |
| 718 | (tmp == 5 ? 0x3040 : 0x3050)); |
| 719 | break; |
| 720 | } |
| 721 | } |
| 722 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 723 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 724 | * ALC880 3-stack model |
| 725 | * |
| 726 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 727 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 728 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 729 | */ |
| 730 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 731 | static hda_nid_t alc880_dac_nids[4] = { |
| 732 | /* front, rear, clfe, rear_surr */ |
| 733 | 0x02, 0x05, 0x04, 0x03 |
| 734 | }; |
| 735 | |
| 736 | static hda_nid_t alc880_adc_nids[3] = { |
| 737 | /* ADC0-2 */ |
| 738 | 0x07, 0x08, 0x09, |
| 739 | }; |
| 740 | |
| 741 | /* The datasheet says the node 0x07 is connected from inputs, |
| 742 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 743 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 744 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 745 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 746 | /* ADC1-2 */ |
| 747 | 0x08, 0x09, |
| 748 | }; |
| 749 | |
| 750 | #define ALC880_DIGOUT_NID 0x06 |
| 751 | #define ALC880_DIGIN_NID 0x0a |
| 752 | |
| 753 | static struct hda_input_mux alc880_capture_source = { |
| 754 | .num_items = 4, |
| 755 | .items = { |
| 756 | { "Mic", 0x0 }, |
| 757 | { "Front Mic", 0x3 }, |
| 758 | { "Line", 0x2 }, |
| 759 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 760 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 761 | }; |
| 762 | |
| 763 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 764 | /* 2ch mode */ |
| 765 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 766 | /* set line-in to input, mute it */ |
| 767 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 768 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 769 | /* set mic-in to input vref 80%, mute it */ |
| 770 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 771 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 772 | { } /* end */ |
| 773 | }; |
| 774 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 775 | /* 6ch mode */ |
| 776 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 777 | /* set line-in to output, unmute it */ |
| 778 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 779 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 780 | /* set mic-in to output, unmute it */ |
| 781 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 782 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 783 | { } /* end */ |
| 784 | }; |
| 785 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 786 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 787 | { 2, alc880_threestack_ch2_init }, |
| 788 | { 6, alc880_threestack_ch6_init }, |
| 789 | }; |
| 790 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 791 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 792 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 793 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 794 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 795 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 796 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 797 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 798 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 799 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 800 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 801 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 802 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 803 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 804 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 805 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 806 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 807 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 808 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 809 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 810 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 811 | { |
| 812 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 813 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 814 | .info = alc_ch_mode_info, |
| 815 | .get = alc_ch_mode_get, |
| 816 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 817 | }, |
| 818 | { } /* end */ |
| 819 | }; |
| 820 | |
| 821 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 822 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 823 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 824 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 825 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 826 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 827 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 828 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 829 | { |
| 830 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 831 | /* The multiple "Capture Source" controls confuse alsamixer |
| 832 | * So call somewhat different.. |
| 833 | * FIXME: the controls appear in the "playback" view! |
| 834 | */ |
| 835 | /* .name = "Capture Source", */ |
| 836 | .name = "Input Source", |
| 837 | .count = 3, |
| 838 | .info = alc_mux_enum_info, |
| 839 | .get = alc_mux_enum_get, |
| 840 | .put = alc_mux_enum_put, |
| 841 | }, |
| 842 | { } /* end */ |
| 843 | }; |
| 844 | |
| 845 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 846 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 847 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 848 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 849 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 850 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 851 | { |
| 852 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 853 | /* The multiple "Capture Source" controls confuse alsamixer |
| 854 | * So call somewhat different.. |
| 855 | * FIXME: the controls appear in the "playback" view! |
| 856 | */ |
| 857 | /* .name = "Capture Source", */ |
| 858 | .name = "Input Source", |
| 859 | .count = 2, |
| 860 | .info = alc_mux_enum_info, |
| 861 | .get = alc_mux_enum_get, |
| 862 | .put = alc_mux_enum_put, |
| 863 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 864 | { } /* end */ |
| 865 | }; |
| 866 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 867 | |
| 868 | |
| 869 | /* |
| 870 | * ALC880 5-stack model |
| 871 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 872 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 873 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 874 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 875 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 876 | */ |
| 877 | |
| 878 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 879 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 880 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 881 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 882 | { } /* end */ |
| 883 | }; |
| 884 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 885 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 886 | /* 6ch mode */ |
| 887 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 888 | /* set line-in to input, mute it */ |
| 889 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 890 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 891 | { } /* end */ |
| 892 | }; |
| 893 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 894 | /* 8ch mode */ |
| 895 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 896 | /* set line-in to output, unmute it */ |
| 897 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 898 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 899 | { } /* end */ |
| 900 | }; |
| 901 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 902 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 903 | { 6, alc880_fivestack_ch6_init }, |
| 904 | { 8, alc880_fivestack_ch8_init }, |
| 905 | }; |
| 906 | |
| 907 | |
| 908 | /* |
| 909 | * ALC880 6-stack model |
| 910 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 911 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 912 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 913 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 914 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 915 | */ |
| 916 | |
| 917 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 918 | /* front, rear, clfe, rear_surr */ |
| 919 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 920 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 921 | |
| 922 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 923 | .num_items = 4, |
| 924 | .items = { |
| 925 | { "Mic", 0x0 }, |
| 926 | { "Front Mic", 0x1 }, |
| 927 | { "Line", 0x2 }, |
| 928 | { "CD", 0x4 }, |
| 929 | }, |
| 930 | }; |
| 931 | |
| 932 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 933 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 934 | { 8, NULL }, |
| 935 | }; |
| 936 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 937 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 938 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 939 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 940 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 941 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 942 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 943 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 944 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 945 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 946 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 947 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 948 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 949 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 950 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 951 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 952 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 953 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 954 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 955 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 956 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 957 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 958 | { |
| 959 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 960 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 961 | .info = alc_ch_mode_info, |
| 962 | .get = alc_ch_mode_get, |
| 963 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 964 | }, |
| 965 | { } /* end */ |
| 966 | }; |
| 967 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 968 | |
| 969 | /* |
| 970 | * ALC880 W810 model |
| 971 | * |
| 972 | * W810 has rear IO for: |
| 973 | * Front (DAC 02) |
| 974 | * Surround (DAC 03) |
| 975 | * Center/LFE (DAC 04) |
| 976 | * Digital out (06) |
| 977 | * |
| 978 | * The system also has a pair of internal speakers, and a headphone jack. |
| 979 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 980 | * |
| 981 | * There is a variable resistor to control the speaker or headphone |
| 982 | * volume. This is a hardware-only device without a software API. |
| 983 | * |
| 984 | * Plugging headphones in will disable the internal speakers. This is |
| 985 | * implemented in hardware, not via the driver using jack sense. In |
| 986 | * a similar fashion, plugging into the rear socket marked "front" will |
| 987 | * disable both the speakers and headphones. |
| 988 | * |
| 989 | * For input, there's a microphone jack, and an "audio in" jack. |
| 990 | * These may not do anything useful with this driver yet, because I |
| 991 | * haven't setup any initialization verbs for these yet... |
| 992 | */ |
| 993 | |
| 994 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 995 | /* front, rear/surround, clfe */ |
| 996 | 0x02, 0x03, 0x04 |
| 997 | }; |
| 998 | |
| 999 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1000 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1001 | { 6, NULL } |
| 1002 | }; |
| 1003 | |
| 1004 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1005 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1006 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1007 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1008 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1009 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1010 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1011 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1012 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1013 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1014 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1015 | { } /* end */ |
| 1016 | }; |
| 1017 | |
| 1018 | |
| 1019 | /* |
| 1020 | * Z710V model |
| 1021 | * |
| 1022 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1023 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1024 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1025 | */ |
| 1026 | |
| 1027 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1028 | 0x02 |
| 1029 | }; |
| 1030 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1031 | |
| 1032 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1033 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1034 | { 2, NULL } |
| 1035 | }; |
| 1036 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1037 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +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 | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1040 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1041 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1042 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1043 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1044 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1045 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1046 | { } /* end */ |
| 1047 | }; |
| 1048 | |
| 1049 | |
| 1050 | /* FIXME! */ |
| 1051 | /* |
| 1052 | * ALC880 F1734 model |
| 1053 | * |
| 1054 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1055 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1056 | */ |
| 1057 | |
| 1058 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1059 | 0x03 |
| 1060 | }; |
| 1061 | #define ALC880_F1734_HP_DAC 0x02 |
| 1062 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1063 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1064 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1065 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1066 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1067 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1068 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1069 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1070 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1071 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1072 | { } /* end */ |
| 1073 | }; |
| 1074 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1075 | |
| 1076 | /* FIXME! */ |
| 1077 | /* |
| 1078 | * ALC880 ASUS model |
| 1079 | * |
| 1080 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1081 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1082 | * Mic = 0x18, Line = 0x1a |
| 1083 | */ |
| 1084 | |
| 1085 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1086 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1087 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1088 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1089 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1090 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1091 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1092 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1093 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1094 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1095 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1096 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1097 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1098 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1099 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1100 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1101 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1102 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1103 | { |
| 1104 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1105 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1106 | .info = alc_ch_mode_info, |
| 1107 | .get = alc_ch_mode_get, |
| 1108 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1109 | }, |
| 1110 | { } /* end */ |
| 1111 | }; |
| 1112 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1113 | /* FIXME! */ |
| 1114 | /* |
| 1115 | * ALC880 ASUS W1V model |
| 1116 | * |
| 1117 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1118 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1119 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1120 | */ |
| 1121 | |
| 1122 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1123 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1124 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1125 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1126 | { } /* end */ |
| 1127 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1128 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1129 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1130 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1131 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1132 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1133 | { } /* end */ |
| 1134 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1135 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1136 | /* TCL S700 */ |
| 1137 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1138 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1139 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1140 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1141 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1142 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1143 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1144 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1145 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1146 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1147 | { |
| 1148 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1149 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1150 | * So call somewhat different.. |
| 1151 | * FIXME: the controls appear in the "playback" view! |
| 1152 | */ |
| 1153 | /* .name = "Capture Source", */ |
| 1154 | .name = "Input Source", |
| 1155 | .count = 1, |
| 1156 | .info = alc_mux_enum_info, |
| 1157 | .get = alc_mux_enum_get, |
| 1158 | .put = alc_mux_enum_put, |
| 1159 | }, |
| 1160 | { } /* end */ |
| 1161 | }; |
| 1162 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1163 | /* Uniwill */ |
| 1164 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
| 1165 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1166 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1167 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1168 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1169 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1170 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1171 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1172 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1173 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1174 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1175 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1176 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1177 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1179 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1180 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1181 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1182 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1183 | { |
| 1184 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1185 | .name = "Channel Mode", |
| 1186 | .info = alc_ch_mode_info, |
| 1187 | .get = alc_ch_mode_get, |
| 1188 | .put = alc_ch_mode_put, |
| 1189 | }, |
| 1190 | { } /* end */ |
| 1191 | }; |
| 1192 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1193 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1194 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1195 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1196 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1197 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1198 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1199 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1200 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1201 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1202 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1203 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1204 | { } /* end */ |
| 1205 | }; |
| 1206 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1207 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
| 1208 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1209 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1210 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1211 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1212 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1213 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1214 | { } /* end */ |
| 1215 | }; |
| 1216 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1217 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1218 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1219 | */ |
| 1220 | static int alc_build_controls(struct hda_codec *codec) |
| 1221 | { |
| 1222 | struct alc_spec *spec = codec->spec; |
| 1223 | int err; |
| 1224 | int i; |
| 1225 | |
| 1226 | for (i = 0; i < spec->num_mixers; i++) { |
| 1227 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1228 | if (err < 0) |
| 1229 | return err; |
| 1230 | } |
| 1231 | |
| 1232 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1233 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1234 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1235 | if (err < 0) |
| 1236 | return err; |
| 1237 | } |
| 1238 | if (spec->dig_in_nid) { |
| 1239 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1240 | if (err < 0) |
| 1241 | return err; |
| 1242 | } |
| 1243 | return 0; |
| 1244 | } |
| 1245 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1246 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1247 | /* |
| 1248 | * initialize the codec volumes, etc |
| 1249 | */ |
| 1250 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1251 | /* |
| 1252 | * generic initialization of ADC, input mixers and output mixers |
| 1253 | */ |
| 1254 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1255 | /* |
| 1256 | * Unmute ADC0-2 and set the default input to mic-in |
| 1257 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1258 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1259 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1260 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1261 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1262 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1263 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1264 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1265 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1266 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1267 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1268 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1269 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1270 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1271 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1272 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1273 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 1274 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 1275 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1276 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1277 | /* |
| 1278 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1279 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1280 | /* set vol=0 to output mixers */ |
| 1281 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1282 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1283 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1284 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1285 | /* set up input amps for analog loopback */ |
| 1286 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1287 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1288 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1289 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1290 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1291 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1292 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1293 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1294 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1295 | |
| 1296 | { } |
| 1297 | }; |
| 1298 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1299 | /* |
| 1300 | * 3-stack pin configuration: |
| 1301 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1302 | */ |
| 1303 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1304 | /* |
| 1305 | * preset connection lists of input pins |
| 1306 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1307 | */ |
| 1308 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1309 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1310 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1311 | |
| 1312 | /* |
| 1313 | * Set pin mode and muting |
| 1314 | */ |
| 1315 | /* set front pin widgets 0x14 for output */ |
| 1316 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1317 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1318 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1319 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1320 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1321 | /* Mic2 (as headphone out) for HP output */ |
| 1322 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1323 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1324 | /* Line In pin widget for input */ |
| 1325 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1326 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1327 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1328 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1329 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1330 | /* CD pin widget for input */ |
| 1331 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1332 | |
| 1333 | { } |
| 1334 | }; |
| 1335 | |
| 1336 | /* |
| 1337 | * 5-stack pin configuration: |
| 1338 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1339 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1340 | */ |
| 1341 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1342 | /* |
| 1343 | * preset connection lists of input pins |
| 1344 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1345 | */ |
| 1346 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1347 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1348 | |
| 1349 | /* |
| 1350 | * Set pin mode and muting |
| 1351 | */ |
| 1352 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1353 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1354 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1355 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1356 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1357 | /* unmute pins for output (no gain on this amp) */ |
| 1358 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1359 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1360 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1361 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1362 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1363 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1364 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1365 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1366 | /* Mic2 (as headphone out) for HP output */ |
| 1367 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1368 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1369 | /* Line In pin widget for input */ |
| 1370 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1371 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1372 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1373 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1374 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1375 | /* CD pin widget for input */ |
| 1376 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1377 | |
| 1378 | { } |
| 1379 | }; |
| 1380 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1381 | /* |
| 1382 | * W810 pin configuration: |
| 1383 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1384 | */ |
| 1385 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1386 | /* hphone/speaker input selector: front DAC */ |
| 1387 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1388 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1389 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1390 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1392 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1393 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1394 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1395 | |
| 1396 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1397 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1398 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1399 | { } |
| 1400 | }; |
| 1401 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1402 | /* |
| 1403 | * Z71V pin configuration: |
| 1404 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1405 | */ |
| 1406 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1407 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1408 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1409 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1410 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1411 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1412 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1413 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1414 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1415 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1416 | |
| 1417 | { } |
| 1418 | }; |
| 1419 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1420 | /* |
| 1421 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1422 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1423 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1424 | */ |
| 1425 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1426 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1427 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1428 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1429 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1430 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1431 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1432 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1433 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1434 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1435 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1436 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1437 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1438 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1439 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1440 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1441 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1442 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1443 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1444 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1445 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1446 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1447 | { } |
| 1448 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1449 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1450 | /* |
| 1451 | * Uniwill pin configuration: |
| 1452 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1453 | * line = 0x1a |
| 1454 | */ |
| 1455 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1456 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1457 | |
| 1458 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1459 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1460 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1461 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1462 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1463 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1464 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1465 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1466 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1467 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1468 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1469 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1470 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1471 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1472 | |
| 1473 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1474 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1475 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1476 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1477 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1478 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1479 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1480 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1481 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1482 | |
| 1483 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1484 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1485 | |
| 1486 | { } |
| 1487 | }; |
| 1488 | |
| 1489 | /* |
| 1490 | * Uniwill P53 |
| 1491 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1492 | */ |
| 1493 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1494 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1495 | |
| 1496 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1497 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1498 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1499 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1500 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1501 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1502 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1503 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1504 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1505 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1506 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1507 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1508 | |
| 1509 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1510 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1511 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1512 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1513 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1514 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1515 | |
| 1516 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1517 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1518 | |
| 1519 | { } |
| 1520 | }; |
| 1521 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1522 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1523 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1524 | { } |
| 1525 | }; |
| 1526 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1527 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1528 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1529 | { |
| 1530 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1531 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1532 | |
| 1533 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1534 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1535 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1536 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1537 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1538 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1539 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1540 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1541 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1542 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1543 | 0x80, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1544 | } |
| 1545 | |
| 1546 | /* auto-toggle front mic */ |
| 1547 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1548 | { |
| 1549 | unsigned int present; |
| 1550 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1551 | |
| 1552 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1553 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1554 | bits = present ? 0x80 : 0; |
| 1555 | snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, |
| 1556 | 0x80, bits); |
| 1557 | snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1, |
| 1558 | 0x80, bits); |
| 1559 | } |
| 1560 | |
| 1561 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1562 | { |
| 1563 | alc880_uniwill_hp_automute(codec); |
| 1564 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1565 | } |
| 1566 | |
| 1567 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1568 | unsigned int res) |
| 1569 | { |
| 1570 | /* Looks like the unsol event is incompatible with the standard |
| 1571 | * definition. 4bit tag is placed at 28 bit! |
| 1572 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1573 | switch (res >> 28) { |
| 1574 | case ALC880_HP_EVENT: |
| 1575 | alc880_uniwill_hp_automute(codec); |
| 1576 | break; |
| 1577 | case ALC880_MIC_EVENT: |
| 1578 | alc880_uniwill_mic_automute(codec); |
| 1579 | break; |
| 1580 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1581 | } |
| 1582 | |
| 1583 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1584 | { |
| 1585 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1586 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1587 | |
| 1588 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1589 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1590 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1591 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_INPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1592 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1593 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_INPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1594 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1595 | } |
| 1596 | |
| 1597 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1598 | { |
| 1599 | unsigned int present; |
| 1600 | |
| 1601 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 1602 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0) & 0x7f; |
| 1603 | |
| 1604 | snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 1605 | 0x7f, present); |
| 1606 | snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 1607 | 0x7f, present); |
| 1608 | |
| 1609 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 1610 | 0x7f, present); |
| 1611 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 1612 | 0x7f, present); |
| 1613 | |
| 1614 | } |
| 1615 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1616 | unsigned int res) |
| 1617 | { |
| 1618 | /* Looks like the unsol event is incompatible with the standard |
| 1619 | * definition. 4bit tag is placed at 28 bit! |
| 1620 | */ |
| 1621 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1622 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1623 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1624 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1625 | } |
| 1626 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1627 | /* FIXME! */ |
| 1628 | /* |
| 1629 | * F1734 pin configuration: |
| 1630 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1631 | */ |
| 1632 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1633 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1634 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1635 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1636 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1637 | |
| 1638 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1639 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1640 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1641 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1642 | |
| 1643 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1644 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1645 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1646 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1647 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1648 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1649 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1650 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1651 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1652 | |
| 1653 | { } |
| 1654 | }; |
| 1655 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1656 | /* FIXME! */ |
| 1657 | /* |
| 1658 | * ASUS pin configuration: |
| 1659 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1660 | */ |
| 1661 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1662 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1663 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1664 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1665 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1666 | |
| 1667 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1668 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1669 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1670 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1671 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1672 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1673 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1674 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1675 | |
| 1676 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1677 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1678 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1679 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1680 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1681 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1682 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1683 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1684 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1685 | |
| 1686 | { } |
| 1687 | }; |
| 1688 | |
| 1689 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1690 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1691 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1692 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1693 | /* Clevo m520g init */ |
| 1694 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1695 | /* headphone output */ |
| 1696 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1697 | /* line-out */ |
| 1698 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1699 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1700 | /* Line-in */ |
| 1701 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1702 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1703 | /* CD */ |
| 1704 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1705 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1706 | /* Mic1 (rear panel) */ |
| 1707 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1708 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1709 | /* Mic2 (front panel) */ |
| 1710 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1711 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1712 | /* headphone */ |
| 1713 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1714 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1715 | /* change to EAPD mode */ |
| 1716 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1717 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1718 | |
| 1719 | { } |
| 1720 | }; |
| 1721 | |
| 1722 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 1723 | /* change to EAPD mode */ |
| 1724 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1725 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 1726 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1727 | /* Headphone output */ |
| 1728 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1729 | /* Front output*/ |
| 1730 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1731 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1732 | |
| 1733 | /* Line In pin widget for input */ |
| 1734 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1735 | /* CD pin widget for input */ |
| 1736 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1737 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1738 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1739 | |
| 1740 | /* change to EAPD mode */ |
| 1741 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1742 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 1743 | |
| 1744 | { } |
| 1745 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1746 | |
| 1747 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1748 | * LG m1 express dual |
| 1749 | * |
| 1750 | * Pin assignment: |
| 1751 | * Rear Line-In/Out (blue): 0x14 |
| 1752 | * Build-in Mic-In: 0x15 |
| 1753 | * Speaker-out: 0x17 |
| 1754 | * HP-Out (green): 0x1b |
| 1755 | * Mic-In/Out (red): 0x19 |
| 1756 | * SPDIF-Out: 0x1e |
| 1757 | */ |
| 1758 | |
| 1759 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 1760 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 1761 | 0x05, 0x02, 0x03 |
| 1762 | }; |
| 1763 | |
| 1764 | /* seems analog CD is not working */ |
| 1765 | static struct hda_input_mux alc880_lg_capture_source = { |
| 1766 | .num_items = 3, |
| 1767 | .items = { |
| 1768 | { "Mic", 0x1 }, |
| 1769 | { "Line", 0x5 }, |
| 1770 | { "Internal Mic", 0x6 }, |
| 1771 | }, |
| 1772 | }; |
| 1773 | |
| 1774 | /* 2,4,6 channel modes */ |
| 1775 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 1776 | /* set line-in and mic-in to input */ |
| 1777 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1778 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1779 | { } |
| 1780 | }; |
| 1781 | |
| 1782 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 1783 | /* set line-in to out and mic-in to input */ |
| 1784 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1785 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1786 | { } |
| 1787 | }; |
| 1788 | |
| 1789 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 1790 | /* set line-in and mic-in to output */ |
| 1791 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1792 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 1793 | { } |
| 1794 | }; |
| 1795 | |
| 1796 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 1797 | { 2, alc880_lg_ch2_init }, |
| 1798 | { 4, alc880_lg_ch4_init }, |
| 1799 | { 6, alc880_lg_ch6_init }, |
| 1800 | }; |
| 1801 | |
| 1802 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
| 1803 | /* FIXME: it's not really "master" but front channels */ |
| 1804 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1805 | HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1806 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1807 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1808 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 1809 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 1810 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 1811 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 1812 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1813 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1814 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 1815 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 1816 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 1817 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 1818 | { |
| 1819 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1820 | .name = "Channel Mode", |
| 1821 | .info = alc_ch_mode_info, |
| 1822 | .get = alc_ch_mode_get, |
| 1823 | .put = alc_ch_mode_put, |
| 1824 | }, |
| 1825 | { } /* end */ |
| 1826 | }; |
| 1827 | |
| 1828 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 1829 | /* set capture source to mic-in */ |
| 1830 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1831 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1832 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1833 | /* mute all amp mixer inputs */ |
| 1834 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 1835 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 1836 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1837 | /* line-in to input */ |
| 1838 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1839 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1840 | /* built-in mic */ |
| 1841 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1842 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1843 | /* speaker-out */ |
| 1844 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1845 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1846 | /* mic-in to input */ |
| 1847 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1848 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1849 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1850 | /* HP-out */ |
| 1851 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1852 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1853 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1854 | /* jack sense */ |
| 1855 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1856 | { } |
| 1857 | }; |
| 1858 | |
| 1859 | /* toggle speaker-output according to the hp-jack state */ |
| 1860 | static void alc880_lg_automute(struct hda_codec *codec) |
| 1861 | { |
| 1862 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1863 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1864 | |
| 1865 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1866 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1867 | bits = present ? 0x80 : 0; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1868 | snd_hda_codec_amp_update(codec, 0x17, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1869 | 0x80, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1870 | snd_hda_codec_amp_update(codec, 0x17, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1871 | 0x80, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1872 | } |
| 1873 | |
| 1874 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1875 | { |
| 1876 | /* Looks like the unsol event is incompatible with the standard |
| 1877 | * definition. 4bit tag is placed at 28 bit! |
| 1878 | */ |
| 1879 | if ((res >> 28) == 0x01) |
| 1880 | alc880_lg_automute(codec); |
| 1881 | } |
| 1882 | |
| 1883 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1884 | * LG LW20 |
| 1885 | * |
| 1886 | * Pin assignment: |
| 1887 | * Speaker-out: 0x14 |
| 1888 | * Mic-In: 0x18 |
| 1889 | * Built-in Mic-In: 0x19 (?) |
| 1890 | * HP-Out: 0x1b |
| 1891 | * SPDIF-Out: 0x1e |
| 1892 | */ |
| 1893 | |
| 1894 | /* seems analog CD is not working */ |
| 1895 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
| 1896 | .num_items = 2, |
| 1897 | .items = { |
| 1898 | { "Mic", 0x0 }, |
| 1899 | { "Internal Mic", 0x1 }, |
| 1900 | }, |
| 1901 | }; |
| 1902 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame^] | 1903 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 1904 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1905 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame^] | 1906 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1907 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1908 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1909 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1910 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1911 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1912 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1913 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1914 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1915 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1916 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1917 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1918 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 1919 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame^] | 1920 | { |
| 1921 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1922 | .name = "Channel Mode", |
| 1923 | .info = alc_ch_mode_info, |
| 1924 | .get = alc_ch_mode_get, |
| 1925 | .put = alc_ch_mode_put, |
| 1926 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1927 | { } /* end */ |
| 1928 | }; |
| 1929 | |
| 1930 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame^] | 1931 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1932 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1933 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1934 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1935 | /* set capture source to mic-in */ |
| 1936 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1937 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1938 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1939 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 1940 | /* speaker-out */ |
| 1941 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1942 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1943 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1944 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1945 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1946 | /* mic-in to input */ |
| 1947 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1948 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1949 | /* built-in mic */ |
| 1950 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1951 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1952 | /* jack sense */ |
| 1953 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 1954 | { } |
| 1955 | }; |
| 1956 | |
| 1957 | /* toggle speaker-output according to the hp-jack state */ |
| 1958 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 1959 | { |
| 1960 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1961 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1962 | |
| 1963 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 1964 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1965 | bits = present ? 0x80 : 0; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1966 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1967 | 0x80, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1968 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1969 | 0x80, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 1970 | } |
| 1971 | |
| 1972 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1973 | { |
| 1974 | /* Looks like the unsol event is incompatible with the standard |
| 1975 | * definition. 4bit tag is placed at 28 bit! |
| 1976 | */ |
| 1977 | if ((res >> 28) == 0x01) |
| 1978 | alc880_lg_lw_automute(codec); |
| 1979 | } |
| 1980 | |
| 1981 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1982 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1983 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1984 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1985 | static int alc_init(struct hda_codec *codec) |
| 1986 | { |
| 1987 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1988 | unsigned int i; |
| 1989 | |
| 1990 | for (i = 0; i < spec->num_init_verbs; i++) |
| 1991 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1992 | |
| 1993 | if (spec->init_hook) |
| 1994 | spec->init_hook(codec); |
| 1995 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1996 | return 0; |
| 1997 | } |
| 1998 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 1999 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2000 | { |
| 2001 | struct alc_spec *spec = codec->spec; |
| 2002 | |
| 2003 | if (spec->unsol_event) |
| 2004 | spec->unsol_event(codec, res); |
| 2005 | } |
| 2006 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2007 | #ifdef CONFIG_PM |
| 2008 | /* |
| 2009 | * resume |
| 2010 | */ |
| 2011 | static int alc_resume(struct hda_codec *codec) |
| 2012 | { |
| 2013 | struct alc_spec *spec = codec->spec; |
| 2014 | int i; |
| 2015 | |
| 2016 | alc_init(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2017 | for (i = 0; i < spec->num_mixers; i++) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2018 | snd_hda_resume_ctls(codec, spec->mixers[i]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2019 | if (spec->multiout.dig_out_nid) |
| 2020 | snd_hda_resume_spdif_out(codec); |
| 2021 | if (spec->dig_in_nid) |
| 2022 | snd_hda_resume_spdif_in(codec); |
| 2023 | |
| 2024 | return 0; |
| 2025 | } |
| 2026 | #endif |
| 2027 | |
| 2028 | /* |
| 2029 | * Analog playback callbacks |
| 2030 | */ |
| 2031 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2032 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2033 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2034 | { |
| 2035 | struct alc_spec *spec = codec->spec; |
| 2036 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 2037 | } |
| 2038 | |
| 2039 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2040 | struct hda_codec *codec, |
| 2041 | unsigned int stream_tag, |
| 2042 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2043 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2044 | { |
| 2045 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2046 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2047 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2048 | } |
| 2049 | |
| 2050 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2051 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2052 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2053 | { |
| 2054 | struct alc_spec *spec = codec->spec; |
| 2055 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2056 | } |
| 2057 | |
| 2058 | /* |
| 2059 | * Digital out |
| 2060 | */ |
| 2061 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2062 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2063 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2064 | { |
| 2065 | struct alc_spec *spec = codec->spec; |
| 2066 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2067 | } |
| 2068 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2069 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2070 | struct hda_codec *codec, |
| 2071 | unsigned int stream_tag, |
| 2072 | unsigned int format, |
| 2073 | struct snd_pcm_substream *substream) |
| 2074 | { |
| 2075 | struct alc_spec *spec = codec->spec; |
| 2076 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2077 | stream_tag, format, substream); |
| 2078 | } |
| 2079 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2080 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2081 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2082 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2083 | { |
| 2084 | struct alc_spec *spec = codec->spec; |
| 2085 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2086 | } |
| 2087 | |
| 2088 | /* |
| 2089 | * Analog capture |
| 2090 | */ |
| 2091 | static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2092 | struct hda_codec *codec, |
| 2093 | unsigned int stream_tag, |
| 2094 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2095 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2096 | { |
| 2097 | struct alc_spec *spec = codec->spec; |
| 2098 | |
| 2099 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2100 | stream_tag, 0, format); |
| 2101 | return 0; |
| 2102 | } |
| 2103 | |
| 2104 | static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2105 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2106 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2107 | { |
| 2108 | struct alc_spec *spec = codec->spec; |
| 2109 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2110 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
| 2111 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2112 | return 0; |
| 2113 | } |
| 2114 | |
| 2115 | |
| 2116 | /* |
| 2117 | */ |
| 2118 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2119 | .substreams = 1, |
| 2120 | .channels_min = 2, |
| 2121 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2122 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2123 | .ops = { |
| 2124 | .open = alc880_playback_pcm_open, |
| 2125 | .prepare = alc880_playback_pcm_prepare, |
| 2126 | .cleanup = alc880_playback_pcm_cleanup |
| 2127 | }, |
| 2128 | }; |
| 2129 | |
| 2130 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
| 2131 | .substreams = 2, |
| 2132 | .channels_min = 2, |
| 2133 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2134 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2135 | .ops = { |
| 2136 | .prepare = alc880_capture_pcm_prepare, |
| 2137 | .cleanup = alc880_capture_pcm_cleanup |
| 2138 | }, |
| 2139 | }; |
| 2140 | |
| 2141 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2142 | .substreams = 1, |
| 2143 | .channels_min = 2, |
| 2144 | .channels_max = 2, |
| 2145 | /* NID is set in alc_build_pcms */ |
| 2146 | .ops = { |
| 2147 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2148 | .close = alc880_dig_playback_pcm_close, |
| 2149 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2150 | }, |
| 2151 | }; |
| 2152 | |
| 2153 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2154 | .substreams = 1, |
| 2155 | .channels_min = 2, |
| 2156 | .channels_max = 2, |
| 2157 | /* NID is set in alc_build_pcms */ |
| 2158 | }; |
| 2159 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2160 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
| 2161 | static struct hda_pcm_stream alc_pcm_null_playback = { |
| 2162 | .substreams = 0, |
| 2163 | .channels_min = 0, |
| 2164 | .channels_max = 0, |
| 2165 | }; |
| 2166 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2167 | static int alc_build_pcms(struct hda_codec *codec) |
| 2168 | { |
| 2169 | struct alc_spec *spec = codec->spec; |
| 2170 | struct hda_pcm *info = spec->pcm_rec; |
| 2171 | int i; |
| 2172 | |
| 2173 | codec->num_pcms = 1; |
| 2174 | codec->pcm_info = info; |
| 2175 | |
| 2176 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2177 | if (spec->stream_analog_playback) { |
| 2178 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2179 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2180 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2181 | } |
| 2182 | if (spec->stream_analog_capture) { |
| 2183 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2184 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2185 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2186 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2187 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2188 | if (spec->channel_mode) { |
| 2189 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2190 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2191 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2192 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2193 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2194 | } |
| 2195 | } |
| 2196 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2197 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2198 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2199 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2200 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2201 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2202 | if (spec->multiout.dig_out_nid && |
| 2203 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2204 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2205 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2206 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2207 | if (spec->dig_in_nid && |
| 2208 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2209 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2210 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2211 | } |
| 2212 | } |
| 2213 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2214 | /* If the use of more than one ADC is requested for the current |
| 2215 | * model, configure a second analog capture-only PCM. |
| 2216 | */ |
| 2217 | /* Additional Analaog capture for index #2 */ |
| 2218 | if (spec->num_adc_nids > 1 && spec->stream_analog_capture && |
| 2219 | spec->adc_nids) { |
| 2220 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2221 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2222 | info->name = spec->stream_name_analog; |
| 2223 | /* No playback stream for second PCM */ |
| 2224 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; |
| 2225 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2226 | if (spec->stream_analog_capture) { |
| 2227 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2228 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; |
| 2229 | } |
| 2230 | } |
| 2231 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2232 | return 0; |
| 2233 | } |
| 2234 | |
| 2235 | static void alc_free(struct hda_codec *codec) |
| 2236 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2237 | struct alc_spec *spec = codec->spec; |
| 2238 | unsigned int i; |
| 2239 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2240 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2241 | return; |
| 2242 | |
| 2243 | if (spec->kctl_alloc) { |
| 2244 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2245 | kfree(spec->kctl_alloc[i].name); |
| 2246 | kfree(spec->kctl_alloc); |
| 2247 | } |
| 2248 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2249 | } |
| 2250 | |
| 2251 | /* |
| 2252 | */ |
| 2253 | static struct hda_codec_ops alc_patch_ops = { |
| 2254 | .build_controls = alc_build_controls, |
| 2255 | .build_pcms = alc_build_pcms, |
| 2256 | .init = alc_init, |
| 2257 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2258 | .unsol_event = alc_unsol_event, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2259 | #ifdef CONFIG_PM |
| 2260 | .resume = alc_resume, |
| 2261 | #endif |
| 2262 | }; |
| 2263 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2264 | |
| 2265 | /* |
| 2266 | * Test configuration for debugging |
| 2267 | * |
| 2268 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2269 | * enum controls. |
| 2270 | */ |
| 2271 | #ifdef CONFIG_SND_DEBUG |
| 2272 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2273 | 0x02, 0x03, 0x04, 0x05 |
| 2274 | }; |
| 2275 | |
| 2276 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2277 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2278 | .items = { |
| 2279 | { "In-1", 0x0 }, |
| 2280 | { "In-2", 0x1 }, |
| 2281 | { "In-3", 0x2 }, |
| 2282 | { "In-4", 0x3 }, |
| 2283 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2284 | { "Front", 0x5 }, |
| 2285 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2286 | }, |
| 2287 | }; |
| 2288 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2289 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2290 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2291 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2292 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2293 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2294 | }; |
| 2295 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2296 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2297 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2298 | { |
| 2299 | static char *texts[] = { |
| 2300 | "N/A", "Line Out", "HP Out", |
| 2301 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2302 | }; |
| 2303 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2304 | uinfo->count = 1; |
| 2305 | uinfo->value.enumerated.items = 8; |
| 2306 | if (uinfo->value.enumerated.item >= 8) |
| 2307 | uinfo->value.enumerated.item = 7; |
| 2308 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2309 | return 0; |
| 2310 | } |
| 2311 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2312 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2313 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2314 | { |
| 2315 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2316 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2317 | unsigned int pin_ctl, item = 0; |
| 2318 | |
| 2319 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2320 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2321 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2322 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2323 | item = 2; |
| 2324 | else |
| 2325 | item = 1; |
| 2326 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2327 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2328 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2329 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2330 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2331 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2332 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2333 | } |
| 2334 | } |
| 2335 | ucontrol->value.enumerated.item[0] = item; |
| 2336 | return 0; |
| 2337 | } |
| 2338 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2339 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2340 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2341 | { |
| 2342 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2343 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2344 | static unsigned int ctls[] = { |
| 2345 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2346 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2347 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2348 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2349 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2350 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2351 | }; |
| 2352 | unsigned int old_ctl, new_ctl; |
| 2353 | |
| 2354 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2355 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2356 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2357 | if (old_ctl != new_ctl) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2358 | snd_hda_codec_write(codec, nid, 0, |
| 2359 | AC_VERB_SET_PIN_WIDGET_CONTROL, new_ctl); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2360 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2361 | (ucontrol->value.enumerated.item[0] >= 3 ? |
| 2362 | 0xb080 : 0xb000)); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2363 | return 1; |
| 2364 | } |
| 2365 | return 0; |
| 2366 | } |
| 2367 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2368 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2369 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2370 | { |
| 2371 | static char *texts[] = { |
| 2372 | "Front", "Surround", "CLFE", "Side" |
| 2373 | }; |
| 2374 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2375 | uinfo->count = 1; |
| 2376 | uinfo->value.enumerated.items = 4; |
| 2377 | if (uinfo->value.enumerated.item >= 4) |
| 2378 | uinfo->value.enumerated.item = 3; |
| 2379 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2380 | return 0; |
| 2381 | } |
| 2382 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2383 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2384 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2385 | { |
| 2386 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2387 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2388 | unsigned int sel; |
| 2389 | |
| 2390 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2391 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2392 | return 0; |
| 2393 | } |
| 2394 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2395 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2396 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2397 | { |
| 2398 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2399 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2400 | unsigned int sel; |
| 2401 | |
| 2402 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2403 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2404 | sel = ucontrol->value.enumerated.item[0] & 3; |
| 2405 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, sel); |
| 2406 | return 1; |
| 2407 | } |
| 2408 | return 0; |
| 2409 | } |
| 2410 | |
| 2411 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2412 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2413 | .name = xname, \ |
| 2414 | .info = alc_test_pin_ctl_info, \ |
| 2415 | .get = alc_test_pin_ctl_get, \ |
| 2416 | .put = alc_test_pin_ctl_put, \ |
| 2417 | .private_value = nid \ |
| 2418 | } |
| 2419 | |
| 2420 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2421 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2422 | .name = xname, \ |
| 2423 | .info = alc_test_pin_src_info, \ |
| 2424 | .get = alc_test_pin_src_get, \ |
| 2425 | .put = alc_test_pin_src_put, \ |
| 2426 | .private_value = nid \ |
| 2427 | } |
| 2428 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2429 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2430 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2431 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2432 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2433 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2434 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2435 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2436 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2437 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2438 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2439 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2440 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2441 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2442 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2443 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2444 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2445 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2446 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2447 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2448 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2449 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2450 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2451 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2452 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2453 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2454 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2455 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2456 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2457 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2458 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2459 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2460 | { |
| 2461 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2462 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2463 | .info = alc_ch_mode_info, |
| 2464 | .get = alc_ch_mode_get, |
| 2465 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2466 | }, |
| 2467 | { } /* end */ |
| 2468 | }; |
| 2469 | |
| 2470 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2471 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2473 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2474 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2475 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2476 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2477 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2478 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2479 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2480 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2481 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2482 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2483 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2484 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2485 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2486 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2487 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2488 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2489 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2490 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2491 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2492 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2493 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2494 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2495 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2496 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2497 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2498 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2499 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2500 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2501 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2502 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2503 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2504 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2505 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2506 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2507 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2508 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2509 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2510 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2511 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2512 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2513 | /* Analog input/passthru */ |
| 2514 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2515 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2516 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2517 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2519 | { } |
| 2520 | }; |
| 2521 | #endif |
| 2522 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2523 | /* |
| 2524 | */ |
| 2525 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2526 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2527 | [ALC880_3ST] = "3stack", |
| 2528 | [ALC880_TCL_S700] = "tcl", |
| 2529 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2530 | [ALC880_CLEVO] = "clevo", |
| 2531 | [ALC880_5ST] = "5stack", |
| 2532 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2533 | [ALC880_W810] = "w810", |
| 2534 | [ALC880_Z71V] = "z71v", |
| 2535 | [ALC880_6ST] = "6stack", |
| 2536 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2537 | [ALC880_ASUS] = "asus", |
| 2538 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2539 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2540 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2541 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2542 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2543 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2544 | [ALC880_F1734] = "F1734", |
| 2545 | [ALC880_LG] = "lg", |
| 2546 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2547 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2548 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2549 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2550 | [ALC880_AUTO] = "auto", |
| 2551 | }; |
| 2552 | |
| 2553 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
| 2554 | /* Broken BIOS configuration */ |
| 2555 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), |
| 2556 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2557 | |
| 2558 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2559 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
Tobin Davis | 4dc53e2 | 2006-12-18 13:24:37 +0100 | [diff] [blame] | 2560 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2561 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2562 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2563 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2564 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2565 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2566 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
| 2567 | |
| 2568 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2569 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
| 2570 | |
| 2571 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2572 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2573 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2574 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2575 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2576 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2577 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2578 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2579 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2580 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2581 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2582 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2583 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2584 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
| 2585 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), |
| 2586 | |
| 2587 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2588 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
| 2589 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2590 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
| 2591 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
| 2592 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2593 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
| 2594 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
| 2595 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2596 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
| 2597 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2598 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2599 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
| 2600 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2601 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2602 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2603 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
| 2604 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
| 2605 | |
| 2606 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
| 2607 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2608 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
| 2609 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
| 2610 | |
| 2611 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
| 2612 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
| 2613 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2614 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2615 | |
| 2616 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2617 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
| 2618 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
| 2619 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
| 2620 | |
| 2621 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
| 2622 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2623 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
| 2624 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2625 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
| 2626 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
| 2627 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2628 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2629 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
| 2630 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
| 2631 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2632 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2633 | {} |
| 2634 | }; |
| 2635 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2636 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2637 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2638 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2639 | static struct alc_config_preset alc880_presets[] = { |
| 2640 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2641 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2642 | .init_verbs = { alc880_volume_init_verbs, |
| 2643 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2644 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2645 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2646 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2647 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2648 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2649 | .input_mux = &alc880_capture_source, |
| 2650 | }, |
| 2651 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2652 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2653 | .init_verbs = { alc880_volume_init_verbs, |
| 2654 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2655 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2656 | .dac_nids = alc880_dac_nids, |
| 2657 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2658 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2659 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2660 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2661 | .input_mux = &alc880_capture_source, |
| 2662 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2663 | [ALC880_TCL_S700] = { |
| 2664 | .mixers = { alc880_tcl_s700_mixer }, |
| 2665 | .init_verbs = { alc880_volume_init_verbs, |
| 2666 | alc880_pin_tcl_S700_init_verbs, |
| 2667 | alc880_gpio2_init_verbs }, |
| 2668 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2669 | .dac_nids = alc880_dac_nids, |
| 2670 | .hp_nid = 0x03, |
| 2671 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2672 | .channel_mode = alc880_2_jack_modes, |
| 2673 | .input_mux = &alc880_capture_source, |
| 2674 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2675 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2676 | .mixers = { alc880_three_stack_mixer, |
| 2677 | alc880_five_stack_mixer}, |
| 2678 | .init_verbs = { alc880_volume_init_verbs, |
| 2679 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2680 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2681 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2682 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2683 | .channel_mode = alc880_fivestack_modes, |
| 2684 | .input_mux = &alc880_capture_source, |
| 2685 | }, |
| 2686 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2687 | .mixers = { alc880_three_stack_mixer, |
| 2688 | alc880_five_stack_mixer }, |
| 2689 | .init_verbs = { alc880_volume_init_verbs, |
| 2690 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2691 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2692 | .dac_nids = alc880_dac_nids, |
| 2693 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2694 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2695 | .channel_mode = alc880_fivestack_modes, |
| 2696 | .input_mux = &alc880_capture_source, |
| 2697 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2698 | [ALC880_6ST] = { |
| 2699 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2700 | .init_verbs = { alc880_volume_init_verbs, |
| 2701 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 2702 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2703 | .dac_nids = alc880_6st_dac_nids, |
| 2704 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2705 | .channel_mode = alc880_sixstack_modes, |
| 2706 | .input_mux = &alc880_6stack_capture_source, |
| 2707 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2708 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2709 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2710 | .init_verbs = { alc880_volume_init_verbs, |
| 2711 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2712 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 2713 | .dac_nids = alc880_6st_dac_nids, |
| 2714 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2715 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 2716 | .channel_mode = alc880_sixstack_modes, |
| 2717 | .input_mux = &alc880_6stack_capture_source, |
| 2718 | }, |
| 2719 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2720 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2721 | .init_verbs = { alc880_volume_init_verbs, |
| 2722 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2723 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2724 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 2725 | .dac_nids = alc880_w810_dac_nids, |
| 2726 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2727 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 2728 | .channel_mode = alc880_w810_modes, |
| 2729 | .input_mux = &alc880_capture_source, |
| 2730 | }, |
| 2731 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2732 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2733 | .init_verbs = { alc880_volume_init_verbs, |
| 2734 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2735 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 2736 | .dac_nids = alc880_z71v_dac_nids, |
| 2737 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2738 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2739 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2740 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2741 | .input_mux = &alc880_capture_source, |
| 2742 | }, |
| 2743 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2744 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2745 | .init_verbs = { alc880_volume_init_verbs, |
| 2746 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2747 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 2748 | .dac_nids = alc880_f1734_dac_nids, |
| 2749 | .hp_nid = 0x02, |
| 2750 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2751 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2752 | .input_mux = &alc880_capture_source, |
| 2753 | }, |
| 2754 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2755 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2756 | .init_verbs = { alc880_volume_init_verbs, |
| 2757 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2758 | alc880_gpio1_init_verbs }, |
| 2759 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2760 | .dac_nids = alc880_asus_dac_nids, |
| 2761 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2762 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2763 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2764 | .input_mux = &alc880_capture_source, |
| 2765 | }, |
| 2766 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2767 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2768 | .init_verbs = { alc880_volume_init_verbs, |
| 2769 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2770 | alc880_gpio1_init_verbs }, |
| 2771 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2772 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2773 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2774 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2775 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2776 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2777 | .input_mux = &alc880_capture_source, |
| 2778 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2779 | [ALC880_ASUS_DIG2] = { |
| 2780 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2781 | .init_verbs = { alc880_volume_init_verbs, |
| 2782 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2783 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 2784 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2785 | .dac_nids = alc880_asus_dac_nids, |
| 2786 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2787 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2788 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2789 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2790 | .input_mux = &alc880_capture_source, |
| 2791 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2792 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2793 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2794 | .init_verbs = { alc880_volume_init_verbs, |
| 2795 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2796 | alc880_gpio1_init_verbs }, |
| 2797 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2798 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2799 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2800 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2801 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2802 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2803 | .input_mux = &alc880_capture_source, |
| 2804 | }, |
| 2805 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 2806 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2807 | .init_verbs = { alc880_volume_init_verbs, |
| 2808 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2809 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2810 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2811 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2812 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 2813 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2814 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2815 | .input_mux = &alc880_capture_source, |
| 2816 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2817 | [ALC880_UNIWILL] = { |
| 2818 | .mixers = { alc880_uniwill_mixer }, |
| 2819 | .init_verbs = { alc880_volume_init_verbs, |
| 2820 | alc880_uniwill_init_verbs }, |
| 2821 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2822 | .dac_nids = alc880_asus_dac_nids, |
| 2823 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2824 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2825 | .channel_mode = alc880_threestack_modes, |
| 2826 | .need_dac_fix = 1, |
| 2827 | .input_mux = &alc880_capture_source, |
| 2828 | .unsol_event = alc880_uniwill_unsol_event, |
| 2829 | .init_hook = alc880_uniwill_automute, |
| 2830 | }, |
| 2831 | [ALC880_UNIWILL_P53] = { |
| 2832 | .mixers = { alc880_uniwill_p53_mixer }, |
| 2833 | .init_verbs = { alc880_volume_init_verbs, |
| 2834 | alc880_uniwill_p53_init_verbs }, |
| 2835 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 2836 | .dac_nids = alc880_asus_dac_nids, |
| 2837 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2838 | .channel_mode = alc880_threestack_modes, |
| 2839 | .input_mux = &alc880_capture_source, |
| 2840 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2841 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2842 | }, |
| 2843 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2844 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2845 | alc880_pcbeep_mixer, }, |
| 2846 | .init_verbs = { alc880_volume_init_verbs, |
| 2847 | alc880_uniwill_p53_init_verbs, |
| 2848 | alc880_beep_init_verbs }, |
| 2849 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2850 | .dac_nids = alc880_dac_nids, |
| 2851 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2852 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2853 | .input_mux = &alc880_capture_source, |
| 2854 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 2855 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 2856 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2857 | [ALC880_CLEVO] = { |
| 2858 | .mixers = { alc880_three_stack_mixer }, |
| 2859 | .init_verbs = { alc880_volume_init_verbs, |
| 2860 | alc880_pin_clevo_init_verbs }, |
| 2861 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2862 | .dac_nids = alc880_dac_nids, |
| 2863 | .hp_nid = 0x03, |
| 2864 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2865 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2866 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2867 | .input_mux = &alc880_capture_source, |
| 2868 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2869 | [ALC880_LG] = { |
| 2870 | .mixers = { alc880_lg_mixer }, |
| 2871 | .init_verbs = { alc880_volume_init_verbs, |
| 2872 | alc880_lg_init_verbs }, |
| 2873 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 2874 | .dac_nids = alc880_lg_dac_nids, |
| 2875 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 2876 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 2877 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2878 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2879 | .input_mux = &alc880_lg_capture_source, |
| 2880 | .unsol_event = alc880_lg_unsol_event, |
| 2881 | .init_hook = alc880_lg_automute, |
| 2882 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2883 | [ALC880_LG_LW] = { |
| 2884 | .mixers = { alc880_lg_lw_mixer }, |
| 2885 | .init_verbs = { alc880_volume_init_verbs, |
| 2886 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame^] | 2887 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2888 | .dac_nids = alc880_dac_nids, |
| 2889 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame^] | 2890 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 2891 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2892 | .input_mux = &alc880_lg_lw_capture_source, |
| 2893 | .unsol_event = alc880_lg_lw_unsol_event, |
| 2894 | .init_hook = alc880_lg_lw_automute, |
| 2895 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2896 | #ifdef CONFIG_SND_DEBUG |
| 2897 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2898 | .mixers = { alc880_test_mixer }, |
| 2899 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2900 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 2901 | .dac_nids = alc880_test_dac_nids, |
| 2902 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2903 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 2904 | .channel_mode = alc880_test_modes, |
| 2905 | .input_mux = &alc880_test_capture_source, |
| 2906 | }, |
| 2907 | #endif |
| 2908 | }; |
| 2909 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2910 | /* |
| 2911 | * Automatic parse of I/O pins from the BIOS configuration |
| 2912 | */ |
| 2913 | |
| 2914 | #define NUM_CONTROL_ALLOC 32 |
| 2915 | #define NUM_VERB_ALLOC 32 |
| 2916 | |
| 2917 | enum { |
| 2918 | ALC_CTL_WIDGET_VOL, |
| 2919 | ALC_CTL_WIDGET_MUTE, |
| 2920 | ALC_CTL_BIND_MUTE, |
| 2921 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2922 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2923 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2924 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2925 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2926 | }; |
| 2927 | |
| 2928 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2929 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 2930 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2931 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2932 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2933 | |
| 2934 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 2935 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 2936 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2937 | /* array + terminator */ |
| 2938 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 2939 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2940 | return -ENOMEM; |
| 2941 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2942 | memcpy(knew, spec->kctl_alloc, |
| 2943 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2944 | kfree(spec->kctl_alloc); |
| 2945 | } |
| 2946 | spec->kctl_alloc = knew; |
| 2947 | spec->num_kctl_alloc = num; |
| 2948 | } |
| 2949 | |
| 2950 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 2951 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 2952 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2953 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2954 | return -ENOMEM; |
| 2955 | knew->private_value = val; |
| 2956 | spec->num_kctl_used++; |
| 2957 | return 0; |
| 2958 | } |
| 2959 | |
| 2960 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 2961 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 2962 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 2963 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 2964 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 2965 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 2966 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 2967 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 2968 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 2969 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 2970 | #define ALC880_PIN_CD_NID 0x1c |
| 2971 | |
| 2972 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2973 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 2974 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2975 | { |
| 2976 | hda_nid_t nid; |
| 2977 | int assigned[4]; |
| 2978 | int i, j; |
| 2979 | |
| 2980 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 2981 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2982 | |
| 2983 | /* check the pins hardwired to audio widget */ |
| 2984 | for (i = 0; i < cfg->line_outs; i++) { |
| 2985 | nid = cfg->line_out_pins[i]; |
| 2986 | if (alc880_is_fixed_pin(nid)) { |
| 2987 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 2988 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2989 | assigned[idx] = 1; |
| 2990 | } |
| 2991 | } |
| 2992 | /* left pins can be connect to any audio widget */ |
| 2993 | for (i = 0; i < cfg->line_outs; i++) { |
| 2994 | nid = cfg->line_out_pins[i]; |
| 2995 | if (alc880_is_fixed_pin(nid)) |
| 2996 | continue; |
| 2997 | /* search for an empty channel */ |
| 2998 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2999 | if (!assigned[j]) { |
| 3000 | spec->multiout.dac_nids[i] = |
| 3001 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3002 | assigned[j] = 1; |
| 3003 | break; |
| 3004 | } |
| 3005 | } |
| 3006 | } |
| 3007 | spec->multiout.num_dacs = cfg->line_outs; |
| 3008 | return 0; |
| 3009 | } |
| 3010 | |
| 3011 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3012 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3013 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3014 | { |
| 3015 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3016 | static const char *chname[4] = { |
| 3017 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3018 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3019 | hda_nid_t nid; |
| 3020 | int i, err; |
| 3021 | |
| 3022 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3023 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3024 | continue; |
| 3025 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3026 | if (i == 2) { |
| 3027 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3028 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3029 | "Center Playback Volume", |
| 3030 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3031 | HDA_OUTPUT)); |
| 3032 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3033 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3034 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3035 | "LFE Playback Volume", |
| 3036 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3037 | HDA_OUTPUT)); |
| 3038 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3039 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3040 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3041 | "Center Playback Switch", |
| 3042 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3043 | HDA_INPUT)); |
| 3044 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3045 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3046 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3047 | "LFE Playback Switch", |
| 3048 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3049 | HDA_INPUT)); |
| 3050 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3051 | return err; |
| 3052 | } else { |
| 3053 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3054 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3055 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3056 | HDA_OUTPUT)); |
| 3057 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3058 | return err; |
| 3059 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3060 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3061 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3062 | HDA_INPUT)); |
| 3063 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3064 | return err; |
| 3065 | } |
| 3066 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3067 | return 0; |
| 3068 | } |
| 3069 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3070 | /* add playback controls for speaker and HP outputs */ |
| 3071 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3072 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3073 | { |
| 3074 | hda_nid_t nid; |
| 3075 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3076 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3077 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3078 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3079 | return 0; |
| 3080 | |
| 3081 | if (alc880_is_fixed_pin(pin)) { |
| 3082 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3083 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3084 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3085 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3086 | else |
| 3087 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3088 | /* control HP volume/switch on the output mixer amp */ |
| 3089 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3090 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3091 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3092 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3093 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3094 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3095 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3096 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3097 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3098 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3099 | return err; |
| 3100 | } else if (alc880_is_multi_pin(pin)) { |
| 3101 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3102 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3103 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3104 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3105 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3106 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3107 | return err; |
| 3108 | } |
| 3109 | return 0; |
| 3110 | } |
| 3111 | |
| 3112 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3113 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3114 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3115 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3116 | { |
| 3117 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3118 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3119 | |
| 3120 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3121 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3122 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3123 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3124 | return err; |
| 3125 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3126 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3127 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3128 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3129 | return err; |
| 3130 | return 0; |
| 3131 | } |
| 3132 | |
| 3133 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3134 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3135 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3136 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3137 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3138 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3139 | |
| 3140 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3141 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3142 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3143 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3144 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3145 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3146 | if (err < 0) |
| 3147 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3148 | imux->items[imux->num_items].label = |
| 3149 | auto_pin_cfg_labels[i]; |
| 3150 | imux->items[imux->num_items].index = |
| 3151 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3152 | imux->num_items++; |
| 3153 | } |
| 3154 | } |
| 3155 | return 0; |
| 3156 | } |
| 3157 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3158 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3159 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3160 | int dac_idx) |
| 3161 | { |
| 3162 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3163 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3164 | pin_type); |
| 3165 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3166 | AMP_OUT_UNMUTE); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3167 | /* need the manual connection? */ |
| 3168 | if (alc880_is_multi_pin(nid)) { |
| 3169 | struct alc_spec *spec = codec->spec; |
| 3170 | int idx = alc880_multi_pin_idx(nid); |
| 3171 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3172 | AC_VERB_SET_CONNECT_SEL, |
| 3173 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3174 | } |
| 3175 | } |
| 3176 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3177 | static int get_pin_type(int line_out_type) |
| 3178 | { |
| 3179 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3180 | return PIN_HP; |
| 3181 | else |
| 3182 | return PIN_OUT; |
| 3183 | } |
| 3184 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3185 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3186 | { |
| 3187 | struct alc_spec *spec = codec->spec; |
| 3188 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3189 | |
| 3190 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3191 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3192 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3193 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3194 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3195 | } |
| 3196 | } |
| 3197 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3198 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3199 | { |
| 3200 | struct alc_spec *spec = codec->spec; |
| 3201 | hda_nid_t pin; |
| 3202 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3203 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3204 | if (pin) /* connect to front */ |
| 3205 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3206 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3207 | if (pin) /* connect to front */ |
| 3208 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3209 | } |
| 3210 | |
| 3211 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3212 | { |
| 3213 | struct alc_spec *spec = codec->spec; |
| 3214 | int i; |
| 3215 | |
| 3216 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3217 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3218 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3219 | snd_hda_codec_write(codec, nid, 0, |
| 3220 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3221 | i <= AUTO_PIN_FRONT_MIC ? |
| 3222 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3223 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3224 | snd_hda_codec_write(codec, nid, 0, |
| 3225 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3226 | AMP_OUT_MUTE); |
| 3227 | } |
| 3228 | } |
| 3229 | } |
| 3230 | |
| 3231 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3232 | /* return 1 if successful, 0 if the proper config is not found, |
| 3233 | * or a negative error code |
| 3234 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3235 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3236 | { |
| 3237 | struct alc_spec *spec = codec->spec; |
| 3238 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3239 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3240 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3241 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3242 | alc880_ignore); |
| 3243 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3244 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3245 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3246 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3247 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3248 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3249 | if (err < 0) |
| 3250 | return err; |
| 3251 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3252 | if (err < 0) |
| 3253 | return err; |
| 3254 | err = alc880_auto_create_extra_out(spec, |
| 3255 | spec->autocfg.speaker_pins[0], |
| 3256 | "Speaker"); |
| 3257 | if (err < 0) |
| 3258 | return err; |
| 3259 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3260 | "Headphone"); |
| 3261 | if (err < 0) |
| 3262 | return err; |
| 3263 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3264 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3265 | return err; |
| 3266 | |
| 3267 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3268 | |
| 3269 | if (spec->autocfg.dig_out_pin) |
| 3270 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3271 | if (spec->autocfg.dig_in_pin) |
| 3272 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3273 | |
| 3274 | if (spec->kctl_alloc) |
| 3275 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3276 | |
| 3277 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3278 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3279 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3280 | spec->input_mux = &spec->private_imux; |
| 3281 | |
| 3282 | return 1; |
| 3283 | } |
| 3284 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3285 | /* additional initialization for auto-configuration model */ |
| 3286 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3287 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3288 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3289 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3290 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3291 | } |
| 3292 | |
| 3293 | /* |
| 3294 | * OK, here we have finally the patch for ALC880 |
| 3295 | */ |
| 3296 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3297 | static int patch_alc880(struct hda_codec *codec) |
| 3298 | { |
| 3299 | struct alc_spec *spec; |
| 3300 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3301 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3302 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3303 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3304 | if (spec == NULL) |
| 3305 | return -ENOMEM; |
| 3306 | |
| 3307 | codec->spec = spec; |
| 3308 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3309 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3310 | alc880_models, |
| 3311 | alc880_cfg_tbl); |
| 3312 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3313 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3314 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3315 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3316 | } |
| 3317 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3318 | if (board_config == ALC880_AUTO) { |
| 3319 | /* automatic parse from the BIOS config */ |
| 3320 | err = alc880_parse_auto_config(codec); |
| 3321 | if (err < 0) { |
| 3322 | alc_free(codec); |
| 3323 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3324 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3325 | printk(KERN_INFO |
| 3326 | "hda_codec: Cannot set up configuration " |
| 3327 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3328 | board_config = ALC880_3ST; |
| 3329 | } |
| 3330 | } |
| 3331 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3332 | if (board_config != ALC880_AUTO) |
| 3333 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3334 | |
| 3335 | spec->stream_name_analog = "ALC880 Analog"; |
| 3336 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3337 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
| 3338 | |
| 3339 | spec->stream_name_digital = "ALC880 Digital"; |
| 3340 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3341 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3342 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3343 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3344 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3345 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3346 | /* get type */ |
| 3347 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3348 | if (wcap != AC_WID_AUD_IN) { |
| 3349 | spec->adc_nids = alc880_adc_nids_alt; |
| 3350 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3351 | spec->mixers[spec->num_mixers] = |
| 3352 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3353 | spec->num_mixers++; |
| 3354 | } else { |
| 3355 | spec->adc_nids = alc880_adc_nids; |
| 3356 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3357 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3358 | spec->num_mixers++; |
| 3359 | } |
| 3360 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3361 | |
| 3362 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3363 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3364 | spec->init_hook = alc880_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3365 | |
| 3366 | return 0; |
| 3367 | } |
| 3368 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3369 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3370 | /* |
| 3371 | * ALC260 support |
| 3372 | */ |
| 3373 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3374 | static hda_nid_t alc260_dac_nids[1] = { |
| 3375 | /* front */ |
| 3376 | 0x02, |
| 3377 | }; |
| 3378 | |
| 3379 | static hda_nid_t alc260_adc_nids[1] = { |
| 3380 | /* ADC0 */ |
| 3381 | 0x04, |
| 3382 | }; |
| 3383 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3384 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3385 | /* ADC1 */ |
| 3386 | 0x05, |
| 3387 | }; |
| 3388 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3389 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3390 | /* ADC1, 0 */ |
| 3391 | 0x05, 0x04 |
| 3392 | }; |
| 3393 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3394 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3395 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3396 | */ |
| 3397 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3398 | /* ADC0, ADC1 */ |
| 3399 | 0x04, 0x05 |
| 3400 | }; |
| 3401 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3402 | #define ALC260_DIGOUT_NID 0x03 |
| 3403 | #define ALC260_DIGIN_NID 0x06 |
| 3404 | |
| 3405 | static struct hda_input_mux alc260_capture_source = { |
| 3406 | .num_items = 4, |
| 3407 | .items = { |
| 3408 | { "Mic", 0x0 }, |
| 3409 | { "Front Mic", 0x1 }, |
| 3410 | { "Line", 0x2 }, |
| 3411 | { "CD", 0x4 }, |
| 3412 | }, |
| 3413 | }; |
| 3414 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3415 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3416 | * headphone jack and the internal CD lines since these are the only pins at |
| 3417 | * which audio can appear. For flexibility, also allow the option of |
| 3418 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3419 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3420 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3421 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3422 | { |
| 3423 | .num_items = 3, |
| 3424 | .items = { |
| 3425 | { "Mic/Line", 0x0 }, |
| 3426 | { "CD", 0x4 }, |
| 3427 | { "Headphone", 0x2 }, |
| 3428 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3429 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3430 | { |
| 3431 | .num_items = 4, |
| 3432 | .items = { |
| 3433 | { "Mic/Line", 0x0 }, |
| 3434 | { "CD", 0x4 }, |
| 3435 | { "Headphone", 0x2 }, |
| 3436 | { "Mixer", 0x5 }, |
| 3437 | }, |
| 3438 | }, |
| 3439 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3440 | }; |
| 3441 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3442 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3443 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3444 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3445 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3446 | { |
| 3447 | .num_items = 4, |
| 3448 | .items = { |
| 3449 | { "Mic", 0x0 }, |
| 3450 | { "Line", 0x2 }, |
| 3451 | { "CD", 0x4 }, |
| 3452 | { "Headphone", 0x5 }, |
| 3453 | }, |
| 3454 | }, |
| 3455 | { |
| 3456 | .num_items = 5, |
| 3457 | .items = { |
| 3458 | { "Mic", 0x0 }, |
| 3459 | { "Line", 0x2 }, |
| 3460 | { "CD", 0x4 }, |
| 3461 | { "Headphone", 0x6 }, |
| 3462 | { "Mixer", 0x5 }, |
| 3463 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3464 | }, |
| 3465 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3466 | /* |
| 3467 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3468 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3469 | * element which allows changing the channel mode, so the verb list is |
| 3470 | * never used. |
| 3471 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3472 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3473 | { 2, NULL }, |
| 3474 | }; |
| 3475 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3476 | |
| 3477 | /* Mixer combinations |
| 3478 | * |
| 3479 | * basic: base_output + input + pc_beep + capture |
| 3480 | * HP: base_output + input + capture_alt |
| 3481 | * HP_3013: hp_3013 + input + capture |
| 3482 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3483 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3484 | */ |
| 3485 | |
| 3486 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3487 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3488 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3489 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3490 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3491 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3492 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3493 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3494 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3495 | |
| 3496 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3497 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3498 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3499 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3500 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3503 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3504 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3505 | { } /* end */ |
| 3506 | }; |
| 3507 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3508 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3509 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3510 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3511 | { } /* end */ |
| 3512 | }; |
| 3513 | |
| 3514 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
| 3515 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3516 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3517 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3518 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3519 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3520 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 3521 | HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3522 | HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3523 | { } /* end */ |
| 3524 | }; |
| 3525 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3526 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3527 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3528 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3529 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3530 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3531 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3532 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3533 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3534 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3535 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3536 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3537 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3538 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3539 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3540 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3541 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3542 | { } /* end */ |
| 3543 | }; |
| 3544 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3545 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3546 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3547 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3548 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3549 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3550 | * revisions available in early 2006. Therefore for now allow the |
| 3551 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3552 | * that the lack of mic bias for this NID is intentional we could change the |
| 3553 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3554 | * |
| 3555 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3556 | * don't appear to make the mic bias available from the "line" jack, even |
| 3557 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3558 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3559 | * and the output jack. If this turns out to be the case for all such |
| 3560 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3561 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3562 | * |
| 3563 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 3564 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 3565 | * controls for such models. On models without a "mono speaker" the control |
| 3566 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3567 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3568 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 3569 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3570 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3571 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3572 | HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3573 | HDA_OUTPUT), |
| 3574 | HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, |
| 3575 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3576 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3577 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3580 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3581 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3582 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3583 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3584 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3585 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3586 | { } /* end */ |
| 3587 | }; |
| 3588 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3589 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 3590 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 3591 | */ |
| 3592 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 3593 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3594 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3595 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3596 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3597 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3598 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3599 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3600 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3601 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3602 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3603 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3604 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3605 | { } /* end */ |
| 3606 | }; |
| 3607 | |
| 3608 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 3609 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 3610 | */ |
| 3611 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 3612 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3613 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3614 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3615 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3616 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3617 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 3618 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 3619 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3620 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3621 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3622 | { } /* end */ |
| 3623 | }; |
| 3624 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3625 | /* capture mixer elements */ |
| 3626 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3627 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 3628 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3629 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 3630 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3631 | { |
| 3632 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3633 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3634 | * So call somewhat different.. |
| 3635 | * FIXME: the controls appear in the "playback" view! |
| 3636 | */ |
| 3637 | /* .name = "Capture Source", */ |
| 3638 | .name = "Input Source", |
| 3639 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3640 | .info = alc_mux_enum_info, |
| 3641 | .get = alc_mux_enum_get, |
| 3642 | .put = alc_mux_enum_put, |
| 3643 | }, |
| 3644 | { } /* end */ |
| 3645 | }; |
| 3646 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3647 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 3648 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 3649 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 3650 | { |
| 3651 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3652 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3653 | * So call somewhat different.. |
| 3654 | * FIXME: the controls appear in the "playback" view! |
| 3655 | */ |
| 3656 | /* .name = "Capture Source", */ |
| 3657 | .name = "Input Source", |
| 3658 | .count = 1, |
| 3659 | .info = alc_mux_enum_info, |
| 3660 | .get = alc_mux_enum_get, |
| 3661 | .put = alc_mux_enum_put, |
| 3662 | }, |
| 3663 | { } /* end */ |
| 3664 | }; |
| 3665 | |
| 3666 | /* |
| 3667 | * initialization verbs |
| 3668 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3669 | static struct hda_verb alc260_init_verbs[] = { |
| 3670 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3671 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3672 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3673 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3674 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3675 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3676 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3677 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3678 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3679 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3680 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 3681 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3682 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3683 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3684 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3685 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3686 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3687 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3688 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3689 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3690 | /* set connection select to line in (default select for this ADC) */ |
| 3691 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3692 | /* mute capture amp left and right */ |
| 3693 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3694 | /* set connection select to line in (default select for this ADC) */ |
| 3695 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3696 | /* set vol=0 Line-Out mixer amp left and right */ |
| 3697 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3698 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3699 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3700 | /* set vol=0 HP mixer amp left and right */ |
| 3701 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3702 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3703 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3704 | /* set vol=0 Mono mixer amp left and right */ |
| 3705 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3706 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 3707 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3708 | /* unmute LINE-2 out pin */ |
| 3709 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3710 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3711 | * Line In 2 = 0x03 |
| 3712 | */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3713 | /* mute CD */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3714 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3715 | /* mute Line In */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3716 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3717 | /* mute Mic */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3718 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3719 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3720 | /* mute Front out path */ |
| 3721 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3722 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3723 | /* mute Headphone out path */ |
| 3724 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3725 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3726 | /* mute Mono out path */ |
| 3727 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3728 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3729 | { } |
| 3730 | }; |
| 3731 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3732 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3733 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 3734 | /* Headphone and output */ |
| 3735 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3736 | /* mono output */ |
| 3737 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3738 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3739 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3740 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3741 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3742 | /* Line In pin widget for input */ |
| 3743 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3744 | /* Line-2 pin widget for output */ |
| 3745 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3746 | /* CD pin widget for input */ |
| 3747 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3748 | /* unmute amp left and right */ |
| 3749 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3750 | /* set connection select to line in (default select for this ADC) */ |
| 3751 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3752 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3753 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3754 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3755 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3756 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3757 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3758 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3759 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3760 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3761 | * Line In 2 = 0x03 |
| 3762 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3763 | /* unmute CD */ |
| 3764 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3765 | /* unmute Line In */ |
| 3766 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3767 | /* unmute Mic */ |
| 3768 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3769 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3770 | /* Unmute Front out path */ |
| 3771 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3772 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3773 | /* Unmute Headphone out path */ |
| 3774 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3775 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3776 | /* Unmute Mono out path */ |
| 3777 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3778 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3779 | { } |
| 3780 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 3781 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3782 | |
| 3783 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 3784 | /* Line out and output */ |
| 3785 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3786 | /* mono output */ |
| 3787 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 3788 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3789 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3790 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 3791 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 3792 | /* Line In pin widget for input */ |
| 3793 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3794 | /* Headphone pin widget for output */ |
| 3795 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 3796 | /* CD pin widget for input */ |
| 3797 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 3798 | /* unmute amp left and right */ |
| 3799 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 3800 | /* set connection select to line in (default select for this ADC) */ |
| 3801 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3802 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 3803 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3804 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3805 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 3806 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 3807 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 3808 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 3809 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3810 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 3811 | * Line In 2 = 0x03 |
| 3812 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3813 | /* unmute CD */ |
| 3814 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 3815 | /* unmute Line In */ |
| 3816 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 3817 | /* unmute Mic */ |
| 3818 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3819 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 3820 | /* Unmute Front out path */ |
| 3821 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3822 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3823 | /* Unmute Headphone out path */ |
| 3824 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3825 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3826 | /* Unmute Mono out path */ |
| 3827 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3828 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3829 | { } |
| 3830 | }; |
| 3831 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3832 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3833 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 3834 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3835 | */ |
| 3836 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 3837 | /* Disable all GPIOs */ |
| 3838 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 3839 | /* Internal speaker is connected to headphone pin */ |
| 3840 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3841 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 3842 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3843 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 3844 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3845 | /* Ensure all other unused pins are disabled and muted. */ |
| 3846 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3847 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3848 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3849 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3850 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3851 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3852 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3853 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3854 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3855 | /* Disable digital (SPDIF) pins */ |
| 3856 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3857 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3858 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3859 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 3860 | * when acting as an output. |
| 3861 | */ |
| 3862 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3863 | |
| 3864 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 3865 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3866 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3867 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3868 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3869 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3870 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3871 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3872 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3873 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3874 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3875 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 3876 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3877 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 3878 | * If the pin mode is changed by the user the pin mode control will |
| 3879 | * take care of enabling the pin's input/output buffers as needed. |
| 3880 | * Therefore there's no need to enable the input buffer at this |
| 3881 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3882 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3883 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 3884 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 3885 | * mixer ctrl) |
| 3886 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3887 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3888 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3889 | /* Mute capture amp left and right */ |
| 3890 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3891 | /* Set ADC connection select to match default mixer setting - line |
| 3892 | * in (on mic1 pin) |
| 3893 | */ |
| 3894 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3895 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3896 | /* Do the same for the second ADC: mute capture input amp and |
| 3897 | * set ADC connection to line in (on mic1 pin) |
| 3898 | */ |
| 3899 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3900 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3901 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 3902 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3903 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3904 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3905 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3906 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3907 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3908 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3909 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3910 | {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] | 3911 | |
| 3912 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3913 | }; |
| 3914 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3915 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 3916 | * similar laptops (adapted from Fujitsu init verbs). |
| 3917 | */ |
| 3918 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 3919 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 3920 | * the headphone jack. Turn this on and rely on the standard mute |
| 3921 | * methods whenever the user wants to turn these outputs off. |
| 3922 | */ |
| 3923 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 3924 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 3925 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 3926 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 3927 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3928 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 3929 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 3930 | /* Line In jack is connected to Line1 pin */ |
| 3931 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3932 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 3933 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3934 | /* Ensure all other unused pins are disabled and muted. */ |
| 3935 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3936 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3937 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3938 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3939 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 3940 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3941 | /* Disable digital (SPDIF) pins */ |
| 3942 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3943 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 3944 | |
| 3945 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 3946 | * bus when acting as outputs. |
| 3947 | */ |
| 3948 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3949 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 3950 | |
| 3951 | /* Start with output sum widgets muted and their output gains at min */ |
| 3952 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3953 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3954 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3955 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3956 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3957 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3958 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3959 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3960 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3961 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3962 | /* Unmute Line-out pin widget amp left and right |
| 3963 | * (no equiv mixer ctrl) |
| 3964 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3965 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3966 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 3967 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3968 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 3969 | * inputs. If the pin mode is changed by the user the pin mode control |
| 3970 | * will take care of enabling the pin's input/output buffers as needed. |
| 3971 | * Therefore there's no need to enable the input buffer at this |
| 3972 | * stage. |
| 3973 | */ |
| 3974 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3975 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3976 | |
| 3977 | /* Mute capture amp left and right */ |
| 3978 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3979 | /* Set ADC connection select to match default mixer setting - mic |
| 3980 | * (on mic1 pin) |
| 3981 | */ |
| 3982 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3983 | |
| 3984 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3985 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3986 | */ |
| 3987 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3988 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3989 | |
| 3990 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 3991 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 3992 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 3993 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 3994 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 3995 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 3996 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 3997 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 3998 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 3999 | |
| 4000 | { } |
| 4001 | }; |
| 4002 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4003 | static struct hda_verb alc260_will_verbs[] = { |
| 4004 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4005 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4006 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4007 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4008 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4009 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4010 | {} |
| 4011 | }; |
| 4012 | |
| 4013 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4014 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4015 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4016 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4017 | |
| 4018 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4019 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4020 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4021 | |
| 4022 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4023 | {} |
| 4024 | }; |
| 4025 | |
| 4026 | /* toggle speaker-output according to the hp-jack state */ |
| 4027 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4028 | { |
| 4029 | unsigned int present; |
| 4030 | |
| 4031 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4032 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4033 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4034 | if (present) { |
| 4035 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 1); |
| 4036 | snd_hda_codec_write(codec, 0x0f, 0, |
| 4037 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); |
| 4038 | } else { |
| 4039 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 4040 | snd_hda_codec_write(codec, 0x0f, 0, |
| 4041 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 4042 | } |
| 4043 | } |
| 4044 | |
| 4045 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4046 | unsigned int res) |
| 4047 | { |
| 4048 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4049 | alc260_replacer_672v_automute(codec); |
| 4050 | } |
| 4051 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4052 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4053 | * configuration. |
| 4054 | */ |
| 4055 | #ifdef CONFIG_SND_DEBUG |
| 4056 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4057 | 0x02, |
| 4058 | }; |
| 4059 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4060 | 0x04, 0x05, |
| 4061 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4062 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4063 | * the signal assignments are different. This assumes that the first ADC |
| 4064 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4065 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4066 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4067 | { |
| 4068 | .num_items = 7, |
| 4069 | .items = { |
| 4070 | { "MIC1 pin", 0x0 }, |
| 4071 | { "MIC2 pin", 0x1 }, |
| 4072 | { "LINE1 pin", 0x2 }, |
| 4073 | { "LINE2 pin", 0x3 }, |
| 4074 | { "CD pin", 0x4 }, |
| 4075 | { "LINE-OUT pin", 0x5 }, |
| 4076 | { "HP-OUT pin", 0x6 }, |
| 4077 | }, |
| 4078 | }, |
| 4079 | { |
| 4080 | .num_items = 8, |
| 4081 | .items = { |
| 4082 | { "MIC1 pin", 0x0 }, |
| 4083 | { "MIC2 pin", 0x1 }, |
| 4084 | { "LINE1 pin", 0x2 }, |
| 4085 | { "LINE2 pin", 0x3 }, |
| 4086 | { "CD pin", 0x4 }, |
| 4087 | { "Mixer", 0x5 }, |
| 4088 | { "LINE-OUT pin", 0x6 }, |
| 4089 | { "HP-OUT pin", 0x7 }, |
| 4090 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4091 | }, |
| 4092 | }; |
| 4093 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4094 | /* Output driver widgets */ |
| 4095 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4096 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4097 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4098 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4099 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4100 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4101 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4102 | /* Modes for retasking pin widgets |
| 4103 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4104 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4105 | * mention this restriction. At this stage it's not clear whether |
| 4106 | * this behaviour is intentional or is a hardware bug in chip |
| 4107 | * revisions available at least up until early 2006. Therefore for |
| 4108 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4109 | * choices, but if it turns out that the lack of mic bias for these |
| 4110 | * NIDs is intentional we could change their modes from |
| 4111 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4112 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4113 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4114 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4115 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4116 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4117 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4118 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4119 | |
| 4120 | /* Loopback mixer controls */ |
| 4121 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4122 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4123 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4124 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4125 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4126 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4127 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4128 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4129 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4130 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4131 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4132 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4133 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4134 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4135 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4136 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4137 | |
| 4138 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4139 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4140 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4141 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4142 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4143 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4144 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4145 | * is ambigious as to which NID is which; testing on laptops which |
| 4146 | * make this output available should provide clarification. |
| 4147 | */ |
| 4148 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4149 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4150 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4151 | { } /* end */ |
| 4152 | }; |
| 4153 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4154 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4155 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4156 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4157 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4158 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4159 | /* Enable retasking pins as output, initially without power amp */ |
| 4160 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4161 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4162 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4163 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4164 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4165 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4166 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4167 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4168 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4169 | * payload also sets the generation to 0, output to be in "consumer" |
| 4170 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4171 | * control. |
| 4172 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4173 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4174 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4175 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4176 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4177 | * OUT1 sum bus when acting as an output. |
| 4178 | */ |
| 4179 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4180 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4181 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4182 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4183 | |
| 4184 | /* Start with output sum widgets muted and their output gains at min */ |
| 4185 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4186 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4187 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4188 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4189 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4190 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4191 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4192 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4193 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4194 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4195 | /* Unmute retasking pin widget output buffers since the default |
| 4196 | * state appears to be output. As the pin mode is changed by the |
| 4197 | * user the pin mode control will take care of enabling the pin's |
| 4198 | * input/output buffers as needed. |
| 4199 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4200 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4201 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4202 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4203 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4204 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4205 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4206 | /* Also unmute the mono-out pin widget */ |
| 4207 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4208 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4209 | /* Mute capture amp left and right */ |
| 4210 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4211 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4212 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4213 | */ |
| 4214 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4215 | |
| 4216 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4217 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4218 | */ |
| 4219 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4220 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4221 | |
| 4222 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4223 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4224 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4225 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4226 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4227 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4228 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4231 | |
| 4232 | { } |
| 4233 | }; |
| 4234 | #endif |
| 4235 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4236 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
| 4237 | .substreams = 1, |
| 4238 | .channels_min = 2, |
| 4239 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4240 | }; |
| 4241 | |
| 4242 | static struct hda_pcm_stream alc260_pcm_analog_capture = { |
| 4243 | .substreams = 1, |
| 4244 | .channels_min = 2, |
| 4245 | .channels_max = 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4246 | }; |
| 4247 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4248 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4249 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4250 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4251 | /* |
| 4252 | * for BIOS auto-configuration |
| 4253 | */ |
| 4254 | |
| 4255 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4256 | const char *pfx) |
| 4257 | { |
| 4258 | hda_nid_t nid_vol; |
| 4259 | unsigned long vol_val, sw_val; |
| 4260 | char name[32]; |
| 4261 | int err; |
| 4262 | |
| 4263 | if (nid >= 0x0f && nid < 0x11) { |
| 4264 | nid_vol = nid - 0x7; |
| 4265 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4266 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4267 | } else if (nid == 0x11) { |
| 4268 | nid_vol = nid - 0x7; |
| 4269 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4270 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4271 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4272 | nid_vol = 0x08; |
| 4273 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4274 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4275 | } else |
| 4276 | return 0; /* N/A */ |
| 4277 | |
| 4278 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4279 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4280 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4281 | return err; |
| 4282 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4283 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4284 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4285 | return err; |
| 4286 | return 1; |
| 4287 | } |
| 4288 | |
| 4289 | /* add playback controls from the parsed DAC table */ |
| 4290 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4291 | const struct auto_pin_cfg *cfg) |
| 4292 | { |
| 4293 | hda_nid_t nid; |
| 4294 | int err; |
| 4295 | |
| 4296 | spec->multiout.num_dacs = 1; |
| 4297 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4298 | spec->multiout.dac_nids[0] = 0x02; |
| 4299 | |
| 4300 | nid = cfg->line_out_pins[0]; |
| 4301 | if (nid) { |
| 4302 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4303 | if (err < 0) |
| 4304 | return err; |
| 4305 | } |
| 4306 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4307 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4308 | if (nid) { |
| 4309 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4310 | if (err < 0) |
| 4311 | return err; |
| 4312 | } |
| 4313 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4314 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4315 | if (nid) { |
| 4316 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4317 | if (err < 0) |
| 4318 | return err; |
| 4319 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4320 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4321 | } |
| 4322 | |
| 4323 | /* create playback/capture controls for input pins */ |
| 4324 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4325 | const struct auto_pin_cfg *cfg) |
| 4326 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4327 | struct hda_input_mux *imux = &spec->private_imux; |
| 4328 | int i, err, idx; |
| 4329 | |
| 4330 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4331 | if (cfg->input_pins[i] >= 0x12) { |
| 4332 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4333 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4334 | auto_pin_cfg_labels[i], idx, |
| 4335 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4336 | if (err < 0) |
| 4337 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4338 | imux->items[imux->num_items].label = |
| 4339 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4340 | imux->items[imux->num_items].index = idx; |
| 4341 | imux->num_items++; |
| 4342 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4343 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4344 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4345 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4346 | auto_pin_cfg_labels[i], idx, |
| 4347 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4348 | if (err < 0) |
| 4349 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4350 | imux->items[imux->num_items].label = |
| 4351 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4352 | imux->items[imux->num_items].index = idx; |
| 4353 | imux->num_items++; |
| 4354 | } |
| 4355 | } |
| 4356 | return 0; |
| 4357 | } |
| 4358 | |
| 4359 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4360 | hda_nid_t nid, int pin_type, |
| 4361 | int sel_idx) |
| 4362 | { |
| 4363 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4364 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4365 | pin_type); |
| 4366 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4367 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4368 | /* need the manual connection? */ |
| 4369 | if (nid >= 0x12) { |
| 4370 | int idx = nid - 0x12; |
| 4371 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4372 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4373 | } |
| 4374 | } |
| 4375 | |
| 4376 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4377 | { |
| 4378 | struct alc_spec *spec = codec->spec; |
| 4379 | hda_nid_t nid; |
| 4380 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4381 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4382 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4383 | if (nid) { |
| 4384 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4385 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4386 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4387 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4388 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4389 | if (nid) |
| 4390 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4391 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4392 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4393 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4394 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4395 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4396 | |
| 4397 | #define ALC260_PIN_CD_NID 0x16 |
| 4398 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4399 | { |
| 4400 | struct alc_spec *spec = codec->spec; |
| 4401 | int i; |
| 4402 | |
| 4403 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4404 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4405 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4406 | snd_hda_codec_write(codec, nid, 0, |
| 4407 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4408 | i <= AUTO_PIN_FRONT_MIC ? |
| 4409 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4410 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4411 | snd_hda_codec_write(codec, nid, 0, |
| 4412 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4413 | AMP_OUT_MUTE); |
| 4414 | } |
| 4415 | } |
| 4416 | } |
| 4417 | |
| 4418 | /* |
| 4419 | * generic initialization of ADC, input mixers and output mixers |
| 4420 | */ |
| 4421 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4422 | /* |
| 4423 | * Unmute ADC0-1 and set the default input to mic-in |
| 4424 | */ |
| 4425 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4426 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4427 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4428 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4429 | |
| 4430 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4431 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4432 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4433 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4434 | */ |
| 4435 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 4436 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4437 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4438 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 4439 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 4440 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 4441 | |
| 4442 | /* |
| 4443 | * Set up output mixers (0x08 - 0x0a) |
| 4444 | */ |
| 4445 | /* set vol=0 to output mixers */ |
| 4446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4447 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4448 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4449 | /* set up input amps for analog loopback */ |
| 4450 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4451 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4452 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4453 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4454 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4455 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4456 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4457 | |
| 4458 | { } |
| 4459 | }; |
| 4460 | |
| 4461 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4462 | { |
| 4463 | struct alc_spec *spec = codec->spec; |
| 4464 | unsigned int wcap; |
| 4465 | int err; |
| 4466 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4467 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4468 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4469 | alc260_ignore); |
| 4470 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4471 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4472 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4473 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4474 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4475 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4476 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4477 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4478 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4479 | return err; |
| 4480 | |
| 4481 | spec->multiout.max_channels = 2; |
| 4482 | |
| 4483 | if (spec->autocfg.dig_out_pin) |
| 4484 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4485 | if (spec->kctl_alloc) |
| 4486 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4487 | |
| 4488 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4489 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4490 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4491 | spec->input_mux = &spec->private_imux; |
| 4492 | |
| 4493 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4494 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4495 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4496 | if (wcap != AC_WID_AUD_IN) { |
| 4497 | spec->adc_nids = alc260_adc_nids_alt; |
| 4498 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4499 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4500 | } else { |
| 4501 | spec->adc_nids = alc260_adc_nids; |
| 4502 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4503 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4504 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4505 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4506 | |
| 4507 | return 1; |
| 4508 | } |
| 4509 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4510 | /* additional initialization for auto-configuration model */ |
| 4511 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4512 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4513 | alc260_auto_init_multi_out(codec); |
| 4514 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4515 | } |
| 4516 | |
| 4517 | /* |
| 4518 | * ALC260 configurations |
| 4519 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4520 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4521 | [ALC260_BASIC] = "basic", |
| 4522 | [ALC260_HP] = "hp", |
| 4523 | [ALC260_HP_3013] = "hp-3013", |
| 4524 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4525 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4526 | [ALC260_WILL] = "will", |
| 4527 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4528 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4529 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4530 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4531 | [ALC260_AUTO] = "auto", |
| 4532 | }; |
| 4533 | |
| 4534 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4535 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4536 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 4537 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 4538 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4539 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 4540 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 4541 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 4542 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 4543 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 4544 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 4545 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 4546 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 4547 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 4548 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 4549 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 4550 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4551 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
| 4552 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4553 | {} |
| 4554 | }; |
| 4555 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4556 | static struct alc_config_preset alc260_presets[] = { |
| 4557 | [ALC260_BASIC] = { |
| 4558 | .mixers = { alc260_base_output_mixer, |
| 4559 | alc260_input_mixer, |
| 4560 | alc260_pc_beep_mixer, |
| 4561 | alc260_capture_mixer }, |
| 4562 | .init_verbs = { alc260_init_verbs }, |
| 4563 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4564 | .dac_nids = alc260_dac_nids, |
| 4565 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4566 | .adc_nids = alc260_adc_nids, |
| 4567 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4568 | .channel_mode = alc260_modes, |
| 4569 | .input_mux = &alc260_capture_source, |
| 4570 | }, |
| 4571 | [ALC260_HP] = { |
| 4572 | .mixers = { alc260_base_output_mixer, |
| 4573 | alc260_input_mixer, |
| 4574 | alc260_capture_alt_mixer }, |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4575 | .init_verbs = { alc260_init_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4576 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4577 | .dac_nids = alc260_dac_nids, |
| 4578 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4579 | .adc_nids = alc260_hp_adc_nids, |
| 4580 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4581 | .channel_mode = alc260_modes, |
| 4582 | .input_mux = &alc260_capture_source, |
| 4583 | }, |
| 4584 | [ALC260_HP_3013] = { |
| 4585 | .mixers = { alc260_hp_3013_mixer, |
| 4586 | alc260_input_mixer, |
| 4587 | alc260_capture_alt_mixer }, |
| 4588 | .init_verbs = { alc260_hp_3013_init_verbs }, |
| 4589 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4590 | .dac_nids = alc260_dac_nids, |
| 4591 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4592 | .adc_nids = alc260_hp_adc_nids, |
| 4593 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4594 | .channel_mode = alc260_modes, |
| 4595 | .input_mux = &alc260_capture_source, |
| 4596 | }, |
| 4597 | [ALC260_FUJITSU_S702X] = { |
| 4598 | .mixers = { alc260_fujitsu_mixer, |
| 4599 | alc260_capture_mixer }, |
| 4600 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 4601 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4602 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4603 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4604 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4605 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4606 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4607 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 4608 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4609 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4610 | [ALC260_ACER] = { |
| 4611 | .mixers = { alc260_acer_mixer, |
| 4612 | alc260_capture_mixer }, |
| 4613 | .init_verbs = { alc260_acer_init_verbs }, |
| 4614 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4615 | .dac_nids = alc260_dac_nids, |
| 4616 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4617 | .adc_nids = alc260_dual_adc_nids, |
| 4618 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4619 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4620 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 4621 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4622 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4623 | [ALC260_WILL] = { |
| 4624 | .mixers = { alc260_will_mixer, |
| 4625 | alc260_capture_mixer }, |
| 4626 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 4627 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4628 | .dac_nids = alc260_dac_nids, |
| 4629 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4630 | .adc_nids = alc260_adc_nids, |
| 4631 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4632 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4633 | .channel_mode = alc260_modes, |
| 4634 | .input_mux = &alc260_capture_source, |
| 4635 | }, |
| 4636 | [ALC260_REPLACER_672V] = { |
| 4637 | .mixers = { alc260_replacer_672v_mixer, |
| 4638 | alc260_capture_mixer }, |
| 4639 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 4640 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4641 | .dac_nids = alc260_dac_nids, |
| 4642 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4643 | .adc_nids = alc260_adc_nids, |
| 4644 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4645 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4646 | .channel_mode = alc260_modes, |
| 4647 | .input_mux = &alc260_capture_source, |
| 4648 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 4649 | .init_hook = alc260_replacer_672v_automute, |
| 4650 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4651 | #ifdef CONFIG_SND_DEBUG |
| 4652 | [ALC260_TEST] = { |
| 4653 | .mixers = { alc260_test_mixer, |
| 4654 | alc260_capture_mixer }, |
| 4655 | .init_verbs = { alc260_test_init_verbs }, |
| 4656 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 4657 | .dac_nids = alc260_test_dac_nids, |
| 4658 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 4659 | .adc_nids = alc260_test_adc_nids, |
| 4660 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4661 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4662 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 4663 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4664 | }, |
| 4665 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4666 | }; |
| 4667 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4668 | static int patch_alc260(struct hda_codec *codec) |
| 4669 | { |
| 4670 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4671 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4672 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4673 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4674 | if (spec == NULL) |
| 4675 | return -ENOMEM; |
| 4676 | |
| 4677 | codec->spec = spec; |
| 4678 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4679 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 4680 | alc260_models, |
| 4681 | alc260_cfg_tbl); |
| 4682 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4683 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 4684 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4685 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4686 | } |
| 4687 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4688 | if (board_config == ALC260_AUTO) { |
| 4689 | /* automatic parse from the BIOS config */ |
| 4690 | err = alc260_parse_auto_config(codec); |
| 4691 | if (err < 0) { |
| 4692 | alc_free(codec); |
| 4693 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4694 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4695 | printk(KERN_INFO |
| 4696 | "hda_codec: Cannot set up configuration " |
| 4697 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4698 | board_config = ALC260_BASIC; |
| 4699 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4700 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4701 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4702 | if (board_config != ALC260_AUTO) |
| 4703 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4704 | |
| 4705 | spec->stream_name_analog = "ALC260 Analog"; |
| 4706 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 4707 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 4708 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4709 | spec->stream_name_digital = "ALC260 Digital"; |
| 4710 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 4711 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 4712 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4713 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4714 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4715 | spec->init_hook = alc260_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4716 | |
| 4717 | return 0; |
| 4718 | } |
| 4719 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4720 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4721 | /* |
| 4722 | * ALC882 support |
| 4723 | * |
| 4724 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 4725 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 4726 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 4727 | * 6-channel independent captures. |
| 4728 | * |
| 4729 | * In addition, an independent DAC for the multi-playback (not used in this |
| 4730 | * driver yet). |
| 4731 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4732 | #define ALC882_DIGOUT_NID 0x06 |
| 4733 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4734 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4735 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4736 | { 8, NULL } |
| 4737 | }; |
| 4738 | |
| 4739 | static hda_nid_t alc882_dac_nids[4] = { |
| 4740 | /* front, rear, clfe, rear_surr */ |
| 4741 | 0x02, 0x03, 0x04, 0x05 |
| 4742 | }; |
| 4743 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4744 | /* identical with ALC880 */ |
| 4745 | #define alc882_adc_nids alc880_adc_nids |
| 4746 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4747 | |
| 4748 | /* input MUX */ |
| 4749 | /* FIXME: should be a matrix-type input source selection */ |
| 4750 | |
| 4751 | static struct hda_input_mux alc882_capture_source = { |
| 4752 | .num_items = 4, |
| 4753 | .items = { |
| 4754 | { "Mic", 0x0 }, |
| 4755 | { "Front Mic", 0x1 }, |
| 4756 | { "Line", 0x2 }, |
| 4757 | { "CD", 0x4 }, |
| 4758 | }, |
| 4759 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4760 | #define alc882_mux_enum_info alc_mux_enum_info |
| 4761 | #define alc882_mux_enum_get alc_mux_enum_get |
| 4762 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4763 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 4764 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4765 | { |
| 4766 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4767 | struct alc_spec *spec = codec->spec; |
| 4768 | const struct hda_input_mux *imux = spec->input_mux; |
| 4769 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 4770 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 4771 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 4772 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 4773 | unsigned int i, idx; |
| 4774 | |
| 4775 | idx = ucontrol->value.enumerated.item[0]; |
| 4776 | if (idx >= imux->num_items) |
| 4777 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4778 | if (*cur_val == idx && !codec->in_resume) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4779 | return 0; |
| 4780 | for (i = 0; i < imux->num_items; i++) { |
| 4781 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 4782 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4783 | v | (imux->items[i].index << 8)); |
| 4784 | } |
| 4785 | *cur_val = idx; |
| 4786 | return 1; |
| 4787 | } |
| 4788 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4789 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 4790 | * 2ch mode |
| 4791 | */ |
| 4792 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 4793 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 4794 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4795 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 4796 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 4797 | { } /* end */ |
| 4798 | }; |
| 4799 | |
| 4800 | /* |
| 4801 | * 6ch mode |
| 4802 | */ |
| 4803 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 4804 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4805 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4806 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 4807 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4808 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 4809 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 4810 | { } /* end */ |
| 4811 | }; |
| 4812 | |
| 4813 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 4814 | { 2, alc882_3ST_ch2_init }, |
| 4815 | { 6, alc882_3ST_ch6_init }, |
| 4816 | }; |
| 4817 | |
| 4818 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4819 | * 6ch mode |
| 4820 | */ |
| 4821 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 4822 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 4823 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4824 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4825 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4826 | { } /* end */ |
| 4827 | }; |
| 4828 | |
| 4829 | /* |
| 4830 | * 8ch mode |
| 4831 | */ |
| 4832 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 4833 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4834 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4835 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4836 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 4837 | { } /* end */ |
| 4838 | }; |
| 4839 | |
| 4840 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 4841 | { 6, alc882_sixstack_ch6_init }, |
| 4842 | { 8, alc882_sixstack_ch8_init }, |
| 4843 | }; |
| 4844 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4845 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 4846 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 4847 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4848 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4849 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4850 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4851 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4852 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4853 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 4854 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4855 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 4856 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4857 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4858 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4859 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4860 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4861 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4862 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4863 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4864 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4865 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4866 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4867 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 4868 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4869 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4870 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4871 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4872 | { } /* end */ |
| 4873 | }; |
| 4874 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 4875 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 4876 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4877 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4878 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4879 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4880 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4881 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4882 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4883 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 4884 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4885 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 4886 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 4887 | { } /* end */ |
| 4888 | }; |
| 4889 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 4890 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 4891 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4892 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4893 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 4894 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4895 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4896 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4897 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4900 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4901 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4902 | { } /* end */ |
| 4903 | }; |
| 4904 | |
| 4905 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 4906 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 4907 | */ |
| 4908 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 4909 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4910 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 4911 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 4912 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 4913 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 4914 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 4915 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 4916 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 4917 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 4918 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 4919 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4920 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4921 | { } /* end */ |
| 4922 | }; |
| 4923 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4924 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 4925 | { |
| 4926 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4927 | .name = "Channel Mode", |
| 4928 | .info = alc_ch_mode_info, |
| 4929 | .get = alc_ch_mode_get, |
| 4930 | .put = alc_ch_mode_put, |
| 4931 | }, |
| 4932 | { } /* end */ |
| 4933 | }; |
| 4934 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4935 | static struct hda_verb alc882_init_verbs[] = { |
| 4936 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4937 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4938 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4939 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4940 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4941 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4942 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4943 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4944 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4945 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4946 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4947 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4948 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4949 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4950 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4951 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4952 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4953 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4955 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4956 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4957 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4958 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4959 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4960 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4961 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4962 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4963 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4964 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4965 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4966 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4967 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4968 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4969 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4970 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4971 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4972 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4973 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4974 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4975 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4976 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4977 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4978 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 4979 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4980 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4981 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4982 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4983 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4984 | |
| 4985 | /* FIXME: use matrix-type input source selection */ |
| 4986 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 4987 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4988 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4989 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4991 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4992 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4993 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4994 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4996 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4997 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4998 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4999 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5000 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5001 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5002 | /* ADC1: mute amp left and right */ |
| 5003 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5004 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5005 | /* ADC2: mute amp left and right */ |
| 5006 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5007 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5008 | /* ADC3: mute amp left and right */ |
| 5009 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5010 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5011 | |
| 5012 | { } |
| 5013 | }; |
| 5014 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5015 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5016 | /* change to EAPD mode */ |
| 5017 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5018 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5019 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5020 | }; |
| 5021 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5022 | /* Mac Pro test */ |
| 5023 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5024 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5025 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5026 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5027 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5028 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5029 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5030 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5031 | { } /* end */ |
| 5032 | }; |
| 5033 | |
| 5034 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5035 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5036 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5037 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5038 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5039 | /* Front Pin: output 0 (0x0c) */ |
| 5040 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5041 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5042 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5043 | /* Front Mic pin: input vref at 80% */ |
| 5044 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5045 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5046 | /* Speaker: output */ |
| 5047 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5048 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5049 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5050 | /* Headphone output (output 0 - 0x0c) */ |
| 5051 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5052 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5053 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5054 | |
| 5055 | /* FIXME: use matrix-type input source selection */ |
| 5056 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5057 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5058 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5059 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5061 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5062 | /* Input mixer2 */ |
| 5063 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5064 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5065 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5066 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5067 | /* Input mixer3 */ |
| 5068 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5069 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5071 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5072 | /* ADC1: mute amp left and right */ |
| 5073 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5074 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5075 | /* ADC2: mute amp left and right */ |
| 5076 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5077 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5078 | /* ADC3: mute amp left and right */ |
| 5079 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5080 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5081 | |
| 5082 | { } |
| 5083 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5084 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5085 | static struct hda_verb alc882_targa_verbs[] = { |
| 5086 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5087 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5088 | |
| 5089 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5090 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5091 | |
| 5092 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5093 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5094 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5095 | |
| 5096 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5097 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5098 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5099 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5100 | { } /* end */ |
| 5101 | }; |
| 5102 | |
| 5103 | /* toggle speaker-output according to the hp-jack state */ |
| 5104 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5105 | { |
| 5106 | unsigned int present; |
| 5107 | |
| 5108 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5109 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5110 | snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 5111 | 0x80, present ? 0x80 : 0); |
| 5112 | snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 5113 | 0x80, present ? 0x80 : 0); |
| 5114 | snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, present ? 1 : 3); |
| 5115 | } |
| 5116 | |
| 5117 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5118 | { |
| 5119 | /* Looks like the unsol event is incompatible with the standard |
| 5120 | * definition. 4bit tag is placed at 26 bit! |
| 5121 | */ |
| 5122 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5123 | alc882_targa_automute(codec); |
| 5124 | } |
| 5125 | } |
| 5126 | |
| 5127 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5128 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5130 | |
| 5131 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5132 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5133 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5134 | |
| 5135 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5136 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5137 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5138 | |
| 5139 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5140 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5141 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5142 | { } /* end */ |
| 5143 | }; |
| 5144 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5145 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5146 | { |
| 5147 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5148 | |
| 5149 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5150 | AC_VERB_GET_GPIO_DATA, 0); |
| 5151 | |
| 5152 | if (!muted) |
| 5153 | gpiostate |= (1 << pin); |
| 5154 | else |
| 5155 | gpiostate &= ~(1 << pin); |
| 5156 | |
| 5157 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5158 | AC_VERB_GET_GPIO_MASK, 0); |
| 5159 | gpiomask |= (1 << pin); |
| 5160 | |
| 5161 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5162 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5163 | gpiodir |= (1 << pin); |
| 5164 | |
| 5165 | |
| 5166 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5167 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5168 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5169 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5170 | |
| 5171 | msleep(1); |
| 5172 | |
| 5173 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5174 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5175 | } |
| 5176 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5177 | /* |
| 5178 | * generic initialization of ADC, input mixers and output mixers |
| 5179 | */ |
| 5180 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5181 | /* |
| 5182 | * Unmute ADC0-2 and set the default input to mic-in |
| 5183 | */ |
| 5184 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5185 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5186 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5187 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5188 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5189 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5190 | |
| 5191 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5192 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5193 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5194 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5195 | */ |
| 5196 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 5197 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5198 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5199 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 5200 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 5201 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 5202 | |
| 5203 | /* |
| 5204 | * Set up output mixers (0x0c - 0x0f) |
| 5205 | */ |
| 5206 | /* set vol=0 to output mixers */ |
| 5207 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5208 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5209 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5210 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5211 | /* set up input amps for analog loopback */ |
| 5212 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5213 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5214 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5215 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5216 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5217 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5218 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5219 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5220 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5221 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5222 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5223 | |
| 5224 | /* FIXME: use matrix-type input source selection */ |
| 5225 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5226 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5227 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5228 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5229 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5230 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5231 | /* Input mixer2 */ |
| 5232 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5233 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5234 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5235 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5236 | /* Input mixer3 */ |
| 5237 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5238 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5239 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5240 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5241 | |
| 5242 | { } |
| 5243 | }; |
| 5244 | |
| 5245 | /* capture mixer elements */ |
| 5246 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5247 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5248 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5249 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5250 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5251 | { |
| 5252 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5253 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5254 | * So call somewhat different.. |
| 5255 | * FIXME: the controls appear in the "playback" view! |
| 5256 | */ |
| 5257 | /* .name = "Capture Source", */ |
| 5258 | .name = "Input Source", |
| 5259 | .count = 2, |
| 5260 | .info = alc882_mux_enum_info, |
| 5261 | .get = alc882_mux_enum_get, |
| 5262 | .put = alc882_mux_enum_put, |
| 5263 | }, |
| 5264 | { } /* end */ |
| 5265 | }; |
| 5266 | |
| 5267 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5268 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5269 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5270 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5271 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5272 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5273 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5274 | { |
| 5275 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5276 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5277 | * So call somewhat different.. |
| 5278 | * FIXME: the controls appear in the "playback" view! |
| 5279 | */ |
| 5280 | /* .name = "Capture Source", */ |
| 5281 | .name = "Input Source", |
| 5282 | .count = 3, |
| 5283 | .info = alc882_mux_enum_info, |
| 5284 | .get = alc882_mux_enum_get, |
| 5285 | .put = alc882_mux_enum_put, |
| 5286 | }, |
| 5287 | { } /* end */ |
| 5288 | }; |
| 5289 | |
| 5290 | /* pcm configuration: identiacal with ALC880 */ |
| 5291 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 5292 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 5293 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 5294 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 5295 | |
| 5296 | /* |
| 5297 | * configuration and preset |
| 5298 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5299 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 5300 | [ALC882_3ST_DIG] = "3stack-dig", |
| 5301 | [ALC882_6ST_DIG] = "6stack-dig", |
| 5302 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5303 | [ALC882_W2JC] = "w2jc", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5304 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5305 | [ALC882_AUTO] = "auto", |
| 5306 | }; |
| 5307 | |
| 5308 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 5309 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 5310 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
| 5311 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5312 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5313 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5314 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 5315 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5316 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5317 | {} |
| 5318 | }; |
| 5319 | |
| 5320 | static struct alc_config_preset alc882_presets[] = { |
| 5321 | [ALC882_3ST_DIG] = { |
| 5322 | .mixers = { alc882_base_mixer }, |
| 5323 | .init_verbs = { alc882_init_verbs }, |
| 5324 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5325 | .dac_nids = alc882_dac_nids, |
| 5326 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5327 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5328 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5329 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5330 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5331 | .input_mux = &alc882_capture_source, |
| 5332 | }, |
| 5333 | [ALC882_6ST_DIG] = { |
| 5334 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5335 | .init_verbs = { alc882_init_verbs }, |
| 5336 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5337 | .dac_nids = alc882_dac_nids, |
| 5338 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5339 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5340 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5341 | .channel_mode = alc882_sixstack_modes, |
| 5342 | .input_mux = &alc882_capture_source, |
| 5343 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5344 | [ALC882_ARIMA] = { |
| 5345 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5346 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 5347 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5348 | .dac_nids = alc882_dac_nids, |
| 5349 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5350 | .channel_mode = alc882_sixstack_modes, |
| 5351 | .input_mux = &alc882_capture_source, |
| 5352 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5353 | [ALC882_W2JC] = { |
| 5354 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 5355 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5356 | alc880_gpio1_init_verbs }, |
| 5357 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5358 | .dac_nids = alc882_dac_nids, |
| 5359 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5360 | .channel_mode = alc880_threestack_modes, |
| 5361 | .need_dac_fix = 1, |
| 5362 | .input_mux = &alc882_capture_source, |
| 5363 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5364 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5365 | [ALC885_MACPRO] = { |
| 5366 | .mixers = { alc882_macpro_mixer }, |
| 5367 | .init_verbs = { alc882_macpro_init_verbs }, |
| 5368 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5369 | .dac_nids = alc882_dac_nids, |
| 5370 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5371 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5372 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5373 | .channel_mode = alc882_ch_modes, |
| 5374 | .input_mux = &alc882_capture_source, |
| 5375 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5376 | [ALC882_TARGA] = { |
| 5377 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 5378 | alc882_capture_mixer }, |
| 5379 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 5380 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5381 | .dac_nids = alc882_dac_nids, |
| 5382 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5383 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5384 | .adc_nids = alc882_adc_nids, |
| 5385 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5386 | .channel_mode = alc882_3ST_6ch_modes, |
| 5387 | .need_dac_fix = 1, |
| 5388 | .input_mux = &alc882_capture_source, |
| 5389 | .unsol_event = alc882_targa_unsol_event, |
| 5390 | .init_hook = alc882_targa_automute, |
| 5391 | }, |
| 5392 | [ALC882_ASUS_A7J] = { |
| 5393 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 5394 | alc882_capture_mixer }, |
| 5395 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 5396 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5397 | .dac_nids = alc882_dac_nids, |
| 5398 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5399 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5400 | .adc_nids = alc882_adc_nids, |
| 5401 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5402 | .channel_mode = alc882_3ST_6ch_modes, |
| 5403 | .need_dac_fix = 1, |
| 5404 | .input_mux = &alc882_capture_source, |
| 5405 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5406 | }; |
| 5407 | |
| 5408 | |
| 5409 | /* |
| 5410 | * BIOS auto configuration |
| 5411 | */ |
| 5412 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5413 | hda_nid_t nid, int pin_type, |
| 5414 | int dac_idx) |
| 5415 | { |
| 5416 | /* set as output */ |
| 5417 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5418 | int idx; |
| 5419 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5420 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 5421 | idx = 4; |
| 5422 | else |
| 5423 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 5424 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5425 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5426 | pin_type); |
| 5427 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5428 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5429 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 5430 | |
| 5431 | } |
| 5432 | |
| 5433 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 5434 | { |
| 5435 | struct alc_spec *spec = codec->spec; |
| 5436 | int i; |
| 5437 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5438 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5439 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5440 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5441 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5442 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5443 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5444 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5445 | } |
| 5446 | } |
| 5447 | |
| 5448 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 5449 | { |
| 5450 | struct alc_spec *spec = codec->spec; |
| 5451 | hda_nid_t pin; |
| 5452 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5453 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5454 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5455 | /* use dac 0 */ |
| 5456 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5457 | } |
| 5458 | |
| 5459 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 5460 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 5461 | |
| 5462 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 5463 | { |
| 5464 | struct alc_spec *spec = codec->spec; |
| 5465 | int i; |
| 5466 | |
| 5467 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5468 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5469 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5470 | snd_hda_codec_write(codec, nid, 0, |
| 5471 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5472 | i <= AUTO_PIN_FRONT_MIC ? |
| 5473 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5474 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5475 | snd_hda_codec_write(codec, nid, 0, |
| 5476 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5477 | AMP_OUT_MUTE); |
| 5478 | } |
| 5479 | } |
| 5480 | } |
| 5481 | |
| 5482 | /* almost identical with ALC880 parser... */ |
| 5483 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 5484 | { |
| 5485 | struct alc_spec *spec = codec->spec; |
| 5486 | int err = alc880_parse_auto_config(codec); |
| 5487 | |
| 5488 | if (err < 0) |
| 5489 | return err; |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 5490 | else if (err > 0) |
| 5491 | /* hack - override the init verbs */ |
| 5492 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 5493 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5494 | } |
| 5495 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5496 | /* additional initialization for auto-configuration model */ |
| 5497 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5498 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5499 | alc882_auto_init_multi_out(codec); |
| 5500 | alc882_auto_init_hp_out(codec); |
| 5501 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5502 | } |
| 5503 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5504 | static int patch_alc882(struct hda_codec *codec) |
| 5505 | { |
| 5506 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5507 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5508 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5509 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5510 | if (spec == NULL) |
| 5511 | return -ENOMEM; |
| 5512 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5513 | codec->spec = spec; |
| 5514 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5515 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 5516 | alc882_models, |
| 5517 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5518 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5519 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 5520 | /* Pick up systems that don't supply PCI SSID */ |
| 5521 | switch (codec->subsystem_id) { |
| 5522 | case 0x106b0c00: /* Mac Pro */ |
| 5523 | board_config = ALC885_MACPRO; |
| 5524 | break; |
| 5525 | default: |
| 5526 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 5527 | "trying auto-probe from BIOS...\n"); |
| 5528 | board_config = ALC882_AUTO; |
| 5529 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5530 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5531 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5532 | if (board_config == ALC882_AUTO) { |
| 5533 | /* automatic parse from the BIOS config */ |
| 5534 | err = alc882_parse_auto_config(codec); |
| 5535 | if (err < 0) { |
| 5536 | alc_free(codec); |
| 5537 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5538 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5539 | printk(KERN_INFO |
| 5540 | "hda_codec: Cannot set up configuration " |
| 5541 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5542 | board_config = ALC882_3ST_DIG; |
| 5543 | } |
| 5544 | } |
| 5545 | |
| 5546 | if (board_config != ALC882_AUTO) |
| 5547 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5548 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5549 | if (board_config == ALC885_MACPRO) { |
| 5550 | alc882_gpio_mute(codec, 0, 0); |
| 5551 | alc882_gpio_mute(codec, 1, 0); |
| 5552 | } |
| 5553 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5554 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5555 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 5556 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5557 | |
| 5558 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5559 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 5560 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5561 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5562 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5563 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5564 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5565 | /* get type */ |
| 5566 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5567 | if (wcap != AC_WID_AUD_IN) { |
| 5568 | spec->adc_nids = alc882_adc_nids_alt; |
| 5569 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5570 | spec->mixers[spec->num_mixers] = |
| 5571 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5572 | spec->num_mixers++; |
| 5573 | } else { |
| 5574 | spec->adc_nids = alc882_adc_nids; |
| 5575 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 5576 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 5577 | spec->num_mixers++; |
| 5578 | } |
| 5579 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5580 | |
| 5581 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5582 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5583 | spec->init_hook = alc882_auto_init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5584 | |
| 5585 | return 0; |
| 5586 | } |
| 5587 | |
| 5588 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5589 | * ALC883 support |
| 5590 | * |
| 5591 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 5592 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5593 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5594 | * 6-channel independent captures. |
| 5595 | * |
| 5596 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5597 | * driver yet). |
| 5598 | */ |
| 5599 | #define ALC883_DIGOUT_NID 0x06 |
| 5600 | #define ALC883_DIGIN_NID 0x0a |
| 5601 | |
| 5602 | static hda_nid_t alc883_dac_nids[4] = { |
| 5603 | /* front, rear, clfe, rear_surr */ |
| 5604 | 0x02, 0x04, 0x03, 0x05 |
| 5605 | }; |
| 5606 | |
| 5607 | static hda_nid_t alc883_adc_nids[2] = { |
| 5608 | /* ADC1-2 */ |
| 5609 | 0x08, 0x09, |
| 5610 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5611 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5612 | /* input MUX */ |
| 5613 | /* FIXME: should be a matrix-type input source selection */ |
| 5614 | |
| 5615 | static struct hda_input_mux alc883_capture_source = { |
| 5616 | .num_items = 4, |
| 5617 | .items = { |
| 5618 | { "Mic", 0x0 }, |
| 5619 | { "Front Mic", 0x1 }, |
| 5620 | { "Line", 0x2 }, |
| 5621 | { "CD", 0x4 }, |
| 5622 | }, |
| 5623 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5624 | |
| 5625 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 5626 | .num_items = 2, |
| 5627 | .items = { |
| 5628 | { "Mic", 0x1 }, |
| 5629 | { "Line", 0x2 }, |
| 5630 | }, |
| 5631 | }; |
| 5632 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5633 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 5634 | .num_items = 4, |
| 5635 | .items = { |
| 5636 | { "Mic", 0x0 }, |
| 5637 | { "iMic", 0x1 }, |
| 5638 | { "Line", 0x2 }, |
| 5639 | { "CD", 0x4 }, |
| 5640 | }, |
| 5641 | }; |
| 5642 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5643 | #define alc883_mux_enum_info alc_mux_enum_info |
| 5644 | #define alc883_mux_enum_get alc_mux_enum_get |
| 5645 | |
| 5646 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5647 | struct snd_ctl_elem_value *ucontrol) |
| 5648 | { |
| 5649 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5650 | struct alc_spec *spec = codec->spec; |
| 5651 | const struct hda_input_mux *imux = spec->input_mux; |
| 5652 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 5653 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 5654 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 5655 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5656 | unsigned int i, idx; |
| 5657 | |
| 5658 | idx = ucontrol->value.enumerated.item[0]; |
| 5659 | if (idx >= imux->num_items) |
| 5660 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5661 | if (*cur_val == idx && !codec->in_resume) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5662 | return 0; |
| 5663 | for (i = 0; i < imux->num_items; i++) { |
| 5664 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 5665 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5666 | v | (imux->items[i].index << 8)); |
| 5667 | } |
| 5668 | *cur_val = idx; |
| 5669 | return 1; |
| 5670 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5671 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5672 | /* |
| 5673 | * 2ch mode |
| 5674 | */ |
| 5675 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 5676 | { 2, NULL } |
| 5677 | }; |
| 5678 | |
| 5679 | /* |
| 5680 | * 2ch mode |
| 5681 | */ |
| 5682 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 5683 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5684 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5685 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5686 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5687 | { } /* end */ |
| 5688 | }; |
| 5689 | |
| 5690 | /* |
| 5691 | * 6ch mode |
| 5692 | */ |
| 5693 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 5694 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5695 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5696 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5697 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5698 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5699 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5700 | { } /* end */ |
| 5701 | }; |
| 5702 | |
| 5703 | static struct hda_channel_mode alc883_3ST_6ch_modes[2] = { |
| 5704 | { 2, alc883_3ST_ch2_init }, |
| 5705 | { 6, alc883_3ST_ch6_init }, |
| 5706 | }; |
| 5707 | |
| 5708 | /* |
| 5709 | * 6ch mode |
| 5710 | */ |
| 5711 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 5712 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5713 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5714 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5715 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5716 | { } /* end */ |
| 5717 | }; |
| 5718 | |
| 5719 | /* |
| 5720 | * 8ch mode |
| 5721 | */ |
| 5722 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 5723 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5724 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5725 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5726 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5727 | { } /* end */ |
| 5728 | }; |
| 5729 | |
| 5730 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 5731 | { 6, alc883_sixstack_ch6_init }, |
| 5732 | { 8, alc883_sixstack_ch8_init }, |
| 5733 | }; |
| 5734 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5735 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 5736 | /* eanable EAPD on medion laptop */ |
| 5737 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5738 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 5739 | { } |
| 5740 | }; |
| 5741 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5742 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5743 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5744 | */ |
| 5745 | |
| 5746 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 5747 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5748 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5749 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5750 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5751 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5752 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5753 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5754 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5755 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 5756 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 5757 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5758 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5759 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5760 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5761 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5762 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5763 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5764 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5765 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5766 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5767 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5768 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5769 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5770 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5771 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5772 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5773 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5774 | { |
| 5775 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5776 | /* .name = "Capture Source", */ |
| 5777 | .name = "Input Source", |
| 5778 | .count = 2, |
| 5779 | .info = alc883_mux_enum_info, |
| 5780 | .get = alc883_mux_enum_get, |
| 5781 | .put = alc883_mux_enum_put, |
| 5782 | }, |
| 5783 | { } /* end */ |
| 5784 | }; |
| 5785 | |
| 5786 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 5787 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5788 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5789 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5790 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5791 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5792 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5793 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5794 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5795 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5796 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5797 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5798 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5799 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5800 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5801 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5802 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5803 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5804 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5805 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5806 | { |
| 5807 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5808 | /* .name = "Capture Source", */ |
| 5809 | .name = "Input Source", |
| 5810 | .count = 2, |
| 5811 | .info = alc883_mux_enum_info, |
| 5812 | .get = alc883_mux_enum_get, |
| 5813 | .put = alc883_mux_enum_put, |
| 5814 | }, |
| 5815 | { } /* end */ |
| 5816 | }; |
| 5817 | |
| 5818 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 5819 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5820 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5821 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5822 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5823 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5824 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5825 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5826 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5827 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5828 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5829 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5830 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5831 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5832 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5833 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5835 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5836 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5837 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5838 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5839 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5840 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5841 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5842 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5843 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5844 | { |
| 5845 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5846 | /* .name = "Capture Source", */ |
| 5847 | .name = "Input Source", |
| 5848 | .count = 2, |
| 5849 | .info = alc883_mux_enum_info, |
| 5850 | .get = alc883_mux_enum_get, |
| 5851 | .put = alc883_mux_enum_put, |
| 5852 | }, |
| 5853 | { } /* end */ |
| 5854 | }; |
| 5855 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 5856 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5857 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5858 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5859 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5860 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5861 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5862 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5863 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 5864 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 5865 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5866 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5867 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5868 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5869 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5870 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5871 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5872 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5873 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5874 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 5875 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5876 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5877 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5878 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5879 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5880 | |
| 5881 | { |
| 5882 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5883 | /* .name = "Capture Source", */ |
| 5884 | .name = "Input Source", |
| 5885 | .count = 1, |
| 5886 | .info = alc883_mux_enum_info, |
| 5887 | .get = alc883_mux_enum_get, |
| 5888 | .put = alc883_mux_enum_put, |
| 5889 | }, |
| 5890 | { } /* end */ |
| 5891 | }; |
| 5892 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5893 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 5894 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5895 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5896 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5897 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5898 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5899 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5900 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 5901 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5902 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 5903 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5904 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5905 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5906 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5907 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5908 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5909 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5910 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5911 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5912 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5913 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5914 | { |
| 5915 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5916 | /* .name = "Capture Source", */ |
| 5917 | .name = "Input Source", |
| 5918 | .count = 2, |
| 5919 | .info = alc883_mux_enum_info, |
| 5920 | .get = alc883_mux_enum_get, |
| 5921 | .put = alc883_mux_enum_put, |
| 5922 | }, |
| 5923 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5924 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5925 | |
| 5926 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 5927 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5928 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5929 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5930 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5931 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5932 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5933 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5934 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5935 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5936 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5937 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5938 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5939 | { |
| 5940 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5941 | /* .name = "Capture Source", */ |
| 5942 | .name = "Input Source", |
| 5943 | .count = 2, |
| 5944 | .info = alc883_mux_enum_info, |
| 5945 | .get = alc883_mux_enum_get, |
| 5946 | .put = alc883_mux_enum_put, |
| 5947 | }, |
| 5948 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5949 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5950 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5951 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 5952 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5953 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5954 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 5955 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 5956 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5957 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5958 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5959 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5960 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5961 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5962 | { |
| 5963 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5964 | /* .name = "Capture Source", */ |
| 5965 | .name = "Input Source", |
| 5966 | .count = 1, |
| 5967 | .info = alc883_mux_enum_info, |
| 5968 | .get = alc883_mux_enum_get, |
| 5969 | .put = alc883_mux_enum_put, |
| 5970 | }, |
| 5971 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5972 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5973 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5974 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 5975 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5976 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5977 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5978 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5979 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5980 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5981 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5982 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5983 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5984 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5985 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5986 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5987 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5988 | { |
| 5989 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5990 | /* .name = "Capture Source", */ |
| 5991 | .name = "Input Source", |
| 5992 | .count = 2, |
| 5993 | .info = alc883_mux_enum_info, |
| 5994 | .get = alc883_mux_enum_get, |
| 5995 | .put = alc883_mux_enum_put, |
| 5996 | }, |
| 5997 | { } /* end */ |
| 5998 | }; |
| 5999 | |
| 6000 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6001 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6002 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6003 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6004 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6005 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6006 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6007 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6008 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6009 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6010 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6011 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6012 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6013 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6014 | { |
| 6015 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6016 | /* .name = "Capture Source", */ |
| 6017 | .name = "Input Source", |
| 6018 | .count = 2, |
| 6019 | .info = alc883_mux_enum_info, |
| 6020 | .get = alc883_mux_enum_get, |
| 6021 | .put = alc883_mux_enum_put, |
| 6022 | }, |
| 6023 | { } /* end */ |
| 6024 | }; |
| 6025 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6026 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 6027 | { |
| 6028 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6029 | .name = "Channel Mode", |
| 6030 | .info = alc_ch_mode_info, |
| 6031 | .get = alc_ch_mode_get, |
| 6032 | .put = alc_ch_mode_put, |
| 6033 | }, |
| 6034 | { } /* end */ |
| 6035 | }; |
| 6036 | |
| 6037 | static struct hda_verb alc883_init_verbs[] = { |
| 6038 | /* ADC1: mute amp left and right */ |
| 6039 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6040 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6041 | /* ADC2: mute amp left and right */ |
| 6042 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6043 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6044 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6045 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6047 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6048 | /* Rear mixer */ |
| 6049 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6050 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6051 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6052 | /* CLFE mixer */ |
| 6053 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6054 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6055 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6056 | /* Side mixer */ |
| 6057 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6058 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6059 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6060 | |
| 6061 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6062 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6063 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6064 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6065 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6066 | |
| 6067 | /* Front Pin: output 0 (0x0c) */ |
| 6068 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6069 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6070 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6071 | /* Rear Pin: output 1 (0x0d) */ |
| 6072 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6073 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6074 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6075 | /* CLFE Pin: output 2 (0x0e) */ |
| 6076 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6077 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6078 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6079 | /* Side Pin: output 3 (0x0f) */ |
| 6080 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6081 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6082 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 6083 | /* Mic (rear) pin: input vref at 80% */ |
| 6084 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6085 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6086 | /* Front Mic pin: input vref at 80% */ |
| 6087 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6088 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6089 | /* Line In pin: input */ |
| 6090 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6091 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6092 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6093 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6094 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6095 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6096 | /* CD pin widget for input */ |
| 6097 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6098 | |
| 6099 | /* FIXME: use matrix-type input source selection */ |
| 6100 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6101 | /* Input mixer2 */ |
| 6102 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6103 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6104 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6105 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6106 | /* Input mixer3 */ |
| 6107 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6111 | { } |
| 6112 | }; |
| 6113 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6114 | static struct hda_verb alc883_tagra_verbs[] = { |
| 6115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6117 | |
| 6118 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6119 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6120 | |
| 6121 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6122 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6123 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6124 | |
| 6125 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6126 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6127 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6128 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6129 | |
| 6130 | { } /* end */ |
| 6131 | }; |
| 6132 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6133 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 6134 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6135 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 6136 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 6137 | { } /* end */ |
| 6138 | }; |
| 6139 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6140 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 6141 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6142 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6143 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6144 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6145 | { } /* end */ |
| 6146 | }; |
| 6147 | |
| 6148 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 6149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6151 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6152 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 6153 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6154 | { } /* end */ |
| 6155 | }; |
| 6156 | |
| 6157 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 6158 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 6159 | { |
| 6160 | unsigned int present; |
| 6161 | |
| 6162 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6163 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6164 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 6165 | 0x80, present ? 0x80 : 0); |
| 6166 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 6167 | 0x80, present ? 0x80 : 0); |
| 6168 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6169 | 0x80, present ? 0x80 : 0); |
| 6170 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6171 | 0x80, present ? 0x80 : 0); |
| 6172 | |
| 6173 | } |
| 6174 | |
| 6175 | /* toggle RCA according to the front-jack state */ |
| 6176 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 6177 | { |
| 6178 | unsigned int present; |
| 6179 | |
| 6180 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6181 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6182 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6183 | 0x80, present ? 0x80 : 0); |
| 6184 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6185 | 0x80, present ? 0x80 : 0); |
| 6186 | |
| 6187 | } |
| 6188 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 6189 | unsigned int res) |
| 6190 | { |
| 6191 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6192 | alc888_lenovo_ms7195_front_automute(codec); |
| 6193 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6194 | alc888_lenovo_ms7195_rca_automute(codec); |
| 6195 | } |
| 6196 | |
| 6197 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 6198 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6199 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6200 | |
| 6201 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6202 | |
| 6203 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6204 | { } /* end */ |
| 6205 | }; |
| 6206 | |
| 6207 | /* toggle speaker-output according to the hp-jack state */ |
| 6208 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 6209 | { |
| 6210 | unsigned int present; |
| 6211 | |
| 6212 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6213 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6214 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 6215 | 0x80, present ? 0x80 : 0); |
| 6216 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 6217 | 0x80, present ? 0x80 : 0); |
| 6218 | } |
| 6219 | |
| 6220 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 6221 | unsigned int res) |
| 6222 | { |
| 6223 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6224 | alc883_medion_md2_automute(codec); |
| 6225 | } |
| 6226 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6227 | /* toggle speaker-output according to the hp-jack state */ |
| 6228 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 6229 | { |
| 6230 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6231 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6232 | |
| 6233 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6234 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6235 | bits = present ? 0x80 : 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6236 | snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6237 | 0x80, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6238 | snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6239 | 0x80, bits); |
| 6240 | snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6241 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6242 | } |
| 6243 | |
| 6244 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6245 | { |
| 6246 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6247 | alc883_tagra_automute(codec); |
| 6248 | } |
| 6249 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6250 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 6251 | { |
| 6252 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6253 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6254 | |
| 6255 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6256 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6257 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6258 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6259 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6260 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6261 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6262 | } |
| 6263 | |
| 6264 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 6265 | { |
| 6266 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6267 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6268 | |
| 6269 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 6270 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6271 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6272 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6273 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6274 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6275 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6276 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6277 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6278 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6279 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6280 | } |
| 6281 | |
| 6282 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 6283 | unsigned int res) |
| 6284 | { |
| 6285 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6286 | alc883_lenovo_101e_all_automute(codec); |
| 6287 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 6288 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 6289 | } |
| 6290 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6291 | /* |
| 6292 | * generic initialization of ADC, input mixers and output mixers |
| 6293 | */ |
| 6294 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 6295 | /* |
| 6296 | * Unmute ADC0-2 and set the default input to mic-in |
| 6297 | */ |
| 6298 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6299 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6300 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6301 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6302 | |
| 6303 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6304 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6305 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6306 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6307 | */ |
| 6308 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 6309 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6310 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6311 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6312 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6313 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6314 | |
| 6315 | /* |
| 6316 | * Set up output mixers (0x0c - 0x0f) |
| 6317 | */ |
| 6318 | /* set vol=0 to output mixers */ |
| 6319 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6320 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6321 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6322 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6323 | /* set up input amps for analog loopback */ |
| 6324 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6325 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6326 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6327 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6328 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6329 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6330 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6331 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6332 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6333 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6334 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6335 | |
| 6336 | /* FIXME: use matrix-type input source selection */ |
| 6337 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6338 | /* Input mixer1 */ |
| 6339 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6340 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6341 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6342 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6343 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6344 | /* Input mixer2 */ |
| 6345 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6346 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6347 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6348 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6349 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6350 | |
| 6351 | { } |
| 6352 | }; |
| 6353 | |
| 6354 | /* capture mixer elements */ |
| 6355 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 6356 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6357 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6358 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6359 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6360 | { |
| 6361 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6362 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6363 | * So call somewhat different.. |
| 6364 | * FIXME: the controls appear in the "playback" view! |
| 6365 | */ |
| 6366 | /* .name = "Capture Source", */ |
| 6367 | .name = "Input Source", |
| 6368 | .count = 2, |
| 6369 | .info = alc882_mux_enum_info, |
| 6370 | .get = alc882_mux_enum_get, |
| 6371 | .put = alc882_mux_enum_put, |
| 6372 | }, |
| 6373 | { } /* end */ |
| 6374 | }; |
| 6375 | |
| 6376 | /* pcm configuration: identiacal with ALC880 */ |
| 6377 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 6378 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
| 6379 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 6380 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 6381 | |
| 6382 | /* |
| 6383 | * configuration and preset |
| 6384 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6385 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 6386 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 6387 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 6388 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 6389 | [ALC883_6ST_DIG] = "6stack-dig", |
| 6390 | [ALC883_TARGA_DIG] = "targa-dig", |
| 6391 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6392 | [ALC883_ACER] = "acer", |
| 6393 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6394 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6395 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6396 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6397 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 6398 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6399 | [ALC883_AUTO] = "auto", |
| 6400 | }; |
| 6401 | |
| 6402 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 6403 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 6404 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6405 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
| 6406 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
| 6407 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 6408 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6409 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 6410 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 6411 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 6412 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Daniel T Chen | 6f3bf65 | 2007-06-08 11:39:35 +0200 | [diff] [blame] | 6413 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6414 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Baruch Even | dd146a6 | 2007-05-25 12:18:49 +0200 | [diff] [blame] | 6415 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6416 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 6417 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 6418 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 6419 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 6420 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 6421 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 6422 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 6423 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
| 6424 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
| 6425 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 6426 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6427 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
| 6428 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 6429 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6430 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
| 6431 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 6432 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Claudio Matsuoka | 8f41b56 | 2007-07-03 20:02:49 +0200 | [diff] [blame] | 6433 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6434 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6435 | {} |
| 6436 | }; |
| 6437 | |
| 6438 | static struct alc_config_preset alc883_presets[] = { |
| 6439 | [ALC883_3ST_2ch_DIG] = { |
| 6440 | .mixers = { alc883_3ST_2ch_mixer }, |
| 6441 | .init_verbs = { alc883_init_verbs }, |
| 6442 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6443 | .dac_nids = alc883_dac_nids, |
| 6444 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6445 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6446 | .adc_nids = alc883_adc_nids, |
| 6447 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6448 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6449 | .channel_mode = alc883_3ST_2ch_modes, |
| 6450 | .input_mux = &alc883_capture_source, |
| 6451 | }, |
| 6452 | [ALC883_3ST_6ch_DIG] = { |
| 6453 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6454 | .init_verbs = { alc883_init_verbs }, |
| 6455 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6456 | .dac_nids = alc883_dac_nids, |
| 6457 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6458 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6459 | .adc_nids = alc883_adc_nids, |
| 6460 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6461 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6462 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6463 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6464 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6465 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6466 | [ALC883_3ST_6ch] = { |
| 6467 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6468 | .init_verbs = { alc883_init_verbs }, |
| 6469 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6470 | .dac_nids = alc883_dac_nids, |
| 6471 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6472 | .adc_nids = alc883_adc_nids, |
| 6473 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6474 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6475 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6476 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6477 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6478 | [ALC883_6ST_DIG] = { |
| 6479 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 6480 | .init_verbs = { alc883_init_verbs }, |
| 6481 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6482 | .dac_nids = alc883_dac_nids, |
| 6483 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6484 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6485 | .adc_nids = alc883_adc_nids, |
| 6486 | .dig_in_nid = ALC883_DIGIN_NID, |
| 6487 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6488 | .channel_mode = alc883_sixstack_modes, |
| 6489 | .input_mux = &alc883_capture_source, |
| 6490 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6491 | [ALC883_TARGA_DIG] = { |
| 6492 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 6493 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 6494 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6495 | .dac_nids = alc883_dac_nids, |
| 6496 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6497 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6498 | .adc_nids = alc883_adc_nids, |
| 6499 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6500 | .channel_mode = alc883_3ST_6ch_modes, |
| 6501 | .need_dac_fix = 1, |
| 6502 | .input_mux = &alc883_capture_source, |
| 6503 | .unsol_event = alc883_tagra_unsol_event, |
| 6504 | .init_hook = alc883_tagra_automute, |
| 6505 | }, |
| 6506 | [ALC883_TARGA_2ch_DIG] = { |
| 6507 | .mixers = { alc883_tagra_2ch_mixer}, |
| 6508 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 6509 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6510 | .dac_nids = alc883_dac_nids, |
| 6511 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6512 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6513 | .adc_nids = alc883_adc_nids, |
| 6514 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6515 | .channel_mode = alc883_3ST_2ch_modes, |
| 6516 | .input_mux = &alc883_capture_source, |
| 6517 | .unsol_event = alc883_tagra_unsol_event, |
| 6518 | .init_hook = alc883_tagra_automute, |
| 6519 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 6520 | [ALC883_ACER] = { |
| 6521 | .mixers = { alc883_base_mixer, |
| 6522 | alc883_chmode_mixer }, |
| 6523 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 6524 | * and the headphone jack. Turn this on and rely on the |
| 6525 | * standard mute methods whenever the user wants to turn |
| 6526 | * these outputs off. |
| 6527 | */ |
| 6528 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 6529 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6530 | .dac_nids = alc883_dac_nids, |
| 6531 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6532 | .adc_nids = alc883_adc_nids, |
| 6533 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6534 | .channel_mode = alc883_3ST_2ch_modes, |
| 6535 | .input_mux = &alc883_capture_source, |
| 6536 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6537 | [ALC883_MEDION] = { |
| 6538 | .mixers = { alc883_fivestack_mixer, |
| 6539 | alc883_chmode_mixer }, |
| 6540 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6541 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6542 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6543 | .dac_nids = alc883_dac_nids, |
| 6544 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6545 | .adc_nids = alc883_adc_nids, |
| 6546 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 6547 | .channel_mode = alc883_sixstack_modes, |
| 6548 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6549 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6550 | [ALC883_MEDION_MD2] = { |
| 6551 | .mixers = { alc883_medion_md2_mixer}, |
| 6552 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 6553 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6554 | .dac_nids = alc883_dac_nids, |
| 6555 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6556 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6557 | .adc_nids = alc883_adc_nids, |
| 6558 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6559 | .channel_mode = alc883_3ST_2ch_modes, |
| 6560 | .input_mux = &alc883_capture_source, |
| 6561 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6562 | .init_hook = alc883_medion_md2_automute, |
| 6563 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6564 | [ALC883_LAPTOP_EAPD] = { |
| 6565 | .mixers = { alc883_base_mixer, |
| 6566 | alc883_chmode_mixer }, |
| 6567 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 6568 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6569 | .dac_nids = alc883_dac_nids, |
| 6570 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6571 | .adc_nids = alc883_adc_nids, |
| 6572 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6573 | .channel_mode = alc883_3ST_2ch_modes, |
| 6574 | .input_mux = &alc883_capture_source, |
| 6575 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6576 | [ALC883_LENOVO_101E_2ch] = { |
| 6577 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 6578 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 6579 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6580 | .dac_nids = alc883_dac_nids, |
| 6581 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6582 | .adc_nids = alc883_adc_nids, |
| 6583 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6584 | .channel_mode = alc883_3ST_2ch_modes, |
| 6585 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 6586 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 6587 | .init_hook = alc883_lenovo_101e_all_automute, |
| 6588 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6589 | [ALC883_LENOVO_NB0763] = { |
| 6590 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 6591 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 6592 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6593 | .dac_nids = alc883_dac_nids, |
| 6594 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6595 | .adc_nids = alc883_adc_nids, |
| 6596 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 6597 | .channel_mode = alc883_3ST_2ch_modes, |
| 6598 | .need_dac_fix = 1, |
| 6599 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 6600 | .unsol_event = alc883_medion_md2_unsol_event, |
| 6601 | .init_hook = alc883_medion_md2_automute, |
| 6602 | }, |
| 6603 | [ALC888_LENOVO_MS7195_DIG] = { |
| 6604 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 6605 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 6606 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 6607 | .dac_nids = alc883_dac_nids, |
| 6608 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 6609 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 6610 | .adc_nids = alc883_adc_nids, |
| 6611 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 6612 | .channel_mode = alc883_3ST_6ch_modes, |
| 6613 | .need_dac_fix = 1, |
| 6614 | .input_mux = &alc883_capture_source, |
| 6615 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 6616 | .init_hook = alc888_lenovo_ms7195_front_automute, |
| 6617 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6618 | }; |
| 6619 | |
| 6620 | |
| 6621 | /* |
| 6622 | * BIOS auto configuration |
| 6623 | */ |
| 6624 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6625 | hda_nid_t nid, int pin_type, |
| 6626 | int dac_idx) |
| 6627 | { |
| 6628 | /* set as output */ |
| 6629 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6630 | int idx; |
| 6631 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6632 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6633 | idx = 4; |
| 6634 | else |
| 6635 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 6636 | |
| 6637 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6638 | pin_type); |
| 6639 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 6640 | AMP_OUT_UNMUTE); |
| 6641 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6642 | |
| 6643 | } |
| 6644 | |
| 6645 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 6646 | { |
| 6647 | struct alc_spec *spec = codec->spec; |
| 6648 | int i; |
| 6649 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6650 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6651 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6652 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6653 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6654 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6655 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6656 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6657 | } |
| 6658 | } |
| 6659 | |
| 6660 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 6661 | { |
| 6662 | struct alc_spec *spec = codec->spec; |
| 6663 | hda_nid_t pin; |
| 6664 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6665 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6666 | if (pin) /* connect to front */ |
| 6667 | /* use dac 0 */ |
| 6668 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 6669 | } |
| 6670 | |
| 6671 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6672 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 6673 | |
| 6674 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 6675 | { |
| 6676 | struct alc_spec *spec = codec->spec; |
| 6677 | int i; |
| 6678 | |
| 6679 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6680 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6681 | if (alc883_is_input_pin(nid)) { |
| 6682 | snd_hda_codec_write(codec, nid, 0, |
| 6683 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6684 | (i <= AUTO_PIN_FRONT_MIC ? |
| 6685 | PIN_VREF80 : PIN_IN)); |
| 6686 | if (nid != ALC883_PIN_CD_NID) |
| 6687 | snd_hda_codec_write(codec, nid, 0, |
| 6688 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6689 | AMP_OUT_MUTE); |
| 6690 | } |
| 6691 | } |
| 6692 | } |
| 6693 | |
| 6694 | /* almost identical with ALC880 parser... */ |
| 6695 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 6696 | { |
| 6697 | struct alc_spec *spec = codec->spec; |
| 6698 | int err = alc880_parse_auto_config(codec); |
| 6699 | |
| 6700 | if (err < 0) |
| 6701 | return err; |
| 6702 | else if (err > 0) |
| 6703 | /* hack - override the init verbs */ |
| 6704 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6705 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 6706 | spec->num_mixers++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6707 | return err; |
| 6708 | } |
| 6709 | |
| 6710 | /* additional initialization for auto-configuration model */ |
| 6711 | static void alc883_auto_init(struct hda_codec *codec) |
| 6712 | { |
| 6713 | alc883_auto_init_multi_out(codec); |
| 6714 | alc883_auto_init_hp_out(codec); |
| 6715 | alc883_auto_init_analog_input(codec); |
| 6716 | } |
| 6717 | |
| 6718 | static int patch_alc883(struct hda_codec *codec) |
| 6719 | { |
| 6720 | struct alc_spec *spec; |
| 6721 | int err, board_config; |
| 6722 | |
| 6723 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 6724 | if (spec == NULL) |
| 6725 | return -ENOMEM; |
| 6726 | |
| 6727 | codec->spec = spec; |
| 6728 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6729 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 6730 | alc883_models, |
| 6731 | alc883_cfg_tbl); |
| 6732 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6733 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 6734 | "trying auto-probe from BIOS...\n"); |
| 6735 | board_config = ALC883_AUTO; |
| 6736 | } |
| 6737 | |
| 6738 | if (board_config == ALC883_AUTO) { |
| 6739 | /* automatic parse from the BIOS config */ |
| 6740 | err = alc883_parse_auto_config(codec); |
| 6741 | if (err < 0) { |
| 6742 | alc_free(codec); |
| 6743 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6744 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6745 | printk(KERN_INFO |
| 6746 | "hda_codec: Cannot set up configuration " |
| 6747 | "from BIOS. Using base mode...\n"); |
| 6748 | board_config = ALC883_3ST_2ch_DIG; |
| 6749 | } |
| 6750 | } |
| 6751 | |
| 6752 | if (board_config != ALC883_AUTO) |
| 6753 | setup_preset(spec, &alc883_presets[board_config]); |
| 6754 | |
| 6755 | spec->stream_name_analog = "ALC883 Analog"; |
| 6756 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 6757 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
| 6758 | |
| 6759 | spec->stream_name_digital = "ALC883 Digital"; |
| 6760 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 6761 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 6762 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6763 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6764 | spec->adc_nids = alc883_adc_nids; |
| 6765 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 6766 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6767 | |
| 6768 | codec->patch_ops = alc_patch_ops; |
| 6769 | if (board_config == ALC883_AUTO) |
| 6770 | spec->init_hook = alc883_auto_init; |
| 6771 | |
| 6772 | return 0; |
| 6773 | } |
| 6774 | |
| 6775 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6776 | * ALC262 support |
| 6777 | */ |
| 6778 | |
| 6779 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 6780 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 6781 | |
| 6782 | #define alc262_dac_nids alc260_dac_nids |
| 6783 | #define alc262_adc_nids alc882_adc_nids |
| 6784 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 6785 | |
| 6786 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 6787 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6788 | |
| 6789 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 6790 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6791 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6792 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6793 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6794 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6795 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6798 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6799 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6800 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6801 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6802 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6803 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 6804 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 6805 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6806 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6807 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6808 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 6809 | }; |
| 6810 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6811 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 6812 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6813 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6814 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6815 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6816 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6817 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6818 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6819 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6820 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6821 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6822 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6823 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6824 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6825 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 6826 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 6827 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6828 | { } /* end */ |
| 6829 | }; |
| 6830 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6831 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
| 6832 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6833 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6834 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6835 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6836 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6837 | |
| 6838 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6839 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6840 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6841 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6842 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6843 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6844 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6845 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6846 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6847 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6848 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6849 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6850 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 6851 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 6852 | { } /* end */ |
| 6853 | }; |
| 6854 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 6855 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
| 6856 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6857 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6858 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6859 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6860 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6861 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6862 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6863 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6864 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 6865 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6866 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6867 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6868 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6869 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6870 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6871 | { } /* end */ |
| 6872 | }; |
| 6873 | |
| 6874 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 6875 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6876 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 6877 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 6878 | { } /* end */ |
| 6879 | }; |
| 6880 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6881 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
| 6882 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6883 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6884 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6885 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6886 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6887 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6888 | { } /* end */ |
| 6889 | }; |
| 6890 | |
| 6891 | |
| 6892 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6893 | #define alc262_capture_mixer alc882_capture_mixer |
| 6894 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 6895 | |
| 6896 | /* |
| 6897 | * generic initialization of ADC, input mixers and output mixers |
| 6898 | */ |
| 6899 | static struct hda_verb alc262_init_verbs[] = { |
| 6900 | /* |
| 6901 | * Unmute ADC0-2 and set the default input to mic-in |
| 6902 | */ |
| 6903 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6904 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6905 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6906 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6907 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6908 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6909 | |
| 6910 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6911 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6912 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6913 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6914 | */ |
| 6915 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 6916 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6917 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6918 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6919 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 6920 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6921 | |
| 6922 | /* |
| 6923 | * Set up output mixers (0x0c - 0x0e) |
| 6924 | */ |
| 6925 | /* set vol=0 to output mixers */ |
| 6926 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6927 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6928 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6929 | /* set up input amps for analog loopback */ |
| 6930 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 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 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6934 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6935 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6936 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6937 | |
| 6938 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6939 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6940 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6941 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6942 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6943 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6944 | |
| 6945 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6946 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6947 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6948 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6949 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6950 | |
| 6951 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6952 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6953 | |
| 6954 | /* FIXME: use matrix-type input source selection */ |
| 6955 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6956 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6957 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6958 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6959 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6960 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6961 | /* Input mixer2 */ |
| 6962 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6963 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6964 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6965 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6966 | /* Input mixer3 */ |
| 6967 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6968 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6969 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6970 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6971 | |
| 6972 | { } |
| 6973 | }; |
| 6974 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6975 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 6976 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6977 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6978 | {} |
| 6979 | }; |
| 6980 | |
| 6981 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 6982 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6983 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6984 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6985 | |
| 6986 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6987 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6988 | {} |
| 6989 | }; |
| 6990 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6991 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 6992 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6993 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6994 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 6995 | |
| 6996 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6997 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6998 | }; |
| 6999 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7000 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 7001 | static void alc262_hippo_automute(struct hda_codec *codec, int force) |
| 7002 | { |
| 7003 | struct alc_spec *spec = codec->spec; |
| 7004 | unsigned int mute; |
| 7005 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7006 | if (force || !spec->sense_updated) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7007 | unsigned int present; |
| 7008 | /* need to execute and sync at first */ |
| 7009 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7010 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7011 | AC_VERB_GET_PIN_SENSE, 0); |
| 7012 | spec->jack_present = (present & 0x80000000) != 0; |
| 7013 | spec->sense_updated = 1; |
| 7014 | } |
| 7015 | if (spec->jack_present) { |
| 7016 | /* mute internal speaker */ |
| 7017 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7018 | 0x80, 0x80); |
| 7019 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7020 | 0x80, 0x80); |
| 7021 | } else { |
| 7022 | /* unmute internal speaker if necessary */ |
| 7023 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 7024 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7025 | 0x80, mute & 0x80); |
| 7026 | mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0); |
| 7027 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7028 | 0x80, mute & 0x80); |
| 7029 | } |
| 7030 | } |
| 7031 | |
| 7032 | /* unsolicited event for HP jack sensing */ |
| 7033 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 7034 | unsigned int res) |
| 7035 | { |
| 7036 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7037 | return; |
| 7038 | alc262_hippo_automute(codec, 1); |
| 7039 | } |
| 7040 | |
| 7041 | static void alc262_hippo1_automute(struct hda_codec *codec, int force) |
| 7042 | { |
| 7043 | struct alc_spec *spec = codec->spec; |
| 7044 | unsigned int mute; |
| 7045 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7046 | if (force || !spec->sense_updated) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7047 | unsigned int present; |
| 7048 | /* need to execute and sync at first */ |
| 7049 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7050 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7051 | AC_VERB_GET_PIN_SENSE, 0); |
| 7052 | spec->jack_present = (present & 0x80000000) != 0; |
| 7053 | spec->sense_updated = 1; |
| 7054 | } |
| 7055 | if (spec->jack_present) { |
| 7056 | /* mute internal speaker */ |
| 7057 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7058 | 0x80, 0x80); |
| 7059 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7060 | 0x80, 0x80); |
| 7061 | } else { |
| 7062 | /* unmute internal speaker if necessary */ |
| 7063 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 7064 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7065 | 0x80, mute & 0x80); |
| 7066 | mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0); |
| 7067 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7068 | 0x80, mute & 0x80); |
| 7069 | } |
| 7070 | } |
| 7071 | |
| 7072 | /* unsolicited event for HP jack sensing */ |
| 7073 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 7074 | unsigned int res) |
| 7075 | { |
| 7076 | if ((res >> 26) != ALC880_HP_EVENT) |
| 7077 | return; |
| 7078 | alc262_hippo1_automute(codec, 1); |
| 7079 | } |
| 7080 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7081 | /* |
| 7082 | * fujitsu model |
| 7083 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 7084 | */ |
| 7085 | |
| 7086 | #define ALC_HP_EVENT 0x37 |
| 7087 | |
| 7088 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 7089 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 7090 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7091 | {} |
| 7092 | }; |
| 7093 | |
| 7094 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
| 7095 | .num_items = 2, |
| 7096 | .items = { |
| 7097 | { "Mic", 0x0 }, |
| 7098 | { "CD", 0x4 }, |
| 7099 | }, |
| 7100 | }; |
| 7101 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7102 | static struct hda_input_mux alc262_HP_capture_source = { |
| 7103 | .num_items = 5, |
| 7104 | .items = { |
| 7105 | { "Mic", 0x0 }, |
| 7106 | { "Front Mic", 0x3 }, |
| 7107 | { "Line", 0x2 }, |
| 7108 | { "CD", 0x4 }, |
| 7109 | { "AUX IN", 0x6 }, |
| 7110 | }, |
| 7111 | }; |
| 7112 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7113 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 7114 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 7115 | { |
| 7116 | struct alc_spec *spec = codec->spec; |
| 7117 | unsigned int mute; |
| 7118 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7119 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7120 | unsigned int present; |
| 7121 | /* need to execute and sync at first */ |
| 7122 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7123 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7124 | AC_VERB_GET_PIN_SENSE, 0); |
| 7125 | spec->jack_present = (present & 0x80000000) != 0; |
| 7126 | spec->sense_updated = 1; |
| 7127 | } |
| 7128 | if (spec->jack_present) { |
| 7129 | /* mute internal speaker */ |
| 7130 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 7131 | 0x80, 0x80); |
| 7132 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 7133 | 0x80, 0x80); |
| 7134 | } else { |
| 7135 | /* unmute internal speaker if necessary */ |
| 7136 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 7137 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 7138 | 0x80, mute & 0x80); |
| 7139 | mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0); |
| 7140 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 7141 | 0x80, mute & 0x80); |
| 7142 | } |
| 7143 | } |
| 7144 | |
| 7145 | /* unsolicited event for HP jack sensing */ |
| 7146 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 7147 | unsigned int res) |
| 7148 | { |
| 7149 | if ((res >> 26) != ALC_HP_EVENT) |
| 7150 | return; |
| 7151 | alc262_fujitsu_automute(codec, 1); |
| 7152 | } |
| 7153 | |
| 7154 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 7155 | static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol, |
| 7156 | struct snd_ctl_elem_value *ucontrol) |
| 7157 | { |
| 7158 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7159 | long *valp = ucontrol->value.integer.value; |
| 7160 | int change; |
| 7161 | |
| 7162 | change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, |
| 7163 | 0x7f, valp[0] & 0x7f); |
| 7164 | change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, |
| 7165 | 0x7f, valp[1] & 0x7f); |
| 7166 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, |
| 7167 | 0x7f, valp[0] & 0x7f); |
| 7168 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, |
| 7169 | 0x7f, valp[1] & 0x7f); |
| 7170 | return change; |
| 7171 | } |
| 7172 | |
| 7173 | /* bind hp and internal speaker mute (with plug check) */ |
| 7174 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 7175 | struct snd_ctl_elem_value *ucontrol) |
| 7176 | { |
| 7177 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7178 | long *valp = ucontrol->value.integer.value; |
| 7179 | int change; |
| 7180 | |
| 7181 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 7182 | 0x80, valp[0] ? 0 : 0x80); |
| 7183 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 7184 | 0x80, valp[1] ? 0 : 0x80); |
| 7185 | if (change || codec->in_resume) |
| 7186 | alc262_fujitsu_automute(codec, codec->in_resume); |
| 7187 | return change; |
| 7188 | } |
| 7189 | |
| 7190 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
| 7191 | { |
| 7192 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7193 | .name = "Master Playback Volume", |
| 7194 | .info = snd_hda_mixer_amp_volume_info, |
| 7195 | .get = snd_hda_mixer_amp_volume_get, |
| 7196 | .put = alc262_fujitsu_master_vol_put, |
Takashi Iwai | c256652 | 2006-08-17 18:21:36 +0200 | [diff] [blame] | 7197 | .tlv = { .c = snd_hda_mixer_amp_tlv }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7198 | .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 7199 | }, |
| 7200 | { |
| 7201 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7202 | .name = "Master Playback Switch", |
| 7203 | .info = snd_hda_mixer_amp_switch_info, |
| 7204 | .get = snd_hda_mixer_amp_switch_get, |
| 7205 | .put = alc262_fujitsu_master_sw_put, |
| 7206 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 7207 | }, |
| 7208 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7209 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7210 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7211 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7212 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7213 | { } /* end */ |
| 7214 | }; |
| 7215 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 7216 | /* additional init verbs for Benq laptops */ |
| 7217 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 7218 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7219 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7220 | {} |
| 7221 | }; |
| 7222 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7223 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7224 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7225 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7226 | { |
| 7227 | hda_nid_t nid; |
| 7228 | int err; |
| 7229 | |
| 7230 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 7231 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 7232 | spec->multiout.dac_nids[0] = 2; |
| 7233 | |
| 7234 | nid = cfg->line_out_pins[0]; |
| 7235 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7236 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7237 | "Front Playback Volume", |
| 7238 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 7239 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7240 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7241 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7242 | "Front Playback Switch", |
| 7243 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 7244 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7245 | return err; |
| 7246 | } |
| 7247 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7248 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7249 | if (nid) { |
| 7250 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7251 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7252 | "Speaker Playback Volume", |
| 7253 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7254 | HDA_OUTPUT)); |
| 7255 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7256 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7257 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7258 | "Speaker Playback Switch", |
| 7259 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7260 | HDA_OUTPUT)); |
| 7261 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7262 | return err; |
| 7263 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7264 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7265 | "Speaker Playback Switch", |
| 7266 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7267 | HDA_OUTPUT)); |
| 7268 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7269 | return err; |
| 7270 | } |
| 7271 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7272 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7273 | if (nid) { |
| 7274 | /* spec->multiout.hp_nid = 2; */ |
| 7275 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7276 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7277 | "Headphone Playback Volume", |
| 7278 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 7279 | HDA_OUTPUT)); |
| 7280 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7281 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7282 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7283 | "Headphone Playback Switch", |
| 7284 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 7285 | HDA_OUTPUT)); |
| 7286 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7287 | return err; |
| 7288 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7289 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 7290 | "Headphone Playback Switch", |
| 7291 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 7292 | HDA_OUTPUT)); |
| 7293 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7294 | return err; |
| 7295 | } |
| 7296 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7297 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7298 | } |
| 7299 | |
| 7300 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7301 | #define alc262_auto_create_analog_input_ctls \ |
| 7302 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7303 | |
| 7304 | /* |
| 7305 | * generic initialization of ADC, input mixers and output mixers |
| 7306 | */ |
| 7307 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 7308 | /* |
| 7309 | * Unmute ADC0-2 and set the default input to mic-in |
| 7310 | */ |
| 7311 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7312 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7313 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7314 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7315 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7316 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7317 | |
| 7318 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7319 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7320 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7321 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7322 | */ |
| 7323 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7324 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7326 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7329 | |
| 7330 | /* |
| 7331 | * Set up output mixers (0x0c - 0x0f) |
| 7332 | */ |
| 7333 | /* set vol=0 to output mixers */ |
| 7334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7335 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7336 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7337 | |
| 7338 | /* set up input amps for analog loopback */ |
| 7339 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7340 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7341 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7342 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7343 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7344 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7345 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7346 | |
| 7347 | /* FIXME: use matrix-type input source selection */ |
| 7348 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7349 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7350 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7351 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7352 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7353 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7354 | /* Input mixer2 */ |
| 7355 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7356 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7357 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7358 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7359 | /* Input mixer3 */ |
| 7360 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7361 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7362 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7363 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7364 | |
| 7365 | { } |
| 7366 | }; |
| 7367 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7368 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 7369 | /* |
| 7370 | * Unmute ADC0-2 and set the default input to mic-in |
| 7371 | */ |
| 7372 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7373 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7374 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7375 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7376 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7377 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7378 | |
| 7379 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7380 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7381 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7382 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7383 | */ |
| 7384 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7385 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7386 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7387 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7388 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7389 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7390 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 7391 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 7392 | |
| 7393 | /* |
| 7394 | * Set up output mixers (0x0c - 0x0e) |
| 7395 | */ |
| 7396 | /* set vol=0 to output mixers */ |
| 7397 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7398 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7399 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7400 | |
| 7401 | /* set up input amps for analog loopback */ |
| 7402 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7403 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7404 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7405 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7406 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7407 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7408 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7409 | |
| 7410 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7411 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7412 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7413 | |
| 7414 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7415 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7416 | |
| 7417 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7418 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7419 | |
| 7420 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7421 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7422 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7423 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7424 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7425 | |
| 7426 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7427 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7428 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7429 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7430 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7431 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7432 | |
| 7433 | |
| 7434 | /* FIXME: use matrix-type input source selection */ |
| 7435 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7436 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7437 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7438 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7439 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7440 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7441 | /* Input mixer2 */ |
| 7442 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7443 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7444 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7445 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7446 | /* Input mixer3 */ |
| 7447 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7448 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7449 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7450 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7451 | |
| 7452 | { } |
| 7453 | }; |
| 7454 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7455 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 7456 | /* |
| 7457 | * Unmute ADC0-2 and set the default input to mic-in |
| 7458 | */ |
| 7459 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7461 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7462 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7463 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7464 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7465 | |
| 7466 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7467 | * mixer widget |
| 7468 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 7469 | * panel mic (mic 2) |
| 7470 | */ |
| 7471 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 7472 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7473 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7474 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7475 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7476 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7477 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
| 7478 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, |
| 7479 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, |
| 7480 | /* |
| 7481 | * Set up output mixers (0x0c - 0x0e) |
| 7482 | */ |
| 7483 | /* set vol=0 to output mixers */ |
| 7484 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7485 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7486 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7487 | |
| 7488 | /* set up input amps for analog loopback */ |
| 7489 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7490 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7491 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7492 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7493 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7494 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7495 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7496 | |
| 7497 | |
| 7498 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 7499 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 7500 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 7501 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 7502 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 7503 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 7504 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 7505 | |
| 7506 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7507 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7508 | |
| 7509 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7510 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7511 | |
| 7512 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 7513 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7514 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7515 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 7516 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7517 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 7518 | |
| 7519 | /* FIXME: use matrix-type input source selection */ |
| 7520 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7521 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7522 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 7523 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 7524 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 7525 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 7526 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 7527 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7528 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 7529 | /* Input mixer2 */ |
| 7530 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7531 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7532 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7533 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7534 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7535 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7536 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 7537 | /* Input mixer3 */ |
| 7538 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7539 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7540 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7541 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7542 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 7543 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 7544 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 7545 | |
| 7546 | { } |
| 7547 | }; |
| 7548 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7549 | /* pcm configuration: identiacal with ALC880 */ |
| 7550 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 7551 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 7552 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 7553 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 7554 | |
| 7555 | /* |
| 7556 | * BIOS auto configuration |
| 7557 | */ |
| 7558 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 7559 | { |
| 7560 | struct alc_spec *spec = codec->spec; |
| 7561 | int err; |
| 7562 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 7563 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7564 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7565 | alc262_ignore); |
| 7566 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7567 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7568 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7569 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7570 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7571 | if (err < 0) |
| 7572 | return err; |
| 7573 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 7574 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7575 | return err; |
| 7576 | |
| 7577 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 7578 | |
| 7579 | if (spec->autocfg.dig_out_pin) |
| 7580 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 7581 | if (spec->autocfg.dig_in_pin) |
| 7582 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 7583 | |
| 7584 | if (spec->kctl_alloc) |
| 7585 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 7586 | |
| 7587 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7588 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7589 | spec->input_mux = &spec->private_imux; |
| 7590 | |
| 7591 | return 1; |
| 7592 | } |
| 7593 | |
| 7594 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 7595 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 7596 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 7597 | |
| 7598 | |
| 7599 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7600 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7601 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7602 | alc262_auto_init_multi_out(codec); |
| 7603 | alc262_auto_init_hp_out(codec); |
| 7604 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7605 | } |
| 7606 | |
| 7607 | /* |
| 7608 | * configuration and preset |
| 7609 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7610 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 7611 | [ALC262_BASIC] = "basic", |
| 7612 | [ALC262_HIPPO] = "hippo", |
| 7613 | [ALC262_HIPPO_1] = "hippo_1", |
| 7614 | [ALC262_FUJITSU] = "fujitsu", |
| 7615 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7616 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7617 | [ALC262_BENQ_ED8] = "benq", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7618 | [ALC262_BENQ_ED8] = "sony-assamd", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7619 | [ALC262_AUTO] = "auto", |
| 7620 | }; |
| 7621 | |
| 7622 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 7623 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 7624 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
| 7625 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7626 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
| 7627 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7628 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7629 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7630 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 7631 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7632 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7633 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7634 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7635 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
| 7636 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7637 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7638 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
| 7639 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7640 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
| 7641 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
| 7642 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
| 7643 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7644 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
| 7645 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 7646 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7647 | {} |
| 7648 | }; |
| 7649 | |
| 7650 | static struct alc_config_preset alc262_presets[] = { |
| 7651 | [ALC262_BASIC] = { |
| 7652 | .mixers = { alc262_base_mixer }, |
| 7653 | .init_verbs = { alc262_init_verbs }, |
| 7654 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7655 | .dac_nids = alc262_dac_nids, |
| 7656 | .hp_nid = 0x03, |
| 7657 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7658 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7659 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7660 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7661 | [ALC262_HIPPO] = { |
| 7662 | .mixers = { alc262_base_mixer }, |
| 7663 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 7664 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7665 | .dac_nids = alc262_dac_nids, |
| 7666 | .hp_nid = 0x03, |
| 7667 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 7668 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7669 | .channel_mode = alc262_modes, |
| 7670 | .input_mux = &alc262_capture_source, |
| 7671 | .unsol_event = alc262_hippo_unsol_event, |
| 7672 | }, |
| 7673 | [ALC262_HIPPO_1] = { |
| 7674 | .mixers = { alc262_hippo1_mixer }, |
| 7675 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 7676 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7677 | .dac_nids = alc262_dac_nids, |
| 7678 | .hp_nid = 0x02, |
| 7679 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 7680 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7681 | .channel_mode = alc262_modes, |
| 7682 | .input_mux = &alc262_capture_source, |
| 7683 | .unsol_event = alc262_hippo1_unsol_event, |
| 7684 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7685 | [ALC262_FUJITSU] = { |
| 7686 | .mixers = { alc262_fujitsu_mixer }, |
| 7687 | .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs }, |
| 7688 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7689 | .dac_nids = alc262_dac_nids, |
| 7690 | .hp_nid = 0x03, |
| 7691 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 7692 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7693 | .channel_mode = alc262_modes, |
| 7694 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7695 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7696 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7697 | [ALC262_HP_BPC] = { |
| 7698 | .mixers = { alc262_HP_BPC_mixer }, |
| 7699 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 7700 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7701 | .dac_nids = alc262_dac_nids, |
| 7702 | .hp_nid = 0x03, |
| 7703 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7704 | .channel_mode = alc262_modes, |
| 7705 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7706 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7707 | [ALC262_HP_BPC_D7000_WF] = { |
| 7708 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 7709 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 7710 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7711 | .dac_nids = alc262_dac_nids, |
| 7712 | .hp_nid = 0x03, |
| 7713 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7714 | .channel_mode = alc262_modes, |
| 7715 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7716 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7717 | [ALC262_HP_BPC_D7000_WL] = { |
| 7718 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 7719 | alc262_HP_BPC_WildWest_option_mixer }, |
| 7720 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 7721 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7722 | .dac_nids = alc262_dac_nids, |
| 7723 | .hp_nid = 0x03, |
| 7724 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7725 | .channel_mode = alc262_modes, |
| 7726 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7727 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 7728 | [ALC262_BENQ_ED8] = { |
| 7729 | .mixers = { alc262_base_mixer }, |
| 7730 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 7731 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7732 | .dac_nids = alc262_dac_nids, |
| 7733 | .hp_nid = 0x03, |
| 7734 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7735 | .channel_mode = alc262_modes, |
| 7736 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7737 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7738 | [ALC262_SONY_ASSAMD] = { |
| 7739 | .mixers = { alc262_sony_mixer }, |
| 7740 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 7741 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 7742 | .dac_nids = alc262_dac_nids, |
| 7743 | .hp_nid = 0x02, |
| 7744 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 7745 | .channel_mode = alc262_modes, |
| 7746 | .input_mux = &alc262_capture_source, |
| 7747 | .unsol_event = alc262_hippo_unsol_event, |
| 7748 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7749 | }; |
| 7750 | |
| 7751 | static int patch_alc262(struct hda_codec *codec) |
| 7752 | { |
| 7753 | struct alc_spec *spec; |
| 7754 | int board_config; |
| 7755 | int err; |
| 7756 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 7757 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7758 | if (spec == NULL) |
| 7759 | return -ENOMEM; |
| 7760 | |
| 7761 | codec->spec = spec; |
| 7762 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7763 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 7764 | * under-run |
| 7765 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7766 | { |
| 7767 | int tmp; |
| 7768 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 7769 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 7770 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 7771 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 7772 | } |
| 7773 | #endif |
| 7774 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7775 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 7776 | alc262_models, |
| 7777 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 7778 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7779 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7780 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 7781 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7782 | board_config = ALC262_AUTO; |
| 7783 | } |
| 7784 | |
| 7785 | if (board_config == ALC262_AUTO) { |
| 7786 | /* automatic parse from the BIOS config */ |
| 7787 | err = alc262_parse_auto_config(codec); |
| 7788 | if (err < 0) { |
| 7789 | alc_free(codec); |
| 7790 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7791 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7792 | printk(KERN_INFO |
| 7793 | "hda_codec: Cannot set up configuration " |
| 7794 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7795 | board_config = ALC262_BASIC; |
| 7796 | } |
| 7797 | } |
| 7798 | |
| 7799 | if (board_config != ALC262_AUTO) |
| 7800 | setup_preset(spec, &alc262_presets[board_config]); |
| 7801 | |
| 7802 | spec->stream_name_analog = "ALC262 Analog"; |
| 7803 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 7804 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 7805 | |
| 7806 | spec->stream_name_digital = "ALC262 Digital"; |
| 7807 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 7808 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 7809 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7810 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7811 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7812 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 7813 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7814 | /* get type */ |
| 7815 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7816 | if (wcap != AC_WID_AUD_IN) { |
| 7817 | spec->adc_nids = alc262_adc_nids_alt; |
| 7818 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7819 | spec->mixers[spec->num_mixers] = |
| 7820 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7821 | spec->num_mixers++; |
| 7822 | } else { |
| 7823 | spec->adc_nids = alc262_adc_nids; |
| 7824 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 7825 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 7826 | spec->num_mixers++; |
| 7827 | } |
| 7828 | } |
| 7829 | |
| 7830 | codec->patch_ops = alc_patch_ops; |
| 7831 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7832 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7833 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7834 | return 0; |
| 7835 | } |
| 7836 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7837 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 7838 | * ALC268 channel source setting (2 channel) |
| 7839 | */ |
| 7840 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 7841 | #define alc268_modes alc260_modes |
| 7842 | |
| 7843 | static hda_nid_t alc268_dac_nids[2] = { |
| 7844 | /* front, hp */ |
| 7845 | 0x02, 0x03 |
| 7846 | }; |
| 7847 | |
| 7848 | static hda_nid_t alc268_adc_nids[2] = { |
| 7849 | /* ADC0-1 */ |
| 7850 | 0x08, 0x07 |
| 7851 | }; |
| 7852 | |
| 7853 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 7854 | /* ADC0 */ |
| 7855 | 0x08 |
| 7856 | }; |
| 7857 | |
| 7858 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 7859 | /* output mixer control */ |
| 7860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 7861 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7862 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 7863 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7864 | { } |
| 7865 | }; |
| 7866 | |
| 7867 | /* |
| 7868 | * generic initialization of ADC, input mixers and output mixers |
| 7869 | */ |
| 7870 | static struct hda_verb alc268_base_init_verbs[] = { |
| 7871 | /* Unmute DAC0-1 and set vol = 0 */ |
| 7872 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7873 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7874 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7875 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7876 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7877 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7878 | |
| 7879 | /* |
| 7880 | * Set up output mixers (0x0c - 0x0e) |
| 7881 | */ |
| 7882 | /* set vol=0 to output mixers */ |
| 7883 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7884 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7885 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7886 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7887 | |
| 7888 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7889 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7890 | |
| 7891 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 7892 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 7893 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 7894 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7895 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7896 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7897 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7898 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7899 | |
| 7900 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7901 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7902 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7903 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7904 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7905 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7906 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7907 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7908 | |
| 7909 | /* FIXME: use matrix-type input source selection */ |
| 7910 | /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */ |
| 7911 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7912 | /* Input mixer2 */ |
| 7913 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7914 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7915 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7916 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7917 | |
| 7918 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7919 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 7920 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 7921 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 7922 | { } |
| 7923 | }; |
| 7924 | |
| 7925 | /* |
| 7926 | * generic initialization of ADC, input mixers and output mixers |
| 7927 | */ |
| 7928 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 7929 | /* set output DAC */ |
| 7930 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7931 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7932 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7933 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7934 | |
| 7935 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7936 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 7937 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7938 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7939 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 7940 | |
| 7941 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7942 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7943 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7944 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7945 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7946 | |
| 7947 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7948 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7949 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7950 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7951 | |
| 7952 | /* set PCBEEP vol = 0 */ |
| 7953 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, |
| 7954 | |
| 7955 | { } |
| 7956 | }; |
| 7957 | |
| 7958 | #define alc268_mux_enum_info alc_mux_enum_info |
| 7959 | #define alc268_mux_enum_get alc_mux_enum_get |
| 7960 | |
| 7961 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 7962 | struct snd_ctl_elem_value *ucontrol) |
| 7963 | { |
| 7964 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 7965 | struct alc_spec *spec = codec->spec; |
| 7966 | const struct hda_input_mux *imux = spec->input_mux; |
| 7967 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 7968 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; |
| 7969 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 7970 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 7971 | unsigned int i, idx; |
| 7972 | |
| 7973 | idx = ucontrol->value.enumerated.item[0]; |
| 7974 | if (idx >= imux->num_items) |
| 7975 | idx = imux->num_items - 1; |
| 7976 | if (*cur_val == idx && !codec->in_resume) |
| 7977 | return 0; |
| 7978 | for (i = 0; i < imux->num_items; i++) { |
| 7979 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 7980 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 7981 | v | (imux->items[i].index << 8)); |
| 7982 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, |
| 7983 | idx ); |
| 7984 | } |
| 7985 | *cur_val = idx; |
| 7986 | return 1; |
| 7987 | } |
| 7988 | |
| 7989 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 7990 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 7991 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 7992 | { |
| 7993 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7994 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7995 | * So call somewhat different.. |
| 7996 | * FIXME: the controls appear in the "playback" view! |
| 7997 | */ |
| 7998 | /* .name = "Capture Source", */ |
| 7999 | .name = "Input Source", |
| 8000 | .count = 1, |
| 8001 | .info = alc268_mux_enum_info, |
| 8002 | .get = alc268_mux_enum_get, |
| 8003 | .put = alc268_mux_enum_put, |
| 8004 | }, |
| 8005 | { } /* end */ |
| 8006 | }; |
| 8007 | |
| 8008 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 8009 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8010 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8011 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 8012 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 8013 | { |
| 8014 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8015 | /* The multiple "Capture Source" controls confuse alsamixer |
| 8016 | * So call somewhat different.. |
| 8017 | * FIXME: the controls appear in the "playback" view! |
| 8018 | */ |
| 8019 | /* .name = "Capture Source", */ |
| 8020 | .name = "Input Source", |
| 8021 | .count = 2, |
| 8022 | .info = alc268_mux_enum_info, |
| 8023 | .get = alc268_mux_enum_get, |
| 8024 | .put = alc268_mux_enum_put, |
| 8025 | }, |
| 8026 | { } /* end */ |
| 8027 | }; |
| 8028 | |
| 8029 | static struct hda_input_mux alc268_capture_source = { |
| 8030 | .num_items = 4, |
| 8031 | .items = { |
| 8032 | { "Mic", 0x0 }, |
| 8033 | { "Front Mic", 0x1 }, |
| 8034 | { "Line", 0x2 }, |
| 8035 | { "CD", 0x3 }, |
| 8036 | }, |
| 8037 | }; |
| 8038 | |
| 8039 | /* create input playback/capture controls for the given pin */ |
| 8040 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 8041 | const char *ctlname, int idx) |
| 8042 | { |
| 8043 | char name[32]; |
| 8044 | int err; |
| 8045 | |
| 8046 | sprintf(name, "%s Playback Volume", ctlname); |
| 8047 | if (nid == 0x14) { |
| 8048 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 8049 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 8050 | HDA_OUTPUT)); |
| 8051 | if (err < 0) |
| 8052 | return err; |
| 8053 | } else if (nid == 0x15) { |
| 8054 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 8055 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 8056 | HDA_OUTPUT)); |
| 8057 | if (err < 0) |
| 8058 | return err; |
| 8059 | } else |
| 8060 | return -1; |
| 8061 | sprintf(name, "%s Playback Switch", ctlname); |
| 8062 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 8063 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 8064 | if (err < 0) |
| 8065 | return err; |
| 8066 | return 0; |
| 8067 | } |
| 8068 | |
| 8069 | /* add playback controls from the parsed DAC table */ |
| 8070 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8071 | const struct auto_pin_cfg *cfg) |
| 8072 | { |
| 8073 | hda_nid_t nid; |
| 8074 | int err; |
| 8075 | |
| 8076 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 8077 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8078 | spec->multiout.dac_nids[0] = 2; |
| 8079 | spec->multiout.dac_nids[1] = 3; |
| 8080 | |
| 8081 | nid = cfg->line_out_pins[0]; |
| 8082 | if (nid) |
| 8083 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 8084 | |
| 8085 | nid = cfg->speaker_pins[0]; |
| 8086 | if (nid == 0x1d) { |
| 8087 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8088 | "Speaker Playback Volume", |
| 8089 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 8090 | if (err < 0) |
| 8091 | return err; |
| 8092 | } |
| 8093 | nid = cfg->hp_pins[0]; |
| 8094 | if (nid) |
| 8095 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 8096 | |
| 8097 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 8098 | if (nid == 0x16) { |
| 8099 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8100 | "Mono Playback Switch", |
| 8101 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 8102 | if (err < 0) |
| 8103 | return err; |
| 8104 | } |
| 8105 | return 0; |
| 8106 | } |
| 8107 | |
| 8108 | /* create playback/capture controls for input pins */ |
| 8109 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 8110 | const struct auto_pin_cfg *cfg) |
| 8111 | { |
| 8112 | struct hda_input_mux *imux = &spec->private_imux; |
| 8113 | int i, idx1; |
| 8114 | |
| 8115 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8116 | switch(cfg->input_pins[i]) { |
| 8117 | case 0x18: |
| 8118 | idx1 = 0; /* Mic 1 */ |
| 8119 | break; |
| 8120 | case 0x19: |
| 8121 | idx1 = 1; /* Mic 2 */ |
| 8122 | break; |
| 8123 | case 0x1a: |
| 8124 | idx1 = 2; /* Line In */ |
| 8125 | break; |
| 8126 | case 0x1c: |
| 8127 | idx1 = 3; /* CD */ |
| 8128 | break; |
| 8129 | default: |
| 8130 | continue; |
| 8131 | } |
| 8132 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 8133 | imux->items[imux->num_items].index = idx1; |
| 8134 | imux->num_items++; |
| 8135 | } |
| 8136 | return 0; |
| 8137 | } |
| 8138 | |
| 8139 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 8140 | { |
| 8141 | struct alc_spec *spec = codec->spec; |
| 8142 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 8143 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 8144 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 8145 | unsigned int dac_vol1, dac_vol2; |
| 8146 | |
| 8147 | if (speaker_nid) { |
| 8148 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 8149 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 8150 | snd_hda_codec_write(codec, 0x0f, 0, |
| 8151 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8152 | AMP_IN_UNMUTE(1)); |
| 8153 | snd_hda_codec_write(codec, 0x10, 0, |
| 8154 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8155 | AMP_IN_UNMUTE(1)); |
| 8156 | } else { |
| 8157 | snd_hda_codec_write(codec, 0x0f, 0, |
| 8158 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 8159 | snd_hda_codec_write(codec, 0x10, 0, |
| 8160 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 8161 | } |
| 8162 | |
| 8163 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 8164 | if (line_nid == 0x14) |
| 8165 | dac_vol2 = AMP_OUT_ZERO; |
| 8166 | else if (line_nid == 0x15) |
| 8167 | dac_vol1 = AMP_OUT_ZERO; |
| 8168 | if (hp_nid == 0x14) |
| 8169 | dac_vol2 = AMP_OUT_ZERO; |
| 8170 | else if (hp_nid == 0x15) |
| 8171 | dac_vol1 = AMP_OUT_ZERO; |
| 8172 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 8173 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 8174 | spec->autocfg.line_out_pins[2] != 0x16) |
| 8175 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 8176 | |
| 8177 | snd_hda_codec_write(codec, 0x02, 0, |
| 8178 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 8179 | snd_hda_codec_write(codec, 0x03, 0, |
| 8180 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 8181 | } |
| 8182 | |
| 8183 | /* pcm configuration: identiacal with ALC880 */ |
| 8184 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 8185 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
| 8186 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 8187 | |
| 8188 | /* |
| 8189 | * BIOS auto configuration |
| 8190 | */ |
| 8191 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 8192 | { |
| 8193 | struct alc_spec *spec = codec->spec; |
| 8194 | int err; |
| 8195 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 8196 | |
| 8197 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 8198 | alc268_ignore); |
| 8199 | if (err < 0) |
| 8200 | return err; |
| 8201 | if (!spec->autocfg.line_outs) |
| 8202 | return 0; /* can't find valid BIOS pin config */ |
| 8203 | |
| 8204 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 8205 | if (err < 0) |
| 8206 | return err; |
| 8207 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 8208 | if (err < 0) |
| 8209 | return err; |
| 8210 | |
| 8211 | spec->multiout.max_channels = 2; |
| 8212 | |
| 8213 | /* digital only support output */ |
| 8214 | if (spec->autocfg.dig_out_pin) |
| 8215 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 8216 | |
| 8217 | if (spec->kctl_alloc) |
| 8218 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 8219 | |
| 8220 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 8221 | spec->num_mux_defs = 1; |
| 8222 | spec->input_mux = &spec->private_imux; |
| 8223 | |
| 8224 | return 1; |
| 8225 | } |
| 8226 | |
| 8227 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 8228 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 8229 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 8230 | |
| 8231 | /* init callback for auto-configuration model -- overriding the default init */ |
| 8232 | static void alc268_auto_init(struct hda_codec *codec) |
| 8233 | { |
| 8234 | alc268_auto_init_multi_out(codec); |
| 8235 | alc268_auto_init_hp_out(codec); |
| 8236 | alc268_auto_init_mono_speaker_out(codec); |
| 8237 | alc268_auto_init_analog_input(codec); |
| 8238 | } |
| 8239 | |
| 8240 | /* |
| 8241 | * configuration and preset |
| 8242 | */ |
| 8243 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 8244 | [ALC268_3ST] = "3stack", |
| 8245 | [ALC268_AUTO] = "auto", |
| 8246 | }; |
| 8247 | |
| 8248 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
| 8249 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
| 8250 | {} |
| 8251 | }; |
| 8252 | |
| 8253 | static struct alc_config_preset alc268_presets[] = { |
| 8254 | [ALC268_3ST] = { |
| 8255 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 8256 | .init_verbs = { alc268_base_init_verbs }, |
| 8257 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 8258 | .dac_nids = alc268_dac_nids, |
| 8259 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 8260 | .adc_nids = alc268_adc_nids_alt, |
| 8261 | .hp_nid = 0x03, |
| 8262 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 8263 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 8264 | .channel_mode = alc268_modes, |
| 8265 | .input_mux = &alc268_capture_source, |
| 8266 | }, |
| 8267 | }; |
| 8268 | |
| 8269 | static int patch_alc268(struct hda_codec *codec) |
| 8270 | { |
| 8271 | struct alc_spec *spec; |
| 8272 | int board_config; |
| 8273 | int err; |
| 8274 | |
| 8275 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 8276 | if (spec == NULL) |
| 8277 | return -ENOMEM; |
| 8278 | |
| 8279 | codec->spec = spec; |
| 8280 | |
| 8281 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 8282 | alc268_models, |
| 8283 | alc268_cfg_tbl); |
| 8284 | |
| 8285 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 8286 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 8287 | "trying auto-probe from BIOS...\n"); |
| 8288 | board_config = ALC268_AUTO; |
| 8289 | } |
| 8290 | |
| 8291 | if (board_config == ALC268_AUTO) { |
| 8292 | /* automatic parse from the BIOS config */ |
| 8293 | err = alc268_parse_auto_config(codec); |
| 8294 | if (err < 0) { |
| 8295 | alc_free(codec); |
| 8296 | return err; |
| 8297 | } else if (!err) { |
| 8298 | printk(KERN_INFO |
| 8299 | "hda_codec: Cannot set up configuration " |
| 8300 | "from BIOS. Using base mode...\n"); |
| 8301 | board_config = ALC268_3ST; |
| 8302 | } |
| 8303 | } |
| 8304 | |
| 8305 | if (board_config != ALC268_AUTO) |
| 8306 | setup_preset(spec, &alc268_presets[board_config]); |
| 8307 | |
| 8308 | spec->stream_name_analog = "ALC268 Analog"; |
| 8309 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 8310 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
| 8311 | |
| 8312 | spec->stream_name_digital = "ALC268 Digital"; |
| 8313 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 8314 | |
| 8315 | if (board_config == ALC268_AUTO) { |
| 8316 | if (!spec->adc_nids && spec->input_mux) { |
| 8317 | /* check whether NID 0x07 is valid */ |
| 8318 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 8319 | |
| 8320 | /* get type */ |
| 8321 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 8322 | if (wcap != AC_WID_AUD_IN) { |
| 8323 | spec->adc_nids = alc268_adc_nids_alt; |
| 8324 | spec->num_adc_nids = |
| 8325 | ARRAY_SIZE(alc268_adc_nids_alt); |
| 8326 | spec->mixers[spec->num_mixers] = |
| 8327 | alc268_capture_alt_mixer; |
| 8328 | spec->num_mixers++; |
| 8329 | } else { |
| 8330 | spec->adc_nids = alc268_adc_nids; |
| 8331 | spec->num_adc_nids = |
| 8332 | ARRAY_SIZE(alc268_adc_nids); |
| 8333 | spec->mixers[spec->num_mixers] = |
| 8334 | alc268_capture_mixer; |
| 8335 | spec->num_mixers++; |
| 8336 | } |
| 8337 | } |
| 8338 | } |
| 8339 | codec->patch_ops = alc_patch_ops; |
| 8340 | if (board_config == ALC268_AUTO) |
| 8341 | spec->init_hook = alc268_auto_init; |
| 8342 | |
| 8343 | return 0; |
| 8344 | } |
| 8345 | |
| 8346 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8347 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 8348 | */ |
| 8349 | |
| 8350 | /* |
| 8351 | * set the path ways for 2 channel output |
| 8352 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 8353 | */ |
| 8354 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 8355 | /* set pin widget 1Ah (line in) for input */ |
| 8356 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8357 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 8358 | * the vref |
| 8359 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8360 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8361 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8362 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 8363 | #if 0 |
| 8364 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8365 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 8366 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8367 | { } /* end */ |
| 8368 | }; |
| 8369 | /* |
| 8370 | * 6ch mode |
| 8371 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 8372 | */ |
| 8373 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 8374 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 8375 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8376 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 8377 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8378 | |
| 8379 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8380 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8381 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8382 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 8383 | #if 0 |
| 8384 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8385 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 8386 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8387 | { } /* end */ |
| 8388 | }; |
| 8389 | |
| 8390 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 8391 | { 2, alc861_threestack_ch2_init }, |
| 8392 | { 6, alc861_threestack_ch6_init }, |
| 8393 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8394 | /* Set mic1 as input and unmute the mixer */ |
| 8395 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 8396 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8397 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8398 | { } /* end */ |
| 8399 | }; |
| 8400 | /* Set mic1 as output and mute mixer */ |
| 8401 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 8402 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8403 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8404 | { } /* end */ |
| 8405 | }; |
| 8406 | |
| 8407 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 8408 | { 2, alc861_uniwill_m31_ch2_init }, |
| 8409 | { 4, alc861_uniwill_m31_ch4_init }, |
| 8410 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8411 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8412 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 8413 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 8414 | /* set pin widget 1Ah (line in) for input */ |
| 8415 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8416 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 8417 | * the vref |
| 8418 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8419 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8420 | |
| 8421 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 8422 | #if 0 |
| 8423 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 8424 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 8425 | #endif |
| 8426 | { } /* end */ |
| 8427 | }; |
| 8428 | /* Set mic1 nad line-in as output and mute mixer */ |
| 8429 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 8430 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 8431 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8432 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 8433 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 8434 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8435 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 8436 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8437 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8438 | |
| 8439 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 8440 | #if 0 |
| 8441 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 8442 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 8443 | #endif |
| 8444 | { } /* end */ |
| 8445 | }; |
| 8446 | |
| 8447 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 8448 | { 2, alc861_asus_ch2_init }, |
| 8449 | { 6, alc861_asus_ch6_init }, |
| 8450 | }; |
| 8451 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8452 | /* patch-ALC861 */ |
| 8453 | |
| 8454 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 8455 | /* output mixer control */ |
| 8456 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8457 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8458 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8459 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8460 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 8461 | |
| 8462 | /*Input mixer control */ |
| 8463 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8464 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8465 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8466 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8467 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8468 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8469 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8470 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8471 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8472 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8473 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8474 | /* Capture mixer control */ |
| 8475 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8476 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8477 | { |
| 8478 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8479 | .name = "Capture Source", |
| 8480 | .count = 1, |
| 8481 | .info = alc_mux_enum_info, |
| 8482 | .get = alc_mux_enum_get, |
| 8483 | .put = alc_mux_enum_put, |
| 8484 | }, |
| 8485 | { } /* end */ |
| 8486 | }; |
| 8487 | |
| 8488 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 8489 | /* output mixer control */ |
| 8490 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8491 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8492 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8493 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8494 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 8495 | |
| 8496 | /* Input mixer control */ |
| 8497 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8498 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8499 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8500 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8501 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8502 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8503 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8504 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8505 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8506 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8507 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8508 | /* Capture mixer control */ |
| 8509 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8510 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8511 | { |
| 8512 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8513 | .name = "Capture Source", |
| 8514 | .count = 1, |
| 8515 | .info = alc_mux_enum_info, |
| 8516 | .get = alc_mux_enum_get, |
| 8517 | .put = alc_mux_enum_put, |
| 8518 | }, |
| 8519 | { |
| 8520 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8521 | .name = "Channel Mode", |
| 8522 | .info = alc_ch_mode_info, |
| 8523 | .get = alc_ch_mode_get, |
| 8524 | .put = alc_ch_mode_put, |
| 8525 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 8526 | }, |
| 8527 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8528 | }; |
| 8529 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8530 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8531 | /* output mixer control */ |
| 8532 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8533 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8534 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8535 | |
| 8536 | /*Capture mixer control */ |
| 8537 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8538 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8539 | { |
| 8540 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8541 | .name = "Capture Source", |
| 8542 | .count = 1, |
| 8543 | .info = alc_mux_enum_info, |
| 8544 | .get = alc_mux_enum_get, |
| 8545 | .put = alc_mux_enum_put, |
| 8546 | }, |
| 8547 | |
| 8548 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8549 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8550 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8551 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 8552 | /* output mixer control */ |
| 8553 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8554 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8555 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8556 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8557 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 8558 | |
| 8559 | /* Input mixer control */ |
| 8560 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8561 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 8562 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8563 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8564 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8565 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8566 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8567 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8568 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 8569 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8570 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8571 | /* Capture mixer control */ |
| 8572 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8573 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8574 | { |
| 8575 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8576 | .name = "Capture Source", |
| 8577 | .count = 1, |
| 8578 | .info = alc_mux_enum_info, |
| 8579 | .get = alc_mux_enum_get, |
| 8580 | .put = alc_mux_enum_put, |
| 8581 | }, |
| 8582 | { |
| 8583 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8584 | .name = "Channel Mode", |
| 8585 | .info = alc_ch_mode_info, |
| 8586 | .get = alc_ch_mode_get, |
| 8587 | .put = alc_ch_mode_put, |
| 8588 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 8589 | }, |
| 8590 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8591 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8592 | |
| 8593 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 8594 | /* output mixer control */ |
| 8595 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 8596 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 8597 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 8598 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 8599 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 8600 | |
| 8601 | /* Input mixer control */ |
| 8602 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 8603 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8604 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8605 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8606 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 8607 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 8608 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 8609 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 8610 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8611 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 8612 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8613 | /* Capture mixer control */ |
| 8614 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 8615 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 8616 | { |
| 8617 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8618 | .name = "Capture Source", |
| 8619 | .count = 1, |
| 8620 | .info = alc_mux_enum_info, |
| 8621 | .get = alc_mux_enum_get, |
| 8622 | .put = alc_mux_enum_put, |
| 8623 | }, |
| 8624 | { |
| 8625 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8626 | .name = "Channel Mode", |
| 8627 | .info = alc_ch_mode_info, |
| 8628 | .get = alc_ch_mode_get, |
| 8629 | .put = alc_ch_mode_put, |
| 8630 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 8631 | }, |
| 8632 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8633 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8634 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8635 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8636 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8637 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 8638 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 8639 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 8640 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 8641 | { } |
| 8642 | }; |
| 8643 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8644 | /* |
| 8645 | * generic initialization of ADC, input mixers and output mixers |
| 8646 | */ |
| 8647 | static struct hda_verb alc861_base_init_verbs[] = { |
| 8648 | /* |
| 8649 | * Unmute ADC0 and set the default input to mic-in |
| 8650 | */ |
| 8651 | /* port-A for surround (rear panel) */ |
| 8652 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8653 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8654 | /* port-B for mic-in (rear panel) with vref */ |
| 8655 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8656 | /* port-C for line-in (rear panel) */ |
| 8657 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8658 | /* port-D for Front */ |
| 8659 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8660 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8661 | /* port-E for HP out (front panel) */ |
| 8662 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 8663 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 8664 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8665 | /* port-F for mic-in (front panel) with vref */ |
| 8666 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8667 | /* port-G for CLFE (rear panel) */ |
| 8668 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8669 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8670 | /* port-H for side (rear panel) */ |
| 8671 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8672 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8673 | /* CD-in */ |
| 8674 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8675 | /* route front mic to ADC1*/ |
| 8676 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8677 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8678 | |
| 8679 | /* Unmute DAC0~3 & spdif out*/ |
| 8680 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8681 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8682 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8683 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8684 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8685 | |
| 8686 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 8687 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8688 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8689 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8690 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8691 | |
| 8692 | /* Unmute Stereo Mixer 15 */ |
| 8693 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8694 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8695 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8696 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8697 | |
| 8698 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8699 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8700 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8701 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8702 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8703 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8704 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8705 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8706 | /* hp used DAC 3 (Front) */ |
| 8707 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8708 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8709 | |
| 8710 | { } |
| 8711 | }; |
| 8712 | |
| 8713 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 8714 | /* |
| 8715 | * Unmute ADC0 and set the default input to mic-in |
| 8716 | */ |
| 8717 | /* port-A for surround (rear panel) */ |
| 8718 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8719 | /* port-B for mic-in (rear panel) with vref */ |
| 8720 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8721 | /* port-C for line-in (rear panel) */ |
| 8722 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8723 | /* port-D for Front */ |
| 8724 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8725 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8726 | /* port-E for HP out (front panel) */ |
| 8727 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 8728 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 8729 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8730 | /* port-F for mic-in (front panel) with vref */ |
| 8731 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8732 | /* port-G for CLFE (rear panel) */ |
| 8733 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8734 | /* port-H for side (rear panel) */ |
| 8735 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8736 | /* CD-in */ |
| 8737 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8738 | /* route front mic to ADC1*/ |
| 8739 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8740 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8741 | /* Unmute DAC0~3 & spdif out*/ |
| 8742 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8743 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8744 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8745 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8746 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8747 | |
| 8748 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 8749 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8750 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8751 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8752 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8753 | |
| 8754 | /* Unmute Stereo Mixer 15 */ |
| 8755 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8756 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8757 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8758 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8759 | |
| 8760 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8761 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8762 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8763 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8764 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8765 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8766 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8767 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8768 | /* hp used DAC 3 (Front) */ |
| 8769 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8770 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8771 | { } |
| 8772 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8773 | |
| 8774 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 8775 | /* |
| 8776 | * Unmute ADC0 and set the default input to mic-in |
| 8777 | */ |
| 8778 | /* port-A for surround (rear panel) */ |
| 8779 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8780 | /* port-B for mic-in (rear panel) with vref */ |
| 8781 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8782 | /* port-C for line-in (rear panel) */ |
| 8783 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8784 | /* port-D for Front */ |
| 8785 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8786 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8787 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8788 | /* this has to be set to VREF80 */ |
| 8789 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8790 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 8791 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8792 | /* port-F for mic-in (front panel) with vref */ |
| 8793 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8794 | /* port-G for CLFE (rear panel) */ |
| 8795 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8796 | /* port-H for side (rear panel) */ |
| 8797 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8798 | /* CD-in */ |
| 8799 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8800 | /* route front mic to ADC1*/ |
| 8801 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8802 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8803 | /* Unmute DAC0~3 & spdif out*/ |
| 8804 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8805 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8806 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8807 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8808 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8809 | |
| 8810 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 8811 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8812 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8813 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8814 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8815 | |
| 8816 | /* Unmute Stereo Mixer 15 */ |
| 8817 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8818 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8819 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8820 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8821 | |
| 8822 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8823 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8824 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8825 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8826 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8827 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8828 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8829 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8830 | /* hp used DAC 3 (Front) */ |
| 8831 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 8832 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8833 | { } |
| 8834 | }; |
| 8835 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8836 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 8837 | /* |
| 8838 | * Unmute ADC0 and set the default input to mic-in |
| 8839 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8840 | /* port-A for surround (rear panel) |
| 8841 | * according to codec#0 this is the HP jack |
| 8842 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8843 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 8844 | /* route front PCM to HP */ |
| 8845 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8846 | /* port-B for mic-in (rear panel) with vref */ |
| 8847 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8848 | /* port-C for line-in (rear panel) */ |
| 8849 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8850 | /* port-D for Front */ |
| 8851 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8852 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8853 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8854 | /* this has to be set to VREF80 */ |
| 8855 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8856 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 8857 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8858 | /* port-F for mic-in (front panel) with vref */ |
| 8859 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 8860 | /* port-G for CLFE (rear panel) */ |
| 8861 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8862 | /* port-H for side (rear panel) */ |
| 8863 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 8864 | /* CD-in */ |
| 8865 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 8866 | /* route front mic to ADC1*/ |
| 8867 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8868 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8869 | /* Unmute DAC0~3 & spdif out*/ |
| 8870 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8871 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8872 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8873 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8874 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8875 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 8876 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8877 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8878 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8879 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8880 | |
| 8881 | /* Unmute Stereo Mixer 15 */ |
| 8882 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8883 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8884 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8885 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8886 | |
| 8887 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8888 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8889 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8890 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8891 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8892 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8893 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8894 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8895 | /* hp used DAC 3 (Front) */ |
| 8896 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8897 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8898 | { } |
| 8899 | }; |
| 8900 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 8901 | /* additional init verbs for ASUS laptops */ |
| 8902 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 8903 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 8904 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 8905 | { } |
| 8906 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 8907 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8908 | /* |
| 8909 | * generic initialization of ADC, input mixers and output mixers |
| 8910 | */ |
| 8911 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 8912 | /* |
| 8913 | * Unmute ADC0 and set the default input to mic-in |
| 8914 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8915 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8916 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8917 | |
| 8918 | /* Unmute DAC0~3 & spdif out*/ |
| 8919 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8920 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8921 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8922 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8923 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8924 | |
| 8925 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 8926 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8927 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8928 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8929 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8930 | |
| 8931 | /* Unmute Stereo Mixer 15 */ |
| 8932 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8933 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8934 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8935 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 8936 | |
| 8937 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8938 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8939 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8940 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8941 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8942 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8943 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8944 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8945 | |
| 8946 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8947 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8948 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8949 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8950 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8951 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8952 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8953 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8954 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8955 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8956 | |
| 8957 | { } |
| 8958 | }; |
| 8959 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8960 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 8961 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8962 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8963 | { } |
| 8964 | }; |
| 8965 | |
| 8966 | /* toggle speaker-output according to the hp-jack state */ |
| 8967 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 8968 | { |
| 8969 | unsigned int present; |
| 8970 | |
| 8971 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 8972 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8973 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0, |
| 8974 | 0x80, present ? 0x80 : 0); |
| 8975 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0, |
| 8976 | 0x80, present ? 0x80 : 0); |
| 8977 | snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3, |
| 8978 | 0x80, present ? 0 : 0x80); |
| 8979 | snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3, |
| 8980 | 0x80, present ? 0 : 0x80); |
| 8981 | } |
| 8982 | |
| 8983 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 8984 | unsigned int res) |
| 8985 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 8986 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8987 | alc861_toshiba_automute(codec); |
| 8988 | } |
| 8989 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8990 | /* pcm configuration: identiacal with ALC880 */ |
| 8991 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 8992 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 8993 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 8994 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 8995 | |
| 8996 | |
| 8997 | #define ALC861_DIGOUT_NID 0x07 |
| 8998 | |
| 8999 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 9000 | { 8, NULL } |
| 9001 | }; |
| 9002 | |
| 9003 | static hda_nid_t alc861_dac_nids[4] = { |
| 9004 | /* front, surround, clfe, side */ |
| 9005 | 0x03, 0x06, 0x05, 0x04 |
| 9006 | }; |
| 9007 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9008 | static hda_nid_t alc660_dac_nids[3] = { |
| 9009 | /* front, clfe, surround */ |
| 9010 | 0x03, 0x05, 0x06 |
| 9011 | }; |
| 9012 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9013 | static hda_nid_t alc861_adc_nids[1] = { |
| 9014 | /* ADC0-2 */ |
| 9015 | 0x08, |
| 9016 | }; |
| 9017 | |
| 9018 | static struct hda_input_mux alc861_capture_source = { |
| 9019 | .num_items = 5, |
| 9020 | .items = { |
| 9021 | { "Mic", 0x0 }, |
| 9022 | { "Front Mic", 0x3 }, |
| 9023 | { "Line", 0x1 }, |
| 9024 | { "CD", 0x4 }, |
| 9025 | { "Mixer", 0x5 }, |
| 9026 | }, |
| 9027 | }; |
| 9028 | |
| 9029 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9030 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 9031 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9032 | { |
| 9033 | int i; |
| 9034 | hda_nid_t nid; |
| 9035 | |
| 9036 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9037 | for (i = 0; i < cfg->line_outs; i++) { |
| 9038 | nid = cfg->line_out_pins[i]; |
| 9039 | if (nid) { |
| 9040 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 9041 | continue; |
| 9042 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 9043 | } |
| 9044 | } |
| 9045 | spec->multiout.num_dacs = cfg->line_outs; |
| 9046 | return 0; |
| 9047 | } |
| 9048 | |
| 9049 | /* add playback controls from the parsed DAC table */ |
| 9050 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9051 | const struct auto_pin_cfg *cfg) |
| 9052 | { |
| 9053 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9054 | static const char *chname[4] = { |
| 9055 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 9056 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9057 | hda_nid_t nid; |
| 9058 | int i, idx, err; |
| 9059 | |
| 9060 | for (i = 0; i < cfg->line_outs; i++) { |
| 9061 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9062 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9063 | continue; |
| 9064 | if (nid == 0x05) { |
| 9065 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9066 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9067 | "Center Playback Switch", |
| 9068 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 9069 | HDA_OUTPUT)); |
| 9070 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9071 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9072 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 9073 | "LFE Playback Switch", |
| 9074 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9075 | HDA_OUTPUT)); |
| 9076 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9077 | return err; |
| 9078 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9079 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 9080 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9081 | if (nid == alc861_dac_nids[idx]) |
| 9082 | break; |
| 9083 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9084 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 9085 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9086 | HDA_OUTPUT)); |
| 9087 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9088 | return err; |
| 9089 | } |
| 9090 | } |
| 9091 | return 0; |
| 9092 | } |
| 9093 | |
| 9094 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 9095 | { |
| 9096 | int err; |
| 9097 | hda_nid_t nid; |
| 9098 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9099 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9100 | return 0; |
| 9101 | |
| 9102 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 9103 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9104 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9105 | "Headphone Playback Switch", |
| 9106 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9107 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9108 | return err; |
| 9109 | spec->multiout.hp_nid = nid; |
| 9110 | } |
| 9111 | return 0; |
| 9112 | } |
| 9113 | |
| 9114 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9115 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 9116 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9117 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9118 | struct hda_input_mux *imux = &spec->private_imux; |
| 9119 | int i, err, idx, idx1; |
| 9120 | |
| 9121 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9122 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9123 | case 0x0c: |
| 9124 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9125 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9126 | break; |
| 9127 | case 0x0f: |
| 9128 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9129 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9130 | break; |
| 9131 | case 0x0d: |
| 9132 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9133 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9134 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9135 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9136 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9137 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9138 | break; |
| 9139 | case 0x11: |
| 9140 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9141 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9142 | break; |
| 9143 | default: |
| 9144 | continue; |
| 9145 | } |
| 9146 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9147 | err = new_analog_input(spec, cfg->input_pins[i], |
| 9148 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9149 | if (err < 0) |
| 9150 | return err; |
| 9151 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9152 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9153 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9154 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9155 | } |
| 9156 | return 0; |
| 9157 | } |
| 9158 | |
| 9159 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 9160 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 9161 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 9162 | |
| 9163 | { |
| 9164 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9165 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9166 | * So call somewhat different.. |
| 9167 | *FIXME: the controls appear in the "playback" view! |
| 9168 | */ |
| 9169 | /* .name = "Capture Source", */ |
| 9170 | .name = "Input Source", |
| 9171 | .count = 1, |
| 9172 | .info = alc_mux_enum_info, |
| 9173 | .get = alc_mux_enum_get, |
| 9174 | .put = alc_mux_enum_put, |
| 9175 | }, |
| 9176 | { } /* end */ |
| 9177 | }; |
| 9178 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9179 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9180 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9181 | int pin_type, int dac_idx) |
| 9182 | { |
| 9183 | /* set as output */ |
| 9184 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9185 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9186 | pin_type); |
| 9187 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 9188 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9189 | |
| 9190 | } |
| 9191 | |
| 9192 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 9193 | { |
| 9194 | struct alc_spec *spec = codec->spec; |
| 9195 | int i; |
| 9196 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9197 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9198 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 9199 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9200 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9201 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9202 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9203 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9204 | } |
| 9205 | } |
| 9206 | |
| 9207 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 9208 | { |
| 9209 | struct alc_spec *spec = codec->spec; |
| 9210 | hda_nid_t pin; |
| 9211 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9212 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9213 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9214 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 9215 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9216 | } |
| 9217 | |
| 9218 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 9219 | { |
| 9220 | struct alc_spec *spec = codec->spec; |
| 9221 | int i; |
| 9222 | |
| 9223 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9224 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9225 | if (nid >= 0x0c && nid <= 0x11) { |
| 9226 | snd_hda_codec_write(codec, nid, 0, |
| 9227 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9228 | i <= AUTO_PIN_FRONT_MIC ? |
| 9229 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9230 | } |
| 9231 | } |
| 9232 | } |
| 9233 | |
| 9234 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9235 | /* return 1 if successful, 0 if the proper config is not found, |
| 9236 | * or a negative error code |
| 9237 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9238 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 9239 | { |
| 9240 | struct alc_spec *spec = codec->spec; |
| 9241 | int err; |
| 9242 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 9243 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9244 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9245 | alc861_ignore); |
| 9246 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9247 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9248 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9249 | return 0; /* can't find valid BIOS pin config */ |
| 9250 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9251 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 9252 | if (err < 0) |
| 9253 | return err; |
| 9254 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9255 | if (err < 0) |
| 9256 | return err; |
| 9257 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 9258 | if (err < 0) |
| 9259 | return err; |
| 9260 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9261 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9262 | return err; |
| 9263 | |
| 9264 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9265 | |
| 9266 | if (spec->autocfg.dig_out_pin) |
| 9267 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 9268 | |
| 9269 | if (spec->kctl_alloc) |
| 9270 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9271 | |
| 9272 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 9273 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9274 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9275 | spec->input_mux = &spec->private_imux; |
| 9276 | |
| 9277 | spec->adc_nids = alc861_adc_nids; |
| 9278 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 9279 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 9280 | spec->num_mixers++; |
| 9281 | |
| 9282 | return 1; |
| 9283 | } |
| 9284 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9285 | /* additional initialization for auto-configuration model */ |
| 9286 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9287 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9288 | alc861_auto_init_multi_out(codec); |
| 9289 | alc861_auto_init_hp_out(codec); |
| 9290 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9291 | } |
| 9292 | |
| 9293 | |
| 9294 | /* |
| 9295 | * configuration and preset |
| 9296 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9297 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 9298 | [ALC861_3ST] = "3stack", |
| 9299 | [ALC660_3ST] = "3stack-660", |
| 9300 | [ALC861_3ST_DIG] = "3stack-dig", |
| 9301 | [ALC861_6ST_DIG] = "6stack-dig", |
| 9302 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 9303 | [ALC861_TOSHIBA] = "toshiba", |
| 9304 | [ALC861_ASUS] = "asus", |
| 9305 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 9306 | [ALC861_AUTO] = "auto", |
| 9307 | }; |
| 9308 | |
| 9309 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 9310 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9311 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 9312 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f223a9f | 2007-04-25 13:38:31 +0200 | [diff] [blame] | 9313 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9314 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 9315 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9316 | SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), |
| 9317 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
Dave Jones | 35739bb | 2007-06-06 14:48:52 +0200 | [diff] [blame] | 9318 | SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), |
Takashi Iwai | 4147dab | 2007-01-31 10:35:19 +0100 | [diff] [blame] | 9319 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 9320 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9321 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9322 | {} |
| 9323 | }; |
| 9324 | |
| 9325 | static struct alc_config_preset alc861_presets[] = { |
| 9326 | [ALC861_3ST] = { |
| 9327 | .mixers = { alc861_3ST_mixer }, |
| 9328 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9329 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9330 | .dac_nids = alc861_dac_nids, |
| 9331 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9332 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9333 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9334 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9335 | .adc_nids = alc861_adc_nids, |
| 9336 | .input_mux = &alc861_capture_source, |
| 9337 | }, |
| 9338 | [ALC861_3ST_DIG] = { |
| 9339 | .mixers = { alc861_base_mixer }, |
| 9340 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9341 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9342 | .dac_nids = alc861_dac_nids, |
| 9343 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9344 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9345 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9346 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9347 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9348 | .adc_nids = alc861_adc_nids, |
| 9349 | .input_mux = &alc861_capture_source, |
| 9350 | }, |
| 9351 | [ALC861_6ST_DIG] = { |
| 9352 | .mixers = { alc861_base_mixer }, |
| 9353 | .init_verbs = { alc861_base_init_verbs }, |
| 9354 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9355 | .dac_nids = alc861_dac_nids, |
| 9356 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9357 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 9358 | .channel_mode = alc861_8ch_modes, |
| 9359 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9360 | .adc_nids = alc861_adc_nids, |
| 9361 | .input_mux = &alc861_capture_source, |
| 9362 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9363 | [ALC660_3ST] = { |
| 9364 | .mixers = { alc861_3ST_mixer }, |
| 9365 | .init_verbs = { alc861_threestack_init_verbs }, |
| 9366 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 9367 | .dac_nids = alc660_dac_nids, |
| 9368 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 9369 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9370 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9371 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9372 | .adc_nids = alc861_adc_nids, |
| 9373 | .input_mux = &alc861_capture_source, |
| 9374 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 9375 | [ALC861_UNIWILL_M31] = { |
| 9376 | .mixers = { alc861_uniwill_m31_mixer }, |
| 9377 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 9378 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9379 | .dac_nids = alc861_dac_nids, |
| 9380 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9381 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 9382 | .channel_mode = alc861_uniwill_m31_modes, |
| 9383 | .need_dac_fix = 1, |
| 9384 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9385 | .adc_nids = alc861_adc_nids, |
| 9386 | .input_mux = &alc861_capture_source, |
| 9387 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9388 | [ALC861_TOSHIBA] = { |
| 9389 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9390 | .init_verbs = { alc861_base_init_verbs, |
| 9391 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 9392 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9393 | .dac_nids = alc861_dac_nids, |
| 9394 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9395 | .channel_mode = alc883_3ST_2ch_modes, |
| 9396 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9397 | .adc_nids = alc861_adc_nids, |
| 9398 | .input_mux = &alc861_capture_source, |
| 9399 | .unsol_event = alc861_toshiba_unsol_event, |
| 9400 | .init_hook = alc861_toshiba_automute, |
| 9401 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 9402 | [ALC861_ASUS] = { |
| 9403 | .mixers = { alc861_asus_mixer }, |
| 9404 | .init_verbs = { alc861_asus_init_verbs }, |
| 9405 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9406 | .dac_nids = alc861_dac_nids, |
| 9407 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9408 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 9409 | .channel_mode = alc861_asus_modes, |
| 9410 | .need_dac_fix = 1, |
| 9411 | .hp_nid = 0x06, |
| 9412 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9413 | .adc_nids = alc861_adc_nids, |
| 9414 | .input_mux = &alc861_capture_source, |
| 9415 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 9416 | [ALC861_ASUS_LAPTOP] = { |
| 9417 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 9418 | .init_verbs = { alc861_asus_init_verbs, |
| 9419 | alc861_asus_laptop_init_verbs }, |
| 9420 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 9421 | .dac_nids = alc861_dac_nids, |
| 9422 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 9423 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9424 | .channel_mode = alc883_3ST_2ch_modes, |
| 9425 | .need_dac_fix = 1, |
| 9426 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 9427 | .adc_nids = alc861_adc_nids, |
| 9428 | .input_mux = &alc861_capture_source, |
| 9429 | }, |
| 9430 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9431 | |
| 9432 | |
| 9433 | static int patch_alc861(struct hda_codec *codec) |
| 9434 | { |
| 9435 | struct alc_spec *spec; |
| 9436 | int board_config; |
| 9437 | int err; |
| 9438 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9439 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9440 | if (spec == NULL) |
| 9441 | return -ENOMEM; |
| 9442 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9443 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9444 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9445 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 9446 | alc861_models, |
| 9447 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9448 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9449 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9450 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 9451 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9452 | board_config = ALC861_AUTO; |
| 9453 | } |
| 9454 | |
| 9455 | if (board_config == ALC861_AUTO) { |
| 9456 | /* automatic parse from the BIOS config */ |
| 9457 | err = alc861_parse_auto_config(codec); |
| 9458 | if (err < 0) { |
| 9459 | alc_free(codec); |
| 9460 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9461 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9462 | printk(KERN_INFO |
| 9463 | "hda_codec: Cannot set up configuration " |
| 9464 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9465 | board_config = ALC861_3ST_DIG; |
| 9466 | } |
| 9467 | } |
| 9468 | |
| 9469 | if (board_config != ALC861_AUTO) |
| 9470 | setup_preset(spec, &alc861_presets[board_config]); |
| 9471 | |
| 9472 | spec->stream_name_analog = "ALC861 Analog"; |
| 9473 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 9474 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 9475 | |
| 9476 | spec->stream_name_digital = "ALC861 Digital"; |
| 9477 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 9478 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 9479 | |
| 9480 | codec->patch_ops = alc_patch_ops; |
| 9481 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9482 | spec->init_hook = alc861_auto_init; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9483 | |
| 9484 | return 0; |
| 9485 | } |
| 9486 | |
| 9487 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9488 | * ALC861-VD support |
| 9489 | * |
| 9490 | * Based on ALC882 |
| 9491 | * |
| 9492 | * In addition, an independent DAC |
| 9493 | */ |
| 9494 | #define ALC861VD_DIGOUT_NID 0x06 |
| 9495 | |
| 9496 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 9497 | /* front, surr, clfe, side surr */ |
| 9498 | 0x02, 0x03, 0x04, 0x05 |
| 9499 | }; |
| 9500 | |
| 9501 | /* dac_nids for ALC660vd are in a different order - according to |
| 9502 | * Realtek's driver. |
| 9503 | * This should probably tesult in a different mixer for 6stack models |
| 9504 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 9505 | * - and it is the same as in 861vd. |
| 9506 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 9507 | */ |
| 9508 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 9509 | /* front, rear, clfe, rear_surr */ |
| 9510 | 0x02, 0x04, 0x03 |
| 9511 | }; |
| 9512 | |
| 9513 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 9514 | /* ADC0 */ |
| 9515 | 0x09, |
| 9516 | }; |
| 9517 | |
| 9518 | /* input MUX */ |
| 9519 | /* FIXME: should be a matrix-type input source selection */ |
| 9520 | static struct hda_input_mux alc861vd_capture_source = { |
| 9521 | .num_items = 4, |
| 9522 | .items = { |
| 9523 | { "Mic", 0x0 }, |
| 9524 | { "Front Mic", 0x1 }, |
| 9525 | { "Line", 0x2 }, |
| 9526 | { "CD", 0x4 }, |
| 9527 | }, |
| 9528 | }; |
| 9529 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9530 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 9531 | .num_items = 3, |
| 9532 | .items = { |
| 9533 | { "Front Mic", 0x0 }, |
| 9534 | { "ATAPI Mic", 0x1 }, |
| 9535 | { "Line In", 0x5 }, |
| 9536 | }, |
| 9537 | }; |
| 9538 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9539 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 9540 | #define alc861vd_mux_enum_get alc_mux_enum_get |
| 9541 | |
| 9542 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9543 | struct snd_ctl_elem_value *ucontrol) |
| 9544 | { |
| 9545 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9546 | struct alc_spec *spec = codec->spec; |
| 9547 | const struct hda_input_mux *imux = spec->input_mux; |
| 9548 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 9549 | static hda_nid_t capture_mixers[1] = { 0x22 }; |
| 9550 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 9551 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 9552 | unsigned int i, idx; |
| 9553 | |
| 9554 | idx = ucontrol->value.enumerated.item[0]; |
| 9555 | if (idx >= imux->num_items) |
| 9556 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9557 | if (*cur_val == idx && !codec->in_resume) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9558 | return 0; |
| 9559 | for (i = 0; i < imux->num_items; i++) { |
| 9560 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 9561 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 9562 | v | (imux->items[i].index << 8)); |
| 9563 | } |
| 9564 | *cur_val = idx; |
| 9565 | return 1; |
| 9566 | } |
| 9567 | |
| 9568 | /* |
| 9569 | * 2ch mode |
| 9570 | */ |
| 9571 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 9572 | { 2, NULL } |
| 9573 | }; |
| 9574 | |
| 9575 | /* |
| 9576 | * 6ch mode |
| 9577 | */ |
| 9578 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 9579 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 9580 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9581 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9582 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9583 | { } /* end */ |
| 9584 | }; |
| 9585 | |
| 9586 | /* |
| 9587 | * 8ch mode |
| 9588 | */ |
| 9589 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 9590 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9591 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9592 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9593 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9594 | { } /* end */ |
| 9595 | }; |
| 9596 | |
| 9597 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 9598 | { 6, alc861vd_6stack_ch6_init }, |
| 9599 | { 8, alc861vd_6stack_ch8_init }, |
| 9600 | }; |
| 9601 | |
| 9602 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 9603 | { |
| 9604 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9605 | .name = "Channel Mode", |
| 9606 | .info = alc_ch_mode_info, |
| 9607 | .get = alc_ch_mode_get, |
| 9608 | .put = alc_ch_mode_put, |
| 9609 | }, |
| 9610 | { } /* end */ |
| 9611 | }; |
| 9612 | |
| 9613 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 9614 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9615 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9616 | |
| 9617 | { |
| 9618 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9619 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9620 | * So call somewhat different.. |
| 9621 | *FIXME: the controls appear in the "playback" view! |
| 9622 | */ |
| 9623 | /* .name = "Capture Source", */ |
| 9624 | .name = "Input Source", |
| 9625 | .count = 1, |
| 9626 | .info = alc861vd_mux_enum_info, |
| 9627 | .get = alc861vd_mux_enum_get, |
| 9628 | .put = alc861vd_mux_enum_put, |
| 9629 | }, |
| 9630 | { } /* end */ |
| 9631 | }; |
| 9632 | |
| 9633 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 9634 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 9635 | */ |
| 9636 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 9637 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9638 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9639 | |
| 9640 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9641 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9642 | |
| 9643 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 9644 | HDA_OUTPUT), |
| 9645 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 9646 | HDA_OUTPUT), |
| 9647 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9648 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9649 | |
| 9650 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 9651 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9652 | |
| 9653 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9654 | |
| 9655 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9656 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9657 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9658 | |
| 9659 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9660 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9661 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9662 | |
| 9663 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9664 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9665 | |
| 9666 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9667 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9668 | |
| 9669 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9670 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9671 | |
| 9672 | { } /* end */ |
| 9673 | }; |
| 9674 | |
| 9675 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 9676 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9677 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9678 | |
| 9679 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9680 | |
| 9681 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9682 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9683 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9684 | |
| 9685 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9686 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9687 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9688 | |
| 9689 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9690 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9691 | |
| 9692 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9693 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9694 | |
| 9695 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9696 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9697 | |
| 9698 | { } /* end */ |
| 9699 | }; |
| 9700 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 9701 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 9702 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9703 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 9704 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9705 | |
| 9706 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9707 | |
| 9708 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9709 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9710 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9711 | |
| 9712 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9713 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9714 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9715 | |
| 9716 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9717 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9718 | |
| 9719 | { } /* end */ |
| 9720 | }; |
| 9721 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9722 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 9723 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 9724 | */ |
| 9725 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 9726 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9727 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9728 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9729 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9730 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9731 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9732 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9733 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9734 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9735 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9736 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 9737 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 9738 | { |
| 9739 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9740 | /* .name = "Capture Source", */ |
| 9741 | .name = "Input Source", |
| 9742 | .count = 1, |
| 9743 | .info = alc882_mux_enum_info, |
| 9744 | .get = alc882_mux_enum_get, |
| 9745 | .put = alc882_mux_enum_put, |
| 9746 | }, |
| 9747 | { } /* end */ |
| 9748 | }; |
| 9749 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9750 | /* |
| 9751 | * generic initialization of ADC, input mixers and output mixers |
| 9752 | */ |
| 9753 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 9754 | /* |
| 9755 | * Unmute ADC0 and set the default input to mic-in |
| 9756 | */ |
| 9757 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9758 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9759 | |
| 9760 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 9761 | * the analog-loopback mixer widget |
| 9762 | */ |
| 9763 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 9764 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9765 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 9767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 9768 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 9769 | |
| 9770 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 9771 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9772 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9773 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9774 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 9775 | |
| 9776 | /* |
| 9777 | * Set up output mixers (0x02 - 0x05) |
| 9778 | */ |
| 9779 | /* set vol=0 to output mixers */ |
| 9780 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9781 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9782 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9783 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9784 | |
| 9785 | /* set up input amps for analog loopback */ |
| 9786 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9787 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9788 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9789 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9790 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9791 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9792 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9793 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9794 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9795 | |
| 9796 | { } |
| 9797 | }; |
| 9798 | |
| 9799 | /* |
| 9800 | * 3-stack pin configuration: |
| 9801 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 9802 | */ |
| 9803 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 9804 | /* |
| 9805 | * Set pin mode and muting |
| 9806 | */ |
| 9807 | /* set front pin widgets 0x14 for output */ |
| 9808 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9809 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9810 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9811 | |
| 9812 | /* Mic (rear) pin: input vref at 80% */ |
| 9813 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9814 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9815 | /* Front Mic pin: input vref at 80% */ |
| 9816 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9817 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9818 | /* Line In pin: input */ |
| 9819 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9820 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9821 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 9822 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9823 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9824 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9825 | /* CD pin widget for input */ |
| 9826 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9827 | |
| 9828 | { } |
| 9829 | }; |
| 9830 | |
| 9831 | /* |
| 9832 | * 6-stack pin configuration: |
| 9833 | */ |
| 9834 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 9835 | /* |
| 9836 | * Set pin mode and muting |
| 9837 | */ |
| 9838 | /* set front pin widgets 0x14 for output */ |
| 9839 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9840 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9841 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9842 | |
| 9843 | /* Rear Pin: output 1 (0x0d) */ |
| 9844 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9845 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9846 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9847 | /* CLFE Pin: output 2 (0x0e) */ |
| 9848 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9849 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9850 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9851 | /* Side Pin: output 3 (0x0f) */ |
| 9852 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9853 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9854 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9855 | |
| 9856 | /* Mic (rear) pin: input vref at 80% */ |
| 9857 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9858 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9859 | /* Front Mic pin: input vref at 80% */ |
| 9860 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9861 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9862 | /* Line In pin: input */ |
| 9863 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9864 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9865 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 9866 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9867 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9868 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9869 | /* CD pin widget for input */ |
| 9870 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9871 | |
| 9872 | { } |
| 9873 | }; |
| 9874 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 9875 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 9876 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9877 | { } |
| 9878 | }; |
| 9879 | |
| 9880 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 9881 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9882 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9883 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9884 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9885 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9886 | {} |
| 9887 | }; |
| 9888 | |
| 9889 | /* toggle speaker-output according to the hp-jack state */ |
| 9890 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 9891 | { |
| 9892 | unsigned int present; |
| 9893 | unsigned char bits; |
| 9894 | |
| 9895 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9896 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9897 | bits = present ? 0x80 : 0; |
| 9898 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9899 | 0x80, bits); |
| 9900 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9901 | 0x80, bits); |
| 9902 | } |
| 9903 | |
| 9904 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 9905 | { |
| 9906 | unsigned int present; |
| 9907 | unsigned char bits; |
| 9908 | |
| 9909 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9910 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9911 | bits = present ? 0x80 : 0; |
| 9912 | snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, |
| 9913 | 0x80, bits); |
| 9914 | snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1, |
| 9915 | 0x80, bits); |
| 9916 | } |
| 9917 | |
| 9918 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 9919 | { |
| 9920 | alc861vd_lenovo_hp_automute(codec); |
| 9921 | alc861vd_lenovo_mic_automute(codec); |
| 9922 | } |
| 9923 | |
| 9924 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 9925 | unsigned int res) |
| 9926 | { |
| 9927 | switch (res >> 26) { |
| 9928 | case ALC880_HP_EVENT: |
| 9929 | alc861vd_lenovo_hp_automute(codec); |
| 9930 | break; |
| 9931 | case ALC880_MIC_EVENT: |
| 9932 | alc861vd_lenovo_mic_automute(codec); |
| 9933 | break; |
| 9934 | } |
| 9935 | } |
| 9936 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9937 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 9938 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9939 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9940 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9941 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9942 | |
| 9943 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9944 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9945 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9946 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9947 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9948 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9949 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9950 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9951 | |
| 9952 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9953 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9954 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9955 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9956 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9957 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9958 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9959 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9960 | |
| 9961 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 9962 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9963 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 9964 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9965 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9966 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9967 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9968 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9969 | |
| 9970 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9971 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9972 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9973 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9974 | |
| 9975 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9976 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9977 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9978 | |
| 9979 | { } /* end */ |
| 9980 | }; |
| 9981 | |
| 9982 | /* toggle speaker-output according to the hp-jack state */ |
| 9983 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 9984 | { |
| 9985 | unsigned int present; |
| 9986 | |
| 9987 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9988 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9989 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9990 | 0x80, present ? 0x80 : 0); |
| 9991 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9992 | 0x80, present ? 0x80 : 0); |
| 9993 | } |
| 9994 | |
| 9995 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9996 | { |
| 9997 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9998 | alc861vd_dallas_automute(codec); |
| 9999 | } |
| 10000 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10001 | /* pcm configuration: identiacal with ALC880 */ |
| 10002 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 10003 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 10004 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 10005 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 10006 | |
| 10007 | /* |
| 10008 | * configuration and preset |
| 10009 | */ |
| 10010 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 10011 | [ALC660VD_3ST] = "3stack-660", |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10012 | [ALC660VD_3ST_DIG]= "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10013 | [ALC861VD_3ST] = "3stack", |
| 10014 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 10015 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10016 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10017 | [ALC861VD_DALLAS] = "dallas", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10018 | [ALC861VD_AUTO] = "auto", |
| 10019 | }; |
| 10020 | |
| 10021 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 10022 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10023 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10024 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10025 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
| 10026 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 10027 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10028 | SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS), |
| 10029 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10030 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
| 10031 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
Takashi Iwai | a18519e | 2007-06-14 12:58:23 +0200 | [diff] [blame] | 10032 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10033 | {} |
| 10034 | }; |
| 10035 | |
| 10036 | static struct alc_config_preset alc861vd_presets[] = { |
| 10037 | [ALC660VD_3ST] = { |
| 10038 | .mixers = { alc861vd_3st_mixer }, |
| 10039 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10040 | alc861vd_3stack_init_verbs }, |
| 10041 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10042 | .dac_nids = alc660vd_dac_nids, |
| 10043 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10044 | .adc_nids = alc861vd_adc_nids, |
| 10045 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10046 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10047 | .input_mux = &alc861vd_capture_source, |
| 10048 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 10049 | [ALC660VD_3ST_DIG] = { |
| 10050 | .mixers = { alc861vd_3st_mixer }, |
| 10051 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10052 | alc861vd_3stack_init_verbs }, |
| 10053 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10054 | .dac_nids = alc660vd_dac_nids, |
| 10055 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10056 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10057 | .adc_nids = alc861vd_adc_nids, |
| 10058 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10059 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10060 | .input_mux = &alc861vd_capture_source, |
| 10061 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10062 | [ALC861VD_3ST] = { |
| 10063 | .mixers = { alc861vd_3st_mixer }, |
| 10064 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10065 | alc861vd_3stack_init_verbs }, |
| 10066 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10067 | .dac_nids = alc861vd_dac_nids, |
| 10068 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10069 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10070 | .input_mux = &alc861vd_capture_source, |
| 10071 | }, |
| 10072 | [ALC861VD_3ST_DIG] = { |
| 10073 | .mixers = { alc861vd_3st_mixer }, |
| 10074 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10075 | alc861vd_3stack_init_verbs }, |
| 10076 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10077 | .dac_nids = alc861vd_dac_nids, |
| 10078 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10079 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10080 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10081 | .input_mux = &alc861vd_capture_source, |
| 10082 | }, |
| 10083 | [ALC861VD_6ST_DIG] = { |
| 10084 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 10085 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10086 | alc861vd_6stack_init_verbs }, |
| 10087 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10088 | .dac_nids = alc861vd_dac_nids, |
| 10089 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 10090 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 10091 | .channel_mode = alc861vd_6stack_modes, |
| 10092 | .input_mux = &alc861vd_capture_source, |
| 10093 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10094 | [ALC861VD_LENOVO] = { |
| 10095 | .mixers = { alc861vd_lenovo_mixer }, |
| 10096 | .init_verbs = { alc861vd_volume_init_verbs, |
| 10097 | alc861vd_3stack_init_verbs, |
| 10098 | alc861vd_eapd_verbs, |
| 10099 | alc861vd_lenovo_unsol_verbs }, |
| 10100 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 10101 | .dac_nids = alc660vd_dac_nids, |
| 10102 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10103 | .adc_nids = alc861vd_adc_nids, |
| 10104 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10105 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10106 | .input_mux = &alc861vd_capture_source, |
| 10107 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 10108 | .init_hook = alc861vd_lenovo_automute, |
| 10109 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10110 | [ALC861VD_DALLAS] = { |
| 10111 | .mixers = { alc861vd_dallas_mixer }, |
| 10112 | .init_verbs = { alc861vd_dallas_verbs }, |
| 10113 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 10114 | .dac_nids = alc861vd_dac_nids, |
| 10115 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 10116 | .adc_nids = alc861vd_adc_nids, |
| 10117 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 10118 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 10119 | .input_mux = &alc861vd_dallas_capture_source, |
| 10120 | .unsol_event = alc861vd_dallas_unsol_event, |
| 10121 | .init_hook = alc861vd_dallas_automute, |
| 10122 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10123 | }; |
| 10124 | |
| 10125 | /* |
| 10126 | * BIOS auto configuration |
| 10127 | */ |
| 10128 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 10129 | hda_nid_t nid, int pin_type, int dac_idx) |
| 10130 | { |
| 10131 | /* set as output */ |
| 10132 | snd_hda_codec_write(codec, nid, 0, |
| 10133 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 10134 | snd_hda_codec_write(codec, nid, 0, |
| 10135 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 10136 | } |
| 10137 | |
| 10138 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 10139 | { |
| 10140 | struct alc_spec *spec = codec->spec; |
| 10141 | int i; |
| 10142 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10143 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10144 | for (i = 0; i <= HDA_SIDE; i++) { |
| 10145 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10146 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10147 | if (nid) |
| 10148 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10149 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10150 | } |
| 10151 | } |
| 10152 | |
| 10153 | |
| 10154 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 10155 | { |
| 10156 | struct alc_spec *spec = codec->spec; |
| 10157 | hda_nid_t pin; |
| 10158 | |
| 10159 | pin = spec->autocfg.hp_pins[0]; |
| 10160 | if (pin) /* connect to front and use dac 0 */ |
| 10161 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 10162 | } |
| 10163 | |
| 10164 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 10165 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 10166 | |
| 10167 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 10168 | { |
| 10169 | struct alc_spec *spec = codec->spec; |
| 10170 | int i; |
| 10171 | |
| 10172 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10173 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 10174 | if (alc861vd_is_input_pin(nid)) { |
| 10175 | snd_hda_codec_write(codec, nid, 0, |
| 10176 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10177 | i <= AUTO_PIN_FRONT_MIC ? |
| 10178 | PIN_VREF80 : PIN_IN); |
| 10179 | if (nid != ALC861VD_PIN_CD_NID) |
| 10180 | snd_hda_codec_write(codec, nid, 0, |
| 10181 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10182 | AMP_OUT_MUTE); |
| 10183 | } |
| 10184 | } |
| 10185 | } |
| 10186 | |
| 10187 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 10188 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 10189 | |
| 10190 | /* add playback controls from the parsed DAC table */ |
| 10191 | /* Based on ALC880 version. But ALC861VD has separate, |
| 10192 | * different NIDs for mute/unmute switch and volume control */ |
| 10193 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10194 | const struct auto_pin_cfg *cfg) |
| 10195 | { |
| 10196 | char name[32]; |
| 10197 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 10198 | hda_nid_t nid_v, nid_s; |
| 10199 | int i, err; |
| 10200 | |
| 10201 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10202 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10203 | continue; |
| 10204 | nid_v = alc861vd_idx_to_mixer_vol( |
| 10205 | alc880_dac_to_idx( |
| 10206 | spec->multiout.dac_nids[i])); |
| 10207 | nid_s = alc861vd_idx_to_mixer_switch( |
| 10208 | alc880_dac_to_idx( |
| 10209 | spec->multiout.dac_nids[i])); |
| 10210 | |
| 10211 | if (i == 2) { |
| 10212 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10213 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10214 | "Center Playback Volume", |
| 10215 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 10216 | HDA_OUTPUT)); |
| 10217 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10218 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10219 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10220 | "LFE Playback Volume", |
| 10221 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 10222 | HDA_OUTPUT)); |
| 10223 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10224 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10225 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10226 | "Center Playback Switch", |
| 10227 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 10228 | HDA_INPUT)); |
| 10229 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10230 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10231 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10232 | "LFE Playback Switch", |
| 10233 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 10234 | HDA_INPUT)); |
| 10235 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10236 | return err; |
| 10237 | } else { |
| 10238 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10239 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10240 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 10241 | HDA_OUTPUT)); |
| 10242 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10243 | return err; |
| 10244 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10245 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 10246 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10247 | HDA_INPUT)); |
| 10248 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10249 | return err; |
| 10250 | } |
| 10251 | } |
| 10252 | return 0; |
| 10253 | } |
| 10254 | |
| 10255 | /* add playback controls for speaker and HP outputs */ |
| 10256 | /* Based on ALC880 version. But ALC861VD has separate, |
| 10257 | * different NIDs for mute/unmute switch and volume control */ |
| 10258 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 10259 | hda_nid_t pin, const char *pfx) |
| 10260 | { |
| 10261 | hda_nid_t nid_v, nid_s; |
| 10262 | int err; |
| 10263 | char name[32]; |
| 10264 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10265 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10266 | return 0; |
| 10267 | |
| 10268 | if (alc880_is_fixed_pin(pin)) { |
| 10269 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 10270 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10271 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10272 | spec->multiout.hp_nid = nid_v; |
| 10273 | else |
| 10274 | spec->multiout.extra_out_nid[0] = nid_v; |
| 10275 | /* control HP volume/switch on the output mixer amp */ |
| 10276 | nid_v = alc861vd_idx_to_mixer_vol( |
| 10277 | alc880_fixed_pin_idx(pin)); |
| 10278 | nid_s = alc861vd_idx_to_mixer_switch( |
| 10279 | alc880_fixed_pin_idx(pin)); |
| 10280 | |
| 10281 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10282 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10283 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 10284 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10285 | return err; |
| 10286 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10287 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 10288 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 10289 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10290 | return err; |
| 10291 | } else if (alc880_is_multi_pin(pin)) { |
| 10292 | /* set manual connection */ |
| 10293 | /* we have only a switch on HP-out PIN */ |
| 10294 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10295 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10296 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 10297 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10298 | return err; |
| 10299 | } |
| 10300 | return 0; |
| 10301 | } |
| 10302 | |
| 10303 | /* parse the BIOS configuration and set up the alc_spec |
| 10304 | * return 1 if successful, 0 if the proper config is not found, |
| 10305 | * or a negative error code |
| 10306 | * Based on ALC880 version - had to change it to override |
| 10307 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 10308 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 10309 | { |
| 10310 | struct alc_spec *spec = codec->spec; |
| 10311 | int err; |
| 10312 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 10313 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10314 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10315 | alc861vd_ignore); |
| 10316 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10317 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10318 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10319 | return 0; /* can't find valid BIOS pin config */ |
| 10320 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10321 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10322 | if (err < 0) |
| 10323 | return err; |
| 10324 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10325 | if (err < 0) |
| 10326 | return err; |
| 10327 | err = alc861vd_auto_create_extra_out(spec, |
| 10328 | spec->autocfg.speaker_pins[0], |
| 10329 | "Speaker"); |
| 10330 | if (err < 0) |
| 10331 | return err; |
| 10332 | err = alc861vd_auto_create_extra_out(spec, |
| 10333 | spec->autocfg.hp_pins[0], |
| 10334 | "Headphone"); |
| 10335 | if (err < 0) |
| 10336 | return err; |
| 10337 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10338 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10339 | return err; |
| 10340 | |
| 10341 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10342 | |
| 10343 | if (spec->autocfg.dig_out_pin) |
| 10344 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 10345 | |
| 10346 | if (spec->kctl_alloc) |
| 10347 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10348 | |
| 10349 | spec->init_verbs[spec->num_init_verbs++] |
| 10350 | = alc861vd_volume_init_verbs; |
| 10351 | |
| 10352 | spec->num_mux_defs = 1; |
| 10353 | spec->input_mux = &spec->private_imux; |
| 10354 | |
| 10355 | return 1; |
| 10356 | } |
| 10357 | |
| 10358 | /* additional initialization for auto-configuration model */ |
| 10359 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 10360 | { |
| 10361 | alc861vd_auto_init_multi_out(codec); |
| 10362 | alc861vd_auto_init_hp_out(codec); |
| 10363 | alc861vd_auto_init_analog_input(codec); |
| 10364 | } |
| 10365 | |
| 10366 | static int patch_alc861vd(struct hda_codec *codec) |
| 10367 | { |
| 10368 | struct alc_spec *spec; |
| 10369 | int err, board_config; |
| 10370 | |
| 10371 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10372 | if (spec == NULL) |
| 10373 | return -ENOMEM; |
| 10374 | |
| 10375 | codec->spec = spec; |
| 10376 | |
| 10377 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 10378 | alc861vd_models, |
| 10379 | alc861vd_cfg_tbl); |
| 10380 | |
| 10381 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 10382 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 10383 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 10384 | board_config = ALC861VD_AUTO; |
| 10385 | } |
| 10386 | |
| 10387 | if (board_config == ALC861VD_AUTO) { |
| 10388 | /* automatic parse from the BIOS config */ |
| 10389 | err = alc861vd_parse_auto_config(codec); |
| 10390 | if (err < 0) { |
| 10391 | alc_free(codec); |
| 10392 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10393 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 10394 | printk(KERN_INFO |
| 10395 | "hda_codec: Cannot set up configuration " |
| 10396 | "from BIOS. Using base mode...\n"); |
| 10397 | board_config = ALC861VD_3ST; |
| 10398 | } |
| 10399 | } |
| 10400 | |
| 10401 | if (board_config != ALC861VD_AUTO) |
| 10402 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 10403 | |
| 10404 | spec->stream_name_analog = "ALC861VD Analog"; |
| 10405 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 10406 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 10407 | |
| 10408 | spec->stream_name_digital = "ALC861VD Digital"; |
| 10409 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 10410 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 10411 | |
| 10412 | spec->adc_nids = alc861vd_adc_nids; |
| 10413 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 10414 | |
| 10415 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 10416 | spec->num_mixers++; |
| 10417 | |
| 10418 | codec->patch_ops = alc_patch_ops; |
| 10419 | |
| 10420 | if (board_config == ALC861VD_AUTO) |
| 10421 | spec->init_hook = alc861vd_auto_init; |
| 10422 | |
| 10423 | return 0; |
| 10424 | } |
| 10425 | |
| 10426 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10427 | * ALC662 support |
| 10428 | * |
| 10429 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 10430 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 10431 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 10432 | * 6-channel independent captures. |
| 10433 | * |
| 10434 | * In addition, an independent DAC for the multi-playback (not used in this |
| 10435 | * driver yet). |
| 10436 | */ |
| 10437 | #define ALC662_DIGOUT_NID 0x06 |
| 10438 | #define ALC662_DIGIN_NID 0x0a |
| 10439 | |
| 10440 | static hda_nid_t alc662_dac_nids[4] = { |
| 10441 | /* front, rear, clfe, rear_surr */ |
| 10442 | 0x02, 0x03, 0x04 |
| 10443 | }; |
| 10444 | |
| 10445 | static hda_nid_t alc662_adc_nids[1] = { |
| 10446 | /* ADC1-2 */ |
| 10447 | 0x09, |
| 10448 | }; |
| 10449 | /* input MUX */ |
| 10450 | /* FIXME: should be a matrix-type input source selection */ |
| 10451 | |
| 10452 | static struct hda_input_mux alc662_capture_source = { |
| 10453 | .num_items = 4, |
| 10454 | .items = { |
| 10455 | { "Mic", 0x0 }, |
| 10456 | { "Front Mic", 0x1 }, |
| 10457 | { "Line", 0x2 }, |
| 10458 | { "CD", 0x4 }, |
| 10459 | }, |
| 10460 | }; |
| 10461 | |
| 10462 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 10463 | .num_items = 2, |
| 10464 | .items = { |
| 10465 | { "Mic", 0x1 }, |
| 10466 | { "Line", 0x2 }, |
| 10467 | }, |
| 10468 | }; |
| 10469 | #define alc662_mux_enum_info alc_mux_enum_info |
| 10470 | #define alc662_mux_enum_get alc_mux_enum_get |
| 10471 | |
| 10472 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10473 | struct snd_ctl_elem_value *ucontrol) |
| 10474 | { |
| 10475 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10476 | struct alc_spec *spec = codec->spec; |
| 10477 | const struct hda_input_mux *imux = spec->input_mux; |
| 10478 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 10479 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 10480 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 10481 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 10482 | unsigned int i, idx; |
| 10483 | |
| 10484 | idx = ucontrol->value.enumerated.item[0]; |
| 10485 | if (idx >= imux->num_items) |
| 10486 | idx = imux->num_items - 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10487 | if (*cur_val == idx && !codec->in_resume) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10488 | return 0; |
| 10489 | for (i = 0; i < imux->num_items; i++) { |
| 10490 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; |
| 10491 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 10492 | v | (imux->items[i].index << 8)); |
| 10493 | } |
| 10494 | *cur_val = idx; |
| 10495 | return 1; |
| 10496 | } |
| 10497 | /* |
| 10498 | * 2ch mode |
| 10499 | */ |
| 10500 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 10501 | { 2, NULL } |
| 10502 | }; |
| 10503 | |
| 10504 | /* |
| 10505 | * 2ch mode |
| 10506 | */ |
| 10507 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 10508 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 10509 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 10510 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 10511 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 10512 | { } /* end */ |
| 10513 | }; |
| 10514 | |
| 10515 | /* |
| 10516 | * 6ch mode |
| 10517 | */ |
| 10518 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 10519 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10520 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10521 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 10522 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10523 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10524 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 10525 | { } /* end */ |
| 10526 | }; |
| 10527 | |
| 10528 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 10529 | { 2, alc662_3ST_ch2_init }, |
| 10530 | { 6, alc662_3ST_ch6_init }, |
| 10531 | }; |
| 10532 | |
| 10533 | /* |
| 10534 | * 2ch mode |
| 10535 | */ |
| 10536 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 10537 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10538 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10539 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10540 | { } /* end */ |
| 10541 | }; |
| 10542 | |
| 10543 | /* |
| 10544 | * 6ch mode |
| 10545 | */ |
| 10546 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 10547 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10548 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10549 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10550 | { } /* end */ |
| 10551 | }; |
| 10552 | |
| 10553 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 10554 | { 2, alc662_sixstack_ch6_init }, |
| 10555 | { 6, alc662_sixstack_ch8_init }, |
| 10556 | }; |
| 10557 | |
| 10558 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 10559 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 10560 | */ |
| 10561 | |
| 10562 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 10563 | /* output mixer control */ |
| 10564 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10565 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 10566 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10567 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10568 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 10569 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 10570 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 10571 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 10572 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10573 | |
| 10574 | /*Input mixer control */ |
| 10575 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 10576 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 10577 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 10578 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 10579 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 10580 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 10581 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 10582 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
| 10583 | |
| 10584 | /* Capture mixer control */ |
| 10585 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10586 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10587 | { |
| 10588 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10589 | .name = "Capture Source", |
| 10590 | .count = 1, |
| 10591 | .info = alc_mux_enum_info, |
| 10592 | .get = alc_mux_enum_get, |
| 10593 | .put = alc_mux_enum_put, |
| 10594 | }, |
| 10595 | { } /* end */ |
| 10596 | }; |
| 10597 | |
| 10598 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 10599 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10600 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10601 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10602 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10603 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10604 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10605 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10606 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10607 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10608 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10609 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10610 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10611 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10612 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10613 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10614 | { |
| 10615 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10616 | /* .name = "Capture Source", */ |
| 10617 | .name = "Input Source", |
| 10618 | .count = 1, |
| 10619 | .info = alc662_mux_enum_info, |
| 10620 | .get = alc662_mux_enum_get, |
| 10621 | .put = alc662_mux_enum_put, |
| 10622 | }, |
| 10623 | { } /* end */ |
| 10624 | }; |
| 10625 | |
| 10626 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 10627 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10628 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10629 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10630 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 10631 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 10632 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 10633 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 10634 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 10635 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10636 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10637 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10638 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10639 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10640 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10641 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10642 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10643 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10644 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 10645 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 10646 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10647 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10648 | { |
| 10649 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10650 | /* .name = "Capture Source", */ |
| 10651 | .name = "Input Source", |
| 10652 | .count = 1, |
| 10653 | .info = alc662_mux_enum_info, |
| 10654 | .get = alc662_mux_enum_get, |
| 10655 | .put = alc662_mux_enum_put, |
| 10656 | }, |
| 10657 | { } /* end */ |
| 10658 | }; |
| 10659 | |
| 10660 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 10661 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10662 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 10663 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10664 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT), |
| 10665 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10666 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10667 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10668 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10669 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10670 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10671 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10672 | { |
| 10673 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10674 | /* .name = "Capture Source", */ |
| 10675 | .name = "Input Source", |
| 10676 | .count = 1, |
| 10677 | .info = alc662_mux_enum_info, |
| 10678 | .get = alc662_mux_enum_get, |
| 10679 | .put = alc662_mux_enum_put, |
| 10680 | }, |
| 10681 | { } /* end */ |
| 10682 | }; |
| 10683 | |
| 10684 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 10685 | { |
| 10686 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10687 | .name = "Channel Mode", |
| 10688 | .info = alc_ch_mode_info, |
| 10689 | .get = alc_ch_mode_get, |
| 10690 | .put = alc_ch_mode_put, |
| 10691 | }, |
| 10692 | { } /* end */ |
| 10693 | }; |
| 10694 | |
| 10695 | static struct hda_verb alc662_init_verbs[] = { |
| 10696 | /* ADC: mute amp left and right */ |
| 10697 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10698 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10699 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 10700 | |
| 10701 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10702 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10703 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10704 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 10705 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10706 | |
| 10707 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10708 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10709 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10710 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10711 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10712 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10713 | |
| 10714 | /* Front Pin: output 0 (0x0c) */ |
| 10715 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10716 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10717 | |
| 10718 | /* Rear Pin: output 1 (0x0d) */ |
| 10719 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10720 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10721 | |
| 10722 | /* CLFE Pin: output 2 (0x0e) */ |
| 10723 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10724 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10725 | |
| 10726 | /* Mic (rear) pin: input vref at 80% */ |
| 10727 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10728 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10729 | /* Front Mic pin: input vref at 80% */ |
| 10730 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10731 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10732 | /* Line In pin: input */ |
| 10733 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10734 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10735 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 10736 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10737 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10738 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10739 | /* CD pin widget for input */ |
| 10740 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10741 | |
| 10742 | /* FIXME: use matrix-type input source selection */ |
| 10743 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10744 | /* Input mixer */ |
| 10745 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10746 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10747 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10748 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10749 | { } |
| 10750 | }; |
| 10751 | |
| 10752 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 10753 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 10754 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 10755 | {} |
| 10756 | }; |
| 10757 | |
| 10758 | /* |
| 10759 | * generic initialization of ADC, input mixers and output mixers |
| 10760 | */ |
| 10761 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 10762 | /* |
| 10763 | * Unmute ADC and set the default input to mic-in |
| 10764 | */ |
| 10765 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10766 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10767 | |
| 10768 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 10769 | * mixer widget |
| 10770 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10771 | * panel mic (mic 2) |
| 10772 | */ |
| 10773 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10774 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10775 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10776 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10777 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 10778 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10779 | |
| 10780 | /* |
| 10781 | * Set up output mixers (0x0c - 0x0f) |
| 10782 | */ |
| 10783 | /* set vol=0 to output mixers */ |
| 10784 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10785 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10786 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10787 | |
| 10788 | /* set up input amps for analog loopback */ |
| 10789 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10790 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10791 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10792 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10793 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10794 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10795 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10796 | |
| 10797 | |
| 10798 | /* FIXME: use matrix-type input source selection */ |
| 10799 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10800 | /* Input mixer */ |
| 10801 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10802 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10803 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10804 | /*{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},*/ |
| 10805 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 10806 | |
| 10807 | { } |
| 10808 | }; |
| 10809 | |
| 10810 | /* capture mixer elements */ |
| 10811 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 10812 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 10813 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 10814 | { |
| 10815 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10816 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10817 | * So call somewhat different.. |
| 10818 | * FIXME: the controls appear in the "playback" view! |
| 10819 | */ |
| 10820 | /* .name = "Capture Source", */ |
| 10821 | .name = "Input Source", |
| 10822 | .count = 1, |
| 10823 | .info = alc882_mux_enum_info, |
| 10824 | .get = alc882_mux_enum_get, |
| 10825 | .put = alc882_mux_enum_put, |
| 10826 | }, |
| 10827 | { } /* end */ |
| 10828 | }; |
| 10829 | |
| 10830 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 10831 | { |
| 10832 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10833 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10834 | |
| 10835 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10836 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10837 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10838 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10839 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10840 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10841 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10842 | } |
| 10843 | |
| 10844 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 10845 | { |
| 10846 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10847 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10848 | |
| 10849 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 10850 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10851 | bits = present ? 0x80 : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10852 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10853 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10854 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10855 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10856 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10857 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10858 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10859 | 0x80, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10860 | } |
| 10861 | |
| 10862 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 10863 | unsigned int res) |
| 10864 | { |
| 10865 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10866 | alc662_lenovo_101e_all_automute(codec); |
| 10867 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 10868 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 10869 | } |
| 10870 | |
| 10871 | |
| 10872 | /* pcm configuration: identiacal with ALC880 */ |
| 10873 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 10874 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 10875 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 10876 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 10877 | |
| 10878 | /* |
| 10879 | * configuration and preset |
| 10880 | */ |
| 10881 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 10882 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 10883 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 10884 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 10885 | [ALC662_5ST_DIG] = "6stack-dig", |
| 10886 | [ALC662_LENOVO_101E] = "lenovo-101e", |
| 10887 | [ALC662_AUTO] = "auto", |
| 10888 | }; |
| 10889 | |
| 10890 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
| 10891 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
| 10892 | {} |
| 10893 | }; |
| 10894 | |
| 10895 | static struct alc_config_preset alc662_presets[] = { |
| 10896 | [ALC662_3ST_2ch_DIG] = { |
| 10897 | .mixers = { alc662_3ST_2ch_mixer }, |
| 10898 | .init_verbs = { alc662_init_verbs }, |
| 10899 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 10900 | .dac_nids = alc662_dac_nids, |
| 10901 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 10902 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 10903 | .adc_nids = alc662_adc_nids, |
| 10904 | .dig_in_nid = ALC662_DIGIN_NID, |
| 10905 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 10906 | .channel_mode = alc662_3ST_2ch_modes, |
| 10907 | .input_mux = &alc662_capture_source, |
| 10908 | }, |
| 10909 | [ALC662_3ST_6ch_DIG] = { |
| 10910 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 10911 | .init_verbs = { alc662_init_verbs }, |
| 10912 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 10913 | .dac_nids = alc662_dac_nids, |
| 10914 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 10915 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 10916 | .adc_nids = alc662_adc_nids, |
| 10917 | .dig_in_nid = ALC662_DIGIN_NID, |
| 10918 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 10919 | .channel_mode = alc662_3ST_6ch_modes, |
| 10920 | .need_dac_fix = 1, |
| 10921 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10922 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10923 | [ALC662_3ST_6ch] = { |
| 10924 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
| 10925 | .init_verbs = { alc662_init_verbs }, |
| 10926 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 10927 | .dac_nids = alc662_dac_nids, |
| 10928 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 10929 | .adc_nids = alc662_adc_nids, |
| 10930 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 10931 | .channel_mode = alc662_3ST_6ch_modes, |
| 10932 | .need_dac_fix = 1, |
| 10933 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10934 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10935 | [ALC662_5ST_DIG] = { |
| 10936 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
| 10937 | .init_verbs = { alc662_init_verbs }, |
| 10938 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 10939 | .dac_nids = alc662_dac_nids, |
| 10940 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 10941 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 10942 | .adc_nids = alc662_adc_nids, |
| 10943 | .dig_in_nid = ALC662_DIGIN_NID, |
| 10944 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 10945 | .channel_mode = alc662_5stack_modes, |
| 10946 | .input_mux = &alc662_capture_source, |
| 10947 | }, |
| 10948 | [ALC662_LENOVO_101E] = { |
| 10949 | .mixers = { alc662_lenovo_101e_mixer }, |
| 10950 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 10951 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 10952 | .dac_nids = alc662_dac_nids, |
| 10953 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 10954 | .adc_nids = alc662_adc_nids, |
| 10955 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 10956 | .channel_mode = alc662_3ST_2ch_modes, |
| 10957 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 10958 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 10959 | .init_hook = alc662_lenovo_101e_all_automute, |
| 10960 | }, |
| 10961 | |
| 10962 | }; |
| 10963 | |
| 10964 | |
| 10965 | /* |
| 10966 | * BIOS auto configuration |
| 10967 | */ |
| 10968 | |
| 10969 | /* add playback controls from the parsed DAC table */ |
| 10970 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10971 | const struct auto_pin_cfg *cfg) |
| 10972 | { |
| 10973 | char name[32]; |
| 10974 | static const char *chname[4] = { |
| 10975 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 10976 | }; |
| 10977 | hda_nid_t nid; |
| 10978 | int i, err; |
| 10979 | |
| 10980 | for (i = 0; i < cfg->line_outs; i++) { |
| 10981 | if (!spec->multiout.dac_nids[i]) |
| 10982 | continue; |
| 10983 | nid = alc880_idx_to_dac(i); |
| 10984 | if (i == 2) { |
| 10985 | /* Center/LFE */ |
| 10986 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10987 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10988 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 10989 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10990 | if (err < 0) |
| 10991 | return err; |
| 10992 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10993 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10994 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10995 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10996 | if (err < 0) |
| 10997 | return err; |
| 10998 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 10999 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11000 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 11001 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11002 | if (err < 0) |
| 11003 | return err; |
| 11004 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11005 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11006 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 11007 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11008 | if (err < 0) |
| 11009 | return err; |
| 11010 | } else { |
| 11011 | sprintf(name, "%s Playback Volume", chname[i]); |
| 11012 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11013 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11014 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11015 | if (err < 0) |
| 11016 | return err; |
| 11017 | sprintf(name, "%s Playback Switch", chname[i]); |
| 11018 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11019 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 11020 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11021 | if (err < 0) |
| 11022 | return err; |
| 11023 | } |
| 11024 | } |
| 11025 | return 0; |
| 11026 | } |
| 11027 | |
| 11028 | /* add playback controls for speaker and HP outputs */ |
| 11029 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 11030 | const char *pfx) |
| 11031 | { |
| 11032 | hda_nid_t nid; |
| 11033 | int err; |
| 11034 | char name[32]; |
| 11035 | |
| 11036 | if (!pin) |
| 11037 | return 0; |
| 11038 | |
| 11039 | if (alc880_is_fixed_pin(pin)) { |
| 11040 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 11041 | /* printk("DAC nid=%x\n",nid); */ |
| 11042 | /* specify the DAC as the extra output */ |
| 11043 | if (!spec->multiout.hp_nid) |
| 11044 | spec->multiout.hp_nid = nid; |
| 11045 | else |
| 11046 | spec->multiout.extra_out_nid[0] = nid; |
| 11047 | /* control HP volume/switch on the output mixer amp */ |
| 11048 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 11049 | sprintf(name, "%s Playback Volume", pfx); |
| 11050 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11051 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11052 | if (err < 0) |
| 11053 | return err; |
| 11054 | sprintf(name, "%s Playback Switch", pfx); |
| 11055 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11056 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 11057 | if (err < 0) |
| 11058 | return err; |
| 11059 | } else if (alc880_is_multi_pin(pin)) { |
| 11060 | /* set manual connection */ |
| 11061 | /* we have only a switch on HP-out PIN */ |
| 11062 | sprintf(name, "%s Playback Switch", pfx); |
| 11063 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11064 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 11065 | if (err < 0) |
| 11066 | return err; |
| 11067 | } |
| 11068 | return 0; |
| 11069 | } |
| 11070 | |
| 11071 | /* create playback/capture controls for input pins */ |
| 11072 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11073 | const struct auto_pin_cfg *cfg) |
| 11074 | { |
| 11075 | struct hda_input_mux *imux = &spec->private_imux; |
| 11076 | int i, err, idx; |
| 11077 | |
| 11078 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11079 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 11080 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 11081 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11082 | auto_pin_cfg_labels[i], |
| 11083 | idx, 0x0b); |
| 11084 | if (err < 0) |
| 11085 | return err; |
| 11086 | imux->items[imux->num_items].label = |
| 11087 | auto_pin_cfg_labels[i]; |
| 11088 | imux->items[imux->num_items].index = |
| 11089 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 11090 | imux->num_items++; |
| 11091 | } |
| 11092 | } |
| 11093 | return 0; |
| 11094 | } |
| 11095 | |
| 11096 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11097 | hda_nid_t nid, int pin_type, |
| 11098 | int dac_idx) |
| 11099 | { |
| 11100 | /* set as output */ |
| 11101 | snd_hda_codec_write(codec, nid, 0, |
| 11102 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 11103 | snd_hda_codec_write(codec, nid, 0, |
| 11104 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 11105 | /* need the manual connection? */ |
| 11106 | if (alc880_is_multi_pin(nid)) { |
| 11107 | struct alc_spec *spec = codec->spec; |
| 11108 | int idx = alc880_multi_pin_idx(nid); |
| 11109 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 11110 | AC_VERB_SET_CONNECT_SEL, |
| 11111 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 11112 | } |
| 11113 | } |
| 11114 | |
| 11115 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 11116 | { |
| 11117 | struct alc_spec *spec = codec->spec; |
| 11118 | int i; |
| 11119 | |
| 11120 | for (i = 0; i <= HDA_SIDE; i++) { |
| 11121 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11122 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11123 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11124 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11125 | i); |
| 11126 | } |
| 11127 | } |
| 11128 | |
| 11129 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 11130 | { |
| 11131 | struct alc_spec *spec = codec->spec; |
| 11132 | hda_nid_t pin; |
| 11133 | |
| 11134 | pin = spec->autocfg.hp_pins[0]; |
| 11135 | if (pin) /* connect to front */ |
| 11136 | /* use dac 0 */ |
| 11137 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 11138 | } |
| 11139 | |
| 11140 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 11141 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 11142 | |
| 11143 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 11144 | { |
| 11145 | struct alc_spec *spec = codec->spec; |
| 11146 | int i; |
| 11147 | |
| 11148 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11149 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 11150 | if (alc662_is_input_pin(nid)) { |
| 11151 | snd_hda_codec_write(codec, nid, 0, |
| 11152 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11153 | (i <= AUTO_PIN_FRONT_MIC ? |
| 11154 | PIN_VREF80 : PIN_IN)); |
| 11155 | if (nid != ALC662_PIN_CD_NID) |
| 11156 | snd_hda_codec_write(codec, nid, 0, |
| 11157 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11158 | AMP_OUT_MUTE); |
| 11159 | } |
| 11160 | } |
| 11161 | } |
| 11162 | |
| 11163 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 11164 | { |
| 11165 | struct alc_spec *spec = codec->spec; |
| 11166 | int err; |
| 11167 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 11168 | |
| 11169 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11170 | alc662_ignore); |
| 11171 | if (err < 0) |
| 11172 | return err; |
| 11173 | if (!spec->autocfg.line_outs) |
| 11174 | return 0; /* can't find valid BIOS pin config */ |
| 11175 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11176 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11177 | if (err < 0) |
| 11178 | return err; |
| 11179 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11180 | if (err < 0) |
| 11181 | return err; |
| 11182 | err = alc662_auto_create_extra_out(spec, |
| 11183 | spec->autocfg.speaker_pins[0], |
| 11184 | "Speaker"); |
| 11185 | if (err < 0) |
| 11186 | return err; |
| 11187 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 11188 | "Headphone"); |
| 11189 | if (err < 0) |
| 11190 | return err; |
| 11191 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11192 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11193 | return err; |
| 11194 | |
| 11195 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11196 | |
| 11197 | if (spec->autocfg.dig_out_pin) |
| 11198 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 11199 | |
| 11200 | if (spec->kctl_alloc) |
| 11201 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11202 | |
| 11203 | spec->num_mux_defs = 1; |
| 11204 | spec->input_mux = &spec->private_imux; |
| 11205 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11206 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11207 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 11208 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11209 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11210 | } |
| 11211 | |
| 11212 | /* additional initialization for auto-configuration model */ |
| 11213 | static void alc662_auto_init(struct hda_codec *codec) |
| 11214 | { |
| 11215 | alc662_auto_init_multi_out(codec); |
| 11216 | alc662_auto_init_hp_out(codec); |
| 11217 | alc662_auto_init_analog_input(codec); |
| 11218 | } |
| 11219 | |
| 11220 | static int patch_alc662(struct hda_codec *codec) |
| 11221 | { |
| 11222 | struct alc_spec *spec; |
| 11223 | int err, board_config; |
| 11224 | |
| 11225 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11226 | if (!spec) |
| 11227 | return -ENOMEM; |
| 11228 | |
| 11229 | codec->spec = spec; |
| 11230 | |
| 11231 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 11232 | alc662_models, |
| 11233 | alc662_cfg_tbl); |
| 11234 | if (board_config < 0) { |
| 11235 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 11236 | "trying auto-probe from BIOS...\n"); |
| 11237 | board_config = ALC662_AUTO; |
| 11238 | } |
| 11239 | |
| 11240 | if (board_config == ALC662_AUTO) { |
| 11241 | /* automatic parse from the BIOS config */ |
| 11242 | err = alc662_parse_auto_config(codec); |
| 11243 | if (err < 0) { |
| 11244 | alc_free(codec); |
| 11245 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 11246 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11247 | printk(KERN_INFO |
| 11248 | "hda_codec: Cannot set up configuration " |
| 11249 | "from BIOS. Using base mode...\n"); |
| 11250 | board_config = ALC662_3ST_2ch_DIG; |
| 11251 | } |
| 11252 | } |
| 11253 | |
| 11254 | if (board_config != ALC662_AUTO) |
| 11255 | setup_preset(spec, &alc662_presets[board_config]); |
| 11256 | |
| 11257 | spec->stream_name_analog = "ALC662 Analog"; |
| 11258 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 11259 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 11260 | |
| 11261 | spec->stream_name_digital = "ALC662 Digital"; |
| 11262 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 11263 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 11264 | |
| 11265 | if (!spec->adc_nids && spec->input_mux) { |
| 11266 | spec->adc_nids = alc662_adc_nids; |
| 11267 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 11268 | } |
| 11269 | |
| 11270 | codec->patch_ops = alc_patch_ops; |
| 11271 | if (board_config == ALC662_AUTO) |
| 11272 | spec->init_hook = alc662_auto_init; |
| 11273 | |
| 11274 | return 0; |
| 11275 | } |
| 11276 | |
| 11277 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11278 | * patch entries |
| 11279 | */ |
| 11280 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 11281 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11282 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11283 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11284 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11285 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11286 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 11287 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 11288 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11289 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 11290 | .patch = patch_alc883 }, |
| 11291 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 11292 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11293 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11294 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11295 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11296 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11297 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11298 | {} /* terminator */ |
| 11299 | }; |