Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
| 33 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 34 | #define ALC880_FRONT_EVENT 0x01 |
| 35 | #define ALC880_DCVOL_EVENT 0x02 |
| 36 | #define ALC880_HP_EVENT 0x04 |
| 37 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
| 39 | /* ALC880 board config type */ |
| 40 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | ALC880_3ST, |
| 42 | ALC880_3ST_DIG, |
| 43 | ALC880_5ST, |
| 44 | ALC880_5ST_DIG, |
| 45 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 46 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 47 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 48 | ALC880_6ST_DIG, |
| 49 | ALC880_F1734, |
| 50 | ALC880_ASUS, |
| 51 | ALC880_ASUS_DIG, |
| 52 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 53 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 54 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 55 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL, |
| 57 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 58 | ALC880_CLEVO, |
| 59 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 60 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 61 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 62 | ALC880_MEDION_RIM, |
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 | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 74 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 75 | ALC260_HP_3013, |
| 76 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 77 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 78 | ALC260_WILL, |
| 79 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 80 | #ifdef CONFIG_SND_DEBUG |
| 81 | ALC260_TEST, |
| 82 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 83 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 84 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | }; |
| 86 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 87 | /* ALC262 models */ |
| 88 | enum { |
| 89 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 90 | ALC262_HIPPO, |
| 91 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 92 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 93 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 94 | ALC262_HP_BPC_D7000_WL, |
| 95 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 96 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 97 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 98 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 99 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 100 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 101 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 102 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 103 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 104 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 105 | ALC262_TOSHIBA_RX1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 106 | ALC262_AUTO, |
| 107 | ALC262_MODEL_LAST /* last tag */ |
| 108 | }; |
| 109 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 110 | /* ALC268 models */ |
| 111 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 112 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 114 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 115 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 116 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 117 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 118 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 119 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 120 | #ifdef CONFIG_SND_DEBUG |
| 121 | ALC268_TEST, |
| 122 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 123 | ALC268_AUTO, |
| 124 | ALC268_MODEL_LAST /* last tag */ |
| 125 | }; |
| 126 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 127 | /* ALC269 models */ |
| 128 | enum { |
| 129 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 130 | ALC269_QUANTA_FL1, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 131 | ALC269_ASUS_EEEPC_P703, |
| 132 | ALC269_ASUS_EEEPC_P901, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 133 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 134 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 135 | ALC269_AUTO, |
| 136 | ALC269_MODEL_LAST /* last tag */ |
| 137 | }; |
| 138 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 139 | /* ALC861 models */ |
| 140 | enum { |
| 141 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 142 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 143 | ALC861_3ST_DIG, |
| 144 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 145 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 146 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 147 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 148 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 149 | ALC861_AUTO, |
| 150 | ALC861_MODEL_LAST, |
| 151 | }; |
| 152 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 153 | /* ALC861-VD models */ |
| 154 | enum { |
| 155 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 156 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 157 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 158 | ALC861VD_3ST, |
| 159 | ALC861VD_3ST_DIG, |
| 160 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 161 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 162 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 163 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 164 | ALC861VD_AUTO, |
| 165 | ALC861VD_MODEL_LAST, |
| 166 | }; |
| 167 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 168 | /* ALC662 models */ |
| 169 | enum { |
| 170 | ALC662_3ST_2ch_DIG, |
| 171 | ALC662_3ST_6ch_DIG, |
| 172 | ALC662_3ST_6ch, |
| 173 | ALC662_5ST_DIG, |
| 174 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 175 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 176 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 177 | ALC663_ASUS_M51VA, |
| 178 | ALC663_ASUS_G71V, |
| 179 | ALC663_ASUS_H13, |
| 180 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 181 | ALC662_ECS, |
| 182 | ALC663_ASUS_MODE1, |
| 183 | ALC662_ASUS_MODE2, |
| 184 | ALC663_ASUS_MODE3, |
| 185 | ALC663_ASUS_MODE4, |
| 186 | ALC663_ASUS_MODE5, |
| 187 | ALC663_ASUS_MODE6, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 188 | ALC662_AUTO, |
| 189 | ALC662_MODEL_LAST, |
| 190 | }; |
| 191 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 192 | /* ALC882 models */ |
| 193 | enum { |
| 194 | ALC882_3ST_DIG, |
| 195 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 196 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 197 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 198 | ALC882_TARGA, |
| 199 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 200 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 201 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 202 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 203 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 204 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 205 | ALC882_MODEL_LAST, |
| 206 | }; |
| 207 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 208 | /* ALC883 models */ |
| 209 | enum { |
| 210 | ALC883_3ST_2ch_DIG, |
| 211 | ALC883_3ST_6ch_DIG, |
| 212 | ALC883_3ST_6ch, |
| 213 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 214 | ALC883_TARGA_DIG, |
| 215 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 216 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 217 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 218 | ALC888_ACER_ASPIRE_4930G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 219 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 220 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 221 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 222 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 223 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 224 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 225 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 226 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 227 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 228 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 229 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 230 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 231 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 232 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 233 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 234 | ALC888_ASUS_M90V, |
| 235 | ALC888_ASUS_EEE1601, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 236 | ALC1200_ASUS_P5Q, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 237 | ALC883_AUTO, |
| 238 | ALC883_MODEL_LAST, |
| 239 | }; |
| 240 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 241 | /* styles of capture selection */ |
| 242 | enum { |
| 243 | CAPT_MUX = 0, /* only mux based */ |
| 244 | CAPT_MIX, /* only mixer based */ |
| 245 | CAPT_1MUX_MIX, /* first mux and other mixers */ |
| 246 | }; |
| 247 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 248 | /* for GPIO Poll */ |
| 249 | #define GPIO_MASK 0x03 |
| 250 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | struct alc_spec { |
| 252 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 253 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 255 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 257 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | * don't forget NULL |
| 259 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 260 | */ |
| 261 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 263 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | struct hda_pcm_stream *stream_analog_playback; |
| 265 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 266 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 267 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 269 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | struct hda_pcm_stream *stream_digital_playback; |
| 271 | struct hda_pcm_stream *stream_digital_capture; |
| 272 | |
| 273 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 274 | struct hda_multi_out multiout; /* playback set-up |
| 275 | * max_channels, dacs must be set |
| 276 | * dig_out_nid and hp_nid are optional |
| 277 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 278 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 279 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | |
| 281 | /* capture */ |
| 282 | unsigned int num_adc_nids; |
| 283 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 284 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 285 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 286 | int capture_style; /* capture style (CAPT_*) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | |
| 288 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 289 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | const struct hda_input_mux *input_mux; |
| 291 | unsigned int cur_mux[3]; |
| 292 | |
| 293 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 294 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 296 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | |
| 298 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 299 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 300 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 301 | /* dynamic controls, init_verbs and input_mux */ |
| 302 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 303 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 304 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 305 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 306 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 307 | /* hooks */ |
| 308 | void (*init_hook)(struct hda_codec *codec); |
| 309 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 310 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 311 | /* for pin sensing */ |
| 312 | unsigned int sense_updated: 1; |
| 313 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 314 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 315 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 316 | /* other flags */ |
| 317 | unsigned int no_analog :1; /* digital I/O only */ |
| 318 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 319 | /* for virtual master */ |
| 320 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 321 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 322 | struct hda_loopback_check loopback; |
| 323 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 324 | |
| 325 | /* for PLL fix */ |
| 326 | hda_nid_t pll_nid; |
| 327 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 328 | |
| 329 | #ifdef SND_HDA_NEEDS_RESUME |
| 330 | #define ALC_MAX_PINS 16 |
| 331 | unsigned int num_pins; |
| 332 | hda_nid_t pin_nids[ALC_MAX_PINS]; |
| 333 | unsigned int pin_cfgs[ALC_MAX_PINS]; |
| 334 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 335 | }; |
| 336 | |
| 337 | /* |
| 338 | * configuration template - to be copied to the spec instance |
| 339 | */ |
| 340 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 341 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 342 | * with spec |
| 343 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 344 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 345 | const struct hda_verb *init_verbs[5]; |
| 346 | unsigned int num_dacs; |
| 347 | hda_nid_t *dac_nids; |
| 348 | hda_nid_t dig_out_nid; /* optional */ |
| 349 | hda_nid_t hp_nid; /* optional */ |
| 350 | unsigned int num_adc_nids; |
| 351 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 352 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 353 | hda_nid_t dig_in_nid; |
| 354 | unsigned int num_channel_mode; |
| 355 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 356 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 357 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 358 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 359 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 360 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 361 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 362 | struct hda_amp_list *loopbacks; |
| 363 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | }; |
| 365 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | |
| 367 | /* |
| 368 | * input MUX handling |
| 369 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 370 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 371 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | { |
| 373 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 374 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 375 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 376 | if (mux_idx >= spec->num_mux_defs) |
| 377 | mux_idx = 0; |
| 378 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | } |
| 380 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 381 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 382 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | { |
| 384 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 385 | struct alc_spec *spec = codec->spec; |
| 386 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 387 | |
| 388 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 389 | return 0; |
| 390 | } |
| 391 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 392 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 393 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | { |
| 395 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 396 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 397 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 399 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 400 | hda_nid_t nid = spec->capsrc_nids ? |
| 401 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 403 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 404 | imux = &spec->input_mux[mux_idx]; |
| 405 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 406 | if (spec->capture_style && |
| 407 | !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 408 | /* Matrix-mixer style (e.g. ALC882) */ |
| 409 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 410 | unsigned int i, idx; |
| 411 | |
| 412 | idx = ucontrol->value.enumerated.item[0]; |
| 413 | if (idx >= imux->num_items) |
| 414 | idx = imux->num_items - 1; |
| 415 | if (*cur_val == idx) |
| 416 | return 0; |
| 417 | for (i = 0; i < imux->num_items; i++) { |
| 418 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 419 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 420 | imux->items[i].index, |
| 421 | HDA_AMP_MUTE, v); |
| 422 | } |
| 423 | *cur_val = idx; |
| 424 | return 1; |
| 425 | } else { |
| 426 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 427 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 428 | &spec->cur_mux[adc_idx]); |
| 429 | } |
| 430 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 431 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | /* |
| 433 | * channel mode setting |
| 434 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 435 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 436 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | { |
| 438 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 439 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 440 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 441 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | } |
| 443 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 444 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 445 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | { |
| 447 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 448 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 449 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 450 | spec->num_channel_mode, |
| 451 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | } |
| 453 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 454 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 455 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | { |
| 457 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 458 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 459 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 460 | spec->num_channel_mode, |
| 461 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 462 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 463 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 464 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | } |
| 466 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 468 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 469 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 470 | * being part of a format specifier. Maximum allowed length of a value is |
| 471 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 472 | * |
| 473 | * Note: some retasking pin complexes seem to ignore requests for input |
| 474 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 475 | * are requested. Therefore order this list so that this behaviour will not |
| 476 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 477 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 478 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 479 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 480 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 481 | "Mic 50pc bias", "Mic 80pc bias", |
| 482 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 483 | }; |
| 484 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 485 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 486 | }; |
| 487 | /* 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] | 488 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 489 | * addition, "input" pins may or may not process the mic bias option |
| 490 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 491 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 492 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 493 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 494 | #define ALC_PIN_DIR_IN 0x00 |
| 495 | #define ALC_PIN_DIR_OUT 0x01 |
| 496 | #define ALC_PIN_DIR_INOUT 0x02 |
| 497 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 498 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 499 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 500 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 501 | * For each direction the minimum and maximum values are given. |
| 502 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 503 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 504 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 505 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 506 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 507 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 508 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 509 | }; |
| 510 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 511 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 512 | #define alc_pin_mode_n_items(_dir) \ |
| 513 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 514 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 515 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 516 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 517 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 518 | unsigned int item_num = uinfo->value.enumerated.item; |
| 519 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 520 | |
| 521 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 522 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 523 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 524 | |
| 525 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 526 | item_num = alc_pin_mode_min(dir); |
| 527 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 528 | return 0; |
| 529 | } |
| 530 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 531 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 532 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 533 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 534 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 535 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 536 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 537 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 538 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 539 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 540 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 541 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 542 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 543 | /* Find enumerated value for current pinctl setting */ |
| 544 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 545 | 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] | 546 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 547 | *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] | 548 | return 0; |
| 549 | } |
| 550 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 551 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 552 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 553 | { |
| 554 | signed int change; |
| 555 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 556 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 557 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 558 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 559 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 560 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 561 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 562 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 563 | 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] | 564 | val = alc_pin_mode_min(dir); |
| 565 | |
| 566 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 567 | if (change) { |
| 568 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 569 | snd_hda_codec_write_cache(codec, nid, 0, |
| 570 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 571 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 572 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 573 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 574 | * for the requested pin mode. Enum values of 2 or less are |
| 575 | * input modes. |
| 576 | * |
| 577 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 578 | * reduces noise slightly (particularly on input) so we'll |
| 579 | * do it. However, having both input and output buffers |
| 580 | * enabled simultaneously doesn't seem to be problematic if |
| 581 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 582 | */ |
| 583 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 584 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 585 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 586 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 587 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 588 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 589 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 590 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 591 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 592 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 593 | } |
| 594 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 595 | return change; |
| 596 | } |
| 597 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 598 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 599 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 600 | .info = alc_pin_mode_info, \ |
| 601 | .get = alc_pin_mode_get, \ |
| 602 | .put = alc_pin_mode_put, \ |
| 603 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 604 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 605 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 606 | * together using a mask with more than one bit set. This control is |
| 607 | * currently used only by the ALC260 test model. At this stage they are not |
| 608 | * needed for any "production" models. |
| 609 | */ |
| 610 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 611 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 612 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 613 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 614 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 615 | { |
| 616 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 617 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 618 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 619 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 620 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 621 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 622 | |
| 623 | *valp = (val & mask) != 0; |
| 624 | return 0; |
| 625 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 626 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 627 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 628 | { |
| 629 | signed int change; |
| 630 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 631 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 632 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 633 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 634 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 635 | AC_VERB_GET_GPIO_DATA, |
| 636 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 637 | |
| 638 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 639 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 640 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 641 | gpio_data &= ~mask; |
| 642 | else |
| 643 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 644 | snd_hda_codec_write_cache(codec, nid, 0, |
| 645 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 646 | |
| 647 | return change; |
| 648 | } |
| 649 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 650 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 651 | .info = alc_gpio_data_info, \ |
| 652 | .get = alc_gpio_data_get, \ |
| 653 | .put = alc_gpio_data_put, \ |
| 654 | .private_value = nid | (mask<<16) } |
| 655 | #endif /* CONFIG_SND_DEBUG */ |
| 656 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 657 | /* A switch control to allow the enabling of the digital IO pins on the |
| 658 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 659 | * to provide something in the test model allowing digital outputs to be |
| 660 | * identified if present. If models are found which can utilise these |
| 661 | * outputs a more complete mixer control can be devised for those models if |
| 662 | * necessary. |
| 663 | */ |
| 664 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 665 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 666 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 667 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 668 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 669 | { |
| 670 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 671 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 672 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 673 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 674 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 675 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 676 | |
| 677 | *valp = (val & mask) != 0; |
| 678 | return 0; |
| 679 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 680 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 681 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 682 | { |
| 683 | signed int change; |
| 684 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 685 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 686 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 687 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 688 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 689 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 690 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 691 | |
| 692 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 693 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 694 | if (val==0) |
| 695 | ctrl_data &= ~mask; |
| 696 | else |
| 697 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 698 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 699 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 700 | |
| 701 | return change; |
| 702 | } |
| 703 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 704 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 705 | .info = alc_spdif_ctrl_info, \ |
| 706 | .get = alc_spdif_ctrl_get, \ |
| 707 | .put = alc_spdif_ctrl_put, \ |
| 708 | .private_value = nid | (mask<<16) } |
| 709 | #endif /* CONFIG_SND_DEBUG */ |
| 710 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 711 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 712 | * Again, this is only used in the ALC26x test models to help identify when |
| 713 | * the EAPD line must be asserted for features to work. |
| 714 | */ |
| 715 | #ifdef CONFIG_SND_DEBUG |
| 716 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 717 | |
| 718 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 719 | struct snd_ctl_elem_value *ucontrol) |
| 720 | { |
| 721 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 722 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 723 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 724 | long *valp = ucontrol->value.integer.value; |
| 725 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 726 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 727 | |
| 728 | *valp = (val & mask) != 0; |
| 729 | return 0; |
| 730 | } |
| 731 | |
| 732 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 733 | struct snd_ctl_elem_value *ucontrol) |
| 734 | { |
| 735 | int change; |
| 736 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 737 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 738 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 739 | long val = *ucontrol->value.integer.value; |
| 740 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 741 | AC_VERB_GET_EAPD_BTLENABLE, |
| 742 | 0x00); |
| 743 | |
| 744 | /* Set/unset the masked control bit(s) as needed */ |
| 745 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 746 | if (!val) |
| 747 | ctrl_data &= ~mask; |
| 748 | else |
| 749 | ctrl_data |= mask; |
| 750 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 751 | ctrl_data); |
| 752 | |
| 753 | return change; |
| 754 | } |
| 755 | |
| 756 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 757 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 758 | .info = alc_eapd_ctrl_info, \ |
| 759 | .get = alc_eapd_ctrl_get, \ |
| 760 | .put = alc_eapd_ctrl_put, \ |
| 761 | .private_value = nid | (mask<<16) } |
| 762 | #endif /* CONFIG_SND_DEBUG */ |
| 763 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 764 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 765 | */ |
| 766 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 767 | { |
| 768 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 769 | return; |
| 770 | spec->mixers[spec->num_mixers++] = mix; |
| 771 | } |
| 772 | |
| 773 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 774 | { |
| 775 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 776 | return; |
| 777 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 778 | } |
| 779 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 780 | #ifdef CONFIG_PROC_FS |
| 781 | /* |
| 782 | * hook for proc |
| 783 | */ |
| 784 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 785 | struct hda_codec *codec, hda_nid_t nid) |
| 786 | { |
| 787 | int coeff; |
| 788 | |
| 789 | if (nid != 0x20) |
| 790 | return; |
| 791 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 792 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 793 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 794 | AC_VERB_GET_COEF_INDEX, 0); |
| 795 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 796 | } |
| 797 | #else |
| 798 | #define print_realtek_coef NULL |
| 799 | #endif |
| 800 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 801 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 802 | * set up from the preset table |
| 803 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 804 | static void setup_preset(struct alc_spec *spec, |
| 805 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 806 | { |
| 807 | int i; |
| 808 | |
| 809 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 810 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 811 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 812 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 813 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 814 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 815 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 816 | spec->channel_mode = preset->channel_mode; |
| 817 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 818 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 819 | |
| 820 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 821 | |
| 822 | spec->multiout.num_dacs = preset->num_dacs; |
| 823 | spec->multiout.dac_nids = preset->dac_nids; |
| 824 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 825 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 826 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 827 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 828 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 829 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 830 | spec->input_mux = preset->input_mux; |
| 831 | |
| 832 | spec->num_adc_nids = preset->num_adc_nids; |
| 833 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 834 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 835 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 836 | |
| 837 | spec->unsol_event = preset->unsol_event; |
| 838 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 839 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 840 | spec->loopback.amplist = preset->loopbacks; |
| 841 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 842 | } |
| 843 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 844 | /* Enable GPIO mask and set output */ |
| 845 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 846 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 847 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 848 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 849 | { } |
| 850 | }; |
| 851 | |
| 852 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 853 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 854 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 855 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 856 | { } |
| 857 | }; |
| 858 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 859 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 860 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 861 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 862 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 863 | { } |
| 864 | }; |
| 865 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 866 | /* |
| 867 | * Fix hardware PLL issue |
| 868 | * On some codecs, the analog PLL gating control must be off while |
| 869 | * the default value is 1. |
| 870 | */ |
| 871 | static void alc_fix_pll(struct hda_codec *codec) |
| 872 | { |
| 873 | struct alc_spec *spec = codec->spec; |
| 874 | unsigned int val; |
| 875 | |
| 876 | if (!spec->pll_nid) |
| 877 | return; |
| 878 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 879 | spec->pll_coef_idx); |
| 880 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 881 | AC_VERB_GET_PROC_COEF, 0); |
| 882 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 883 | spec->pll_coef_idx); |
| 884 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 885 | val & ~(1 << spec->pll_coef_bit)); |
| 886 | } |
| 887 | |
| 888 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 889 | unsigned int coef_idx, unsigned int coef_bit) |
| 890 | { |
| 891 | struct alc_spec *spec = codec->spec; |
| 892 | spec->pll_nid = nid; |
| 893 | spec->pll_coef_idx = coef_idx; |
| 894 | spec->pll_coef_bit = coef_bit; |
| 895 | alc_fix_pll(codec); |
| 896 | } |
| 897 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 898 | static void alc_sku_automute(struct hda_codec *codec) |
| 899 | { |
| 900 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 901 | unsigned int present; |
| 902 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 903 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 904 | |
| 905 | /* need to execute and sync at first */ |
| 906 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 907 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 908 | AC_VERB_GET_PIN_SENSE, 0); |
| 909 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 910 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 911 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 912 | } |
| 913 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 914 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 915 | static void alc_mic_automute(struct hda_codec *codec) |
| 916 | { |
| 917 | struct alc_spec *spec = codec->spec; |
| 918 | unsigned int present; |
| 919 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 920 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 921 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 922 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 923 | |
| 924 | capsrc_idx_mic = mic_nid - 0x18; |
| 925 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 926 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 927 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 928 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 929 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 930 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 931 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 932 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 933 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 934 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 935 | #else |
| 936 | #define alc_mic_automute(codec) /* NOP */ |
| 937 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 938 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 939 | /* unsolicited event for HP jack sensing */ |
| 940 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 941 | { |
| 942 | if (codec->vendor_id == 0x10ec0880) |
| 943 | res >>= 28; |
| 944 | else |
| 945 | res >>= 26; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 946 | if (res == ALC880_HP_EVENT) |
| 947 | alc_sku_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 948 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 949 | if (res == ALC880_MIC_EVENT) |
| 950 | alc_mic_automute(codec); |
| 951 | } |
| 952 | |
| 953 | static void alc_inithook(struct hda_codec *codec) |
| 954 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 955 | alc_sku_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 956 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 957 | } |
| 958 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 959 | /* additional initialization for ALC888 variants */ |
| 960 | static void alc888_coef_init(struct hda_codec *codec) |
| 961 | { |
| 962 | unsigned int tmp; |
| 963 | |
| 964 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 965 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 966 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 967 | if ((tmp & 0xf0) == 2) |
| 968 | /* alc888S-VC */ |
| 969 | snd_hda_codec_read(codec, 0x20, 0, |
| 970 | AC_VERB_SET_PROC_COEF, 0x830); |
| 971 | else |
| 972 | /* alc888-VB */ |
| 973 | snd_hda_codec_read(codec, 0x20, 0, |
| 974 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 975 | } |
| 976 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 977 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 978 | * 31 ~ 16 : Manufacture ID |
| 979 | * 15 ~ 8 : SKU ID |
| 980 | * 7 ~ 0 : Assembly ID |
| 981 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 982 | */ |
| 983 | static void alc_subsystem_id(struct hda_codec *codec, |
| 984 | unsigned int porta, unsigned int porte, |
| 985 | unsigned int portd) |
| 986 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 987 | unsigned int ass, tmp, i; |
| 988 | unsigned nid; |
| 989 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 990 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 991 | ass = codec->subsystem_id & 0xffff; |
| 992 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 993 | goto do_sku; |
| 994 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 995 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 996 | * 31~30 : port conetcivity |
| 997 | * 29~21 : reserve |
| 998 | * 20 : PCBEEP input |
| 999 | * 19~16 : Check sum (15:1) |
| 1000 | * 15~1 : Custom |
| 1001 | * 0 : override |
| 1002 | */ |
| 1003 | nid = 0x1d; |
| 1004 | if (codec->vendor_id == 0x10ec0260) |
| 1005 | nid = 0x17; |
| 1006 | ass = snd_hda_codec_read(codec, nid, 0, |
| 1007 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 1008 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1009 | return; |
| 1010 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1011 | return; |
| 1012 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1013 | /* check sum */ |
| 1014 | tmp = 0; |
| 1015 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1016 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1017 | tmp++; |
| 1018 | } |
| 1019 | if (((ass >> 16) & 0xf) != tmp) |
| 1020 | return; |
| 1021 | do_sku: |
| 1022 | /* |
| 1023 | * 0 : override |
| 1024 | * 1 : Swap Jack |
| 1025 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1026 | * 3~5 : External Amplifier control |
| 1027 | * 7~6 : Reserved |
| 1028 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1029 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1030 | switch (tmp) { |
| 1031 | case 1: |
| 1032 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1033 | break; |
| 1034 | case 3: |
| 1035 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1036 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1037 | case 7: |
| 1038 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1039 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1040 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1041 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1042 | case 0x10ec0260: |
| 1043 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1044 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1045 | snd_hda_codec_write(codec, 0x10, 0, |
| 1046 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1047 | break; |
| 1048 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1049 | case 0x10ec0267: |
| 1050 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1051 | case 0x10ec0269: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1052 | case 0x10ec0660: |
| 1053 | case 0x10ec0662: |
| 1054 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1055 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1056 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1057 | snd_hda_codec_write(codec, 0x14, 0, |
| 1058 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1059 | snd_hda_codec_write(codec, 0x15, 0, |
| 1060 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1061 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1062 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1063 | switch (codec->vendor_id) { |
| 1064 | case 0x10ec0260: |
| 1065 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1066 | AC_VERB_SET_COEF_INDEX, 7); |
| 1067 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1068 | AC_VERB_GET_PROC_COEF, 0); |
| 1069 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1070 | AC_VERB_SET_COEF_INDEX, 7); |
| 1071 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1072 | AC_VERB_SET_PROC_COEF, |
| 1073 | tmp | 0x2010); |
| 1074 | break; |
| 1075 | case 0x10ec0262: |
| 1076 | case 0x10ec0880: |
| 1077 | case 0x10ec0882: |
| 1078 | case 0x10ec0883: |
| 1079 | case 0x10ec0885: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1080 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1081 | snd_hda_codec_write(codec, 0x20, 0, |
| 1082 | AC_VERB_SET_COEF_INDEX, 7); |
| 1083 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1084 | AC_VERB_GET_PROC_COEF, 0); |
| 1085 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1086 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1087 | snd_hda_codec_write(codec, 0x20, 0, |
| 1088 | AC_VERB_SET_PROC_COEF, |
| 1089 | tmp | 0x2010); |
| 1090 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1091 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 1092 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1093 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1094 | case 0x10ec0267: |
| 1095 | case 0x10ec0268: |
| 1096 | snd_hda_codec_write(codec, 0x20, 0, |
| 1097 | AC_VERB_SET_COEF_INDEX, 7); |
| 1098 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1099 | AC_VERB_GET_PROC_COEF, 0); |
| 1100 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1101 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1102 | snd_hda_codec_write(codec, 0x20, 0, |
| 1103 | AC_VERB_SET_PROC_COEF, |
| 1104 | tmp | 0x3000); |
| 1105 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1106 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1107 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1108 | break; |
| 1109 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1110 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1111 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1112 | * when the external headphone out jack is plugged" |
| 1113 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1114 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1115 | return; |
| 1116 | /* |
| 1117 | * 10~8 : Jack location |
| 1118 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1119 | * 14~13: Resvered |
| 1120 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1121 | * when the external headphone out jack is plugged" |
| 1122 | */ |
| 1123 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1124 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1125 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1126 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1127 | else |
| 1128 | return; |
| 1129 | } |
| 1130 | |
| 1131 | if (!spec->autocfg.hp_pins[0]) { |
| 1132 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1133 | if (tmp == 0) |
| 1134 | spec->autocfg.hp_pins[0] = porta; |
| 1135 | else if (tmp == 1) |
| 1136 | spec->autocfg.hp_pins[0] = porte; |
| 1137 | else if (tmp == 2) |
| 1138 | spec->autocfg.hp_pins[0] = portd; |
| 1139 | else |
| 1140 | return; |
| 1141 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1142 | if (spec->autocfg.hp_pins[0]) |
| 1143 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1144 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1145 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1146 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1147 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1148 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
| 1149 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) |
| 1150 | snd_hda_codec_write(codec, |
| 1151 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, |
| 1152 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1153 | AC_USRSP_EN | ALC880_MIC_EVENT); |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1154 | #endif /* disabled */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1155 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1156 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1157 | } |
| 1158 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1159 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1160 | * Fix-up pin default configurations |
| 1161 | */ |
| 1162 | |
| 1163 | struct alc_pincfg { |
| 1164 | hda_nid_t nid; |
| 1165 | u32 val; |
| 1166 | }; |
| 1167 | |
| 1168 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1169 | const struct snd_pci_quirk *quirk, |
| 1170 | const struct alc_pincfg **pinfix) |
| 1171 | { |
| 1172 | const struct alc_pincfg *cfg; |
| 1173 | |
| 1174 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1175 | if (!quirk) |
| 1176 | return; |
| 1177 | |
| 1178 | cfg = pinfix[quirk->value]; |
| 1179 | for (; cfg->nid; cfg++) { |
| 1180 | int i; |
| 1181 | u32 val = cfg->val; |
| 1182 | for (i = 0; i < 4; i++) { |
| 1183 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1184 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1185 | val & 0xff); |
| 1186 | val >>= 8; |
| 1187 | } |
| 1188 | } |
| 1189 | } |
| 1190 | |
| 1191 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1192 | * ALC888 |
| 1193 | */ |
| 1194 | |
| 1195 | /* |
| 1196 | * 2ch mode |
| 1197 | */ |
| 1198 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1199 | /* Mic-in jack as mic in */ |
| 1200 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1201 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1202 | /* Line-in jack as Line in */ |
| 1203 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1204 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1205 | /* Line-Out as Front */ |
| 1206 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1207 | { } /* end */ |
| 1208 | }; |
| 1209 | |
| 1210 | /* |
| 1211 | * 4ch mode |
| 1212 | */ |
| 1213 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1214 | /* Mic-in jack as mic in */ |
| 1215 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1216 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1217 | /* Line-in jack as Surround */ |
| 1218 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1219 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1220 | /* Line-Out as Front */ |
| 1221 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1222 | { } /* end */ |
| 1223 | }; |
| 1224 | |
| 1225 | /* |
| 1226 | * 6ch mode |
| 1227 | */ |
| 1228 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1229 | /* Mic-in jack as CLFE */ |
| 1230 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1231 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1232 | /* Line-in jack as Surround */ |
| 1233 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1234 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1235 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1236 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1237 | { } /* end */ |
| 1238 | }; |
| 1239 | |
| 1240 | /* |
| 1241 | * 8ch mode |
| 1242 | */ |
| 1243 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1244 | /* Mic-in jack as CLFE */ |
| 1245 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1246 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1247 | /* Line-in jack as Surround */ |
| 1248 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1249 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1250 | /* Line-Out as Side */ |
| 1251 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1252 | { } /* end */ |
| 1253 | }; |
| 1254 | |
| 1255 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1256 | { 2, alc888_4ST_ch2_intel_init }, |
| 1257 | { 4, alc888_4ST_ch4_intel_init }, |
| 1258 | { 6, alc888_4ST_ch6_intel_init }, |
| 1259 | { 8, alc888_4ST_ch8_intel_init }, |
| 1260 | }; |
| 1261 | |
| 1262 | /* |
| 1263 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1264 | */ |
| 1265 | |
| 1266 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1267 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1268 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1269 | /* Connect Internal HP to Front */ |
| 1270 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1271 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1272 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1273 | /* Connect Bass HP to Front */ |
| 1274 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1275 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1276 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1277 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1278 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1279 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1280 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1281 | /* Connect Mic jack to CLFE */ |
| 1282 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1283 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1284 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1285 | /* Connect Line-in jack to Surround */ |
| 1286 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1287 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1288 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1289 | /* Connect HP out jack to Front */ |
| 1290 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1291 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1292 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1293 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1294 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1295 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1296 | {} |
| 1297 | }; |
| 1298 | |
| 1299 | static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec) |
| 1300 | { |
| 1301 | unsigned int present; |
| 1302 | unsigned int bits; |
| 1303 | /* Line out presence */ |
| 1304 | present = snd_hda_codec_read(codec, 0x17, 0, |
| 1305 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1306 | /* HP out presence */ |
| 1307 | present = present || snd_hda_codec_read(codec, 0x1b, 0, |
| 1308 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1309 | bits = present ? HDA_AMP_MUTE : 0; |
| 1310 | /* Toggle internal speakers muting */ |
| 1311 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1312 | HDA_AMP_MUTE, bits); |
| 1313 | /* Toggle internal bass muting */ |
| 1314 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1315 | HDA_AMP_MUTE, bits); |
| 1316 | } |
| 1317 | |
| 1318 | static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec, |
| 1319 | unsigned int res) |
| 1320 | { |
| 1321 | if (res >> 26 == ALC880_HP_EVENT) |
| 1322 | alc888_fujitsu_xa3530_automute(codec); |
| 1323 | } |
| 1324 | |
| 1325 | |
| 1326 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1327 | * ALC888 Acer Aspire 4930G model |
| 1328 | */ |
| 1329 | |
| 1330 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1331 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1332 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1333 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1334 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1335 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1336 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1337 | /* Connect Internal HP to front */ |
| 1338 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1339 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1340 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1341 | /* Connect HP out to front */ |
| 1342 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1343 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1344 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1345 | { } |
| 1346 | }; |
| 1347 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1348 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1349 | /* Front mic only available on one ADC */ |
| 1350 | { |
| 1351 | .num_items = 4, |
| 1352 | .items = { |
| 1353 | { "Mic", 0x0 }, |
| 1354 | { "Line", 0x2 }, |
| 1355 | { "CD", 0x4 }, |
| 1356 | { "Front Mic", 0xb }, |
| 1357 | }, |
| 1358 | }, |
| 1359 | { |
| 1360 | .num_items = 3, |
| 1361 | .items = { |
| 1362 | { "Mic", 0x0 }, |
| 1363 | { "Line", 0x2 }, |
| 1364 | { "CD", 0x4 }, |
| 1365 | }, |
| 1366 | } |
| 1367 | }; |
| 1368 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1369 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1370 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1371 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1372 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1373 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1374 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1375 | HDA_OUTPUT), |
| 1376 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1377 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1378 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1379 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1380 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1381 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1382 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1383 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1384 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1385 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1386 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1387 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1388 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1389 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1390 | { } /* end */ |
| 1391 | }; |
| 1392 | |
| 1393 | static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec) |
| 1394 | { |
| 1395 | unsigned int present; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1396 | unsigned int bits; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1397 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 1398 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1399 | bits = present ? HDA_AMP_MUTE : 0; |
| 1400 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1401 | HDA_AMP_MUTE, bits); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1402 | } |
| 1403 | |
| 1404 | static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, |
| 1405 | unsigned int res) |
| 1406 | { |
| 1407 | if (res >> 26 == ALC880_HP_EVENT) |
| 1408 | alc888_acer_aspire_4930g_automute(codec); |
| 1409 | } |
| 1410 | |
| 1411 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1412 | * ALC880 3-stack model |
| 1413 | * |
| 1414 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1415 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1416 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1417 | */ |
| 1418 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1419 | static hda_nid_t alc880_dac_nids[4] = { |
| 1420 | /* front, rear, clfe, rear_surr */ |
| 1421 | 0x02, 0x05, 0x04, 0x03 |
| 1422 | }; |
| 1423 | |
| 1424 | static hda_nid_t alc880_adc_nids[3] = { |
| 1425 | /* ADC0-2 */ |
| 1426 | 0x07, 0x08, 0x09, |
| 1427 | }; |
| 1428 | |
| 1429 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1430 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1431 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1432 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1433 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1434 | /* ADC1-2 */ |
| 1435 | 0x08, 0x09, |
| 1436 | }; |
| 1437 | |
| 1438 | #define ALC880_DIGOUT_NID 0x06 |
| 1439 | #define ALC880_DIGIN_NID 0x0a |
| 1440 | |
| 1441 | static struct hda_input_mux alc880_capture_source = { |
| 1442 | .num_items = 4, |
| 1443 | .items = { |
| 1444 | { "Mic", 0x0 }, |
| 1445 | { "Front Mic", 0x3 }, |
| 1446 | { "Line", 0x2 }, |
| 1447 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1448 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1449 | }; |
| 1450 | |
| 1451 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1452 | /* 2ch mode */ |
| 1453 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1454 | /* set line-in to input, mute it */ |
| 1455 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1456 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1457 | /* set mic-in to input vref 80%, mute it */ |
| 1458 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1459 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1460 | { } /* end */ |
| 1461 | }; |
| 1462 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1463 | /* 6ch mode */ |
| 1464 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1465 | /* set line-in to output, unmute it */ |
| 1466 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1467 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1468 | /* set mic-in to output, unmute it */ |
| 1469 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1470 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1471 | { } /* end */ |
| 1472 | }; |
| 1473 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1474 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1475 | { 2, alc880_threestack_ch2_init }, |
| 1476 | { 6, alc880_threestack_ch6_init }, |
| 1477 | }; |
| 1478 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1479 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1480 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1481 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1482 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1483 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1484 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1485 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1486 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1487 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1488 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1489 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1490 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1491 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1492 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1493 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1494 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1495 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1496 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1497 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1498 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1499 | { |
| 1500 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1501 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1502 | .info = alc_ch_mode_info, |
| 1503 | .get = alc_ch_mode_get, |
| 1504 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1505 | }, |
| 1506 | { } /* end */ |
| 1507 | }; |
| 1508 | |
| 1509 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1510 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1511 | struct snd_ctl_elem_info *uinfo) |
| 1512 | { |
| 1513 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1514 | struct alc_spec *spec = codec->spec; |
| 1515 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1516 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1517 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1518 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1519 | HDA_INPUT); |
| 1520 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1521 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1522 | return err; |
| 1523 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1524 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1525 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1526 | unsigned int size, unsigned int __user *tlv) |
| 1527 | { |
| 1528 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1529 | struct alc_spec *spec = codec->spec; |
| 1530 | int err; |
| 1531 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1532 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1533 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1534 | HDA_INPUT); |
| 1535 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1536 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1537 | return err; |
| 1538 | } |
| 1539 | |
| 1540 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1541 | struct snd_ctl_elem_value *ucontrol); |
| 1542 | |
| 1543 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1544 | struct snd_ctl_elem_value *ucontrol, |
| 1545 | getput_call_t func) |
| 1546 | { |
| 1547 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1548 | struct alc_spec *spec = codec->spec; |
| 1549 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1550 | int err; |
| 1551 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1552 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1553 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1554 | 3, 0, HDA_INPUT); |
| 1555 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1556 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1557 | return err; |
| 1558 | } |
| 1559 | |
| 1560 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1561 | struct snd_ctl_elem_value *ucontrol) |
| 1562 | { |
| 1563 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1564 | snd_hda_mixer_amp_volume_get); |
| 1565 | } |
| 1566 | |
| 1567 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1568 | struct snd_ctl_elem_value *ucontrol) |
| 1569 | { |
| 1570 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1571 | snd_hda_mixer_amp_volume_put); |
| 1572 | } |
| 1573 | |
| 1574 | /* capture mixer elements */ |
| 1575 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1576 | |
| 1577 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1578 | struct snd_ctl_elem_value *ucontrol) |
| 1579 | { |
| 1580 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1581 | snd_hda_mixer_amp_switch_get); |
| 1582 | } |
| 1583 | |
| 1584 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1585 | struct snd_ctl_elem_value *ucontrol) |
| 1586 | { |
| 1587 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1588 | snd_hda_mixer_amp_switch_put); |
| 1589 | } |
| 1590 | |
| 1591 | #define DEFINE_CAPMIX(num) \ |
| 1592 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1593 | { \ |
| 1594 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1595 | .name = "Capture Switch", \ |
| 1596 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1597 | .count = num, \ |
| 1598 | .info = alc_cap_sw_info, \ |
| 1599 | .get = alc_cap_sw_get, \ |
| 1600 | .put = alc_cap_sw_put, \ |
| 1601 | }, \ |
| 1602 | { \ |
| 1603 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1604 | .name = "Capture Volume", \ |
| 1605 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1606 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1607 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1608 | .count = num, \ |
| 1609 | .info = alc_cap_vol_info, \ |
| 1610 | .get = alc_cap_vol_get, \ |
| 1611 | .put = alc_cap_vol_put, \ |
| 1612 | .tlv = { .c = alc_cap_vol_tlv }, \ |
| 1613 | }, \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1614 | { \ |
| 1615 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1616 | /* .name = "Capture Source", */ \ |
| 1617 | .name = "Input Source", \ |
| 1618 | .count = num, \ |
| 1619 | .info = alc_mux_enum_info, \ |
| 1620 | .get = alc_mux_enum_get, \ |
| 1621 | .put = alc_mux_enum_put, \ |
| 1622 | }, \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1623 | { } /* end */ \ |
| 1624 | } |
| 1625 | |
| 1626 | /* up to three ADCs */ |
| 1627 | DEFINE_CAPMIX(1); |
| 1628 | DEFINE_CAPMIX(2); |
| 1629 | DEFINE_CAPMIX(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1630 | |
| 1631 | |
| 1632 | /* |
| 1633 | * ALC880 5-stack model |
| 1634 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1635 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1636 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1637 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1638 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1639 | */ |
| 1640 | |
| 1641 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1642 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1643 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1644 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1645 | { } /* end */ |
| 1646 | }; |
| 1647 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1648 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1649 | /* 6ch mode */ |
| 1650 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1651 | /* set line-in to input, mute it */ |
| 1652 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1653 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1654 | { } /* end */ |
| 1655 | }; |
| 1656 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1657 | /* 8ch mode */ |
| 1658 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1659 | /* set line-in to output, unmute it */ |
| 1660 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1661 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1662 | { } /* end */ |
| 1663 | }; |
| 1664 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1665 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1666 | { 6, alc880_fivestack_ch6_init }, |
| 1667 | { 8, alc880_fivestack_ch8_init }, |
| 1668 | }; |
| 1669 | |
| 1670 | |
| 1671 | /* |
| 1672 | * ALC880 6-stack model |
| 1673 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1674 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1675 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1676 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1677 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1678 | */ |
| 1679 | |
| 1680 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1681 | /* front, rear, clfe, rear_surr */ |
| 1682 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1683 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1684 | |
| 1685 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1686 | .num_items = 4, |
| 1687 | .items = { |
| 1688 | { "Mic", 0x0 }, |
| 1689 | { "Front Mic", 0x1 }, |
| 1690 | { "Line", 0x2 }, |
| 1691 | { "CD", 0x4 }, |
| 1692 | }, |
| 1693 | }; |
| 1694 | |
| 1695 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1696 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1697 | { 8, NULL }, |
| 1698 | }; |
| 1699 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1700 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1701 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1702 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1703 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1704 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1705 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1706 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1707 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1708 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1709 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1710 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1711 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1712 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1713 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1714 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1715 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1716 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1717 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1718 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1719 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1720 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1721 | { |
| 1722 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1723 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1724 | .info = alc_ch_mode_info, |
| 1725 | .get = alc_ch_mode_get, |
| 1726 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1727 | }, |
| 1728 | { } /* end */ |
| 1729 | }; |
| 1730 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1731 | |
| 1732 | /* |
| 1733 | * ALC880 W810 model |
| 1734 | * |
| 1735 | * W810 has rear IO for: |
| 1736 | * Front (DAC 02) |
| 1737 | * Surround (DAC 03) |
| 1738 | * Center/LFE (DAC 04) |
| 1739 | * Digital out (06) |
| 1740 | * |
| 1741 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1742 | * These are both connected to Line2 on the codec, hence to DAC 02. |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1743 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1744 | * There is a variable resistor to control the speaker or headphone |
| 1745 | * volume. This is a hardware-only device without a software API. |
| 1746 | * |
| 1747 | * Plugging headphones in will disable the internal speakers. This is |
| 1748 | * implemented in hardware, not via the driver using jack sense. In |
| 1749 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1750 | * disable both the speakers and headphones. |
| 1751 | * |
| 1752 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1753 | * These may not do anything useful with this driver yet, because I |
| 1754 | * haven't setup any initialization verbs for these yet... |
| 1755 | */ |
| 1756 | |
| 1757 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1758 | /* front, rear/surround, clfe */ |
| 1759 | 0x02, 0x03, 0x04 |
| 1760 | }; |
| 1761 | |
| 1762 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1763 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1764 | { 6, NULL } |
| 1765 | }; |
| 1766 | |
| 1767 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1768 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1769 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1770 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1771 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1772 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1773 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1774 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1775 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1776 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1777 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1778 | { } /* end */ |
| 1779 | }; |
| 1780 | |
| 1781 | |
| 1782 | /* |
| 1783 | * Z710V model |
| 1784 | * |
| 1785 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1786 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1787 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1788 | */ |
| 1789 | |
| 1790 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1791 | 0x02 |
| 1792 | }; |
| 1793 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1794 | |
| 1795 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1796 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1797 | { 2, NULL } |
| 1798 | }; |
| 1799 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1800 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1801 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1802 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1803 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1804 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1805 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1806 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1807 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1808 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1809 | { } /* end */ |
| 1810 | }; |
| 1811 | |
| 1812 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1813 | /* |
| 1814 | * ALC880 F1734 model |
| 1815 | * |
| 1816 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1817 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1818 | */ |
| 1819 | |
| 1820 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1821 | 0x03 |
| 1822 | }; |
| 1823 | #define ALC880_F1734_HP_DAC 0x02 |
| 1824 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1825 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1826 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1827 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1828 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1829 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1830 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1831 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1832 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1833 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1834 | { } /* end */ |
| 1835 | }; |
| 1836 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1837 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1838 | .num_items = 2, |
| 1839 | .items = { |
| 1840 | { "Mic", 0x1 }, |
| 1841 | { "CD", 0x4 }, |
| 1842 | }, |
| 1843 | }; |
| 1844 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1845 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1846 | /* |
| 1847 | * ALC880 ASUS model |
| 1848 | * |
| 1849 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1850 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1851 | * Mic = 0x18, Line = 0x1a |
| 1852 | */ |
| 1853 | |
| 1854 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1855 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1856 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1857 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1858 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1859 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1860 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1861 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1862 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1863 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1864 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1865 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1866 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1867 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1868 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1869 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1870 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1871 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1872 | { |
| 1873 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1874 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1875 | .info = alc_ch_mode_info, |
| 1876 | .get = alc_ch_mode_get, |
| 1877 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1878 | }, |
| 1879 | { } /* end */ |
| 1880 | }; |
| 1881 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1882 | /* |
| 1883 | * ALC880 ASUS W1V model |
| 1884 | * |
| 1885 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1886 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1887 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1888 | */ |
| 1889 | |
| 1890 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1891 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1892 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1893 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1894 | { } /* end */ |
| 1895 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1896 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1897 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1898 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1899 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1900 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1901 | { } /* end */ |
| 1902 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1903 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1904 | /* TCL S700 */ |
| 1905 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1906 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1907 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1908 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1909 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1910 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1911 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1912 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1913 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1914 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1915 | { } /* end */ |
| 1916 | }; |
| 1917 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1918 | /* Uniwill */ |
| 1919 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1920 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1921 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1922 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1923 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1924 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1925 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1926 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1927 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1928 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1929 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1930 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1931 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1932 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1933 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1934 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1935 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1936 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1937 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1938 | { |
| 1939 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1940 | .name = "Channel Mode", |
| 1941 | .info = alc_ch_mode_info, |
| 1942 | .get = alc_ch_mode_get, |
| 1943 | .put = alc_ch_mode_put, |
| 1944 | }, |
| 1945 | { } /* end */ |
| 1946 | }; |
| 1947 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1948 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1949 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1950 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1951 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1952 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1953 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1954 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1955 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1956 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1957 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1958 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1959 | { } /* end */ |
| 1960 | }; |
| 1961 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1962 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1963 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1964 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1965 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1966 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1967 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1968 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1969 | { } /* end */ |
| 1970 | }; |
| 1971 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1972 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1973 | * virtual master controls |
| 1974 | */ |
| 1975 | |
| 1976 | /* |
| 1977 | * slave controls for virtual master |
| 1978 | */ |
| 1979 | static const char *alc_slave_vols[] = { |
| 1980 | "Front Playback Volume", |
| 1981 | "Surround Playback Volume", |
| 1982 | "Center Playback Volume", |
| 1983 | "LFE Playback Volume", |
| 1984 | "Side Playback Volume", |
| 1985 | "Headphone Playback Volume", |
| 1986 | "Speaker Playback Volume", |
| 1987 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1988 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 1989 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1990 | NULL, |
| 1991 | }; |
| 1992 | |
| 1993 | static const char *alc_slave_sws[] = { |
| 1994 | "Front Playback Switch", |
| 1995 | "Surround Playback Switch", |
| 1996 | "Center Playback Switch", |
| 1997 | "LFE Playback Switch", |
| 1998 | "Side Playback Switch", |
| 1999 | "Headphone Playback Switch", |
| 2000 | "Speaker Playback Switch", |
| 2001 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2002 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2003 | NULL, |
| 2004 | }; |
| 2005 | |
| 2006 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2007 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2008 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2009 | |
| 2010 | static void alc_free_kctls(struct hda_codec *codec); |
| 2011 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2012 | static int alc_build_controls(struct hda_codec *codec) |
| 2013 | { |
| 2014 | struct alc_spec *spec = codec->spec; |
| 2015 | int err; |
| 2016 | int i; |
| 2017 | |
| 2018 | for (i = 0; i < spec->num_mixers; i++) { |
| 2019 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2020 | if (err < 0) |
| 2021 | return err; |
| 2022 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2023 | if (spec->cap_mixer) { |
| 2024 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2025 | if (err < 0) |
| 2026 | return err; |
| 2027 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2028 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2029 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2030 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2031 | if (err < 0) |
| 2032 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2033 | if (!spec->no_analog) { |
| 2034 | err = snd_hda_create_spdif_share_sw(codec, |
| 2035 | &spec->multiout); |
| 2036 | if (err < 0) |
| 2037 | return err; |
| 2038 | spec->multiout.share_spdif = 1; |
| 2039 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2040 | } |
| 2041 | if (spec->dig_in_nid) { |
| 2042 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2043 | if (err < 0) |
| 2044 | return err; |
| 2045 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2046 | |
| 2047 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2048 | if (!spec->no_analog && |
| 2049 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2050 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2051 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2052 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2053 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2054 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2055 | if (err < 0) |
| 2056 | return err; |
| 2057 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2058 | if (!spec->no_analog && |
| 2059 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2060 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2061 | NULL, alc_slave_sws); |
| 2062 | if (err < 0) |
| 2063 | return err; |
| 2064 | } |
| 2065 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2066 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2067 | return 0; |
| 2068 | } |
| 2069 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2070 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2071 | /* |
| 2072 | * initialize the codec volumes, etc |
| 2073 | */ |
| 2074 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2075 | /* |
| 2076 | * generic initialization of ADC, input mixers and output mixers |
| 2077 | */ |
| 2078 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2079 | /* |
| 2080 | * Unmute ADC0-2 and set the default input to mic-in |
| 2081 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2082 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2083 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2084 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2085 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2086 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2087 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2088 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2089 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2090 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2091 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2092 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2093 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2094 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2095 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2096 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2102 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2103 | /* |
| 2104 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2105 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2106 | /* set vol=0 to output mixers */ |
| 2107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2108 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2109 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2110 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2111 | /* set up input amps for analog loopback */ |
| 2112 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2113 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2114 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2115 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2116 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2117 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2118 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2119 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2120 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2121 | |
| 2122 | { } |
| 2123 | }; |
| 2124 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2125 | /* |
| 2126 | * 3-stack pin configuration: |
| 2127 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2128 | */ |
| 2129 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2130 | /* |
| 2131 | * preset connection lists of input pins |
| 2132 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2133 | */ |
| 2134 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2135 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2136 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2137 | |
| 2138 | /* |
| 2139 | * Set pin mode and muting |
| 2140 | */ |
| 2141 | /* set front pin widgets 0x14 for output */ |
| 2142 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2143 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2144 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2145 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2146 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2147 | /* Mic2 (as headphone out) for HP output */ |
| 2148 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2149 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2150 | /* Line In pin widget for input */ |
| 2151 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2152 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2153 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2154 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2155 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2156 | /* CD pin widget for input */ |
| 2157 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2158 | |
| 2159 | { } |
| 2160 | }; |
| 2161 | |
| 2162 | /* |
| 2163 | * 5-stack pin configuration: |
| 2164 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2165 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2166 | */ |
| 2167 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2168 | /* |
| 2169 | * preset connection lists of input pins |
| 2170 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2171 | */ |
| 2172 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2173 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2174 | |
| 2175 | /* |
| 2176 | * Set pin mode and muting |
| 2177 | */ |
| 2178 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2179 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2180 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2181 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2182 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2183 | /* unmute pins for output (no gain on this amp) */ |
| 2184 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2185 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2186 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2187 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2188 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2189 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2190 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2191 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2192 | /* Mic2 (as headphone out) for HP output */ |
| 2193 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2194 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2195 | /* Line In pin widget for input */ |
| 2196 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2197 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2198 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2199 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2200 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2201 | /* CD pin widget for input */ |
| 2202 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2203 | |
| 2204 | { } |
| 2205 | }; |
| 2206 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2207 | /* |
| 2208 | * W810 pin configuration: |
| 2209 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2210 | */ |
| 2211 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2212 | /* hphone/speaker input selector: front DAC */ |
| 2213 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2214 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2215 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2216 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2217 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2218 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2219 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2220 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2221 | |
| 2222 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2223 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2224 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2225 | { } |
| 2226 | }; |
| 2227 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2228 | /* |
| 2229 | * Z71V pin configuration: |
| 2230 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2231 | */ |
| 2232 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2233 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2234 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2236 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2237 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2238 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2239 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2240 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2241 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2242 | |
| 2243 | { } |
| 2244 | }; |
| 2245 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2246 | /* |
| 2247 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2248 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2249 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2250 | */ |
| 2251 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2252 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2253 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2254 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2255 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2256 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2257 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2258 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2259 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2260 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2261 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2262 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2263 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2264 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2265 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2266 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2267 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2268 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2269 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2270 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2271 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2272 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2273 | { } |
| 2274 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2275 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2276 | /* |
| 2277 | * Uniwill pin configuration: |
| 2278 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2279 | * line = 0x1a |
| 2280 | */ |
| 2281 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2282 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2283 | |
| 2284 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2285 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2286 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2287 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2288 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2289 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2290 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2291 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2292 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2293 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2294 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2296 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2298 | |
| 2299 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2300 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2301 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2302 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2303 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2304 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2305 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2306 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2307 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2308 | |
| 2309 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2310 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2311 | |
| 2312 | { } |
| 2313 | }; |
| 2314 | |
| 2315 | /* |
| 2316 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2317 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2318 | */ |
| 2319 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2320 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2321 | |
| 2322 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2323 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2324 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2325 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2326 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2327 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2328 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2329 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2330 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2331 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2332 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2333 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2334 | |
| 2335 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2336 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2337 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2338 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2339 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2340 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2341 | |
| 2342 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2343 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2344 | |
| 2345 | { } |
| 2346 | }; |
| 2347 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2348 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2349 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2350 | { } |
| 2351 | }; |
| 2352 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2353 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2354 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2355 | { |
| 2356 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2357 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2358 | |
| 2359 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2360 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2361 | bits = present ? HDA_AMP_MUTE : 0; |
| 2362 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 2363 | HDA_AMP_MUTE, bits); |
| 2364 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 2365 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2366 | } |
| 2367 | |
| 2368 | /* auto-toggle front mic */ |
| 2369 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2370 | { |
| 2371 | unsigned int present; |
| 2372 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2373 | |
| 2374 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2375 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2376 | bits = present ? HDA_AMP_MUTE : 0; |
| 2377 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2378 | } |
| 2379 | |
| 2380 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 2381 | { |
| 2382 | alc880_uniwill_hp_automute(codec); |
| 2383 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2384 | } |
| 2385 | |
| 2386 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2387 | unsigned int res) |
| 2388 | { |
| 2389 | /* Looks like the unsol event is incompatible with the standard |
| 2390 | * definition. 4bit tag is placed at 28 bit! |
| 2391 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2392 | switch (res >> 28) { |
| 2393 | case ALC880_HP_EVENT: |
| 2394 | alc880_uniwill_hp_automute(codec); |
| 2395 | break; |
| 2396 | case ALC880_MIC_EVENT: |
| 2397 | alc880_uniwill_mic_automute(codec); |
| 2398 | break; |
| 2399 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2400 | } |
| 2401 | |
| 2402 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 2403 | { |
| 2404 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2405 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2406 | |
| 2407 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2408 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2409 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 2410 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2411 | } |
| 2412 | |
| 2413 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2414 | { |
| 2415 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2416 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2417 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2418 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2419 | present &= HDA_AMP_VOLMASK; |
| 2420 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2421 | HDA_AMP_VOLMASK, present); |
| 2422 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2423 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2424 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2425 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2426 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2427 | unsigned int res) |
| 2428 | { |
| 2429 | /* Looks like the unsol event is incompatible with the standard |
| 2430 | * definition. 4bit tag is placed at 28 bit! |
| 2431 | */ |
| 2432 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2433 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2434 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2435 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2436 | } |
| 2437 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2438 | /* |
| 2439 | * F1734 pin configuration: |
| 2440 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2441 | */ |
| 2442 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2443 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2444 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2445 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2446 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2447 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2448 | |
| 2449 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2450 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2451 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2452 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2453 | |
| 2454 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2455 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2456 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2457 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2458 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2459 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2460 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2461 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2462 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2463 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2464 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2465 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2466 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2467 | { } |
| 2468 | }; |
| 2469 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2470 | /* |
| 2471 | * ASUS pin configuration: |
| 2472 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2473 | */ |
| 2474 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2475 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2476 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2477 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2478 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2479 | |
| 2480 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2481 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2482 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2483 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2484 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2485 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2486 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2487 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2488 | |
| 2489 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2490 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2491 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2492 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2493 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2494 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2495 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2497 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2498 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2499 | { } |
| 2500 | }; |
| 2501 | |
| 2502 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2503 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2504 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2505 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2506 | /* Clevo m520g init */ |
| 2507 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2508 | /* headphone output */ |
| 2509 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2510 | /* line-out */ |
| 2511 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2512 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2513 | /* Line-in */ |
| 2514 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2515 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2516 | /* CD */ |
| 2517 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2518 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2519 | /* Mic1 (rear panel) */ |
| 2520 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2521 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2522 | /* Mic2 (front panel) */ |
| 2523 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2524 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2525 | /* headphone */ |
| 2526 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2527 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2528 | /* change to EAPD mode */ |
| 2529 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2530 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2531 | |
| 2532 | { } |
| 2533 | }; |
| 2534 | |
| 2535 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2536 | /* change to EAPD mode */ |
| 2537 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2538 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2539 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2540 | /* Headphone output */ |
| 2541 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2542 | /* Front output*/ |
| 2543 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2544 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2545 | |
| 2546 | /* Line In pin widget for input */ |
| 2547 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2548 | /* CD pin widget for input */ |
| 2549 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2550 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2551 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2552 | |
| 2553 | /* change to EAPD mode */ |
| 2554 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2555 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2556 | |
| 2557 | { } |
| 2558 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2559 | |
| 2560 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2561 | * LG m1 express dual |
| 2562 | * |
| 2563 | * Pin assignment: |
| 2564 | * Rear Line-In/Out (blue): 0x14 |
| 2565 | * Build-in Mic-In: 0x15 |
| 2566 | * Speaker-out: 0x17 |
| 2567 | * HP-Out (green): 0x1b |
| 2568 | * Mic-In/Out (red): 0x19 |
| 2569 | * SPDIF-Out: 0x1e |
| 2570 | */ |
| 2571 | |
| 2572 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2573 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2574 | 0x05, 0x02, 0x03 |
| 2575 | }; |
| 2576 | |
| 2577 | /* seems analog CD is not working */ |
| 2578 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2579 | .num_items = 3, |
| 2580 | .items = { |
| 2581 | { "Mic", 0x1 }, |
| 2582 | { "Line", 0x5 }, |
| 2583 | { "Internal Mic", 0x6 }, |
| 2584 | }, |
| 2585 | }; |
| 2586 | |
| 2587 | /* 2,4,6 channel modes */ |
| 2588 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2589 | /* set line-in and mic-in to input */ |
| 2590 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2591 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2592 | { } |
| 2593 | }; |
| 2594 | |
| 2595 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2596 | /* set line-in to out and mic-in to input */ |
| 2597 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2598 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2599 | { } |
| 2600 | }; |
| 2601 | |
| 2602 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2603 | /* set line-in and mic-in to output */ |
| 2604 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2605 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2606 | { } |
| 2607 | }; |
| 2608 | |
| 2609 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2610 | { 2, alc880_lg_ch2_init }, |
| 2611 | { 4, alc880_lg_ch4_init }, |
| 2612 | { 6, alc880_lg_ch6_init }, |
| 2613 | }; |
| 2614 | |
| 2615 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2616 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2617 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2618 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2619 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2620 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2621 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2622 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2623 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2624 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2625 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2626 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2627 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2628 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2629 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2630 | { |
| 2631 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2632 | .name = "Channel Mode", |
| 2633 | .info = alc_ch_mode_info, |
| 2634 | .get = alc_ch_mode_get, |
| 2635 | .put = alc_ch_mode_put, |
| 2636 | }, |
| 2637 | { } /* end */ |
| 2638 | }; |
| 2639 | |
| 2640 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2641 | /* set capture source to mic-in */ |
| 2642 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2643 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2644 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2645 | /* mute all amp mixer inputs */ |
| 2646 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2647 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2648 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2649 | /* line-in to input */ |
| 2650 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2651 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2652 | /* built-in mic */ |
| 2653 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2654 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2655 | /* speaker-out */ |
| 2656 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2657 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2658 | /* mic-in to input */ |
| 2659 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2660 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2661 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2662 | /* HP-out */ |
| 2663 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2664 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2665 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2666 | /* jack sense */ |
| 2667 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2668 | { } |
| 2669 | }; |
| 2670 | |
| 2671 | /* toggle speaker-output according to the hp-jack state */ |
| 2672 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2673 | { |
| 2674 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2675 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2676 | |
| 2677 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2678 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2679 | bits = present ? HDA_AMP_MUTE : 0; |
| 2680 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2681 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2682 | } |
| 2683 | |
| 2684 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2685 | { |
| 2686 | /* Looks like the unsol event is incompatible with the standard |
| 2687 | * definition. 4bit tag is placed at 28 bit! |
| 2688 | */ |
| 2689 | if ((res >> 28) == 0x01) |
| 2690 | alc880_lg_automute(codec); |
| 2691 | } |
| 2692 | |
| 2693 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2694 | * LG LW20 |
| 2695 | * |
| 2696 | * Pin assignment: |
| 2697 | * Speaker-out: 0x14 |
| 2698 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2699 | * Built-in Mic-In: 0x19 |
| 2700 | * Line-In: 0x1b |
| 2701 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2702 | * SPDIF-Out: 0x1e |
| 2703 | */ |
| 2704 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2705 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2706 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2707 | .items = { |
| 2708 | { "Mic", 0x0 }, |
| 2709 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2710 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2711 | }, |
| 2712 | }; |
| 2713 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2714 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2715 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2716 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2717 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2718 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2719 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2720 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2721 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2722 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2723 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2724 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2725 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2726 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2727 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2728 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2729 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2730 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2731 | { |
| 2732 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2733 | .name = "Channel Mode", |
| 2734 | .info = alc_ch_mode_info, |
| 2735 | .get = alc_ch_mode_get, |
| 2736 | .put = alc_ch_mode_put, |
| 2737 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2738 | { } /* end */ |
| 2739 | }; |
| 2740 | |
| 2741 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2742 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2743 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2744 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2745 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2746 | /* set capture source to mic-in */ |
| 2747 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2748 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2749 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2750 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2751 | /* speaker-out */ |
| 2752 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2753 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2754 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2755 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2756 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2757 | /* mic-in to input */ |
| 2758 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2759 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2760 | /* built-in mic */ |
| 2761 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2762 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2763 | /* jack sense */ |
| 2764 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2765 | { } |
| 2766 | }; |
| 2767 | |
| 2768 | /* toggle speaker-output according to the hp-jack state */ |
| 2769 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2770 | { |
| 2771 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2772 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2773 | |
| 2774 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2775 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2776 | bits = present ? HDA_AMP_MUTE : 0; |
| 2777 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2778 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2779 | } |
| 2780 | |
| 2781 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2782 | { |
| 2783 | /* Looks like the unsol event is incompatible with the standard |
| 2784 | * definition. 4bit tag is placed at 28 bit! |
| 2785 | */ |
| 2786 | if ((res >> 28) == 0x01) |
| 2787 | alc880_lg_lw_automute(codec); |
| 2788 | } |
| 2789 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2790 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2791 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2792 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2793 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2794 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2795 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2796 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2797 | { } /* end */ |
| 2798 | }; |
| 2799 | |
| 2800 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2801 | .num_items = 2, |
| 2802 | .items = { |
| 2803 | { "Mic", 0x0 }, |
| 2804 | { "Internal Mic", 0x1 }, |
| 2805 | }, |
| 2806 | }; |
| 2807 | |
| 2808 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2809 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2810 | |
| 2811 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2812 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2813 | |
| 2814 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2815 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2816 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2817 | /* Mic2 (as headphone out) for HP output */ |
| 2818 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2820 | /* Internal Speaker */ |
| 2821 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2822 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2823 | |
| 2824 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2825 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2826 | |
| 2827 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2828 | { } |
| 2829 | }; |
| 2830 | |
| 2831 | /* toggle speaker-output according to the hp-jack state */ |
| 2832 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2833 | { |
| 2834 | unsigned int present; |
| 2835 | unsigned char bits; |
| 2836 | |
| 2837 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2838 | AC_VERB_GET_PIN_SENSE, 0) |
| 2839 | & AC_PINSENSE_PRESENCE; |
| 2840 | bits = present ? HDA_AMP_MUTE : 0; |
| 2841 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2842 | HDA_AMP_MUTE, bits); |
| 2843 | if (present) |
| 2844 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2845 | else |
| 2846 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2847 | } |
| 2848 | |
| 2849 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2850 | unsigned int res) |
| 2851 | { |
| 2852 | /* Looks like the unsol event is incompatible with the standard |
| 2853 | * definition. 4bit tag is placed at 28 bit! |
| 2854 | */ |
| 2855 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2856 | alc880_medion_rim_automute(codec); |
| 2857 | } |
| 2858 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2859 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2860 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2861 | { 0x0b, HDA_INPUT, 0 }, |
| 2862 | { 0x0b, HDA_INPUT, 1 }, |
| 2863 | { 0x0b, HDA_INPUT, 2 }, |
| 2864 | { 0x0b, HDA_INPUT, 3 }, |
| 2865 | { 0x0b, HDA_INPUT, 4 }, |
| 2866 | { } /* end */ |
| 2867 | }; |
| 2868 | |
| 2869 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2870 | { 0x0b, HDA_INPUT, 1 }, |
| 2871 | { 0x0b, HDA_INPUT, 6 }, |
| 2872 | { 0x0b, HDA_INPUT, 7 }, |
| 2873 | { } /* end */ |
| 2874 | }; |
| 2875 | #endif |
| 2876 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2877 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2878 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2879 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2880 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2881 | static int alc_init(struct hda_codec *codec) |
| 2882 | { |
| 2883 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2884 | unsigned int i; |
| 2885 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2886 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2887 | if (codec->vendor_id == 0x10ec0888) |
| 2888 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2889 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2890 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2891 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2892 | |
| 2893 | if (spec->init_hook) |
| 2894 | spec->init_hook(codec); |
| 2895 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2896 | return 0; |
| 2897 | } |
| 2898 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2899 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2900 | { |
| 2901 | struct alc_spec *spec = codec->spec; |
| 2902 | |
| 2903 | if (spec->unsol_event) |
| 2904 | spec->unsol_event(codec, res); |
| 2905 | } |
| 2906 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2907 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2908 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2909 | { |
| 2910 | struct alc_spec *spec = codec->spec; |
| 2911 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2912 | } |
| 2913 | #endif |
| 2914 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2915 | /* |
| 2916 | * Analog playback callbacks |
| 2917 | */ |
| 2918 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2919 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2920 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2921 | { |
| 2922 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2923 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2924 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2925 | } |
| 2926 | |
| 2927 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2928 | struct hda_codec *codec, |
| 2929 | unsigned int stream_tag, |
| 2930 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2931 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2932 | { |
| 2933 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2934 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2935 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2936 | } |
| 2937 | |
| 2938 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2939 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2940 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2941 | { |
| 2942 | struct alc_spec *spec = codec->spec; |
| 2943 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2944 | } |
| 2945 | |
| 2946 | /* |
| 2947 | * Digital out |
| 2948 | */ |
| 2949 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2950 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2951 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2952 | { |
| 2953 | struct alc_spec *spec = codec->spec; |
| 2954 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2955 | } |
| 2956 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2957 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2958 | struct hda_codec *codec, |
| 2959 | unsigned int stream_tag, |
| 2960 | unsigned int format, |
| 2961 | struct snd_pcm_substream *substream) |
| 2962 | { |
| 2963 | struct alc_spec *spec = codec->spec; |
| 2964 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2965 | stream_tag, format, substream); |
| 2966 | } |
| 2967 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2968 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2969 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2970 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2971 | { |
| 2972 | struct alc_spec *spec = codec->spec; |
| 2973 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2974 | } |
| 2975 | |
| 2976 | /* |
| 2977 | * Analog capture |
| 2978 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2979 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2980 | struct hda_codec *codec, |
| 2981 | unsigned int stream_tag, |
| 2982 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2983 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2984 | { |
| 2985 | struct alc_spec *spec = codec->spec; |
| 2986 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2987 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2988 | stream_tag, 0, format); |
| 2989 | return 0; |
| 2990 | } |
| 2991 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2992 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2993 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2994 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2995 | { |
| 2996 | struct alc_spec *spec = codec->spec; |
| 2997 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2998 | snd_hda_codec_cleanup_stream(codec, |
| 2999 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3000 | return 0; |
| 3001 | } |
| 3002 | |
| 3003 | |
| 3004 | /* |
| 3005 | */ |
| 3006 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3007 | .substreams = 1, |
| 3008 | .channels_min = 2, |
| 3009 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3010 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3011 | .ops = { |
| 3012 | .open = alc880_playback_pcm_open, |
| 3013 | .prepare = alc880_playback_pcm_prepare, |
| 3014 | .cleanup = alc880_playback_pcm_cleanup |
| 3015 | }, |
| 3016 | }; |
| 3017 | |
| 3018 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3019 | .substreams = 1, |
| 3020 | .channels_min = 2, |
| 3021 | .channels_max = 2, |
| 3022 | /* NID is set in alc_build_pcms */ |
| 3023 | }; |
| 3024 | |
| 3025 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3026 | .substreams = 1, |
| 3027 | .channels_min = 2, |
| 3028 | .channels_max = 2, |
| 3029 | /* NID is set in alc_build_pcms */ |
| 3030 | }; |
| 3031 | |
| 3032 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3033 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3034 | .channels_min = 2, |
| 3035 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3036 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3037 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3038 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3039 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3040 | }, |
| 3041 | }; |
| 3042 | |
| 3043 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3044 | .substreams = 1, |
| 3045 | .channels_min = 2, |
| 3046 | .channels_max = 2, |
| 3047 | /* NID is set in alc_build_pcms */ |
| 3048 | .ops = { |
| 3049 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3050 | .close = alc880_dig_playback_pcm_close, |
| 3051 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3052 | }, |
| 3053 | }; |
| 3054 | |
| 3055 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3056 | .substreams = 1, |
| 3057 | .channels_min = 2, |
| 3058 | .channels_max = 2, |
| 3059 | /* NID is set in alc_build_pcms */ |
| 3060 | }; |
| 3061 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3062 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3063 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3064 | .substreams = 0, |
| 3065 | .channels_min = 0, |
| 3066 | .channels_max = 0, |
| 3067 | }; |
| 3068 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3069 | static int alc_build_pcms(struct hda_codec *codec) |
| 3070 | { |
| 3071 | struct alc_spec *spec = codec->spec; |
| 3072 | struct hda_pcm *info = spec->pcm_rec; |
| 3073 | int i; |
| 3074 | |
| 3075 | codec->num_pcms = 1; |
| 3076 | codec->pcm_info = info; |
| 3077 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3078 | if (spec->no_analog) |
| 3079 | goto skip_analog; |
| 3080 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3081 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3082 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3083 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3084 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3085 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3086 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3087 | } |
| 3088 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3089 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3090 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3091 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3092 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3093 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3094 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3095 | if (spec->channel_mode) { |
| 3096 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3097 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3098 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3099 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3100 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3101 | } |
| 3102 | } |
| 3103 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3104 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3105 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3106 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3107 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3108 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3109 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3110 | if (spec->dig_out_type) |
| 3111 | info->pcm_type = spec->dig_out_type; |
| 3112 | else |
| 3113 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3114 | if (spec->multiout.dig_out_nid && |
| 3115 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3116 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3117 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3118 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3119 | if (spec->dig_in_nid && |
| 3120 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3121 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3122 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3123 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3124 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3125 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3126 | } |
| 3127 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3128 | if (spec->no_analog) |
| 3129 | return 0; |
| 3130 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3131 | /* If the use of more than one ADC is requested for the current |
| 3132 | * model, configure a second analog capture-only PCM. |
| 3133 | */ |
| 3134 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3135 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3136 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3137 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3138 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3139 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3140 | if (spec->alt_dac_nid) { |
| 3141 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3142 | *spec->stream_analog_alt_playback; |
| 3143 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3144 | spec->alt_dac_nid; |
| 3145 | } else { |
| 3146 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3147 | alc_pcm_null_stream; |
| 3148 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3149 | } |
| 3150 | if (spec->num_adc_nids > 1) { |
| 3151 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3152 | *spec->stream_analog_alt_capture; |
| 3153 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3154 | spec->adc_nids[1]; |
| 3155 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3156 | spec->num_adc_nids - 1; |
| 3157 | } else { |
| 3158 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3159 | alc_pcm_null_stream; |
| 3160 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3161 | } |
| 3162 | } |
| 3163 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3164 | return 0; |
| 3165 | } |
| 3166 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3167 | static void alc_free_kctls(struct hda_codec *codec) |
| 3168 | { |
| 3169 | struct alc_spec *spec = codec->spec; |
| 3170 | |
| 3171 | if (spec->kctls.list) { |
| 3172 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3173 | int i; |
| 3174 | for (i = 0; i < spec->kctls.used; i++) |
| 3175 | kfree(kctl[i].name); |
| 3176 | } |
| 3177 | snd_array_free(&spec->kctls); |
| 3178 | } |
| 3179 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3180 | static void alc_free(struct hda_codec *codec) |
| 3181 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3182 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3183 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3184 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3185 | return; |
| 3186 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3187 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3188 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 3189 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3190 | } |
| 3191 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3192 | #ifdef SND_HDA_NEEDS_RESUME |
| 3193 | static void store_pin_configs(struct hda_codec *codec) |
| 3194 | { |
| 3195 | struct alc_spec *spec = codec->spec; |
| 3196 | hda_nid_t nid, end_nid; |
| 3197 | |
| 3198 | end_nid = codec->start_nid + codec->num_nodes; |
| 3199 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
| 3200 | unsigned int wid_caps = get_wcaps(codec, nid); |
| 3201 | unsigned int wid_type = |
| 3202 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 3203 | if (wid_type != AC_WID_PIN) |
| 3204 | continue; |
| 3205 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) |
| 3206 | break; |
| 3207 | spec->pin_nids[spec->num_pins] = nid; |
| 3208 | spec->pin_cfgs[spec->num_pins] = |
| 3209 | snd_hda_codec_read(codec, nid, 0, |
| 3210 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 3211 | spec->num_pins++; |
| 3212 | } |
| 3213 | } |
| 3214 | |
| 3215 | static void resume_pin_configs(struct hda_codec *codec) |
| 3216 | { |
| 3217 | struct alc_spec *spec = codec->spec; |
| 3218 | int i; |
| 3219 | |
| 3220 | for (i = 0; i < spec->num_pins; i++) { |
| 3221 | hda_nid_t pin_nid = spec->pin_nids[i]; |
| 3222 | unsigned int pin_config = spec->pin_cfgs[i]; |
| 3223 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3224 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 3225 | pin_config & 0x000000ff); |
| 3226 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3227 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 3228 | (pin_config & 0x0000ff00) >> 8); |
| 3229 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3230 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 3231 | (pin_config & 0x00ff0000) >> 16); |
| 3232 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3233 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 3234 | pin_config >> 24); |
| 3235 | } |
| 3236 | } |
| 3237 | |
| 3238 | static int alc_resume(struct hda_codec *codec) |
| 3239 | { |
| 3240 | resume_pin_configs(codec); |
| 3241 | codec->patch_ops.init(codec); |
| 3242 | snd_hda_codec_resume_amp(codec); |
| 3243 | snd_hda_codec_resume_cache(codec); |
| 3244 | return 0; |
| 3245 | } |
| 3246 | #else |
| 3247 | #define store_pin_configs(codec) |
| 3248 | #endif |
| 3249 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3250 | /* |
| 3251 | */ |
| 3252 | static struct hda_codec_ops alc_patch_ops = { |
| 3253 | .build_controls = alc_build_controls, |
| 3254 | .build_pcms = alc_build_pcms, |
| 3255 | .init = alc_init, |
| 3256 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3257 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3258 | #ifdef SND_HDA_NEEDS_RESUME |
| 3259 | .resume = alc_resume, |
| 3260 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3261 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3262 | .check_power_status = alc_check_power_status, |
| 3263 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3264 | }; |
| 3265 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3266 | |
| 3267 | /* |
| 3268 | * Test configuration for debugging |
| 3269 | * |
| 3270 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3271 | * enum controls. |
| 3272 | */ |
| 3273 | #ifdef CONFIG_SND_DEBUG |
| 3274 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3275 | 0x02, 0x03, 0x04, 0x05 |
| 3276 | }; |
| 3277 | |
| 3278 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3279 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3280 | .items = { |
| 3281 | { "In-1", 0x0 }, |
| 3282 | { "In-2", 0x1 }, |
| 3283 | { "In-3", 0x2 }, |
| 3284 | { "In-4", 0x3 }, |
| 3285 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3286 | { "Front", 0x5 }, |
| 3287 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3288 | }, |
| 3289 | }; |
| 3290 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3291 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3292 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3293 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3294 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3295 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3296 | }; |
| 3297 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3298 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3299 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3300 | { |
| 3301 | static char *texts[] = { |
| 3302 | "N/A", "Line Out", "HP Out", |
| 3303 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3304 | }; |
| 3305 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3306 | uinfo->count = 1; |
| 3307 | uinfo->value.enumerated.items = 8; |
| 3308 | if (uinfo->value.enumerated.item >= 8) |
| 3309 | uinfo->value.enumerated.item = 7; |
| 3310 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3311 | return 0; |
| 3312 | } |
| 3313 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3314 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3315 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3316 | { |
| 3317 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3318 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3319 | unsigned int pin_ctl, item = 0; |
| 3320 | |
| 3321 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3322 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3323 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3324 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3325 | item = 2; |
| 3326 | else |
| 3327 | item = 1; |
| 3328 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3329 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3330 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3331 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3332 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3333 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3334 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3335 | } |
| 3336 | } |
| 3337 | ucontrol->value.enumerated.item[0] = item; |
| 3338 | return 0; |
| 3339 | } |
| 3340 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3341 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3342 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3343 | { |
| 3344 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3345 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3346 | static unsigned int ctls[] = { |
| 3347 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3348 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3349 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3350 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3351 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3352 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3353 | }; |
| 3354 | unsigned int old_ctl, new_ctl; |
| 3355 | |
| 3356 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3357 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3358 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3359 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3360 | int val; |
| 3361 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3362 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3363 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3364 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3365 | HDA_AMP_MUTE : 0; |
| 3366 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3367 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3368 | return 1; |
| 3369 | } |
| 3370 | return 0; |
| 3371 | } |
| 3372 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3373 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3374 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3375 | { |
| 3376 | static char *texts[] = { |
| 3377 | "Front", "Surround", "CLFE", "Side" |
| 3378 | }; |
| 3379 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3380 | uinfo->count = 1; |
| 3381 | uinfo->value.enumerated.items = 4; |
| 3382 | if (uinfo->value.enumerated.item >= 4) |
| 3383 | uinfo->value.enumerated.item = 3; |
| 3384 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3385 | return 0; |
| 3386 | } |
| 3387 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3388 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3389 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3390 | { |
| 3391 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3392 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3393 | unsigned int sel; |
| 3394 | |
| 3395 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3396 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3397 | return 0; |
| 3398 | } |
| 3399 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3400 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3401 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3402 | { |
| 3403 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3404 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3405 | unsigned int sel; |
| 3406 | |
| 3407 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3408 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3409 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3410 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3411 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3412 | return 1; |
| 3413 | } |
| 3414 | return 0; |
| 3415 | } |
| 3416 | |
| 3417 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3418 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3419 | .name = xname, \ |
| 3420 | .info = alc_test_pin_ctl_info, \ |
| 3421 | .get = alc_test_pin_ctl_get, \ |
| 3422 | .put = alc_test_pin_ctl_put, \ |
| 3423 | .private_value = nid \ |
| 3424 | } |
| 3425 | |
| 3426 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3427 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3428 | .name = xname, \ |
| 3429 | .info = alc_test_pin_src_info, \ |
| 3430 | .get = alc_test_pin_src_get, \ |
| 3431 | .put = alc_test_pin_src_put, \ |
| 3432 | .private_value = nid \ |
| 3433 | } |
| 3434 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3435 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3436 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3437 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3438 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3439 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3440 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3441 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3442 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3443 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3444 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3445 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3446 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3447 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3448 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3449 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3450 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3451 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3452 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3453 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3454 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3455 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3456 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3457 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3458 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3459 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3460 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3461 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3462 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3463 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3464 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3465 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3466 | { |
| 3467 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3468 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3469 | .info = alc_ch_mode_info, |
| 3470 | .get = alc_ch_mode_get, |
| 3471 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3472 | }, |
| 3473 | { } /* end */ |
| 3474 | }; |
| 3475 | |
| 3476 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3477 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3478 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3479 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3480 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3481 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3482 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3483 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3484 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3485 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3486 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3487 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3488 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3489 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3490 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3491 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3492 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3493 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3494 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3495 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3496 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3497 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3498 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3499 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3500 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3501 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3502 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3503 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3504 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3505 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3506 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3507 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3508 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3509 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3510 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3511 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3512 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3513 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3514 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3515 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3516 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3517 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3518 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3519 | /* Analog input/passthru */ |
| 3520 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3521 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3522 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3523 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3524 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3525 | { } |
| 3526 | }; |
| 3527 | #endif |
| 3528 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3529 | /* |
| 3530 | */ |
| 3531 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3532 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3533 | [ALC880_3ST] = "3stack", |
| 3534 | [ALC880_TCL_S700] = "tcl", |
| 3535 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3536 | [ALC880_CLEVO] = "clevo", |
| 3537 | [ALC880_5ST] = "5stack", |
| 3538 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3539 | [ALC880_W810] = "w810", |
| 3540 | [ALC880_Z71V] = "z71v", |
| 3541 | [ALC880_6ST] = "6stack", |
| 3542 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3543 | [ALC880_ASUS] = "asus", |
| 3544 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3545 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3546 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3547 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3548 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3549 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3550 | [ALC880_F1734] = "F1734", |
| 3551 | [ALC880_LG] = "lg", |
| 3552 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3553 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3554 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3555 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3556 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3557 | [ALC880_AUTO] = "auto", |
| 3558 | }; |
| 3559 | |
| 3560 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3561 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3562 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3563 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3564 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3565 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3566 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3567 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3568 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3569 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3570 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3571 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3572 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3573 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3574 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3575 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3576 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3577 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3578 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3579 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3580 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3581 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3582 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3583 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3584 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3585 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3586 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3587 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3588 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3589 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3590 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3591 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3592 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3593 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3594 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3595 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3596 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3597 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3598 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3599 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3600 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3601 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3602 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3603 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3604 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3605 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3606 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3607 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3608 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3609 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3610 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3611 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3612 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3613 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3614 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3615 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3616 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3617 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3618 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3619 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3620 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3621 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3622 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3623 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3624 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3625 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3626 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3627 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3628 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3629 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3630 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3631 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3632 | {} |
| 3633 | }; |
| 3634 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3635 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3636 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3637 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3638 | static struct alc_config_preset alc880_presets[] = { |
| 3639 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3640 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3641 | .init_verbs = { alc880_volume_init_verbs, |
| 3642 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3643 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3644 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3645 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3646 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3647 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3648 | .input_mux = &alc880_capture_source, |
| 3649 | }, |
| 3650 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3651 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3652 | .init_verbs = { alc880_volume_init_verbs, |
| 3653 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3654 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3655 | .dac_nids = alc880_dac_nids, |
| 3656 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3657 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3658 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3659 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3660 | .input_mux = &alc880_capture_source, |
| 3661 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3662 | [ALC880_TCL_S700] = { |
| 3663 | .mixers = { alc880_tcl_s700_mixer }, |
| 3664 | .init_verbs = { alc880_volume_init_verbs, |
| 3665 | alc880_pin_tcl_S700_init_verbs, |
| 3666 | alc880_gpio2_init_verbs }, |
| 3667 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3668 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3669 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3670 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3671 | .hp_nid = 0x03, |
| 3672 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3673 | .channel_mode = alc880_2_jack_modes, |
| 3674 | .input_mux = &alc880_capture_source, |
| 3675 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3676 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3677 | .mixers = { alc880_three_stack_mixer, |
| 3678 | alc880_five_stack_mixer}, |
| 3679 | .init_verbs = { alc880_volume_init_verbs, |
| 3680 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3681 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3682 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3683 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3684 | .channel_mode = alc880_fivestack_modes, |
| 3685 | .input_mux = &alc880_capture_source, |
| 3686 | }, |
| 3687 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3688 | .mixers = { alc880_three_stack_mixer, |
| 3689 | alc880_five_stack_mixer }, |
| 3690 | .init_verbs = { alc880_volume_init_verbs, |
| 3691 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3692 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3693 | .dac_nids = alc880_dac_nids, |
| 3694 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3695 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3696 | .channel_mode = alc880_fivestack_modes, |
| 3697 | .input_mux = &alc880_capture_source, |
| 3698 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3699 | [ALC880_6ST] = { |
| 3700 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3701 | .init_verbs = { alc880_volume_init_verbs, |
| 3702 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3703 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3704 | .dac_nids = alc880_6st_dac_nids, |
| 3705 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3706 | .channel_mode = alc880_sixstack_modes, |
| 3707 | .input_mux = &alc880_6stack_capture_source, |
| 3708 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3709 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3710 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3711 | .init_verbs = { alc880_volume_init_verbs, |
| 3712 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3713 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3714 | .dac_nids = alc880_6st_dac_nids, |
| 3715 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3716 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3717 | .channel_mode = alc880_sixstack_modes, |
| 3718 | .input_mux = &alc880_6stack_capture_source, |
| 3719 | }, |
| 3720 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3721 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3722 | .init_verbs = { alc880_volume_init_verbs, |
| 3723 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3724 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3725 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3726 | .dac_nids = alc880_w810_dac_nids, |
| 3727 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3728 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3729 | .channel_mode = alc880_w810_modes, |
| 3730 | .input_mux = &alc880_capture_source, |
| 3731 | }, |
| 3732 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3733 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3734 | .init_verbs = { alc880_volume_init_verbs, |
| 3735 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3736 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3737 | .dac_nids = alc880_z71v_dac_nids, |
| 3738 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3739 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3740 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3741 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3742 | .input_mux = &alc880_capture_source, |
| 3743 | }, |
| 3744 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3745 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3746 | .init_verbs = { alc880_volume_init_verbs, |
| 3747 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3748 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3749 | .dac_nids = alc880_f1734_dac_nids, |
| 3750 | .hp_nid = 0x02, |
| 3751 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3752 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3753 | .input_mux = &alc880_f1734_capture_source, |
| 3754 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3755 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3756 | }, |
| 3757 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3758 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3759 | .init_verbs = { alc880_volume_init_verbs, |
| 3760 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3761 | alc880_gpio1_init_verbs }, |
| 3762 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3763 | .dac_nids = alc880_asus_dac_nids, |
| 3764 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3765 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3766 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3767 | .input_mux = &alc880_capture_source, |
| 3768 | }, |
| 3769 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3770 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3771 | .init_verbs = { alc880_volume_init_verbs, |
| 3772 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3773 | alc880_gpio1_init_verbs }, |
| 3774 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3775 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3776 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3777 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3778 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3779 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3780 | .input_mux = &alc880_capture_source, |
| 3781 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3782 | [ALC880_ASUS_DIG2] = { |
| 3783 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3784 | .init_verbs = { alc880_volume_init_verbs, |
| 3785 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3786 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3787 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3788 | .dac_nids = alc880_asus_dac_nids, |
| 3789 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3790 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3791 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3792 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3793 | .input_mux = &alc880_capture_source, |
| 3794 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3795 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3796 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3797 | .init_verbs = { alc880_volume_init_verbs, |
| 3798 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3799 | alc880_gpio1_init_verbs }, |
| 3800 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3801 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3802 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3803 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3804 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3805 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3806 | .input_mux = &alc880_capture_source, |
| 3807 | }, |
| 3808 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3809 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3810 | .init_verbs = { alc880_volume_init_verbs, |
| 3811 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3812 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3813 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3814 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3815 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3816 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3817 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3818 | .input_mux = &alc880_capture_source, |
| 3819 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3820 | [ALC880_UNIWILL] = { |
| 3821 | .mixers = { alc880_uniwill_mixer }, |
| 3822 | .init_verbs = { alc880_volume_init_verbs, |
| 3823 | alc880_uniwill_init_verbs }, |
| 3824 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3825 | .dac_nids = alc880_asus_dac_nids, |
| 3826 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3827 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3828 | .channel_mode = alc880_threestack_modes, |
| 3829 | .need_dac_fix = 1, |
| 3830 | .input_mux = &alc880_capture_source, |
| 3831 | .unsol_event = alc880_uniwill_unsol_event, |
| 3832 | .init_hook = alc880_uniwill_automute, |
| 3833 | }, |
| 3834 | [ALC880_UNIWILL_P53] = { |
| 3835 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3836 | .init_verbs = { alc880_volume_init_verbs, |
| 3837 | alc880_uniwill_p53_init_verbs }, |
| 3838 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3839 | .dac_nids = alc880_asus_dac_nids, |
| 3840 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3841 | .channel_mode = alc880_threestack_modes, |
| 3842 | .input_mux = &alc880_capture_source, |
| 3843 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3844 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3845 | }, |
| 3846 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3847 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3848 | alc880_pcbeep_mixer, }, |
| 3849 | .init_verbs = { alc880_volume_init_verbs, |
| 3850 | alc880_uniwill_p53_init_verbs, |
| 3851 | alc880_beep_init_verbs }, |
| 3852 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3853 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3854 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3855 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3856 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3857 | .input_mux = &alc880_capture_source, |
| 3858 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3859 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3860 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3861 | [ALC880_CLEVO] = { |
| 3862 | .mixers = { alc880_three_stack_mixer }, |
| 3863 | .init_verbs = { alc880_volume_init_verbs, |
| 3864 | alc880_pin_clevo_init_verbs }, |
| 3865 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3866 | .dac_nids = alc880_dac_nids, |
| 3867 | .hp_nid = 0x03, |
| 3868 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3869 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3870 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3871 | .input_mux = &alc880_capture_source, |
| 3872 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3873 | [ALC880_LG] = { |
| 3874 | .mixers = { alc880_lg_mixer }, |
| 3875 | .init_verbs = { alc880_volume_init_verbs, |
| 3876 | alc880_lg_init_verbs }, |
| 3877 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3878 | .dac_nids = alc880_lg_dac_nids, |
| 3879 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3880 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3881 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3882 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3883 | .input_mux = &alc880_lg_capture_source, |
| 3884 | .unsol_event = alc880_lg_unsol_event, |
| 3885 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3886 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3887 | .loopbacks = alc880_lg_loopbacks, |
| 3888 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3889 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3890 | [ALC880_LG_LW] = { |
| 3891 | .mixers = { alc880_lg_lw_mixer }, |
| 3892 | .init_verbs = { alc880_volume_init_verbs, |
| 3893 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3894 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3895 | .dac_nids = alc880_dac_nids, |
| 3896 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3897 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3898 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3899 | .input_mux = &alc880_lg_lw_capture_source, |
| 3900 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3901 | .init_hook = alc880_lg_lw_automute, |
| 3902 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3903 | [ALC880_MEDION_RIM] = { |
| 3904 | .mixers = { alc880_medion_rim_mixer }, |
| 3905 | .init_verbs = { alc880_volume_init_verbs, |
| 3906 | alc880_medion_rim_init_verbs, |
| 3907 | alc_gpio2_init_verbs }, |
| 3908 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3909 | .dac_nids = alc880_dac_nids, |
| 3910 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3911 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3912 | .channel_mode = alc880_2_jack_modes, |
| 3913 | .input_mux = &alc880_medion_rim_capture_source, |
| 3914 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3915 | .init_hook = alc880_medion_rim_automute, |
| 3916 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3917 | #ifdef CONFIG_SND_DEBUG |
| 3918 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3919 | .mixers = { alc880_test_mixer }, |
| 3920 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3921 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3922 | .dac_nids = alc880_test_dac_nids, |
| 3923 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3924 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3925 | .channel_mode = alc880_test_modes, |
| 3926 | .input_mux = &alc880_test_capture_source, |
| 3927 | }, |
| 3928 | #endif |
| 3929 | }; |
| 3930 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3931 | /* |
| 3932 | * Automatic parse of I/O pins from the BIOS configuration |
| 3933 | */ |
| 3934 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3935 | enum { |
| 3936 | ALC_CTL_WIDGET_VOL, |
| 3937 | ALC_CTL_WIDGET_MUTE, |
| 3938 | ALC_CTL_BIND_MUTE, |
| 3939 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3940 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3941 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3942 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3943 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3944 | }; |
| 3945 | |
| 3946 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3947 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3948 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3949 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3950 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3951 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3952 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 3953 | knew = snd_array_new(&spec->kctls); |
| 3954 | if (!knew) |
| 3955 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3956 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3957 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3958 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3959 | return -ENOMEM; |
| 3960 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3961 | return 0; |
| 3962 | } |
| 3963 | |
| 3964 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3965 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3966 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3967 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3968 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3969 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3970 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3971 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3972 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3973 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3974 | #define ALC880_PIN_CD_NID 0x1c |
| 3975 | |
| 3976 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3977 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3978 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3979 | { |
| 3980 | hda_nid_t nid; |
| 3981 | int assigned[4]; |
| 3982 | int i, j; |
| 3983 | |
| 3984 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3985 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3986 | |
| 3987 | /* check the pins hardwired to audio widget */ |
| 3988 | for (i = 0; i < cfg->line_outs; i++) { |
| 3989 | nid = cfg->line_out_pins[i]; |
| 3990 | if (alc880_is_fixed_pin(nid)) { |
| 3991 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3992 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3993 | assigned[idx] = 1; |
| 3994 | } |
| 3995 | } |
| 3996 | /* left pins can be connect to any audio widget */ |
| 3997 | for (i = 0; i < cfg->line_outs; i++) { |
| 3998 | nid = cfg->line_out_pins[i]; |
| 3999 | if (alc880_is_fixed_pin(nid)) |
| 4000 | continue; |
| 4001 | /* search for an empty channel */ |
| 4002 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4003 | if (!assigned[j]) { |
| 4004 | spec->multiout.dac_nids[i] = |
| 4005 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4006 | assigned[j] = 1; |
| 4007 | break; |
| 4008 | } |
| 4009 | } |
| 4010 | } |
| 4011 | spec->multiout.num_dacs = cfg->line_outs; |
| 4012 | return 0; |
| 4013 | } |
| 4014 | |
| 4015 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4016 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4017 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4018 | { |
| 4019 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4020 | static const char *chname[4] = { |
| 4021 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4022 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4023 | hda_nid_t nid; |
| 4024 | int i, err; |
| 4025 | |
| 4026 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4027 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4028 | continue; |
| 4029 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4030 | if (i == 2) { |
| 4031 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4032 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4033 | "Center Playback Volume", |
| 4034 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4035 | HDA_OUTPUT)); |
| 4036 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4037 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4038 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4039 | "LFE Playback Volume", |
| 4040 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4041 | HDA_OUTPUT)); |
| 4042 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4043 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4044 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4045 | "Center Playback Switch", |
| 4046 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4047 | HDA_INPUT)); |
| 4048 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4049 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4050 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4051 | "LFE Playback Switch", |
| 4052 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4053 | HDA_INPUT)); |
| 4054 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4055 | return err; |
| 4056 | } else { |
| 4057 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4058 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4059 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4060 | HDA_OUTPUT)); |
| 4061 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4062 | return err; |
| 4063 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4064 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4065 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4066 | HDA_INPUT)); |
| 4067 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4068 | return err; |
| 4069 | } |
| 4070 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4071 | return 0; |
| 4072 | } |
| 4073 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4074 | /* add playback controls for speaker and HP outputs */ |
| 4075 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4076 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4077 | { |
| 4078 | hda_nid_t nid; |
| 4079 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4080 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4081 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4082 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4083 | return 0; |
| 4084 | |
| 4085 | if (alc880_is_fixed_pin(pin)) { |
| 4086 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4087 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4088 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4089 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4090 | else |
| 4091 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4092 | /* control HP volume/switch on the output mixer amp */ |
| 4093 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4094 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4095 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4096 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4097 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4098 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4099 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4100 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4101 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4102 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4103 | return err; |
| 4104 | } else if (alc880_is_multi_pin(pin)) { |
| 4105 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4106 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4107 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4108 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4109 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4110 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4111 | return err; |
| 4112 | } |
| 4113 | return 0; |
| 4114 | } |
| 4115 | |
| 4116 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4117 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4118 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4119 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4120 | { |
| 4121 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4122 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4123 | |
| 4124 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4125 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4126 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4127 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4128 | return err; |
| 4129 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4130 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4131 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4132 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4133 | return err; |
| 4134 | return 0; |
| 4135 | } |
| 4136 | |
| 4137 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4138 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4139 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4140 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 4141 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4142 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4143 | |
| 4144 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4145 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4146 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4147 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4148 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4149 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4150 | if (err < 0) |
| 4151 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4152 | imux->items[imux->num_items].label = |
| 4153 | auto_pin_cfg_labels[i]; |
| 4154 | imux->items[imux->num_items].index = |
| 4155 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4156 | imux->num_items++; |
| 4157 | } |
| 4158 | } |
| 4159 | return 0; |
| 4160 | } |
| 4161 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4162 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4163 | unsigned int pin_type) |
| 4164 | { |
| 4165 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4166 | pin_type); |
| 4167 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4168 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4169 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4170 | } |
| 4171 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4172 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4173 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4174 | int dac_idx) |
| 4175 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4176 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4177 | /* need the manual connection? */ |
| 4178 | if (alc880_is_multi_pin(nid)) { |
| 4179 | struct alc_spec *spec = codec->spec; |
| 4180 | int idx = alc880_multi_pin_idx(nid); |
| 4181 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4182 | AC_VERB_SET_CONNECT_SEL, |
| 4183 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4184 | } |
| 4185 | } |
| 4186 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4187 | static int get_pin_type(int line_out_type) |
| 4188 | { |
| 4189 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4190 | return PIN_HP; |
| 4191 | else |
| 4192 | return PIN_OUT; |
| 4193 | } |
| 4194 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4195 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4196 | { |
| 4197 | struct alc_spec *spec = codec->spec; |
| 4198 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4199 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4200 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4201 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4202 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4203 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4204 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4205 | } |
| 4206 | } |
| 4207 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4208 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4209 | { |
| 4210 | struct alc_spec *spec = codec->spec; |
| 4211 | hda_nid_t pin; |
| 4212 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4213 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4214 | if (pin) /* connect to front */ |
| 4215 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4216 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4217 | if (pin) /* connect to front */ |
| 4218 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4219 | } |
| 4220 | |
| 4221 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4222 | { |
| 4223 | struct alc_spec *spec = codec->spec; |
| 4224 | int i; |
| 4225 | |
| 4226 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4227 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4228 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4229 | snd_hda_codec_write(codec, nid, 0, |
| 4230 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4231 | i <= AUTO_PIN_FRONT_MIC ? |
| 4232 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4233 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4234 | snd_hda_codec_write(codec, nid, 0, |
| 4235 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4236 | AMP_OUT_MUTE); |
| 4237 | } |
| 4238 | } |
| 4239 | } |
| 4240 | |
| 4241 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4242 | /* return 1 if successful, 0 if the proper config is not found, |
| 4243 | * or a negative error code |
| 4244 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4245 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4246 | { |
| 4247 | struct alc_spec *spec = codec->spec; |
| 4248 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4249 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4250 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4251 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4252 | alc880_ignore); |
| 4253 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4254 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4255 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4256 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4257 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4258 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4259 | if (err < 0) |
| 4260 | return err; |
| 4261 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4262 | if (err < 0) |
| 4263 | return err; |
| 4264 | err = alc880_auto_create_extra_out(spec, |
| 4265 | spec->autocfg.speaker_pins[0], |
| 4266 | "Speaker"); |
| 4267 | if (err < 0) |
| 4268 | return err; |
| 4269 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4270 | "Headphone"); |
| 4271 | if (err < 0) |
| 4272 | return err; |
| 4273 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4274 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4275 | return err; |
| 4276 | |
| 4277 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4278 | |
| 4279 | if (spec->autocfg.dig_out_pin) |
| 4280 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 4281 | if (spec->autocfg.dig_in_pin) |
| 4282 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4283 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4284 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4285 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4286 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4287 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4288 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4289 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 4290 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4291 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4292 | store_pin_configs(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4293 | return 1; |
| 4294 | } |
| 4295 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4296 | /* additional initialization for auto-configuration model */ |
| 4297 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4298 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4299 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4300 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4301 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4302 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4303 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4304 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4305 | } |
| 4306 | |
| 4307 | /* |
| 4308 | * OK, here we have finally the patch for ALC880 |
| 4309 | */ |
| 4310 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4311 | static void set_capture_mixer(struct alc_spec *spec) |
| 4312 | { |
| 4313 | static struct snd_kcontrol_new *caps[3] = { |
| 4314 | alc_capture_mixer1, |
| 4315 | alc_capture_mixer2, |
| 4316 | alc_capture_mixer3, |
| 4317 | }; |
Takashi Iwai | 30d72e9 | 2008-11-27 15:25:34 +0100 | [diff] [blame] | 4318 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4319 | spec->cap_mixer = caps[spec->num_adc_nids - 1]; |
| 4320 | } |
| 4321 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4322 | static int patch_alc880(struct hda_codec *codec) |
| 4323 | { |
| 4324 | struct alc_spec *spec; |
| 4325 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4326 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4327 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4328 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4329 | if (spec == NULL) |
| 4330 | return -ENOMEM; |
| 4331 | |
| 4332 | codec->spec = spec; |
| 4333 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4334 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4335 | alc880_models, |
| 4336 | alc880_cfg_tbl); |
| 4337 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4338 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 4339 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4340 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4341 | } |
| 4342 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4343 | if (board_config == ALC880_AUTO) { |
| 4344 | /* automatic parse from the BIOS config */ |
| 4345 | err = alc880_parse_auto_config(codec); |
| 4346 | if (err < 0) { |
| 4347 | alc_free(codec); |
| 4348 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4349 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4350 | printk(KERN_INFO |
| 4351 | "hda_codec: Cannot set up configuration " |
| 4352 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4353 | board_config = ALC880_3ST; |
| 4354 | } |
| 4355 | } |
| 4356 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4357 | if (board_config != ALC880_AUTO) |
| 4358 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4359 | |
| 4360 | spec->stream_name_analog = "ALC880 Analog"; |
| 4361 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4362 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4363 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4364 | |
| 4365 | spec->stream_name_digital = "ALC880 Digital"; |
| 4366 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4367 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4368 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4369 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4370 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4371 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4372 | /* get type */ |
| 4373 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4374 | if (wcap != AC_WID_AUD_IN) { |
| 4375 | spec->adc_nids = alc880_adc_nids_alt; |
| 4376 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4377 | } else { |
| 4378 | spec->adc_nids = alc880_adc_nids; |
| 4379 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4380 | } |
| 4381 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4382 | set_capture_mixer(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4383 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4384 | spec->vmaster_nid = 0x0c; |
| 4385 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4386 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4387 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4388 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4389 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4390 | if (!spec->loopback.amplist) |
| 4391 | spec->loopback.amplist = alc880_loopbacks; |
| 4392 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4393 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4394 | |
| 4395 | return 0; |
| 4396 | } |
| 4397 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4398 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4399 | /* |
| 4400 | * ALC260 support |
| 4401 | */ |
| 4402 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4403 | static hda_nid_t alc260_dac_nids[1] = { |
| 4404 | /* front */ |
| 4405 | 0x02, |
| 4406 | }; |
| 4407 | |
| 4408 | static hda_nid_t alc260_adc_nids[1] = { |
| 4409 | /* ADC0 */ |
| 4410 | 0x04, |
| 4411 | }; |
| 4412 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4413 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4414 | /* ADC1 */ |
| 4415 | 0x05, |
| 4416 | }; |
| 4417 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4418 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4419 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4420 | */ |
| 4421 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4422 | /* ADC0, ADC1 */ |
| 4423 | 0x04, 0x05 |
| 4424 | }; |
| 4425 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4426 | #define ALC260_DIGOUT_NID 0x03 |
| 4427 | #define ALC260_DIGIN_NID 0x06 |
| 4428 | |
| 4429 | static struct hda_input_mux alc260_capture_source = { |
| 4430 | .num_items = 4, |
| 4431 | .items = { |
| 4432 | { "Mic", 0x0 }, |
| 4433 | { "Front Mic", 0x1 }, |
| 4434 | { "Line", 0x2 }, |
| 4435 | { "CD", 0x4 }, |
| 4436 | }, |
| 4437 | }; |
| 4438 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4439 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4440 | * headphone jack and the internal CD lines since these are the only pins at |
| 4441 | * which audio can appear. For flexibility, also allow the option of |
| 4442 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4443 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4444 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4445 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4446 | { |
| 4447 | .num_items = 3, |
| 4448 | .items = { |
| 4449 | { "Mic/Line", 0x0 }, |
| 4450 | { "CD", 0x4 }, |
| 4451 | { "Headphone", 0x2 }, |
| 4452 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4453 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4454 | { |
| 4455 | .num_items = 4, |
| 4456 | .items = { |
| 4457 | { "Mic/Line", 0x0 }, |
| 4458 | { "CD", 0x4 }, |
| 4459 | { "Headphone", 0x2 }, |
| 4460 | { "Mixer", 0x5 }, |
| 4461 | }, |
| 4462 | }, |
| 4463 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4464 | }; |
| 4465 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4466 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4467 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4468 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4469 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4470 | { |
| 4471 | .num_items = 4, |
| 4472 | .items = { |
| 4473 | { "Mic", 0x0 }, |
| 4474 | { "Line", 0x2 }, |
| 4475 | { "CD", 0x4 }, |
| 4476 | { "Headphone", 0x5 }, |
| 4477 | }, |
| 4478 | }, |
| 4479 | { |
| 4480 | .num_items = 5, |
| 4481 | .items = { |
| 4482 | { "Mic", 0x0 }, |
| 4483 | { "Line", 0x2 }, |
| 4484 | { "CD", 0x4 }, |
| 4485 | { "Headphone", 0x6 }, |
| 4486 | { "Mixer", 0x5 }, |
| 4487 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4488 | }, |
| 4489 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4490 | /* |
| 4491 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4492 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4493 | * element which allows changing the channel mode, so the verb list is |
| 4494 | * never used. |
| 4495 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4496 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4497 | { 2, NULL }, |
| 4498 | }; |
| 4499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4500 | |
| 4501 | /* Mixer combinations |
| 4502 | * |
| 4503 | * basic: base_output + input + pc_beep + capture |
| 4504 | * HP: base_output + input + capture_alt |
| 4505 | * HP_3013: hp_3013 + input + capture |
| 4506 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4507 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4508 | */ |
| 4509 | |
| 4510 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4511 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4512 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4513 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4514 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4515 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4516 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4517 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4518 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4519 | |
| 4520 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4521 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4522 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4523 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4524 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4525 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4526 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4527 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4528 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4529 | { } /* end */ |
| 4530 | }; |
| 4531 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4532 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 4533 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4534 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4535 | { } /* end */ |
| 4536 | }; |
| 4537 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4538 | /* update HP, line and mono out pins according to the master switch */ |
| 4539 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4540 | hda_nid_t hp, hda_nid_t line, |
| 4541 | hda_nid_t mono) |
| 4542 | { |
| 4543 | struct alc_spec *spec = codec->spec; |
| 4544 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4545 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4546 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4547 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4548 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4549 | val); |
| 4550 | /* mono (speaker) depending on the HP jack sense */ |
| 4551 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4552 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4553 | val); |
| 4554 | } |
| 4555 | |
| 4556 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4557 | struct snd_ctl_elem_value *ucontrol) |
| 4558 | { |
| 4559 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4560 | struct alc_spec *spec = codec->spec; |
| 4561 | *ucontrol->value.integer.value = spec->master_sw; |
| 4562 | return 0; |
| 4563 | } |
| 4564 | |
| 4565 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4566 | struct snd_ctl_elem_value *ucontrol) |
| 4567 | { |
| 4568 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4569 | struct alc_spec *spec = codec->spec; |
| 4570 | int val = !!*ucontrol->value.integer.value; |
| 4571 | hda_nid_t hp, line, mono; |
| 4572 | |
| 4573 | if (val == spec->master_sw) |
| 4574 | return 0; |
| 4575 | spec->master_sw = val; |
| 4576 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4577 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4578 | mono = kcontrol->private_value & 0xff; |
| 4579 | alc260_hp_master_update(codec, hp, line, mono); |
| 4580 | return 1; |
| 4581 | } |
| 4582 | |
| 4583 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4584 | { |
| 4585 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4586 | .name = "Master Playback Switch", |
| 4587 | .info = snd_ctl_boolean_mono_info, |
| 4588 | .get = alc260_hp_master_sw_get, |
| 4589 | .put = alc260_hp_master_sw_put, |
| 4590 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4591 | }, |
| 4592 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4593 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4594 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4595 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4596 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4597 | HDA_OUTPUT), |
| 4598 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4599 | { } /* end */ |
| 4600 | }; |
| 4601 | |
| 4602 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4603 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4604 | {}, |
| 4605 | }; |
| 4606 | |
| 4607 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4608 | { |
| 4609 | struct alc_spec *spec = codec->spec; |
| 4610 | unsigned int present; |
| 4611 | |
| 4612 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4613 | AC_VERB_GET_PIN_SENSE, 0); |
| 4614 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4615 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4616 | } |
| 4617 | |
| 4618 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4619 | { |
| 4620 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4621 | alc260_hp_automute(codec); |
| 4622 | } |
| 4623 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4624 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4625 | { |
| 4626 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4627 | .name = "Master Playback Switch", |
| 4628 | .info = snd_ctl_boolean_mono_info, |
| 4629 | .get = alc260_hp_master_sw_get, |
| 4630 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4631 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4632 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4633 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4634 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4635 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4636 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4637 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4638 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4639 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4640 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4641 | { } /* end */ |
| 4642 | }; |
| 4643 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4644 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4645 | .ops = &snd_hda_bind_vol, |
| 4646 | .values = { |
| 4647 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4648 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4649 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4650 | 0 |
| 4651 | }, |
| 4652 | }; |
| 4653 | |
| 4654 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4655 | .ops = &snd_hda_bind_sw, |
| 4656 | .values = { |
| 4657 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4658 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4659 | 0 |
| 4660 | }, |
| 4661 | }; |
| 4662 | |
| 4663 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4664 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4665 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4666 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4667 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4668 | { } /* end */ |
| 4669 | }; |
| 4670 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4671 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4672 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4673 | {}, |
| 4674 | }; |
| 4675 | |
| 4676 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4677 | { |
| 4678 | struct alc_spec *spec = codec->spec; |
| 4679 | unsigned int present; |
| 4680 | |
| 4681 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4682 | AC_VERB_GET_PIN_SENSE, 0); |
| 4683 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4684 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4685 | } |
| 4686 | |
| 4687 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4688 | unsigned int res) |
| 4689 | { |
| 4690 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4691 | alc260_hp_3013_automute(codec); |
| 4692 | } |
| 4693 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4694 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4695 | { |
| 4696 | unsigned int present, bits; |
| 4697 | |
| 4698 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4699 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4700 | |
| 4701 | bits = present ? 0 : PIN_OUT; |
| 4702 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4703 | bits); |
| 4704 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4705 | bits); |
| 4706 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4707 | bits); |
| 4708 | } |
| 4709 | |
| 4710 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4711 | unsigned int res) |
| 4712 | { |
| 4713 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4714 | alc260_hp_3012_automute(codec); |
| 4715 | } |
| 4716 | |
| 4717 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4718 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4719 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4720 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4721 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4722 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4723 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4724 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4725 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4726 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4727 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4728 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4729 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4730 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4731 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4732 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4733 | { } /* end */ |
| 4734 | }; |
| 4735 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4736 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4737 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4738 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4739 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4740 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4741 | * revisions available in early 2006. Therefore for now allow the |
| 4742 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4743 | * that the lack of mic bias for this NID is intentional we could change the |
| 4744 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4745 | * |
| 4746 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4747 | * don't appear to make the mic bias available from the "line" jack, even |
| 4748 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4749 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4750 | * and the output jack. If this turns out to be the case for all such |
| 4751 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4752 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4753 | * |
| 4754 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4755 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4756 | * controls for such models. On models without a "mono speaker" the control |
| 4757 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4758 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4759 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4760 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4761 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4762 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4763 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4764 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4765 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4766 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4767 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4768 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4769 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4770 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4771 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4772 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4773 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4774 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4775 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4776 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4777 | { } /* end */ |
| 4778 | }; |
| 4779 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4780 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4781 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4782 | */ |
| 4783 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4784 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4785 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4786 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4787 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4788 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4789 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4790 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4791 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4792 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4793 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4794 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4795 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4796 | { } /* end */ |
| 4797 | }; |
| 4798 | |
| 4799 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4800 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4801 | */ |
| 4802 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4803 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4804 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4805 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4806 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4807 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4808 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4809 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4810 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4811 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4812 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4813 | { } /* end */ |
| 4814 | }; |
| 4815 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4816 | /* |
| 4817 | * initialization verbs |
| 4818 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4819 | static struct hda_verb alc260_init_verbs[] = { |
| 4820 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4821 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4822 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4823 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4824 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4825 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4826 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4827 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4828 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4829 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4830 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4831 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4832 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4833 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4834 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4835 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4836 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4837 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4838 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4839 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4840 | /* set connection select to line in (default select for this ADC) */ |
| 4841 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4842 | /* mute capture amp left and right */ |
| 4843 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4844 | /* set connection select to line in (default select for this ADC) */ |
| 4845 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4846 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4847 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4848 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4849 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4850 | /* set vol=0 HP mixer amp left and right */ |
| 4851 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4852 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4853 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4854 | /* set vol=0 Mono mixer amp left and right */ |
| 4855 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4856 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4857 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4858 | /* unmute LINE-2 out pin */ |
| 4859 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4860 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4861 | * Line In 2 = 0x03 |
| 4862 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4863 | /* mute analog inputs */ |
| 4864 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4865 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4866 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4867 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4868 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4869 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4870 | /* mute Front out path */ |
| 4871 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4872 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4873 | /* mute Headphone out path */ |
| 4874 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4875 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4876 | /* mute Mono out path */ |
| 4877 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4878 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4879 | { } |
| 4880 | }; |
| 4881 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4882 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4883 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4884 | /* Headphone and output */ |
| 4885 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4886 | /* mono output */ |
| 4887 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4888 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4889 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4890 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4891 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4892 | /* Line In pin widget for input */ |
| 4893 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4894 | /* Line-2 pin widget for output */ |
| 4895 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4896 | /* CD pin widget for input */ |
| 4897 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4898 | /* unmute amp left and right */ |
| 4899 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4900 | /* set connection select to line in (default select for this ADC) */ |
| 4901 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4902 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4903 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4904 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4905 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4906 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4907 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4908 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4909 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4910 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4911 | * Line In 2 = 0x03 |
| 4912 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4913 | /* mute analog inputs */ |
| 4914 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4915 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4916 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4917 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4918 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4919 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4920 | /* Unmute Front out path */ |
| 4921 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4922 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4923 | /* Unmute Headphone out path */ |
| 4924 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4925 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4926 | /* Unmute Mono out path */ |
| 4927 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4928 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4929 | { } |
| 4930 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4931 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4932 | |
| 4933 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4934 | /* Line out and output */ |
| 4935 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4936 | /* mono output */ |
| 4937 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4938 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4939 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4940 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4941 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4942 | /* Line In pin widget for input */ |
| 4943 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4944 | /* Headphone pin widget for output */ |
| 4945 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4946 | /* CD pin widget for input */ |
| 4947 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4948 | /* unmute amp left and right */ |
| 4949 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4950 | /* set connection select to line in (default select for this ADC) */ |
| 4951 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4952 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4953 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4954 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4955 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4956 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4957 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4958 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4959 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4960 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4961 | * Line In 2 = 0x03 |
| 4962 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4963 | /* mute analog inputs */ |
| 4964 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4965 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4966 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4967 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4968 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4969 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4970 | /* Unmute Front out path */ |
| 4971 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4972 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4973 | /* Unmute Headphone out path */ |
| 4974 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4975 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4976 | /* Unmute Mono out path */ |
| 4977 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4978 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4979 | { } |
| 4980 | }; |
| 4981 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4982 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4983 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4984 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4985 | */ |
| 4986 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4987 | /* Disable all GPIOs */ |
| 4988 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4989 | /* Internal speaker is connected to headphone pin */ |
| 4990 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4991 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4992 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4993 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4994 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4995 | /* Ensure all other unused pins are disabled and muted. */ |
| 4996 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4997 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4998 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4999 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5000 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5001 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5002 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5003 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5004 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5005 | /* Disable digital (SPDIF) pins */ |
| 5006 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5007 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5008 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5009 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5010 | * when acting as an output. |
| 5011 | */ |
| 5012 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5013 | |
| 5014 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5015 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5016 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5017 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5018 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5019 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5020 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5021 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5022 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5023 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5024 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5025 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5026 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5027 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5028 | * If the pin mode is changed by the user the pin mode control will |
| 5029 | * take care of enabling the pin's input/output buffers as needed. |
| 5030 | * Therefore there's no need to enable the input buffer at this |
| 5031 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5032 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5033 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5034 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5035 | * mixer ctrl) |
| 5036 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5037 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5038 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5039 | /* Mute capture amp left and right */ |
| 5040 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5041 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5042 | * in (on mic1 pin) |
| 5043 | */ |
| 5044 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5045 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5046 | /* Do the same for the second ADC: mute capture input amp and |
| 5047 | * set ADC connection to line in (on mic1 pin) |
| 5048 | */ |
| 5049 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5050 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5051 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5052 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5053 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5054 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5055 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5056 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5057 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5058 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5059 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5060 | {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] | 5061 | |
| 5062 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5063 | }; |
| 5064 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5065 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5066 | * similar laptops (adapted from Fujitsu init verbs). |
| 5067 | */ |
| 5068 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5069 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5070 | * the headphone jack. Turn this on and rely on the standard mute |
| 5071 | * methods whenever the user wants to turn these outputs off. |
| 5072 | */ |
| 5073 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5074 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5075 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5076 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5077 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5078 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5079 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5080 | /* Line In jack is connected to Line1 pin */ |
| 5081 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5082 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5083 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5084 | /* Ensure all other unused pins are disabled and muted. */ |
| 5085 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5086 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5087 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5088 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5089 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5090 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5091 | /* Disable digital (SPDIF) pins */ |
| 5092 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5093 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5094 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5095 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5096 | * bus when acting as outputs. |
| 5097 | */ |
| 5098 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5099 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5100 | |
| 5101 | /* Start with output sum widgets muted and their output gains at min */ |
| 5102 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5103 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5104 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5105 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5106 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5107 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5108 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5109 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5110 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5111 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5112 | /* Unmute Line-out pin widget amp left and right |
| 5113 | * (no equiv mixer ctrl) |
| 5114 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5115 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5116 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5117 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5118 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5119 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5120 | * will take care of enabling the pin's input/output buffers as needed. |
| 5121 | * Therefore there's no need to enable the input buffer at this |
| 5122 | * stage. |
| 5123 | */ |
| 5124 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5125 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5126 | |
| 5127 | /* Mute capture amp left and right */ |
| 5128 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5129 | /* Set ADC connection select to match default mixer setting - mic |
| 5130 | * (on mic1 pin) |
| 5131 | */ |
| 5132 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5133 | |
| 5134 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5135 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5136 | */ |
| 5137 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5138 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5139 | |
| 5140 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5141 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5142 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5143 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5144 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5145 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5146 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5147 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5148 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5149 | |
| 5150 | { } |
| 5151 | }; |
| 5152 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5153 | static struct hda_verb alc260_will_verbs[] = { |
| 5154 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5155 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5156 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5157 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5158 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5159 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5160 | {} |
| 5161 | }; |
| 5162 | |
| 5163 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5164 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5165 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5166 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5167 | |
| 5168 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5169 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5170 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5171 | |
| 5172 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5173 | {} |
| 5174 | }; |
| 5175 | |
| 5176 | /* toggle speaker-output according to the hp-jack state */ |
| 5177 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5178 | { |
| 5179 | unsigned int present; |
| 5180 | |
| 5181 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5182 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5183 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5184 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5185 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5186 | AC_VERB_SET_GPIO_DATA, 1); |
| 5187 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5188 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5189 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5190 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5191 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5192 | AC_VERB_SET_GPIO_DATA, 0); |
| 5193 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5194 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5195 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5196 | } |
| 5197 | } |
| 5198 | |
| 5199 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5200 | unsigned int res) |
| 5201 | { |
| 5202 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5203 | alc260_replacer_672v_automute(codec); |
| 5204 | } |
| 5205 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5206 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5207 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5208 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5209 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5210 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5211 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5212 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5213 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5214 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5215 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5216 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5217 | {} |
| 5218 | }; |
| 5219 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5220 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5221 | * configuration. |
| 5222 | */ |
| 5223 | #ifdef CONFIG_SND_DEBUG |
| 5224 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5225 | 0x02, |
| 5226 | }; |
| 5227 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5228 | 0x04, 0x05, |
| 5229 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5230 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5231 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5232 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5233 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5234 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5235 | { |
| 5236 | .num_items = 7, |
| 5237 | .items = { |
| 5238 | { "MIC1 pin", 0x0 }, |
| 5239 | { "MIC2 pin", 0x1 }, |
| 5240 | { "LINE1 pin", 0x2 }, |
| 5241 | { "LINE2 pin", 0x3 }, |
| 5242 | { "CD pin", 0x4 }, |
| 5243 | { "LINE-OUT pin", 0x5 }, |
| 5244 | { "HP-OUT pin", 0x6 }, |
| 5245 | }, |
| 5246 | }, |
| 5247 | { |
| 5248 | .num_items = 8, |
| 5249 | .items = { |
| 5250 | { "MIC1 pin", 0x0 }, |
| 5251 | { "MIC2 pin", 0x1 }, |
| 5252 | { "LINE1 pin", 0x2 }, |
| 5253 | { "LINE2 pin", 0x3 }, |
| 5254 | { "CD pin", 0x4 }, |
| 5255 | { "Mixer", 0x5 }, |
| 5256 | { "LINE-OUT pin", 0x6 }, |
| 5257 | { "HP-OUT pin", 0x7 }, |
| 5258 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5259 | }, |
| 5260 | }; |
| 5261 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5262 | /* Output driver widgets */ |
| 5263 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5264 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5265 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5266 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5267 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5268 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5269 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5270 | /* Modes for retasking pin widgets |
| 5271 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5272 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5273 | * mention this restriction. At this stage it's not clear whether |
| 5274 | * this behaviour is intentional or is a hardware bug in chip |
| 5275 | * revisions available at least up until early 2006. Therefore for |
| 5276 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5277 | * choices, but if it turns out that the lack of mic bias for these |
| 5278 | * NIDs is intentional we could change their modes from |
| 5279 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5280 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5281 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5282 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5283 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5284 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5285 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5286 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5287 | |
| 5288 | /* Loopback mixer controls */ |
| 5289 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5290 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5291 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5292 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5293 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5294 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5295 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5296 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5297 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5298 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5299 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 5300 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 5301 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5302 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5303 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5304 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5305 | |
| 5306 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5307 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5308 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5309 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5310 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5311 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5312 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5313 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5314 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5315 | */ |
| 5316 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5317 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5318 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5319 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5320 | * this output to turn on an external amplifier. |
| 5321 | */ |
| 5322 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5323 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5324 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5325 | { } /* end */ |
| 5326 | }; |
| 5327 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5328 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5329 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5330 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5331 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5332 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5333 | /* Enable retasking pins as output, initially without power amp */ |
| 5334 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5335 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5337 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5338 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5339 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5340 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5341 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5342 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5343 | * payload also sets the generation to 0, output to be in "consumer" |
| 5344 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5345 | * control. |
| 5346 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5347 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5348 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5349 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5350 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5351 | * OUT1 sum bus when acting as an output. |
| 5352 | */ |
| 5353 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5354 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5355 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5356 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5357 | |
| 5358 | /* Start with output sum widgets muted and their output gains at min */ |
| 5359 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5360 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5361 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5362 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5363 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5364 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5365 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5366 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5367 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5368 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5369 | /* Unmute retasking pin widget output buffers since the default |
| 5370 | * state appears to be output. As the pin mode is changed by the |
| 5371 | * user the pin mode control will take care of enabling the pin's |
| 5372 | * input/output buffers as needed. |
| 5373 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5374 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5375 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5376 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5377 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5378 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5379 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5380 | /* Also unmute the mono-out pin widget */ |
| 5381 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5382 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5383 | /* Mute capture amp left and right */ |
| 5384 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5385 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5386 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5387 | */ |
| 5388 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5389 | |
| 5390 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5391 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5392 | */ |
| 5393 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5394 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5395 | |
| 5396 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5399 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5400 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5401 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5402 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5403 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5404 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5405 | |
| 5406 | { } |
| 5407 | }; |
| 5408 | #endif |
| 5409 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5410 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5411 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5412 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5413 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5414 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5415 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5416 | /* |
| 5417 | * for BIOS auto-configuration |
| 5418 | */ |
| 5419 | |
| 5420 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5421 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5422 | { |
| 5423 | hda_nid_t nid_vol; |
| 5424 | unsigned long vol_val, sw_val; |
| 5425 | char name[32]; |
| 5426 | int err; |
| 5427 | |
| 5428 | if (nid >= 0x0f && nid < 0x11) { |
| 5429 | nid_vol = nid - 0x7; |
| 5430 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5431 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5432 | } else if (nid == 0x11) { |
| 5433 | nid_vol = nid - 0x7; |
| 5434 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5435 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5436 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5437 | nid_vol = 0x08; |
| 5438 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5439 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5440 | } else |
| 5441 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5442 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5443 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5444 | /* first control for the volume widget */ |
| 5445 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5446 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5447 | if (err < 0) |
| 5448 | return err; |
| 5449 | *vol_bits |= (1 << nid_vol); |
| 5450 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5451 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5452 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5453 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5454 | return err; |
| 5455 | return 1; |
| 5456 | } |
| 5457 | |
| 5458 | /* add playback controls from the parsed DAC table */ |
| 5459 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5460 | const struct auto_pin_cfg *cfg) |
| 5461 | { |
| 5462 | hda_nid_t nid; |
| 5463 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5464 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5465 | |
| 5466 | spec->multiout.num_dacs = 1; |
| 5467 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5468 | spec->multiout.dac_nids[0] = 0x02; |
| 5469 | |
| 5470 | nid = cfg->line_out_pins[0]; |
| 5471 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5472 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5473 | if (err < 0) |
| 5474 | return err; |
| 5475 | } |
| 5476 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5477 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5478 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5479 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5480 | if (err < 0) |
| 5481 | return err; |
| 5482 | } |
| 5483 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5484 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5485 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5486 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5487 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5488 | if (err < 0) |
| 5489 | return err; |
| 5490 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5491 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5492 | } |
| 5493 | |
| 5494 | /* create playback/capture controls for input pins */ |
| 5495 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5496 | const struct auto_pin_cfg *cfg) |
| 5497 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 5498 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5499 | int i, err, idx; |
| 5500 | |
| 5501 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5502 | if (cfg->input_pins[i] >= 0x12) { |
| 5503 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5504 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5505 | auto_pin_cfg_labels[i], idx, |
| 5506 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5507 | if (err < 0) |
| 5508 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5509 | imux->items[imux->num_items].label = |
| 5510 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5511 | imux->items[imux->num_items].index = idx; |
| 5512 | imux->num_items++; |
| 5513 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5514 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5515 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5516 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5517 | auto_pin_cfg_labels[i], idx, |
| 5518 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5519 | if (err < 0) |
| 5520 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5521 | imux->items[imux->num_items].label = |
| 5522 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5523 | imux->items[imux->num_items].index = idx; |
| 5524 | imux->num_items++; |
| 5525 | } |
| 5526 | } |
| 5527 | return 0; |
| 5528 | } |
| 5529 | |
| 5530 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5531 | hda_nid_t nid, int pin_type, |
| 5532 | int sel_idx) |
| 5533 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5534 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5535 | /* need the manual connection? */ |
| 5536 | if (nid >= 0x12) { |
| 5537 | int idx = nid - 0x12; |
| 5538 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5539 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5540 | } |
| 5541 | } |
| 5542 | |
| 5543 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5544 | { |
| 5545 | struct alc_spec *spec = codec->spec; |
| 5546 | hda_nid_t nid; |
| 5547 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5548 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5549 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5550 | if (nid) { |
| 5551 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5552 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5553 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5554 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5555 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5556 | if (nid) |
| 5557 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5558 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5559 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5560 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5561 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5562 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5563 | |
| 5564 | #define ALC260_PIN_CD_NID 0x16 |
| 5565 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5566 | { |
| 5567 | struct alc_spec *spec = codec->spec; |
| 5568 | int i; |
| 5569 | |
| 5570 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5571 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5572 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5573 | snd_hda_codec_write(codec, nid, 0, |
| 5574 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5575 | i <= AUTO_PIN_FRONT_MIC ? |
| 5576 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5577 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5578 | snd_hda_codec_write(codec, nid, 0, |
| 5579 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5580 | AMP_OUT_MUTE); |
| 5581 | } |
| 5582 | } |
| 5583 | } |
| 5584 | |
| 5585 | /* |
| 5586 | * generic initialization of ADC, input mixers and output mixers |
| 5587 | */ |
| 5588 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5589 | /* |
| 5590 | * Unmute ADC0-1 and set the default input to mic-in |
| 5591 | */ |
| 5592 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5593 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5594 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5595 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5596 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5597 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5598 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5599 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5600 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5601 | */ |
| 5602 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5603 | /* mute analog inputs */ |
| 5604 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5605 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5606 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5607 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5608 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5609 | |
| 5610 | /* |
| 5611 | * Set up output mixers (0x08 - 0x0a) |
| 5612 | */ |
| 5613 | /* set vol=0 to output mixers */ |
| 5614 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5615 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5616 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5617 | /* set up input amps for analog loopback */ |
| 5618 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5619 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5620 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5621 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5622 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5623 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5624 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5625 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5626 | { } |
| 5627 | }; |
| 5628 | |
| 5629 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5630 | { |
| 5631 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5632 | int err; |
| 5633 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5634 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5635 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5636 | alc260_ignore); |
| 5637 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5638 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5639 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5640 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5641 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5642 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5643 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5644 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5645 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5646 | return err; |
| 5647 | |
| 5648 | spec->multiout.max_channels = 2; |
| 5649 | |
| 5650 | if (spec->autocfg.dig_out_pin) |
| 5651 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5652 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5653 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5654 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5655 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5656 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5657 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 5658 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5659 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 5660 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5661 | return 1; |
| 5662 | } |
| 5663 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5664 | /* additional initialization for auto-configuration model */ |
| 5665 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5666 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5667 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5668 | alc260_auto_init_multi_out(codec); |
| 5669 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5670 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5671 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5672 | } |
| 5673 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5674 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5675 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5676 | { 0x07, HDA_INPUT, 0 }, |
| 5677 | { 0x07, HDA_INPUT, 1 }, |
| 5678 | { 0x07, HDA_INPUT, 2 }, |
| 5679 | { 0x07, HDA_INPUT, 3 }, |
| 5680 | { 0x07, HDA_INPUT, 4 }, |
| 5681 | { } /* end */ |
| 5682 | }; |
| 5683 | #endif |
| 5684 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5685 | /* |
| 5686 | * ALC260 configurations |
| 5687 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5688 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5689 | [ALC260_BASIC] = "basic", |
| 5690 | [ALC260_HP] = "hp", |
| 5691 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5692 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5693 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5694 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5695 | [ALC260_WILL] = "will", |
| 5696 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5697 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5698 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5699 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5700 | [ALC260_AUTO] = "auto", |
| 5701 | }; |
| 5702 | |
| 5703 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5704 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5705 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5706 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5707 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5708 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5709 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5710 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5711 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5712 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5713 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5714 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5715 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5716 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5717 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5718 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5719 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5720 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5721 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5722 | {} |
| 5723 | }; |
| 5724 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5725 | static struct alc_config_preset alc260_presets[] = { |
| 5726 | [ALC260_BASIC] = { |
| 5727 | .mixers = { alc260_base_output_mixer, |
| 5728 | alc260_input_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5729 | alc260_pc_beep_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5730 | .init_verbs = { alc260_init_verbs }, |
| 5731 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5732 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5733 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5734 | .adc_nids = alc260_adc_nids, |
| 5735 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5736 | .channel_mode = alc260_modes, |
| 5737 | .input_mux = &alc260_capture_source, |
| 5738 | }, |
| 5739 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5740 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5741 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5742 | .init_verbs = { alc260_init_verbs, |
| 5743 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5744 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5745 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5746 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5747 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5748 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5749 | .channel_mode = alc260_modes, |
| 5750 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5751 | .unsol_event = alc260_hp_unsol_event, |
| 5752 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5753 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5754 | [ALC260_HP_DC7600] = { |
| 5755 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5756 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5757 | .init_verbs = { alc260_init_verbs, |
| 5758 | alc260_hp_dc7600_verbs }, |
| 5759 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5760 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5761 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5762 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5763 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5764 | .channel_mode = alc260_modes, |
| 5765 | .input_mux = &alc260_capture_source, |
| 5766 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5767 | .init_hook = alc260_hp_3012_automute, |
| 5768 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5769 | [ALC260_HP_3013] = { |
| 5770 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5771 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5772 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5773 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5774 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5775 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5776 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5777 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5778 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5779 | .channel_mode = alc260_modes, |
| 5780 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5781 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5782 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5783 | }, |
| 5784 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5785 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5786 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5787 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5788 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5789 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5790 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5791 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5792 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5793 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5794 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5795 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5796 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5797 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5798 | .init_verbs = { alc260_acer_init_verbs }, |
| 5799 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5800 | .dac_nids = alc260_dac_nids, |
| 5801 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5802 | .adc_nids = alc260_dual_adc_nids, |
| 5803 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5804 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5805 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5806 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5807 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5808 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5809 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5810 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5811 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5812 | .dac_nids = alc260_dac_nids, |
| 5813 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5814 | .adc_nids = alc260_adc_nids, |
| 5815 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5816 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5817 | .channel_mode = alc260_modes, |
| 5818 | .input_mux = &alc260_capture_source, |
| 5819 | }, |
| 5820 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5821 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5822 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5823 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5824 | .dac_nids = alc260_dac_nids, |
| 5825 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5826 | .adc_nids = alc260_adc_nids, |
| 5827 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5828 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5829 | .channel_mode = alc260_modes, |
| 5830 | .input_mux = &alc260_capture_source, |
| 5831 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5832 | .init_hook = alc260_replacer_672v_automute, |
| 5833 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5834 | #ifdef CONFIG_SND_DEBUG |
| 5835 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5836 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5837 | .init_verbs = { alc260_test_init_verbs }, |
| 5838 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5839 | .dac_nids = alc260_test_dac_nids, |
| 5840 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5841 | .adc_nids = alc260_test_adc_nids, |
| 5842 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5843 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5844 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5845 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5846 | }, |
| 5847 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5848 | }; |
| 5849 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5850 | static int patch_alc260(struct hda_codec *codec) |
| 5851 | { |
| 5852 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5853 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5854 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5855 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5856 | if (spec == NULL) |
| 5857 | return -ENOMEM; |
| 5858 | |
| 5859 | codec->spec = spec; |
| 5860 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5861 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5862 | alc260_models, |
| 5863 | alc260_cfg_tbl); |
| 5864 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5865 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5866 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5867 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5868 | } |
| 5869 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5870 | if (board_config == ALC260_AUTO) { |
| 5871 | /* automatic parse from the BIOS config */ |
| 5872 | err = alc260_parse_auto_config(codec); |
| 5873 | if (err < 0) { |
| 5874 | alc_free(codec); |
| 5875 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5876 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5877 | printk(KERN_INFO |
| 5878 | "hda_codec: Cannot set up configuration " |
| 5879 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5880 | board_config = ALC260_BASIC; |
| 5881 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5882 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5883 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5884 | if (board_config != ALC260_AUTO) |
| 5885 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5886 | |
| 5887 | spec->stream_name_analog = "ALC260 Analog"; |
| 5888 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5889 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5890 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5891 | spec->stream_name_digital = "ALC260 Digital"; |
| 5892 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5893 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5894 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 5895 | if (!spec->adc_nids && spec->input_mux) { |
| 5896 | /* check whether NID 0x04 is valid */ |
| 5897 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 5898 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 5899 | /* get type */ |
| 5900 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 5901 | spec->adc_nids = alc260_adc_nids_alt; |
| 5902 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5903 | } else { |
| 5904 | spec->adc_nids = alc260_adc_nids; |
| 5905 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5906 | } |
| 5907 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5908 | set_capture_mixer(spec); |
| 5909 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5910 | spec->vmaster_nid = 0x08; |
| 5911 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5912 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5913 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5914 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5915 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5916 | if (!spec->loopback.amplist) |
| 5917 | spec->loopback.amplist = alc260_loopbacks; |
| 5918 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 5919 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5920 | |
| 5921 | return 0; |
| 5922 | } |
| 5923 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5924 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5925 | /* |
| 5926 | * ALC882 support |
| 5927 | * |
| 5928 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5929 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5930 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5931 | * 6-channel independent captures. |
| 5932 | * |
| 5933 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5934 | * driver yet). |
| 5935 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5936 | #define ALC882_DIGOUT_NID 0x06 |
| 5937 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5938 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5939 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5940 | { 8, NULL } |
| 5941 | }; |
| 5942 | |
| 5943 | static hda_nid_t alc882_dac_nids[4] = { |
| 5944 | /* front, rear, clfe, rear_surr */ |
| 5945 | 0x02, 0x03, 0x04, 0x05 |
| 5946 | }; |
| 5947 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5948 | /* identical with ALC880 */ |
| 5949 | #define alc882_adc_nids alc880_adc_nids |
| 5950 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5951 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5952 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5953 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5954 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5955 | /* input MUX */ |
| 5956 | /* FIXME: should be a matrix-type input source selection */ |
| 5957 | |
| 5958 | static struct hda_input_mux alc882_capture_source = { |
| 5959 | .num_items = 4, |
| 5960 | .items = { |
| 5961 | { "Mic", 0x0 }, |
| 5962 | { "Front Mic", 0x1 }, |
| 5963 | { "Line", 0x2 }, |
| 5964 | { "CD", 0x4 }, |
| 5965 | }, |
| 5966 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5967 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5968 | * 2ch mode |
| 5969 | */ |
| 5970 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5971 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5972 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5973 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5974 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5975 | { } /* end */ |
| 5976 | }; |
| 5977 | |
| 5978 | /* |
| 5979 | * 6ch mode |
| 5980 | */ |
| 5981 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5982 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5983 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5984 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5985 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5986 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5987 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5988 | { } /* end */ |
| 5989 | }; |
| 5990 | |
| 5991 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5992 | { 2, alc882_3ST_ch2_init }, |
| 5993 | { 6, alc882_3ST_ch6_init }, |
| 5994 | }; |
| 5995 | |
| 5996 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5997 | * 6ch mode |
| 5998 | */ |
| 5999 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6000 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6001 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6002 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6003 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6004 | { } /* end */ |
| 6005 | }; |
| 6006 | |
| 6007 | /* |
| 6008 | * 8ch mode |
| 6009 | */ |
| 6010 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6011 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6012 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6013 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6014 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6015 | { } /* end */ |
| 6016 | }; |
| 6017 | |
| 6018 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6019 | { 6, alc882_sixstack_ch6_init }, |
| 6020 | { 8, alc882_sixstack_ch8_init }, |
| 6021 | }; |
| 6022 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6023 | /* |
| 6024 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 6025 | */ |
| 6026 | |
| 6027 | /* |
| 6028 | * 2ch mode |
| 6029 | */ |
| 6030 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6031 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6032 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6033 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6034 | { } /* end */ |
| 6035 | }; |
| 6036 | |
| 6037 | /* |
| 6038 | * 6ch mode |
| 6039 | */ |
| 6040 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6041 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6042 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6043 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6044 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6045 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6046 | { } /* end */ |
| 6047 | }; |
| 6048 | |
| 6049 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6050 | { 2, alc885_mbp_ch2_init }, |
| 6051 | { 6, alc885_mbp_ch6_init }, |
| 6052 | }; |
| 6053 | |
| 6054 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6055 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6056 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6057 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6058 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6059 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6060 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6061 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6062 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6063 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6064 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6065 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6066 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6067 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6068 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6069 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6070 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6071 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6072 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6073 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6074 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6075 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6076 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6077 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6078 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6079 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6080 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6081 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6082 | { } /* end */ |
| 6083 | }; |
| 6084 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6085 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6087 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6088 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6089 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6090 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6091 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6092 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6093 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6094 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6095 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6096 | { } /* end */ |
| 6097 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6098 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6099 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6100 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6101 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6102 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6103 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6104 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6105 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6106 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6107 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6108 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6109 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6110 | { } /* end */ |
| 6111 | }; |
| 6112 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6113 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6114 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6115 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6116 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6117 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6118 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6119 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6120 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6121 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6122 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6123 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6124 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6125 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6126 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6127 | { } /* end */ |
| 6128 | }; |
| 6129 | |
| 6130 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6131 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6132 | */ |
| 6133 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6134 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6135 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6136 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6137 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6138 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6139 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6140 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6141 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6142 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6143 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6144 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6145 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6146 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6147 | { } /* end */ |
| 6148 | }; |
| 6149 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6150 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6151 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6152 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6153 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6154 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6155 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6156 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6157 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6158 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6159 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6160 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6161 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6162 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6163 | { } /* end */ |
| 6164 | }; |
| 6165 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6166 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6167 | { |
| 6168 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6169 | .name = "Channel Mode", |
| 6170 | .info = alc_ch_mode_info, |
| 6171 | .get = alc_ch_mode_get, |
| 6172 | .put = alc_ch_mode_put, |
| 6173 | }, |
| 6174 | { } /* end */ |
| 6175 | }; |
| 6176 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6177 | static struct hda_verb alc882_init_verbs[] = { |
| 6178 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6179 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6180 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6181 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6182 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6183 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6184 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6185 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6186 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6187 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6188 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6189 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6190 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6191 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6192 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6193 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6194 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6195 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6196 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6197 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6198 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6199 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6200 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6201 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6202 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6203 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6204 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6205 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6206 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6207 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6208 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6209 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6210 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6211 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6212 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6213 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6214 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6215 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6216 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6217 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6218 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6219 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6220 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6221 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6222 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6223 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6224 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6225 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6226 | |
| 6227 | /* FIXME: use matrix-type input source selection */ |
| 6228 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6229 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6230 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6231 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6232 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6233 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6234 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6235 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6236 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6237 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6238 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6239 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6240 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6241 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6242 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6243 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6244 | /* ADC1: mute amp left and right */ |
| 6245 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6246 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6247 | /* ADC2: mute amp left and right */ |
| 6248 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6249 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6250 | /* ADC3: mute amp left and right */ |
| 6251 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6252 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6253 | |
| 6254 | { } |
| 6255 | }; |
| 6256 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6257 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6258 | /* change to EAPD mode */ |
| 6259 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6260 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6261 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6262 | }; |
| 6263 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6264 | /* Mac Pro test */ |
| 6265 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6266 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6267 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6268 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6269 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6270 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6271 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6272 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6273 | { } /* end */ |
| 6274 | }; |
| 6275 | |
| 6276 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6277 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6278 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6280 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6281 | /* Front Pin: output 0 (0x0c) */ |
| 6282 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6283 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6284 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6285 | /* Front Mic pin: input vref at 80% */ |
| 6286 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6287 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6288 | /* Speaker: output */ |
| 6289 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6290 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6291 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6292 | /* Headphone output (output 0 - 0x0c) */ |
| 6293 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6294 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6295 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6296 | |
| 6297 | /* FIXME: use matrix-type input source selection */ |
| 6298 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6299 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6300 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6301 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6302 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6303 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6304 | /* Input mixer2 */ |
| 6305 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6306 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6307 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6308 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6309 | /* Input mixer3 */ |
| 6310 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6311 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6312 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6313 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6314 | /* ADC1: mute amp left and right */ |
| 6315 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6316 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6317 | /* ADC2: mute amp left and right */ |
| 6318 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6319 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6320 | /* ADC3: mute amp left and right */ |
| 6321 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6322 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6323 | |
| 6324 | { } |
| 6325 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6326 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6327 | /* Macbook Pro rev3 */ |
| 6328 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6329 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6330 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6331 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6332 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6333 | /* Rear mixer */ |
| 6334 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6335 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6336 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6337 | /* Front Pin: output 0 (0x0c) */ |
| 6338 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6339 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6340 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6341 | /* HP Pin: output 0 (0x0d) */ |
| 6342 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6343 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6344 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6345 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6346 | /* Mic (rear) pin: input vref at 80% */ |
| 6347 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6348 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6349 | /* Front Mic pin: input vref at 80% */ |
| 6350 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6351 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6352 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6353 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6354 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6355 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6356 | |
| 6357 | /* FIXME: use matrix-type input source selection */ |
| 6358 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6359 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6360 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6361 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6362 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6363 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6364 | /* Input mixer2 */ |
| 6365 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6367 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6368 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6369 | /* Input mixer3 */ |
| 6370 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6372 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6373 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6374 | /* ADC1: mute amp left and right */ |
| 6375 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6376 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6377 | /* ADC2: mute amp left and right */ |
| 6378 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6379 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6380 | /* ADC3: mute amp left and right */ |
| 6381 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6382 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6383 | |
| 6384 | { } |
| 6385 | }; |
| 6386 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6387 | /* iMac 24 mixer. */ |
| 6388 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6389 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6390 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6391 | { } /* end */ |
| 6392 | }; |
| 6393 | |
| 6394 | /* iMac 24 init verbs. */ |
| 6395 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6396 | /* Internal speakers: output 0 (0x0c) */ |
| 6397 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6398 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6399 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6400 | /* Internal speakers: output 0 (0x0c) */ |
| 6401 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6402 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6403 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6404 | /* Headphone: output 0 (0x0c) */ |
| 6405 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6406 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6407 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6408 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6409 | /* Front Mic: input vref at 80% */ |
| 6410 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6411 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6412 | { } |
| 6413 | }; |
| 6414 | |
| 6415 | /* Toggle speaker-output according to the hp-jack state */ |
| 6416 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 6417 | { |
| 6418 | unsigned int present; |
| 6419 | |
| 6420 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6421 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6422 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 6423 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6424 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 6425 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6426 | } |
| 6427 | |
| 6428 | /* Processes unsolicited events. */ |
| 6429 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6430 | unsigned int res) |
| 6431 | { |
| 6432 | /* Headphone insertion or removal. */ |
| 6433 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6434 | alc885_imac24_automute(codec); |
| 6435 | } |
| 6436 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6437 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6438 | { |
| 6439 | unsigned int present; |
| 6440 | |
| 6441 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6442 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6443 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6444 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6445 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6446 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6447 | |
| 6448 | } |
| 6449 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6450 | unsigned int res) |
| 6451 | { |
| 6452 | /* Headphone insertion or removal. */ |
| 6453 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6454 | alc885_mbp3_automute(codec); |
| 6455 | } |
| 6456 | |
| 6457 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6458 | static struct hda_verb alc882_targa_verbs[] = { |
| 6459 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6460 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6461 | |
| 6462 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6463 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6464 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6465 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6466 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6467 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6468 | |
| 6469 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6470 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6471 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6472 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6473 | { } /* end */ |
| 6474 | }; |
| 6475 | |
| 6476 | /* toggle speaker-output according to the hp-jack state */ |
| 6477 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6478 | { |
| 6479 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6480 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6481 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6482 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6483 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6484 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6485 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6486 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6487 | } |
| 6488 | |
| 6489 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6490 | { |
| 6491 | /* Looks like the unsol event is incompatible with the standard |
| 6492 | * definition. 4bit tag is placed at 26 bit! |
| 6493 | */ |
| 6494 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6495 | alc882_targa_automute(codec); |
| 6496 | } |
| 6497 | } |
| 6498 | |
| 6499 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6500 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6501 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6502 | |
| 6503 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6504 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6505 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6506 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6507 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6508 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6509 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6510 | |
| 6511 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6512 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6513 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6514 | { } /* end */ |
| 6515 | }; |
| 6516 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6517 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6519 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6520 | |
| 6521 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6522 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6523 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6524 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6525 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6526 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6527 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6528 | |
| 6529 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6530 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6531 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6532 | { } /* end */ |
| 6533 | }; |
| 6534 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6535 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6536 | { |
| 6537 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6538 | |
| 6539 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6540 | AC_VERB_GET_GPIO_DATA, 0); |
| 6541 | |
| 6542 | if (!muted) |
| 6543 | gpiostate |= (1 << pin); |
| 6544 | else |
| 6545 | gpiostate &= ~(1 << pin); |
| 6546 | |
| 6547 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6548 | AC_VERB_GET_GPIO_MASK, 0); |
| 6549 | gpiomask |= (1 << pin); |
| 6550 | |
| 6551 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6552 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6553 | gpiodir |= (1 << pin); |
| 6554 | |
| 6555 | |
| 6556 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6557 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6558 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6559 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6560 | |
| 6561 | msleep(1); |
| 6562 | |
| 6563 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6564 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6565 | } |
| 6566 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6567 | /* set up GPIO at initialization */ |
| 6568 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6569 | { |
| 6570 | alc882_gpio_mute(codec, 0, 0); |
| 6571 | alc882_gpio_mute(codec, 1, 0); |
| 6572 | } |
| 6573 | |
| 6574 | /* set up GPIO and update auto-muting at initialization */ |
| 6575 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6576 | { |
| 6577 | alc885_macpro_init_hook(codec); |
| 6578 | alc885_imac24_automute(codec); |
| 6579 | } |
| 6580 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6581 | /* |
| 6582 | * generic initialization of ADC, input mixers and output mixers |
| 6583 | */ |
| 6584 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6585 | /* |
| 6586 | * Unmute ADC0-2 and set the default input to mic-in |
| 6587 | */ |
| 6588 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6589 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6590 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6591 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6592 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6593 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6594 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6595 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6596 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6597 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6598 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6599 | */ |
| 6600 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6601 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6602 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6603 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6604 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6605 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6606 | |
| 6607 | /* |
| 6608 | * Set up output mixers (0x0c - 0x0f) |
| 6609 | */ |
| 6610 | /* set vol=0 to output mixers */ |
| 6611 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6612 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6613 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6614 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6615 | /* set up input amps for analog loopback */ |
| 6616 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6618 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6620 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6621 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6622 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6623 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6624 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6625 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6626 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6627 | |
| 6628 | /* FIXME: use matrix-type input source selection */ |
| 6629 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6630 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6631 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6632 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6633 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6634 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6635 | /* Input mixer2 */ |
| 6636 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6637 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6638 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6639 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6640 | /* Input mixer3 */ |
| 6641 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6642 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6643 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6644 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6645 | |
| 6646 | { } |
| 6647 | }; |
| 6648 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6649 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6650 | #define alc882_loopbacks alc880_loopbacks |
| 6651 | #endif |
| 6652 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6653 | /* pcm configuration: identiacal with ALC880 */ |
| 6654 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6655 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6656 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6657 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6658 | |
| 6659 | /* |
| 6660 | * configuration and preset |
| 6661 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6662 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6663 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6664 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6665 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6666 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6667 | [ALC882_TARGA] = "targa", |
| 6668 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6669 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6670 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6671 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6672 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6673 | [ALC882_AUTO] = "auto", |
| 6674 | }; |
| 6675 | |
| 6676 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6677 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6678 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6679 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6680 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6681 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6682 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6683 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6684 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6685 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6686 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6687 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6688 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6689 | {} |
| 6690 | }; |
| 6691 | |
| 6692 | static struct alc_config_preset alc882_presets[] = { |
| 6693 | [ALC882_3ST_DIG] = { |
| 6694 | .mixers = { alc882_base_mixer }, |
| 6695 | .init_verbs = { alc882_init_verbs }, |
| 6696 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6697 | .dac_nids = alc882_dac_nids, |
| 6698 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6699 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6700 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6701 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6702 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6703 | .input_mux = &alc882_capture_source, |
| 6704 | }, |
| 6705 | [ALC882_6ST_DIG] = { |
| 6706 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6707 | .init_verbs = { alc882_init_verbs }, |
| 6708 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6709 | .dac_nids = alc882_dac_nids, |
| 6710 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6711 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6712 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6713 | .channel_mode = alc882_sixstack_modes, |
| 6714 | .input_mux = &alc882_capture_source, |
| 6715 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6716 | [ALC882_ARIMA] = { |
| 6717 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6718 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6719 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6720 | .dac_nids = alc882_dac_nids, |
| 6721 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6722 | .channel_mode = alc882_sixstack_modes, |
| 6723 | .input_mux = &alc882_capture_source, |
| 6724 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6725 | [ALC882_W2JC] = { |
| 6726 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6727 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6728 | alc880_gpio1_init_verbs }, |
| 6729 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6730 | .dac_nids = alc882_dac_nids, |
| 6731 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6732 | .channel_mode = alc880_threestack_modes, |
| 6733 | .need_dac_fix = 1, |
| 6734 | .input_mux = &alc882_capture_source, |
| 6735 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6736 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6737 | [ALC885_MBP3] = { |
| 6738 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6739 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6740 | alc880_gpio1_init_verbs }, |
| 6741 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6742 | .dac_nids = alc882_dac_nids, |
| 6743 | .channel_mode = alc885_mbp_6ch_modes, |
| 6744 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6745 | .input_mux = &alc882_capture_source, |
| 6746 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6747 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6748 | .unsol_event = alc885_mbp3_unsol_event, |
| 6749 | .init_hook = alc885_mbp3_automute, |
| 6750 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6751 | [ALC885_MACPRO] = { |
| 6752 | .mixers = { alc882_macpro_mixer }, |
| 6753 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6754 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6755 | .dac_nids = alc882_dac_nids, |
| 6756 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6757 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6758 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6759 | .channel_mode = alc882_ch_modes, |
| 6760 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6761 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6762 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6763 | [ALC885_IMAC24] = { |
| 6764 | .mixers = { alc885_imac24_mixer }, |
| 6765 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6766 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6767 | .dac_nids = alc882_dac_nids, |
| 6768 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6769 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6770 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6771 | .channel_mode = alc882_ch_modes, |
| 6772 | .input_mux = &alc882_capture_source, |
| 6773 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6774 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6775 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6776 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6777 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6778 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6779 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6780 | .dac_nids = alc882_dac_nids, |
| 6781 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6782 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6783 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6784 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6785 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6786 | .channel_mode = alc882_3ST_6ch_modes, |
| 6787 | .need_dac_fix = 1, |
| 6788 | .input_mux = &alc882_capture_source, |
| 6789 | .unsol_event = alc882_targa_unsol_event, |
| 6790 | .init_hook = alc882_targa_automute, |
| 6791 | }, |
| 6792 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6793 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6794 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6795 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6796 | .dac_nids = alc882_dac_nids, |
| 6797 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6798 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6799 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6800 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6801 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6802 | .channel_mode = alc882_3ST_6ch_modes, |
| 6803 | .need_dac_fix = 1, |
| 6804 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6805 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6806 | [ALC882_ASUS_A7M] = { |
| 6807 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6808 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6809 | alc880_gpio1_init_verbs, |
| 6810 | alc882_asus_a7m_verbs }, |
| 6811 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6812 | .dac_nids = alc882_dac_nids, |
| 6813 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6814 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6815 | .channel_mode = alc880_threestack_modes, |
| 6816 | .need_dac_fix = 1, |
| 6817 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6818 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6819 | }; |
| 6820 | |
| 6821 | |
| 6822 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6823 | * Pin config fixes |
| 6824 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6825 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6826 | PINFIX_ABIT_AW9D_MAX |
| 6827 | }; |
| 6828 | |
| 6829 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6830 | { 0x15, 0x01080104 }, /* side */ |
| 6831 | { 0x16, 0x01011012 }, /* rear */ |
| 6832 | { 0x17, 0x01016011 }, /* clfe */ |
| 6833 | { } |
| 6834 | }; |
| 6835 | |
| 6836 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6837 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6838 | }; |
| 6839 | |
| 6840 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6841 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6842 | {} |
| 6843 | }; |
| 6844 | |
| 6845 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6846 | * BIOS auto configuration |
| 6847 | */ |
| 6848 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6849 | hda_nid_t nid, int pin_type, |
| 6850 | int dac_idx) |
| 6851 | { |
| 6852 | /* set as output */ |
| 6853 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6854 | int idx; |
| 6855 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6856 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6857 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6858 | idx = 4; |
| 6859 | else |
| 6860 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6861 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6862 | |
| 6863 | } |
| 6864 | |
| 6865 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6866 | { |
| 6867 | struct alc_spec *spec = codec->spec; |
| 6868 | int i; |
| 6869 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6870 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6871 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6872 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6873 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6874 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6875 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6876 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6877 | } |
| 6878 | } |
| 6879 | |
| 6880 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6881 | { |
| 6882 | struct alc_spec *spec = codec->spec; |
| 6883 | hda_nid_t pin; |
| 6884 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6885 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6886 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6887 | /* use dac 0 */ |
| 6888 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6889 | pin = spec->autocfg.speaker_pins[0]; |
| 6890 | if (pin) |
| 6891 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6892 | } |
| 6893 | |
| 6894 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6895 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6896 | |
| 6897 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6898 | { |
| 6899 | struct alc_spec *spec = codec->spec; |
| 6900 | int i; |
| 6901 | |
| 6902 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6903 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6904 | unsigned int vref; |
| 6905 | if (!nid) |
| 6906 | continue; |
| 6907 | vref = PIN_IN; |
| 6908 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6909 | unsigned int pincap; |
| 6910 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6911 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6912 | AC_PINCAP_VREF_80) |
| 6913 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6914 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6915 | snd_hda_codec_write(codec, nid, 0, |
| 6916 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6917 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6918 | snd_hda_codec_write(codec, nid, 0, |
| 6919 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6920 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6921 | } |
| 6922 | } |
| 6923 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6924 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 6925 | { |
| 6926 | struct alc_spec *spec = codec->spec; |
| 6927 | const struct hda_input_mux *imux = spec->input_mux; |
| 6928 | int c; |
| 6929 | |
| 6930 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 6931 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 6932 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 6933 | int conns, mute, idx, item; |
| 6934 | |
| 6935 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 6936 | ARRAY_SIZE(conn_list)); |
| 6937 | if (conns < 0) |
| 6938 | continue; |
| 6939 | for (idx = 0; idx < conns; idx++) { |
| 6940 | /* if the current connection is the selected one, |
| 6941 | * unmute it as default - otherwise mute it |
| 6942 | */ |
| 6943 | mute = AMP_IN_MUTE(idx); |
| 6944 | for (item = 0; item < imux->num_items; item++) { |
| 6945 | if (imux->items[item].index == idx) { |
| 6946 | if (spec->cur_mux[c] == item) |
| 6947 | mute = AMP_IN_UNMUTE(idx); |
| 6948 | break; |
| 6949 | } |
| 6950 | } |
| 6951 | snd_hda_codec_write(codec, nid, 0, |
| 6952 | AC_VERB_SET_AMP_GAIN_MUTE, mute); |
| 6953 | } |
| 6954 | } |
| 6955 | } |
| 6956 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6957 | /* add mic boosts if needed */ |
| 6958 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6959 | { |
| 6960 | struct alc_spec *spec = codec->spec; |
| 6961 | int err; |
| 6962 | hda_nid_t nid; |
| 6963 | |
| 6964 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6965 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6966 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6967 | "Mic Boost", |
| 6968 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6969 | if (err < 0) |
| 6970 | return err; |
| 6971 | } |
| 6972 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6973 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6974 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6975 | "Front Mic Boost", |
| 6976 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6977 | if (err < 0) |
| 6978 | return err; |
| 6979 | } |
| 6980 | return 0; |
| 6981 | } |
| 6982 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6983 | /* almost identical with ALC880 parser... */ |
| 6984 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6985 | { |
| 6986 | struct alc_spec *spec = codec->spec; |
| 6987 | int err = alc880_parse_auto_config(codec); |
| 6988 | |
| 6989 | if (err < 0) |
| 6990 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6991 | else if (!err) |
| 6992 | return 0; /* no config found */ |
| 6993 | |
| 6994 | err = alc_auto_add_mic_boost(codec); |
| 6995 | if (err < 0) |
| 6996 | return err; |
| 6997 | |
| 6998 | /* hack - override the init verbs */ |
| 6999 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7000 | |
| 7001 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7002 | } |
| 7003 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7004 | /* additional initialization for auto-configuration model */ |
| 7005 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7006 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7007 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7008 | alc882_auto_init_multi_out(codec); |
| 7009 | alc882_auto_init_hp_out(codec); |
| 7010 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7011 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7012 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7013 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7014 | } |
| 7015 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7016 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7017 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7018 | static int patch_alc882(struct hda_codec *codec) |
| 7019 | { |
| 7020 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7021 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7022 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7023 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7024 | if (spec == NULL) |
| 7025 | return -ENOMEM; |
| 7026 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7027 | codec->spec = spec; |
| 7028 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7029 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7030 | alc882_models, |
| 7031 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7032 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7033 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7034 | /* Pick up systems that don't supply PCI SSID */ |
| 7035 | switch (codec->subsystem_id) { |
| 7036 | case 0x106b0c00: /* Mac Pro */ |
| 7037 | board_config = ALC885_MACPRO; |
| 7038 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7039 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7040 | case 0x106b2800: /* AppleTV */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7041 | board_config = ALC885_IMAC24; |
| 7042 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7043 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7044 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7045 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7046 | case 0x106b3600: /* Macbook 3.1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7047 | board_config = ALC885_MBP3; |
| 7048 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7049 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7050 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7051 | if (codec->revision_id == 0x100101 || |
| 7052 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7053 | alc_free(codec); |
| 7054 | return patch_alc883(codec); |
| 7055 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7056 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 7057 | "trying auto-probe from BIOS...\n"); |
| 7058 | board_config = ALC882_AUTO; |
| 7059 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7060 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7061 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7062 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7063 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7064 | if (board_config == ALC882_AUTO) { |
| 7065 | /* automatic parse from the BIOS config */ |
| 7066 | err = alc882_parse_auto_config(codec); |
| 7067 | if (err < 0) { |
| 7068 | alc_free(codec); |
| 7069 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7070 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7071 | printk(KERN_INFO |
| 7072 | "hda_codec: Cannot set up configuration " |
| 7073 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7074 | board_config = ALC882_3ST_DIG; |
| 7075 | } |
| 7076 | } |
| 7077 | |
| 7078 | if (board_config != ALC882_AUTO) |
| 7079 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7080 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 7081 | if (codec->vendor_id == 0x10ec0885) { |
| 7082 | spec->stream_name_analog = "ALC885 Analog"; |
| 7083 | spec->stream_name_digital = "ALC885 Digital"; |
| 7084 | } else { |
| 7085 | spec->stream_name_analog = "ALC882 Analog"; |
| 7086 | spec->stream_name_digital = "ALC882 Digital"; |
| 7087 | } |
| 7088 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7089 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7090 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7091 | /* FIXME: setup DAC5 */ |
| 7092 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7093 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7094 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7095 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7096 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7097 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 7098 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7099 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7100 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7101 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7102 | /* get type */ |
| 7103 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7104 | if (wcap != AC_WID_AUD_IN) { |
| 7105 | spec->adc_nids = alc882_adc_nids_alt; |
| 7106 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7107 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7108 | } else { |
| 7109 | spec->adc_nids = alc882_adc_nids; |
| 7110 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7111 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7112 | } |
| 7113 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7114 | set_capture_mixer(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7115 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7116 | spec->vmaster_nid = 0x0c; |
| 7117 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7118 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7119 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7120 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7121 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7122 | if (!spec->loopback.amplist) |
| 7123 | spec->loopback.amplist = alc882_loopbacks; |
| 7124 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7125 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7126 | |
| 7127 | return 0; |
| 7128 | } |
| 7129 | |
| 7130 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7131 | * ALC883 support |
| 7132 | * |
| 7133 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7134 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7135 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7136 | * 6-channel independent captures. |
| 7137 | * |
| 7138 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7139 | * driver yet). |
| 7140 | */ |
| 7141 | #define ALC883_DIGOUT_NID 0x06 |
| 7142 | #define ALC883_DIGIN_NID 0x0a |
| 7143 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7144 | #define ALC1200_DIGOUT_NID 0x10 |
| 7145 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7146 | static hda_nid_t alc883_dac_nids[4] = { |
| 7147 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7148 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7149 | }; |
| 7150 | |
| 7151 | static hda_nid_t alc883_adc_nids[2] = { |
| 7152 | /* ADC1-2 */ |
| 7153 | 0x08, 0x09, |
| 7154 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7155 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7156 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7157 | /* ADC1 */ |
| 7158 | 0x08, |
| 7159 | }; |
| 7160 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7161 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7162 | /* ADC2-1 */ |
| 7163 | 0x09, 0x08 |
| 7164 | }; |
| 7165 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 7166 | #define alc889_adc_nids alc880_adc_nids |
| 7167 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7168 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7169 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7170 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7171 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 7172 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7173 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7174 | /* input MUX */ |
| 7175 | /* FIXME: should be a matrix-type input source selection */ |
| 7176 | |
| 7177 | static struct hda_input_mux alc883_capture_source = { |
| 7178 | .num_items = 4, |
| 7179 | .items = { |
| 7180 | { "Mic", 0x0 }, |
| 7181 | { "Front Mic", 0x1 }, |
| 7182 | { "Line", 0x2 }, |
| 7183 | { "CD", 0x4 }, |
| 7184 | }, |
| 7185 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7186 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7187 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7188 | .num_items = 4, |
| 7189 | .items = { |
| 7190 | { "Mic", 0x1 }, |
| 7191 | { "Front Mic", 0x0 }, |
| 7192 | { "Line", 0x2 }, |
| 7193 | { "CD", 0x4 }, |
| 7194 | }, |
| 7195 | }; |
| 7196 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7197 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7198 | .num_items = 2, |
| 7199 | .items = { |
| 7200 | { "Mic", 0x1 }, |
| 7201 | { "Line", 0x2 }, |
| 7202 | }, |
| 7203 | }; |
| 7204 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7205 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7206 | .num_items = 4, |
| 7207 | .items = { |
| 7208 | { "Mic", 0x0 }, |
| 7209 | { "iMic", 0x1 }, |
| 7210 | { "Line", 0x2 }, |
| 7211 | { "CD", 0x4 }, |
| 7212 | }, |
| 7213 | }; |
| 7214 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7215 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7216 | .num_items = 2, |
| 7217 | .items = { |
| 7218 | { "Mic", 0x0 }, |
| 7219 | { "Int Mic", 0x1 }, |
| 7220 | }, |
| 7221 | }; |
| 7222 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7223 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7224 | .num_items = 3, |
| 7225 | .items = { |
| 7226 | { "Mic", 0x0 }, |
| 7227 | { "Front Mic", 0x1 }, |
| 7228 | { "Line", 0x4 }, |
| 7229 | }, |
| 7230 | }; |
| 7231 | |
| 7232 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7233 | .num_items = 2, |
| 7234 | .items = { |
| 7235 | { "Mic", 0x0 }, |
| 7236 | { "Line", 0x2 }, |
| 7237 | }, |
| 7238 | }; |
| 7239 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7240 | /* |
| 7241 | * 2ch mode |
| 7242 | */ |
| 7243 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7244 | { 2, NULL } |
| 7245 | }; |
| 7246 | |
| 7247 | /* |
| 7248 | * 2ch mode |
| 7249 | */ |
| 7250 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7251 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7252 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7253 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7254 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7255 | { } /* end */ |
| 7256 | }; |
| 7257 | |
| 7258 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7259 | * 4ch mode |
| 7260 | */ |
| 7261 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7262 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7263 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7264 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7265 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7266 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7267 | { } /* end */ |
| 7268 | }; |
| 7269 | |
| 7270 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7271 | * 6ch mode |
| 7272 | */ |
| 7273 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7274 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7275 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7276 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7277 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7278 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7279 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7280 | { } /* end */ |
| 7281 | }; |
| 7282 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7283 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7284 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7285 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7286 | { 6, alc883_3ST_ch6_init }, |
| 7287 | }; |
| 7288 | |
| 7289 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7290 | * 2ch mode |
| 7291 | */ |
| 7292 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7293 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7294 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7295 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7296 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7297 | { } /* end */ |
| 7298 | }; |
| 7299 | |
| 7300 | /* |
| 7301 | * 4ch mode |
| 7302 | */ |
| 7303 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7304 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7305 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7306 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7307 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7308 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7309 | { } /* end */ |
| 7310 | }; |
| 7311 | |
| 7312 | /* |
| 7313 | * 6ch mode |
| 7314 | */ |
| 7315 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7316 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7317 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7318 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7319 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7320 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7321 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7322 | { } /* end */ |
| 7323 | }; |
| 7324 | |
| 7325 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7326 | { 2, alc883_3ST_ch2_intel_init }, |
| 7327 | { 4, alc883_3ST_ch4_intel_init }, |
| 7328 | { 6, alc883_3ST_ch6_intel_init }, |
| 7329 | }; |
| 7330 | |
| 7331 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7332 | * 6ch mode |
| 7333 | */ |
| 7334 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7335 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7336 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7337 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7338 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7339 | { } /* end */ |
| 7340 | }; |
| 7341 | |
| 7342 | /* |
| 7343 | * 8ch mode |
| 7344 | */ |
| 7345 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7346 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7347 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7348 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7349 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7350 | { } /* end */ |
| 7351 | }; |
| 7352 | |
| 7353 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7354 | { 6, alc883_sixstack_ch6_init }, |
| 7355 | { 8, alc883_sixstack_ch8_init }, |
| 7356 | }; |
| 7357 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7358 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7359 | /* eanable EAPD on medion laptop */ |
| 7360 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7361 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7362 | { } |
| 7363 | }; |
| 7364 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7365 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7366 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7367 | */ |
| 7368 | |
| 7369 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7370 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7371 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7372 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7373 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7374 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7375 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7376 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7377 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7378 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7379 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7380 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7381 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7382 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7383 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7384 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7385 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7386 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7387 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7388 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7389 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7390 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7391 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7392 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7393 | { } /* end */ |
| 7394 | }; |
| 7395 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7396 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7397 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7398 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7399 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7400 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7401 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7402 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7403 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7404 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7405 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7406 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7407 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7408 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7409 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7410 | { } /* end */ |
| 7411 | }; |
| 7412 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7413 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7414 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7415 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7416 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7417 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7418 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7419 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7420 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7421 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7422 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7423 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7424 | { } /* end */ |
| 7425 | }; |
| 7426 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7427 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7428 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7429 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7430 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7431 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7432 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7433 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7434 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7435 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7436 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7437 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7438 | { } /* end */ |
| 7439 | }; |
| 7440 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7441 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7442 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7443 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7444 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7445 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7446 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7447 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7448 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7449 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7450 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7451 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7452 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7453 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7454 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7455 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7456 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7457 | { } /* end */ |
| 7458 | }; |
| 7459 | |
| 7460 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7461 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7462 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7463 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7464 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7465 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7466 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7467 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7468 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7469 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7470 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7471 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7472 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7473 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7474 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7475 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7476 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7477 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7478 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7479 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7480 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7481 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7482 | { } /* end */ |
| 7483 | }; |
| 7484 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7485 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7486 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7487 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7488 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7489 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7490 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7491 | HDA_OUTPUT), |
| 7492 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7493 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7494 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7495 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7496 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7497 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7498 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7499 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7501 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7503 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7504 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7505 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7506 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7507 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7508 | { } /* end */ |
| 7509 | }; |
| 7510 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7511 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7512 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7513 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7514 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7515 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7516 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7517 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7518 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7519 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7520 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7521 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7522 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7523 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7524 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7525 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7526 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7527 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7528 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7529 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7530 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7531 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7532 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7533 | { } /* end */ |
| 7534 | }; |
| 7535 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7536 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7537 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7538 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7539 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7540 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7541 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7542 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7543 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7544 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7545 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7546 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7547 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7548 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7549 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7551 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7552 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7553 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7554 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7555 | |
| 7556 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7557 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7558 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7559 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7560 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7561 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7562 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7563 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7564 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7565 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7566 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7567 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7568 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7569 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7570 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7571 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7572 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7573 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7574 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7575 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7576 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7577 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7578 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7580 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7581 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7582 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7583 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7584 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7585 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7586 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7587 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7588 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7589 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7590 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7591 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7592 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7593 | { } /* end */ |
| 7594 | }; |
| 7595 | |
| 7596 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7597 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7598 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7599 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7600 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7601 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7602 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7603 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7604 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7605 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7606 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7607 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7608 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7609 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7610 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7611 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7612 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7613 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7614 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7615 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7616 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7617 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7618 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7619 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7620 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7621 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7622 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7623 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7624 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7625 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7626 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7627 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7628 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7629 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7630 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7631 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7632 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7633 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7634 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7635 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7636 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7637 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7638 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7639 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7640 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7641 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7642 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7643 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7644 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7645 | { } /* end */ |
| 7646 | }; |
| 7647 | |
| 7648 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7649 | .ops = &snd_hda_bind_vol, |
| 7650 | .values = { |
| 7651 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7652 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7653 | 0 |
| 7654 | }, |
| 7655 | }; |
| 7656 | |
| 7657 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7658 | .ops = &snd_hda_bind_sw, |
| 7659 | .values = { |
| 7660 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7661 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7662 | 0 |
| 7663 | }, |
| 7664 | }; |
| 7665 | |
| 7666 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7667 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7668 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7669 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7670 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7671 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7672 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7673 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7674 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7675 | { } /* end */ |
| 7676 | }; |
| 7677 | |
| 7678 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7679 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7680 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7681 | { |
| 7682 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7683 | /* .name = "Capture Source", */ |
| 7684 | .name = "Input Source", |
| 7685 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7686 | .info = alc_mux_enum_info, |
| 7687 | .get = alc_mux_enum_get, |
| 7688 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7689 | }, |
| 7690 | { } /* end */ |
| 7691 | }; |
| 7692 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7693 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7694 | { |
| 7695 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7696 | .name = "Channel Mode", |
| 7697 | .info = alc_ch_mode_info, |
| 7698 | .get = alc_ch_mode_get, |
| 7699 | .put = alc_ch_mode_put, |
| 7700 | }, |
| 7701 | { } /* end */ |
| 7702 | }; |
| 7703 | |
| 7704 | static struct hda_verb alc883_init_verbs[] = { |
| 7705 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7706 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7707 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7708 | /* ADC2: mute amp left and right */ |
| 7709 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7710 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7711 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7712 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7713 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7714 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7715 | /* Rear mixer */ |
| 7716 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7717 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7718 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7719 | /* CLFE mixer */ |
| 7720 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7721 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7722 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7723 | /* Side mixer */ |
| 7724 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7725 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7726 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7727 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7728 | /* mute analog input loopbacks */ |
| 7729 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7730 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7731 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7732 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7733 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7734 | |
| 7735 | /* Front Pin: output 0 (0x0c) */ |
| 7736 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7737 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7738 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7739 | /* Rear Pin: output 1 (0x0d) */ |
| 7740 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7742 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7743 | /* CLFE Pin: output 2 (0x0e) */ |
| 7744 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7745 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7746 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7747 | /* Side Pin: output 3 (0x0f) */ |
| 7748 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7749 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7750 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7751 | /* Mic (rear) pin: input vref at 80% */ |
| 7752 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7753 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7754 | /* Front Mic pin: input vref at 80% */ |
| 7755 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7756 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7757 | /* Line In pin: input */ |
| 7758 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7759 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7760 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7761 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7762 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7763 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7764 | /* CD pin widget for input */ |
| 7765 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7766 | |
| 7767 | /* FIXME: use matrix-type input source selection */ |
| 7768 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7769 | /* Input mixer2 */ |
| 7770 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7771 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7772 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7773 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7774 | /* Input mixer3 */ |
| 7775 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7776 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7777 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7778 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7779 | { } |
| 7780 | }; |
| 7781 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7782 | /* toggle speaker-output according to the hp-jack state */ |
| 7783 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7784 | { |
| 7785 | unsigned int present; |
| 7786 | |
| 7787 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7788 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7789 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7790 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7791 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7792 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7793 | } |
| 7794 | |
| 7795 | /* auto-toggle front mic */ |
| 7796 | /* |
| 7797 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7798 | { |
| 7799 | unsigned int present; |
| 7800 | unsigned char bits; |
| 7801 | |
| 7802 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7803 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7804 | bits = present ? HDA_AMP_MUTE : 0; |
| 7805 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7806 | } |
| 7807 | */ |
| 7808 | |
| 7809 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7810 | { |
| 7811 | alc883_mitac_hp_automute(codec); |
| 7812 | /* alc883_mitac_mic_automute(codec); */ |
| 7813 | } |
| 7814 | |
| 7815 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7816 | unsigned int res) |
| 7817 | { |
| 7818 | switch (res >> 26) { |
| 7819 | case ALC880_HP_EVENT: |
| 7820 | alc883_mitac_hp_automute(codec); |
| 7821 | break; |
| 7822 | case ALC880_MIC_EVENT: |
| 7823 | /* alc883_mitac_mic_automute(codec); */ |
| 7824 | break; |
| 7825 | } |
| 7826 | } |
| 7827 | |
| 7828 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7829 | /* HP */ |
| 7830 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7831 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7832 | /* Subwoofer */ |
| 7833 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7834 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7835 | |
| 7836 | /* enable unsolicited event */ |
| 7837 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7838 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7839 | |
| 7840 | { } /* end */ |
| 7841 | }; |
| 7842 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7843 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7844 | /* HP */ |
| 7845 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7846 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7847 | /* Int speaker */ |
| 7848 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7849 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7850 | |
| 7851 | /* enable unsolicited event */ |
| 7852 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7853 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7854 | |
| 7855 | { } /* end */ |
| 7856 | }; |
| 7857 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7858 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7859 | /* HP */ |
| 7860 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7861 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7862 | /* Subwoofer */ |
| 7863 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7864 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7865 | |
| 7866 | /* enable unsolicited event */ |
| 7867 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7868 | |
| 7869 | { } /* end */ |
| 7870 | }; |
| 7871 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7872 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7873 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7874 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7875 | |
| 7876 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7877 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7878 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7879 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7880 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7881 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7882 | |
| 7883 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7884 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7885 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7886 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7887 | |
| 7888 | { } /* end */ |
| 7889 | }; |
| 7890 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7891 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7892 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7893 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7894 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7895 | { } /* end */ |
| 7896 | }; |
| 7897 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7898 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7899 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7900 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7901 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7902 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7903 | { } /* end */ |
| 7904 | }; |
| 7905 | |
| 7906 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7907 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7908 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7909 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7910 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7911 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7912 | { } /* end */ |
| 7913 | }; |
| 7914 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7915 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7916 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7917 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7918 | |
| 7919 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7920 | |
| 7921 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7922 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7923 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7924 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7925 | { } /* end */ |
| 7926 | }; |
| 7927 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7928 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 7929 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7930 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7931 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7932 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7933 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7934 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7935 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7936 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7937 | { } /* end */ |
| 7938 | }; |
| 7939 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7940 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7941 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7942 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7943 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7944 | { } |
| 7945 | }; |
| 7946 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7947 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7948 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7949 | { } |
| 7950 | }; |
| 7951 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7952 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7953 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7954 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7955 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7956 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7957 | { } |
| 7958 | }; |
| 7959 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7960 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7961 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7962 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7963 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7964 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7965 | { } |
| 7966 | }; |
| 7967 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7968 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7969 | { 2, alc888_3st_hp_2ch_init }, |
| 7970 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7971 | }; |
| 7972 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7973 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7974 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7975 | { |
| 7976 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7977 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7978 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7979 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7980 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7981 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7982 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7983 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7984 | } |
| 7985 | |
| 7986 | /* toggle RCA according to the front-jack state */ |
| 7987 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7988 | { |
| 7989 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7990 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7991 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7992 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7993 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7994 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7995 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7996 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7997 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7998 | unsigned int res) |
| 7999 | { |
| 8000 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8001 | alc888_lenovo_ms7195_front_automute(codec); |
| 8002 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8003 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8004 | } |
| 8005 | |
| 8006 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8007 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8008 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8009 | |
| 8010 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8011 | |
| 8012 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8013 | { } /* end */ |
| 8014 | }; |
| 8015 | |
| 8016 | /* toggle speaker-output according to the hp-jack state */ |
| 8017 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 8018 | { |
| 8019 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8020 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8021 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8022 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8023 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8024 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8025 | } |
| 8026 | |
| 8027 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 8028 | unsigned int res) |
| 8029 | { |
| 8030 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8031 | alc883_medion_md2_automute(codec); |
| 8032 | } |
| 8033 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8034 | /* toggle speaker-output according to the hp-jack state */ |
| 8035 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 8036 | { |
| 8037 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8038 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8039 | |
| 8040 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8041 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8042 | bits = present ? HDA_AMP_MUTE : 0; |
| 8043 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8044 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8045 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 8046 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8047 | } |
| 8048 | |
| 8049 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8050 | { |
| 8051 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8052 | alc883_tagra_automute(codec); |
| 8053 | } |
| 8054 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8055 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8056 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8057 | { |
| 8058 | unsigned int present; |
| 8059 | unsigned char bits; |
| 8060 | |
| 8061 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8062 | & AC_PINSENSE_PRESENCE; |
| 8063 | bits = present ? HDA_AMP_MUTE : 0; |
| 8064 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8065 | HDA_AMP_MUTE, bits); |
| 8066 | } |
| 8067 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8068 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8069 | { |
| 8070 | unsigned int present; |
| 8071 | |
| 8072 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8073 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8074 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8075 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8076 | } |
| 8077 | |
| 8078 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 8079 | { |
| 8080 | alc883_clevo_m720_hp_automute(codec); |
| 8081 | alc883_clevo_m720_mic_automute(codec); |
| 8082 | } |
| 8083 | |
| 8084 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8085 | unsigned int res) |
| 8086 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8087 | switch (res >> 26) { |
| 8088 | case ALC880_HP_EVENT: |
| 8089 | alc883_clevo_m720_hp_automute(codec); |
| 8090 | break; |
| 8091 | case ALC880_MIC_EVENT: |
| 8092 | alc883_clevo_m720_mic_automute(codec); |
| 8093 | break; |
| 8094 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8095 | } |
| 8096 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8097 | /* toggle speaker-output according to the hp-jack state */ |
| 8098 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 8099 | { |
| 8100 | unsigned int present; |
| 8101 | unsigned char bits; |
| 8102 | |
| 8103 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8104 | & AC_PINSENSE_PRESENCE; |
| 8105 | bits = present ? HDA_AMP_MUTE : 0; |
| 8106 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8107 | HDA_AMP_MUTE, bits); |
| 8108 | } |
| 8109 | |
| 8110 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 8111 | unsigned int res) |
| 8112 | { |
| 8113 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8114 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 8115 | } |
| 8116 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8117 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 8118 | { |
| 8119 | unsigned int present; |
| 8120 | unsigned char bits; |
| 8121 | |
| 8122 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8123 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8124 | bits = present ? 0x80 : 0; |
| 8125 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8126 | 0x80, bits); |
| 8127 | } |
| 8128 | |
| 8129 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 8130 | unsigned int res) |
| 8131 | { |
| 8132 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8133 | alc883_haier_w66_automute(codec); |
| 8134 | } |
| 8135 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8136 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8137 | { |
| 8138 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8139 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8140 | |
| 8141 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8142 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8143 | bits = present ? HDA_AMP_MUTE : 0; |
| 8144 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8145 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8146 | } |
| 8147 | |
| 8148 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8149 | { |
| 8150 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8151 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8152 | |
| 8153 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8154 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8155 | bits = present ? HDA_AMP_MUTE : 0; |
| 8156 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8157 | HDA_AMP_MUTE, bits); |
| 8158 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8159 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8160 | } |
| 8161 | |
| 8162 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8163 | unsigned int res) |
| 8164 | { |
| 8165 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8166 | alc883_lenovo_101e_all_automute(codec); |
| 8167 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8168 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8169 | } |
| 8170 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8171 | /* toggle speaker-output according to the hp-jack state */ |
| 8172 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 8173 | { |
| 8174 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8175 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8176 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8177 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8178 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8179 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8180 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8181 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8182 | } |
| 8183 | |
| 8184 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 8185 | unsigned int res) |
| 8186 | { |
| 8187 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8188 | alc883_acer_aspire_automute(codec); |
| 8189 | } |
| 8190 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8191 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8192 | /* HP Pin: output 0 (0x0c) */ |
| 8193 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8194 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8195 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8196 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8197 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8198 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8199 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8200 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8201 | /* eanable EAPD on medion laptop */ |
| 8202 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8203 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8204 | /* enable unsolicited event */ |
| 8205 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8206 | { } |
| 8207 | }; |
| 8208 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8209 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 8210 | { |
| 8211 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8212 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8213 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8214 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8215 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8216 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8217 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8218 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8219 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8220 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8221 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8222 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8223 | } |
| 8224 | |
| 8225 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 8226 | unsigned int res) |
| 8227 | { |
| 8228 | switch (res >> 26) { |
| 8229 | case ALC880_HP_EVENT: |
| 8230 | printk("hp_event\n"); |
| 8231 | alc888_6st_dell_front_automute(codec); |
| 8232 | break; |
| 8233 | } |
| 8234 | } |
| 8235 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8236 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 8237 | { |
| 8238 | unsigned int mute; |
| 8239 | unsigned int present; |
| 8240 | |
| 8241 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8242 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8243 | AC_VERB_GET_PIN_SENSE, 0); |
| 8244 | present = (present & 0x80000000) != 0; |
| 8245 | if (present) { |
| 8246 | /* mute internal speaker */ |
| 8247 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8248 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8249 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8250 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8251 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8252 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8253 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8254 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8255 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8256 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8257 | } else { |
| 8258 | /* unmute internal speaker if necessary */ |
| 8259 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8260 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8261 | HDA_AMP_MUTE, mute); |
| 8262 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8263 | HDA_AMP_MUTE, mute); |
| 8264 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8265 | HDA_AMP_MUTE, mute); |
| 8266 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8267 | HDA_AMP_MUTE, mute); |
| 8268 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8269 | HDA_AMP_MUTE, mute); |
| 8270 | } |
| 8271 | } |
| 8272 | |
| 8273 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 8274 | unsigned int res) |
| 8275 | { |
| 8276 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8277 | alc888_lenovo_sky_front_automute(codec); |
| 8278 | } |
| 8279 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8280 | /* |
| 8281 | * generic initialization of ADC, input mixers and output mixers |
| 8282 | */ |
| 8283 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8284 | /* |
| 8285 | * Unmute ADC0-2 and set the default input to mic-in |
| 8286 | */ |
| 8287 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8288 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8289 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8290 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8291 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8292 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8293 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8294 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8295 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8296 | */ |
| 8297 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8298 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8299 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8300 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8301 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8302 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8303 | |
| 8304 | /* |
| 8305 | * Set up output mixers (0x0c - 0x0f) |
| 8306 | */ |
| 8307 | /* set vol=0 to output mixers */ |
| 8308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8311 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8312 | /* set up input amps for analog loopback */ |
| 8313 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8314 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8315 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8316 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8317 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8318 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8319 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8320 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8321 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8322 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8323 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8324 | |
| 8325 | /* FIXME: use matrix-type input source selection */ |
| 8326 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8327 | /* Input mixer1 */ |
| 8328 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8329 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8330 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8331 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8332 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8333 | /* Input mixer2 */ |
| 8334 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8335 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8336 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8337 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8338 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8339 | |
| 8340 | { } |
| 8341 | }; |
| 8342 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8343 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8344 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8345 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8346 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8347 | /* enable unsolicited event */ |
| 8348 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8349 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8350 | { } /* end */ |
| 8351 | }; |
| 8352 | |
| 8353 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8354 | { |
| 8355 | unsigned int present; |
| 8356 | |
| 8357 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8358 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8359 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8360 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8361 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8362 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8363 | } |
| 8364 | |
| 8365 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8366 | { |
| 8367 | unsigned int present; |
| 8368 | unsigned char bits; |
| 8369 | |
| 8370 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8371 | AC_VERB_GET_PIN_SENSE, 0) |
| 8372 | & AC_PINSENSE_PRESENCE; |
| 8373 | bits = present ? 0 : PIN_OUT; |
| 8374 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8375 | bits); |
| 8376 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8377 | bits); |
| 8378 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8379 | bits); |
| 8380 | } |
| 8381 | |
| 8382 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8383 | unsigned int res) |
| 8384 | { |
| 8385 | switch (res >> 26) { |
| 8386 | case ALC880_HP_EVENT: |
| 8387 | alc883_M90V_speaker_automute(codec); |
| 8388 | break; |
| 8389 | case ALC880_MIC_EVENT: |
| 8390 | alc883_nb_mic_automute(codec); |
| 8391 | break; |
| 8392 | } |
| 8393 | } |
| 8394 | |
| 8395 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8396 | { |
| 8397 | alc883_M90V_speaker_automute(codec); |
| 8398 | alc883_nb_mic_automute(codec); |
| 8399 | } |
| 8400 | |
| 8401 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8402 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8403 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8404 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8405 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8406 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8407 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8408 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8409 | /* enable unsolicited event */ |
| 8410 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8411 | { } /* end */ |
| 8412 | }; |
| 8413 | |
| 8414 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8415 | { |
| 8416 | unsigned int present; |
| 8417 | unsigned char bits; |
| 8418 | |
| 8419 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8420 | AC_VERB_GET_PIN_SENSE, 0) |
| 8421 | & AC_PINSENSE_PRESENCE; |
| 8422 | bits = present ? 0 : PIN_OUT; |
| 8423 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8424 | bits); |
| 8425 | } |
| 8426 | |
| 8427 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8428 | unsigned int res) |
| 8429 | { |
| 8430 | switch (res >> 26) { |
| 8431 | case ALC880_HP_EVENT: |
| 8432 | alc883_eee1601_speaker_automute(codec); |
| 8433 | break; |
| 8434 | } |
| 8435 | } |
| 8436 | |
| 8437 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8438 | { |
| 8439 | alc883_eee1601_speaker_automute(codec); |
| 8440 | } |
| 8441 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8442 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8443 | #define alc883_loopbacks alc880_loopbacks |
| 8444 | #endif |
| 8445 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8446 | /* pcm configuration: identiacal with ALC880 */ |
| 8447 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8448 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8449 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8450 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8451 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8452 | |
| 8453 | /* |
| 8454 | * configuration and preset |
| 8455 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8456 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8457 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8458 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8459 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8460 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8461 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8462 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8463 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8464 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8465 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8466 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8467 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8468 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8469 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8470 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8471 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8472 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8473 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8474 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8475 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8476 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8477 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8478 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8479 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8480 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8481 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8482 | [ALC883_AUTO] = "auto", |
| 8483 | }; |
| 8484 | |
| 8485 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8486 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8487 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8488 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8489 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8490 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8491 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8492 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8493 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8494 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8495 | ALC888_ACER_ASPIRE_4930G), |
| 8496 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 8497 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8498 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8499 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8500 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8501 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8502 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8503 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8504 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8505 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8506 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8507 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8508 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8509 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8510 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8511 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8512 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8513 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8514 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8515 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8516 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8517 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8518 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8519 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8520 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8521 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8522 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8523 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8524 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8525 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8526 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8527 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8528 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8529 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8530 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8531 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8532 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8533 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8534 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8535 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8536 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8537 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8538 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8539 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8540 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8541 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8542 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8543 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8544 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8545 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8546 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8547 | SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", |
| 8548 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8549 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8550 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8551 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8552 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8553 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8554 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8555 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8556 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8557 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8558 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8559 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8560 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 8561 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8562 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8563 | {} |
| 8564 | }; |
| 8565 | |
| 8566 | static struct alc_config_preset alc883_presets[] = { |
| 8567 | [ALC883_3ST_2ch_DIG] = { |
| 8568 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8569 | .init_verbs = { alc883_init_verbs }, |
| 8570 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8571 | .dac_nids = alc883_dac_nids, |
| 8572 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8573 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8574 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8575 | .channel_mode = alc883_3ST_2ch_modes, |
| 8576 | .input_mux = &alc883_capture_source, |
| 8577 | }, |
| 8578 | [ALC883_3ST_6ch_DIG] = { |
| 8579 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8580 | .init_verbs = { alc883_init_verbs }, |
| 8581 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8582 | .dac_nids = alc883_dac_nids, |
| 8583 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8584 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8585 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8586 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8587 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8588 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8589 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8590 | [ALC883_3ST_6ch] = { |
| 8591 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8592 | .init_verbs = { alc883_init_verbs }, |
| 8593 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8594 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8595 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8596 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8597 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8598 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8599 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8600 | [ALC883_3ST_6ch_INTEL] = { |
| 8601 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8602 | .init_verbs = { alc883_init_verbs }, |
| 8603 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8604 | .dac_nids = alc883_dac_nids, |
| 8605 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8606 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8607 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8608 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8609 | .need_dac_fix = 1, |
| 8610 | .input_mux = &alc883_3stack_6ch_intel, |
| 8611 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8612 | [ALC883_6ST_DIG] = { |
| 8613 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8614 | .init_verbs = { alc883_init_verbs }, |
| 8615 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8616 | .dac_nids = alc883_dac_nids, |
| 8617 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8618 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8619 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8620 | .channel_mode = alc883_sixstack_modes, |
| 8621 | .input_mux = &alc883_capture_source, |
| 8622 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8623 | [ALC883_TARGA_DIG] = { |
| 8624 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8625 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8626 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8627 | .dac_nids = alc883_dac_nids, |
| 8628 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8629 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8630 | .channel_mode = alc883_3ST_6ch_modes, |
| 8631 | .need_dac_fix = 1, |
| 8632 | .input_mux = &alc883_capture_source, |
| 8633 | .unsol_event = alc883_tagra_unsol_event, |
| 8634 | .init_hook = alc883_tagra_automute, |
| 8635 | }, |
| 8636 | [ALC883_TARGA_2ch_DIG] = { |
| 8637 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8638 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8639 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8640 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8641 | .adc_nids = alc883_adc_nids_alt, |
| 8642 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8643 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8644 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8645 | .channel_mode = alc883_3ST_2ch_modes, |
| 8646 | .input_mux = &alc883_capture_source, |
| 8647 | .unsol_event = alc883_tagra_unsol_event, |
| 8648 | .init_hook = alc883_tagra_automute, |
| 8649 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8650 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8651 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8652 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8653 | * and the headphone jack. Turn this on and rely on the |
| 8654 | * standard mute methods whenever the user wants to turn |
| 8655 | * these outputs off. |
| 8656 | */ |
| 8657 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8658 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8659 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8660 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8661 | .channel_mode = alc883_3ST_2ch_modes, |
| 8662 | .input_mux = &alc883_capture_source, |
| 8663 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8664 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8665 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8666 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8667 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8668 | .dac_nids = alc883_dac_nids, |
| 8669 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8670 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8671 | .channel_mode = alc883_3ST_2ch_modes, |
| 8672 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8673 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8674 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8675 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8676 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8677 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8678 | alc883_chmode_mixer }, |
| 8679 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8680 | alc888_acer_aspire_4930g_verbs }, |
| 8681 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8682 | .dac_nids = alc883_dac_nids, |
| 8683 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8684 | .adc_nids = alc883_adc_nids_rev, |
| 8685 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8686 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8687 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8688 | .channel_mode = alc883_3ST_6ch_modes, |
| 8689 | .need_dac_fix = 1, |
| 8690 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8691 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8692 | .input_mux = alc888_2_capture_sources, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8693 | .unsol_event = alc888_acer_aspire_4930g_unsol_event, |
| 8694 | .init_hook = alc888_acer_aspire_4930g_automute, |
| 8695 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8696 | [ALC883_MEDION] = { |
| 8697 | .mixers = { alc883_fivestack_mixer, |
| 8698 | alc883_chmode_mixer }, |
| 8699 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8700 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8701 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8702 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8703 | .adc_nids = alc883_adc_nids_alt, |
| 8704 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8705 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8706 | .channel_mode = alc883_sixstack_modes, |
| 8707 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8708 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8709 | [ALC883_MEDION_MD2] = { |
| 8710 | .mixers = { alc883_medion_md2_mixer}, |
| 8711 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8712 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8713 | .dac_nids = alc883_dac_nids, |
| 8714 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8715 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8716 | .channel_mode = alc883_3ST_2ch_modes, |
| 8717 | .input_mux = &alc883_capture_source, |
| 8718 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8719 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8720 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8721 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8722 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8723 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8724 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8725 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8726 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8727 | .channel_mode = alc883_3ST_2ch_modes, |
| 8728 | .input_mux = &alc883_capture_source, |
| 8729 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8730 | [ALC883_CLEVO_M720] = { |
| 8731 | .mixers = { alc883_clevo_m720_mixer }, |
| 8732 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8733 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8734 | .dac_nids = alc883_dac_nids, |
| 8735 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8736 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8737 | .channel_mode = alc883_3ST_2ch_modes, |
| 8738 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8739 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8740 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8741 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8742 | [ALC883_LENOVO_101E_2ch] = { |
| 8743 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8744 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8745 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8746 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8747 | .adc_nids = alc883_adc_nids_alt, |
| 8748 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8749 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8750 | .channel_mode = alc883_3ST_2ch_modes, |
| 8751 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8752 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8753 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8754 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8755 | [ALC883_LENOVO_NB0763] = { |
| 8756 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8757 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8758 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8759 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8760 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8761 | .channel_mode = alc883_3ST_2ch_modes, |
| 8762 | .need_dac_fix = 1, |
| 8763 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8764 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8765 | .init_hook = alc883_medion_md2_automute, |
| 8766 | }, |
| 8767 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8768 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8769 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8770 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8771 | .dac_nids = alc883_dac_nids, |
| 8772 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8773 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8774 | .channel_mode = alc883_3ST_6ch_modes, |
| 8775 | .need_dac_fix = 1, |
| 8776 | .input_mux = &alc883_capture_source, |
| 8777 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8778 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8779 | }, |
| 8780 | [ALC883_HAIER_W66] = { |
| 8781 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8782 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8783 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8784 | .dac_nids = alc883_dac_nids, |
| 8785 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8786 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8787 | .channel_mode = alc883_3ST_2ch_modes, |
| 8788 | .input_mux = &alc883_capture_source, |
| 8789 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8790 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8791 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8792 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8793 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8794 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8795 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8796 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8797 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8798 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8799 | .need_dac_fix = 1, |
| 8800 | .input_mux = &alc883_capture_source, |
| 8801 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8802 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8803 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8804 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8805 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8806 | .dac_nids = alc883_dac_nids, |
| 8807 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8808 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8809 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8810 | .channel_mode = alc883_sixstack_modes, |
| 8811 | .input_mux = &alc883_capture_source, |
| 8812 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8813 | .init_hook = alc888_6st_dell_front_automute, |
| 8814 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8815 | [ALC883_MITAC] = { |
| 8816 | .mixers = { alc883_mitac_mixer }, |
| 8817 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8818 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8819 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8820 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8821 | .channel_mode = alc883_3ST_2ch_modes, |
| 8822 | .input_mux = &alc883_capture_source, |
| 8823 | .unsol_event = alc883_mitac_unsol_event, |
| 8824 | .init_hook = alc883_mitac_automute, |
| 8825 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8826 | [ALC883_FUJITSU_PI2515] = { |
| 8827 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8828 | .init_verbs = { alc883_init_verbs, |
| 8829 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8830 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8831 | .dac_nids = alc883_dac_nids, |
| 8832 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8833 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8834 | .channel_mode = alc883_3ST_2ch_modes, |
| 8835 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8836 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8837 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8838 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8839 | [ALC888_FUJITSU_XA3530] = { |
| 8840 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 8841 | .init_verbs = { alc883_init_verbs, |
| 8842 | alc888_fujitsu_xa3530_verbs }, |
| 8843 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8844 | .dac_nids = alc883_dac_nids, |
| 8845 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8846 | .adc_nids = alc883_adc_nids_rev, |
| 8847 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8848 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8849 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 8850 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 8851 | .num_mux_defs = |
| 8852 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8853 | .input_mux = alc888_2_capture_sources, |
| 8854 | .unsol_event = alc888_fujitsu_xa3530_unsol_event, |
| 8855 | .init_hook = alc888_fujitsu_xa3530_automute, |
| 8856 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8857 | [ALC888_LENOVO_SKY] = { |
| 8858 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 8859 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 8860 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8861 | .dac_nids = alc883_dac_nids, |
| 8862 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8863 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8864 | .channel_mode = alc883_sixstack_modes, |
| 8865 | .need_dac_fix = 1, |
| 8866 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 8867 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 8868 | .init_hook = alc888_lenovo_sky_front_automute, |
| 8869 | }, |
| 8870 | [ALC888_ASUS_M90V] = { |
| 8871 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8872 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 8873 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8874 | .dac_nids = alc883_dac_nids, |
| 8875 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8876 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8877 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8878 | .channel_mode = alc883_3ST_6ch_modes, |
| 8879 | .need_dac_fix = 1, |
| 8880 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8881 | .unsol_event = alc883_mode2_unsol_event, |
| 8882 | .init_hook = alc883_mode2_inithook, |
| 8883 | }, |
| 8884 | [ALC888_ASUS_EEE1601] = { |
| 8885 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8886 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8887 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 8888 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8889 | .dac_nids = alc883_dac_nids, |
| 8890 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8891 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8892 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8893 | .channel_mode = alc883_3ST_2ch_modes, |
| 8894 | .need_dac_fix = 1, |
| 8895 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 8896 | .unsol_event = alc883_eee1601_unsol_event, |
| 8897 | .init_hook = alc883_eee1601_inithook, |
| 8898 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8899 | [ALC1200_ASUS_P5Q] = { |
| 8900 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8901 | .init_verbs = { alc883_init_verbs }, |
| 8902 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8903 | .dac_nids = alc883_dac_nids, |
| 8904 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 8905 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8906 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8907 | .channel_mode = alc883_sixstack_modes, |
| 8908 | .input_mux = &alc883_capture_source, |
| 8909 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8910 | }; |
| 8911 | |
| 8912 | |
| 8913 | /* |
| 8914 | * BIOS auto configuration |
| 8915 | */ |
| 8916 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8917 | hda_nid_t nid, int pin_type, |
| 8918 | int dac_idx) |
| 8919 | { |
| 8920 | /* set as output */ |
| 8921 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8922 | int idx; |
| 8923 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8924 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8925 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8926 | idx = 4; |
| 8927 | else |
| 8928 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8929 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8930 | |
| 8931 | } |
| 8932 | |
| 8933 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8934 | { |
| 8935 | struct alc_spec *spec = codec->spec; |
| 8936 | int i; |
| 8937 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8938 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8939 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8940 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8941 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8942 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8943 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8944 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8945 | } |
| 8946 | } |
| 8947 | |
| 8948 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8949 | { |
| 8950 | struct alc_spec *spec = codec->spec; |
| 8951 | hda_nid_t pin; |
| 8952 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8953 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8954 | if (pin) /* connect to front */ |
| 8955 | /* use dac 0 */ |
| 8956 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8957 | pin = spec->autocfg.speaker_pins[0]; |
| 8958 | if (pin) |
| 8959 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8960 | } |
| 8961 | |
| 8962 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8963 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8964 | |
| 8965 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8966 | { |
| 8967 | struct alc_spec *spec = codec->spec; |
| 8968 | int i; |
| 8969 | |
| 8970 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8971 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8972 | if (alc883_is_input_pin(nid)) { |
| 8973 | snd_hda_codec_write(codec, nid, 0, |
| 8974 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8975 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8976 | PIN_VREF80 : PIN_IN)); |
| 8977 | if (nid != ALC883_PIN_CD_NID) |
| 8978 | snd_hda_codec_write(codec, nid, 0, |
| 8979 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8980 | AMP_OUT_MUTE); |
| 8981 | } |
| 8982 | } |
| 8983 | } |
| 8984 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8985 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 8986 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8987 | /* almost identical with ALC880 parser... */ |
| 8988 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8989 | { |
| 8990 | struct alc_spec *spec = codec->spec; |
| 8991 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 8992 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 8993 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8994 | |
| 8995 | if (err < 0) |
| 8996 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8997 | else if (!err) |
| 8998 | return 0; /* no config found */ |
| 8999 | |
| 9000 | err = alc_auto_add_mic_boost(codec); |
| 9001 | if (err < 0) |
| 9002 | return err; |
| 9003 | |
| 9004 | /* hack - override the init verbs */ |
| 9005 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9006 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 9007 | /* setup input_mux for ALC889 */ |
| 9008 | if (codec->vendor_id == 0x10ec0889) { |
| 9009 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9010 | * because it's under 0x18 |
| 9011 | */ |
| 9012 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9013 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9014 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9015 | for (i = 1; i < 3; i++) |
| 9016 | memcpy(&spec->private_imux[i], |
| 9017 | &spec->private_imux[0], |
| 9018 | sizeof(spec->private_imux[0])); |
| 9019 | imux->items[imux->num_items].label = "Int DMic"; |
| 9020 | imux->items[imux->num_items].index = 0x0b; |
| 9021 | imux->num_items++; |
| 9022 | spec->num_mux_defs = 3; |
| 9023 | spec->input_mux = spec->private_imux; |
| 9024 | } |
| 9025 | } |
| 9026 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9027 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9028 | } |
| 9029 | |
| 9030 | /* additional initialization for auto-configuration model */ |
| 9031 | static void alc883_auto_init(struct hda_codec *codec) |
| 9032 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9033 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9034 | alc883_auto_init_multi_out(codec); |
| 9035 | alc883_auto_init_hp_out(codec); |
| 9036 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9037 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9038 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9039 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9040 | } |
| 9041 | |
| 9042 | static int patch_alc883(struct hda_codec *codec) |
| 9043 | { |
| 9044 | struct alc_spec *spec; |
| 9045 | int err, board_config; |
| 9046 | |
| 9047 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9048 | if (spec == NULL) |
| 9049 | return -ENOMEM; |
| 9050 | |
| 9051 | codec->spec = spec; |
| 9052 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9053 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9054 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9055 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9056 | alc883_models, |
| 9057 | alc883_cfg_tbl); |
| 9058 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9059 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 9060 | "trying auto-probe from BIOS...\n"); |
| 9061 | board_config = ALC883_AUTO; |
| 9062 | } |
| 9063 | |
| 9064 | if (board_config == ALC883_AUTO) { |
| 9065 | /* automatic parse from the BIOS config */ |
| 9066 | err = alc883_parse_auto_config(codec); |
| 9067 | if (err < 0) { |
| 9068 | alc_free(codec); |
| 9069 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9070 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9071 | printk(KERN_INFO |
| 9072 | "hda_codec: Cannot set up configuration " |
| 9073 | "from BIOS. Using base mode...\n"); |
| 9074 | board_config = ALC883_3ST_2ch_DIG; |
| 9075 | } |
| 9076 | } |
| 9077 | |
| 9078 | if (board_config != ALC883_AUTO) |
| 9079 | setup_preset(spec, &alc883_presets[board_config]); |
| 9080 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9081 | switch (codec->vendor_id) { |
| 9082 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 9083 | if (codec->revision_id == 0x100101) { |
| 9084 | spec->stream_name_analog = "ALC1200 Analog"; |
| 9085 | spec->stream_name_digital = "ALC1200 Digital"; |
| 9086 | } else { |
| 9087 | spec->stream_name_analog = "ALC888 Analog"; |
| 9088 | spec->stream_name_digital = "ALC888 Digital"; |
| 9089 | } |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 9090 | if (!spec->num_adc_nids) { |
| 9091 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9092 | spec->adc_nids = alc883_adc_nids; |
| 9093 | } |
| 9094 | if (!spec->capsrc_nids) |
| 9095 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9096 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9097 | break; |
| 9098 | case 0x10ec0889: |
| 9099 | spec->stream_name_analog = "ALC889 Analog"; |
| 9100 | spec->stream_name_digital = "ALC889 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 9101 | if (!spec->num_adc_nids) { |
| 9102 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9103 | spec->adc_nids = alc889_adc_nids; |
| 9104 | } |
| 9105 | if (!spec->capsrc_nids) |
| 9106 | spec->capsrc_nids = alc889_capsrc_nids; |
| 9107 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style |
| 9108 | capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9109 | break; |
| 9110 | default: |
| 9111 | spec->stream_name_analog = "ALC883 Analog"; |
| 9112 | spec->stream_name_digital = "ALC883 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 9113 | if (!spec->num_adc_nids) { |
| 9114 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9115 | spec->adc_nids = alc883_adc_nids; |
| 9116 | } |
| 9117 | if (!spec->capsrc_nids) |
| 9118 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9119 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9120 | break; |
| 9121 | } |
| 9122 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9123 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9124 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9125 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9126 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9127 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9128 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9129 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9130 | if (!spec->cap_mixer) |
| 9131 | set_capture_mixer(spec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9132 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9133 | spec->vmaster_nid = 0x0c; |
| 9134 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9135 | codec->patch_ops = alc_patch_ops; |
| 9136 | if (board_config == ALC883_AUTO) |
| 9137 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9138 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9139 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9140 | if (!spec->loopback.amplist) |
| 9141 | spec->loopback.amplist = alc883_loopbacks; |
| 9142 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9143 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9144 | |
| 9145 | return 0; |
| 9146 | } |
| 9147 | |
| 9148 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9149 | * ALC262 support |
| 9150 | */ |
| 9151 | |
| 9152 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9153 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9154 | |
| 9155 | #define alc262_dac_nids alc260_dac_nids |
| 9156 | #define alc262_adc_nids alc882_adc_nids |
| 9157 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9158 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9159 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9160 | |
| 9161 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9162 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9163 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9164 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9165 | /* ADC0 */ |
| 9166 | 0x09 |
| 9167 | }; |
| 9168 | |
| 9169 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9170 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9171 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9172 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9173 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9174 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9175 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9176 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9177 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9178 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9179 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9180 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9181 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9182 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9183 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9184 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 9185 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9186 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9187 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9188 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9189 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9190 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9191 | }; |
| 9192 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9193 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9194 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9195 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9196 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9197 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9198 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9199 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9200 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9201 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9202 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9203 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9204 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9205 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9206 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 9207 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9208 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 9209 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9210 | { } /* end */ |
| 9211 | }; |
| 9212 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9213 | /* update HP, line and mono-out pins according to the master switch */ |
| 9214 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9215 | { |
| 9216 | struct alc_spec *spec = codec->spec; |
| 9217 | int val = spec->master_sw; |
| 9218 | |
| 9219 | /* HP & line-out */ |
| 9220 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9221 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9222 | val ? PIN_HP : 0); |
| 9223 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9224 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9225 | val ? PIN_HP : 0); |
| 9226 | /* mono (speaker) depending on the HP jack sense */ |
| 9227 | val = val && !spec->jack_present; |
| 9228 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9229 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9230 | val ? PIN_OUT : 0); |
| 9231 | } |
| 9232 | |
| 9233 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9234 | { |
| 9235 | struct alc_spec *spec = codec->spec; |
| 9236 | unsigned int presence; |
| 9237 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9238 | AC_VERB_GET_PIN_SENSE, 0); |
| 9239 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9240 | alc262_hp_master_update(codec); |
| 9241 | } |
| 9242 | |
| 9243 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9244 | { |
| 9245 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9246 | return; |
| 9247 | alc262_hp_bpc_automute(codec); |
| 9248 | } |
| 9249 | |
| 9250 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9251 | { |
| 9252 | struct alc_spec *spec = codec->spec; |
| 9253 | unsigned int presence; |
| 9254 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9255 | AC_VERB_GET_PIN_SENSE, 0); |
| 9256 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9257 | alc262_hp_master_update(codec); |
| 9258 | } |
| 9259 | |
| 9260 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9261 | unsigned int res) |
| 9262 | { |
| 9263 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9264 | return; |
| 9265 | alc262_hp_wildwest_automute(codec); |
| 9266 | } |
| 9267 | |
| 9268 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 9269 | struct snd_ctl_elem_value *ucontrol) |
| 9270 | { |
| 9271 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9272 | struct alc_spec *spec = codec->spec; |
| 9273 | *ucontrol->value.integer.value = spec->master_sw; |
| 9274 | return 0; |
| 9275 | } |
| 9276 | |
| 9277 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9278 | struct snd_ctl_elem_value *ucontrol) |
| 9279 | { |
| 9280 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9281 | struct alc_spec *spec = codec->spec; |
| 9282 | int val = !!*ucontrol->value.integer.value; |
| 9283 | |
| 9284 | if (val == spec->master_sw) |
| 9285 | return 0; |
| 9286 | spec->master_sw = val; |
| 9287 | alc262_hp_master_update(codec); |
| 9288 | return 1; |
| 9289 | } |
| 9290 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9291 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9292 | { |
| 9293 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9294 | .name = "Master Playback Switch", |
| 9295 | .info = snd_ctl_boolean_mono_info, |
| 9296 | .get = alc262_hp_master_sw_get, |
| 9297 | .put = alc262_hp_master_sw_put, |
| 9298 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9299 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9300 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9301 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9302 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9303 | HDA_OUTPUT), |
| 9304 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9305 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9306 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9307 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9308 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9309 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9310 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9311 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9312 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9313 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9314 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9315 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9316 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9317 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9318 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9319 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9320 | { } /* end */ |
| 9321 | }; |
| 9322 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9323 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9324 | { |
| 9325 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9326 | .name = "Master Playback Switch", |
| 9327 | .info = snd_ctl_boolean_mono_info, |
| 9328 | .get = alc262_hp_master_sw_get, |
| 9329 | .put = alc262_hp_master_sw_put, |
| 9330 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9331 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9332 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9333 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9334 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9335 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9336 | HDA_OUTPUT), |
| 9337 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9338 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9339 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9340 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9341 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9342 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9343 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9344 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9345 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9346 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 9347 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 9348 | { } /* end */ |
| 9349 | }; |
| 9350 | |
| 9351 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9352 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9353 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9354 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9355 | { } /* end */ |
| 9356 | }; |
| 9357 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9358 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9359 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 9360 | { |
| 9361 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9362 | |
| 9363 | if (force || !spec->sense_updated) { |
| 9364 | unsigned int present; |
| 9365 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9366 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9367 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9368 | spec->sense_updated = 1; |
| 9369 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9370 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 9371 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9372 | } |
| 9373 | |
| 9374 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9375 | unsigned int res) |
| 9376 | { |
| 9377 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9378 | return; |
| 9379 | alc262_hp_t5735_automute(codec, 1); |
| 9380 | } |
| 9381 | |
| 9382 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9383 | { |
| 9384 | alc262_hp_t5735_automute(codec, 1); |
| 9385 | } |
| 9386 | |
| 9387 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9388 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9389 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9390 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9391 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9392 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9393 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9394 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9395 | { } /* end */ |
| 9396 | }; |
| 9397 | |
| 9398 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9399 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9400 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9401 | |
| 9402 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9403 | { } |
| 9404 | }; |
| 9405 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9406 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9407 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9408 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9409 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9410 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9411 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9412 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9413 | { } /* end */ |
| 9414 | }; |
| 9415 | |
| 9416 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9417 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9418 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9419 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9420 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9421 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9422 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9423 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9424 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9425 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9426 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9427 | {} |
| 9428 | }; |
| 9429 | |
| 9430 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9431 | .num_items = 1, |
| 9432 | .items = { |
| 9433 | { "Line", 0x1 }, |
| 9434 | }, |
| 9435 | }; |
| 9436 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9437 | /* bind hp and internal speaker mute (with plug check) */ |
| 9438 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9439 | struct snd_ctl_elem_value *ucontrol) |
| 9440 | { |
| 9441 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9442 | long *valp = ucontrol->value.integer.value; |
| 9443 | int change; |
| 9444 | |
| 9445 | /* change hp mute */ |
| 9446 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9447 | HDA_AMP_MUTE, |
| 9448 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9449 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9450 | HDA_AMP_MUTE, |
| 9451 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9452 | if (change) { |
| 9453 | /* change speaker according to HP jack state */ |
| 9454 | struct alc_spec *spec = codec->spec; |
| 9455 | unsigned int mute; |
| 9456 | if (spec->jack_present) |
| 9457 | mute = HDA_AMP_MUTE; |
| 9458 | else |
| 9459 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9460 | HDA_OUTPUT, 0); |
| 9461 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9462 | HDA_AMP_MUTE, mute); |
| 9463 | } |
| 9464 | return change; |
| 9465 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9466 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9467 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9468 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9469 | { |
| 9470 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9471 | .name = "Master Playback Switch", |
| 9472 | .info = snd_hda_mixer_amp_switch_info, |
| 9473 | .get = snd_hda_mixer_amp_switch_get, |
| 9474 | .put = alc262_sony_master_sw_put, |
| 9475 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9476 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9477 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9478 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9479 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9480 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9481 | { } /* end */ |
| 9482 | }; |
| 9483 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9484 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9485 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9486 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9487 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9488 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9489 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9490 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9491 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9492 | { } /* end */ |
| 9493 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9494 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9495 | #define alc262_capture_mixer alc882_capture_mixer |
| 9496 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9497 | |
| 9498 | /* |
| 9499 | * generic initialization of ADC, input mixers and output mixers |
| 9500 | */ |
| 9501 | static struct hda_verb alc262_init_verbs[] = { |
| 9502 | /* |
| 9503 | * Unmute ADC0-2 and set the default input to mic-in |
| 9504 | */ |
| 9505 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9506 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9507 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9508 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9509 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9510 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9511 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9512 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9513 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9514 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9515 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9516 | */ |
| 9517 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9520 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9521 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9522 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9523 | |
| 9524 | /* |
| 9525 | * Set up output mixers (0x0c - 0x0e) |
| 9526 | */ |
| 9527 | /* set vol=0 to output mixers */ |
| 9528 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9529 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9530 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9531 | /* set up input amps for analog loopback */ |
| 9532 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9533 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9534 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9535 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9536 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9537 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9538 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9539 | |
| 9540 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9541 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9542 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9543 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9544 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9545 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9546 | |
| 9547 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9548 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9549 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9550 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9551 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9552 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9553 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9554 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9555 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9556 | /* FIXME: use matrix-type input source selection */ |
| 9557 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9558 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9559 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9560 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9561 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9562 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9563 | /* Input mixer2 */ |
| 9564 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9565 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9566 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9567 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9568 | /* Input mixer3 */ |
| 9569 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9570 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9571 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9572 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9573 | |
| 9574 | { } |
| 9575 | }; |
| 9576 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9577 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9578 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9579 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9580 | { } |
| 9581 | }; |
| 9582 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9583 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9584 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9585 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9586 | {} |
| 9587 | }; |
| 9588 | |
| 9589 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9590 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9591 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9592 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9593 | |
| 9594 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9595 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9596 | {} |
| 9597 | }; |
| 9598 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9599 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9600 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9601 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9602 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9603 | |
| 9604 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9605 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9606 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9607 | }; |
| 9608 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9609 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9610 | .num_items = 2, |
| 9611 | .items = { |
| 9612 | { "Int DMic", 0x9 }, |
| 9613 | { "Mic", 0x0 }, |
| 9614 | }, |
| 9615 | }; |
| 9616 | |
| 9617 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9618 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9619 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9620 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9621 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9622 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9623 | { } /* end */ |
| 9624 | }; |
| 9625 | |
| 9626 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9627 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9628 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9629 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9630 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9631 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9632 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9633 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9634 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9635 | {} |
| 9636 | }; |
| 9637 | |
| 9638 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9639 | { |
| 9640 | unsigned int present; |
| 9641 | |
| 9642 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9643 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9644 | snd_hda_codec_write(codec, 0x22, 0, |
| 9645 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9646 | } |
| 9647 | |
| 9648 | /* toggle speaker-output according to the hp-jack state */ |
| 9649 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9650 | { |
| 9651 | unsigned int present; |
| 9652 | unsigned char bits; |
| 9653 | |
| 9654 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9655 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9656 | bits = present ? 0 : PIN_OUT; |
| 9657 | snd_hda_codec_write(codec, 0x14, 0, |
| 9658 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9659 | } |
| 9660 | |
| 9661 | |
| 9662 | |
| 9663 | /* unsolicited event for HP jack sensing */ |
| 9664 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9665 | unsigned int res) |
| 9666 | { |
| 9667 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9668 | alc262_toshiba_s06_speaker_automute(codec); |
| 9669 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9670 | alc262_dmic_automute(codec); |
| 9671 | |
| 9672 | } |
| 9673 | |
| 9674 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9675 | { |
| 9676 | alc262_toshiba_s06_speaker_automute(codec); |
| 9677 | alc262_dmic_automute(codec); |
| 9678 | } |
| 9679 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9680 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9681 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9682 | { |
| 9683 | struct alc_spec *spec = codec->spec; |
| 9684 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9685 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9686 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9687 | /* need to execute and sync at first */ |
| 9688 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9689 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9690 | AC_VERB_GET_PIN_SENSE, 0); |
| 9691 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9692 | if (spec->jack_present) { |
| 9693 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9694 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9695 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9696 | } else { |
| 9697 | /* unmute internal speaker if necessary */ |
| 9698 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9699 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9700 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9701 | } |
| 9702 | } |
| 9703 | |
| 9704 | /* unsolicited event for HP jack sensing */ |
| 9705 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9706 | unsigned int res) |
| 9707 | { |
| 9708 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9709 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9710 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9711 | } |
| 9712 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9713 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9714 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9715 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9716 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9717 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9718 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9719 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9720 | AC_VERB_GET_PIN_SENSE, 0); |
| 9721 | present = (present & 0x80000000) != 0; |
| 9722 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9723 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9724 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9725 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9726 | } else { |
| 9727 | /* unmute internal speaker if necessary */ |
| 9728 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9729 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9730 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9731 | } |
| 9732 | } |
| 9733 | |
| 9734 | /* unsolicited event for HP jack sensing */ |
| 9735 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9736 | unsigned int res) |
| 9737 | { |
| 9738 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9739 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9740 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9741 | } |
| 9742 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9743 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9744 | * nec model |
| 9745 | * 0x15 = headphone |
| 9746 | * 0x16 = internal speaker |
| 9747 | * 0x18 = external mic |
| 9748 | */ |
| 9749 | |
| 9750 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9751 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9752 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9753 | |
| 9754 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9755 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9756 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9757 | |
| 9758 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9759 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9760 | { } /* end */ |
| 9761 | }; |
| 9762 | |
| 9763 | static struct hda_verb alc262_nec_verbs[] = { |
| 9764 | /* Unmute Speaker */ |
| 9765 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9766 | |
| 9767 | /* Headphone */ |
| 9768 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9769 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9770 | |
| 9771 | /* External mic to headphone */ |
| 9772 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9773 | /* External mic to speaker */ |
| 9774 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9775 | {} |
| 9776 | }; |
| 9777 | |
| 9778 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9779 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9780 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9781 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9782 | */ |
| 9783 | |
| 9784 | #define ALC_HP_EVENT 0x37 |
| 9785 | |
| 9786 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9787 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9788 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9789 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9790 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9791 | {} |
| 9792 | }; |
| 9793 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9794 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9795 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9796 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9797 | {} |
| 9798 | }; |
| 9799 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9800 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9801 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9802 | .items = { |
| 9803 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9804 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9805 | { "CD", 0x4 }, |
| 9806 | }, |
| 9807 | }; |
| 9808 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9809 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9810 | .num_items = 5, |
| 9811 | .items = { |
| 9812 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9813 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9814 | { "Line", 0x2 }, |
| 9815 | { "CD", 0x4 }, |
| 9816 | { "AUX IN", 0x6 }, |
| 9817 | }, |
| 9818 | }; |
| 9819 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9820 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9821 | .num_items = 4, |
| 9822 | .items = { |
| 9823 | { "Mic", 0x0 }, |
| 9824 | { "Front Mic", 0x2 }, |
| 9825 | { "Line", 0x1 }, |
| 9826 | { "CD", 0x4 }, |
| 9827 | }, |
| 9828 | }; |
| 9829 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9830 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9831 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9832 | { |
| 9833 | struct alc_spec *spec = codec->spec; |
| 9834 | unsigned int mute; |
| 9835 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9836 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9837 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9838 | /* need to execute and sync at first */ |
| 9839 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9840 | /* check laptop HP jack */ |
| 9841 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9842 | AC_VERB_GET_PIN_SENSE, 0); |
| 9843 | /* need to execute and sync at first */ |
| 9844 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9845 | /* check docking HP jack */ |
| 9846 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9847 | AC_VERB_GET_PIN_SENSE, 0); |
| 9848 | if (present & AC_PINSENSE_PRESENCE) |
| 9849 | spec->jack_present = 1; |
| 9850 | else |
| 9851 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9852 | spec->sense_updated = 1; |
| 9853 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9854 | /* unmute internal speaker only if both HPs are unplugged and |
| 9855 | * master switch is on |
| 9856 | */ |
| 9857 | if (spec->jack_present) |
| 9858 | mute = HDA_AMP_MUTE; |
| 9859 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9860 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9861 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9862 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9863 | } |
| 9864 | |
| 9865 | /* unsolicited event for HP jack sensing */ |
| 9866 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9867 | unsigned int res) |
| 9868 | { |
| 9869 | if ((res >> 26) != ALC_HP_EVENT) |
| 9870 | return; |
| 9871 | alc262_fujitsu_automute(codec, 1); |
| 9872 | } |
| 9873 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9874 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9875 | { |
| 9876 | alc262_fujitsu_automute(codec, 1); |
| 9877 | } |
| 9878 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9879 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9880 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 9881 | .ops = &snd_hda_bind_vol, |
| 9882 | .values = { |
| 9883 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 9884 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 9885 | 0 |
| 9886 | }, |
| 9887 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9888 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9889 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9890 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 9891 | { |
| 9892 | struct alc_spec *spec = codec->spec; |
| 9893 | unsigned int mute; |
| 9894 | |
| 9895 | if (force || !spec->sense_updated) { |
| 9896 | unsigned int present_int_hp; |
| 9897 | /* need to execute and sync at first */ |
| 9898 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9899 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 9900 | AC_VERB_GET_PIN_SENSE, 0); |
| 9901 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 9902 | spec->sense_updated = 1; |
| 9903 | } |
| 9904 | if (spec->jack_present) { |
| 9905 | /* mute internal speaker */ |
| 9906 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9907 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9908 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9909 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9910 | } else { |
| 9911 | /* unmute internal speaker if necessary */ |
| 9912 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9913 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9914 | HDA_AMP_MUTE, mute); |
| 9915 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9916 | HDA_AMP_MUTE, mute); |
| 9917 | } |
| 9918 | } |
| 9919 | |
| 9920 | /* unsolicited event for HP jack sensing */ |
| 9921 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 9922 | unsigned int res) |
| 9923 | { |
| 9924 | if ((res >> 26) != ALC_HP_EVENT) |
| 9925 | return; |
| 9926 | alc262_lenovo_3000_automute(codec, 1); |
| 9927 | } |
| 9928 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9929 | /* bind hp and internal speaker mute (with plug check) */ |
| 9930 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9931 | struct snd_ctl_elem_value *ucontrol) |
| 9932 | { |
| 9933 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9934 | long *valp = ucontrol->value.integer.value; |
| 9935 | int change; |
| 9936 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9937 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9938 | HDA_AMP_MUTE, |
| 9939 | valp ? 0 : HDA_AMP_MUTE); |
| 9940 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9941 | HDA_AMP_MUTE, |
| 9942 | valp ? 0 : HDA_AMP_MUTE); |
| 9943 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 9944 | if (change) |
| 9945 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9946 | return change; |
| 9947 | } |
| 9948 | |
| 9949 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9950 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9951 | { |
| 9952 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9953 | .name = "Master Playback Switch", |
| 9954 | .info = snd_hda_mixer_amp_switch_info, |
| 9955 | .get = snd_hda_mixer_amp_switch_get, |
| 9956 | .put = alc262_fujitsu_master_sw_put, |
| 9957 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9958 | }, |
| 9959 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9960 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 9961 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 9962 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9963 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9964 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9965 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9966 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9967 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9968 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9969 | { } /* end */ |
| 9970 | }; |
| 9971 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9972 | /* bind hp and internal speaker mute (with plug check) */ |
| 9973 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9974 | struct snd_ctl_elem_value *ucontrol) |
| 9975 | { |
| 9976 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9977 | long *valp = ucontrol->value.integer.value; |
| 9978 | int change; |
| 9979 | |
| 9980 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9981 | HDA_AMP_MUTE, |
| 9982 | valp ? 0 : HDA_AMP_MUTE); |
| 9983 | |
| 9984 | if (change) |
| 9985 | alc262_lenovo_3000_automute(codec, 0); |
| 9986 | return change; |
| 9987 | } |
| 9988 | |
| 9989 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 9990 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9991 | { |
| 9992 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9993 | .name = "Master Playback Switch", |
| 9994 | .info = snd_hda_mixer_amp_switch_info, |
| 9995 | .get = snd_hda_mixer_amp_switch_get, |
| 9996 | .put = alc262_lenovo_3000_master_sw_put, |
| 9997 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 9998 | }, |
| 9999 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10000 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10001 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10002 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10003 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10004 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10005 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10006 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10007 | { } /* end */ |
| 10008 | }; |
| 10009 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10010 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10011 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10012 | { |
| 10013 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10014 | .name = "Master Playback Switch", |
| 10015 | .info = snd_hda_mixer_amp_switch_info, |
| 10016 | .get = snd_hda_mixer_amp_switch_get, |
| 10017 | .put = alc262_sony_master_sw_put, |
| 10018 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 10019 | }, |
| 10020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10022 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10023 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10024 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10025 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10026 | { } /* end */ |
| 10027 | }; |
| 10028 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10029 | /* additional init verbs for Benq laptops */ |
| 10030 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10031 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10032 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10033 | {} |
| 10034 | }; |
| 10035 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10036 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10037 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10038 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10039 | |
| 10040 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10041 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10042 | {} |
| 10043 | }; |
| 10044 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10045 | /* Samsung Q1 Ultra Vista model setup */ |
| 10046 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10047 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10048 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10049 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10050 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10051 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10052 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10053 | { } /* end */ |
| 10054 | }; |
| 10055 | |
| 10056 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10057 | /* output mixer */ |
| 10058 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10059 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10060 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10061 | /* speaker */ |
| 10062 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10063 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10064 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10065 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10066 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10067 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10068 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10069 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10070 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10071 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10072 | /* internal mic */ |
| 10073 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10074 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10075 | /* ADC, choose mic */ |
| 10076 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10077 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10078 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10079 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10080 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10081 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10082 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10083 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10084 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10085 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10086 | {} |
| 10087 | }; |
| 10088 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10089 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10090 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10091 | { |
| 10092 | struct alc_spec *spec = codec->spec; |
| 10093 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10094 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10095 | mute = 0; |
| 10096 | /* auto-mute only when HP is used as HP */ |
| 10097 | if (!spec->cur_mux[0]) { |
| 10098 | unsigned int present; |
| 10099 | /* need to execute and sync at first */ |
| 10100 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10101 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10102 | AC_VERB_GET_PIN_SENSE, 0); |
| 10103 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10104 | if (spec->jack_present) |
| 10105 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10106 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10107 | /* mute/unmute internal speaker */ |
| 10108 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10109 | HDA_AMP_MUTE, mute); |
| 10110 | /* mute/unmute HP */ |
| 10111 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10112 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10113 | } |
| 10114 | |
| 10115 | /* unsolicited event for HP jack sensing */ |
| 10116 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10117 | unsigned int res) |
| 10118 | { |
| 10119 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10120 | return; |
| 10121 | alc262_ultra_automute(codec); |
| 10122 | } |
| 10123 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10124 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10125 | .num_items = 2, |
| 10126 | .items = { |
| 10127 | { "Mic", 0x1 }, |
| 10128 | { "Headphone", 0x7 }, |
| 10129 | }, |
| 10130 | }; |
| 10131 | |
| 10132 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10133 | struct snd_ctl_elem_value *ucontrol) |
| 10134 | { |
| 10135 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10136 | struct alc_spec *spec = codec->spec; |
| 10137 | int ret; |
| 10138 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10139 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10140 | if (!ret) |
| 10141 | return 0; |
| 10142 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10143 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10144 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10145 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10146 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10147 | return ret; |
| 10148 | } |
| 10149 | |
| 10150 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10151 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10152 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10153 | { |
| 10154 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10155 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10156 | .info = alc_mux_enum_info, |
| 10157 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10158 | .put = alc262_ultra_mux_enum_put, |
| 10159 | }, |
| 10160 | { } /* end */ |
| 10161 | }; |
| 10162 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10163 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10164 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10165 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10166 | { |
| 10167 | hda_nid_t nid; |
| 10168 | int err; |
| 10169 | |
| 10170 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10171 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10172 | spec->multiout.dac_nids[0] = 2; |
| 10173 | |
| 10174 | nid = cfg->line_out_pins[0]; |
| 10175 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10176 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10177 | "Front Playback Volume", |
| 10178 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10179 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10180 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10181 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10182 | "Front Playback Switch", |
| 10183 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10184 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10185 | return err; |
| 10186 | } |
| 10187 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10188 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10189 | if (nid) { |
| 10190 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10191 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10192 | "Speaker Playback Volume", |
| 10193 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10194 | HDA_OUTPUT)); |
| 10195 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10196 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10197 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10198 | "Speaker Playback Switch", |
| 10199 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10200 | HDA_OUTPUT)); |
| 10201 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10202 | return err; |
| 10203 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10204 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10205 | "Speaker Playback Switch", |
| 10206 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10207 | HDA_OUTPUT)); |
| 10208 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10209 | return err; |
| 10210 | } |
| 10211 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10212 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10213 | if (nid) { |
| 10214 | /* spec->multiout.hp_nid = 2; */ |
| 10215 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10216 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10217 | "Headphone Playback Volume", |
| 10218 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10219 | HDA_OUTPUT)); |
| 10220 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10221 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10222 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10223 | "Headphone Playback Switch", |
| 10224 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10225 | HDA_OUTPUT)); |
| 10226 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10227 | return err; |
| 10228 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10229 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10230 | "Headphone Playback Switch", |
| 10231 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10232 | HDA_OUTPUT)); |
| 10233 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10234 | return err; |
| 10235 | } |
| 10236 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10237 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10238 | } |
| 10239 | |
| 10240 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10241 | #define alc262_auto_create_analog_input_ctls \ |
| 10242 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10243 | |
| 10244 | /* |
| 10245 | * generic initialization of ADC, input mixers and output mixers |
| 10246 | */ |
| 10247 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10248 | /* |
| 10249 | * Unmute ADC0-2 and set the default input to mic-in |
| 10250 | */ |
| 10251 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10252 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10253 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10254 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10255 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10256 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10257 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10258 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10259 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10260 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10261 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10262 | */ |
| 10263 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10264 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10265 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10266 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10267 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10268 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10269 | |
| 10270 | /* |
| 10271 | * Set up output mixers (0x0c - 0x0f) |
| 10272 | */ |
| 10273 | /* set vol=0 to output mixers */ |
| 10274 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10275 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10276 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10277 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10278 | /* set up input amps for analog loopback */ |
| 10279 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10280 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10281 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10282 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10283 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10284 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10285 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10286 | |
| 10287 | /* FIXME: use matrix-type input source selection */ |
| 10288 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10289 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10290 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10291 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10292 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10293 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10294 | /* Input mixer2 */ |
| 10295 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10296 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10297 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10299 | /* Input mixer3 */ |
| 10300 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10301 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10302 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10303 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10304 | |
| 10305 | { } |
| 10306 | }; |
| 10307 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10308 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10309 | /* |
| 10310 | * Unmute ADC0-2 and set the default input to mic-in |
| 10311 | */ |
| 10312 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10313 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10314 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10315 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10316 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10317 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10318 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10319 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10320 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10321 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10322 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10323 | */ |
| 10324 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10326 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10329 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10330 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10331 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10332 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10333 | /* |
| 10334 | * Set up output mixers (0x0c - 0x0e) |
| 10335 | */ |
| 10336 | /* set vol=0 to output mixers */ |
| 10337 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10338 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10339 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10340 | |
| 10341 | /* set up input amps for analog loopback */ |
| 10342 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10343 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10344 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10345 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10346 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10349 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10350 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10351 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10352 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10353 | |
| 10354 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10355 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10356 | |
| 10357 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10358 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10359 | |
| 10360 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10361 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10362 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10363 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10364 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10365 | |
| 10366 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10367 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10368 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10369 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10370 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10371 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10372 | |
| 10373 | |
| 10374 | /* FIXME: use matrix-type input source selection */ |
| 10375 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10376 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10377 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10378 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10379 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10380 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10381 | /* Input mixer2 */ |
| 10382 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10383 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10384 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10385 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10386 | /* Input mixer3 */ |
| 10387 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10388 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10389 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10390 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10391 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10392 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10393 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10394 | { } |
| 10395 | }; |
| 10396 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10397 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10398 | /* |
| 10399 | * Unmute ADC0-2 and set the default input to mic-in |
| 10400 | */ |
| 10401 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10402 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10403 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10404 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10405 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10406 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10407 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10408 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10409 | * mixer widget |
| 10410 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10411 | * panel mic (mic 2) |
| 10412 | */ |
| 10413 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10414 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10415 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10416 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10417 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10418 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10419 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10420 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10421 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10422 | /* |
| 10423 | * Set up output mixers (0x0c - 0x0e) |
| 10424 | */ |
| 10425 | /* set vol=0 to output mixers */ |
| 10426 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10427 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10428 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10429 | |
| 10430 | /* set up input amps for analog loopback */ |
| 10431 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10433 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10434 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10435 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10436 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10437 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10438 | |
| 10439 | |
| 10440 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10441 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10442 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10443 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10444 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10445 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10446 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10447 | |
| 10448 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10449 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10450 | |
| 10451 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10452 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10453 | |
| 10454 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10455 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10456 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10457 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10458 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10459 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10460 | |
| 10461 | /* FIXME: use matrix-type input source selection */ |
| 10462 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10463 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10464 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10465 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10466 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10467 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10468 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10469 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10470 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10471 | /* Input mixer2 */ |
| 10472 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10473 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10474 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10475 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10476 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10477 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10478 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10479 | /* Input mixer3 */ |
| 10480 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10481 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10482 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10483 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10484 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10485 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10486 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10487 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10488 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10489 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10490 | { } |
| 10491 | }; |
| 10492 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10493 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10494 | |
| 10495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10497 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10498 | |
| 10499 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10500 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10501 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10502 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10503 | |
| 10504 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10505 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10506 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10507 | {} |
| 10508 | }; |
| 10509 | |
| 10510 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10511 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10512 | #define alc262_loopbacks alc880_loopbacks |
| 10513 | #endif |
| 10514 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10515 | /* pcm configuration: identiacal with ALC880 */ |
| 10516 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10517 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10518 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10519 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10520 | |
| 10521 | /* |
| 10522 | * BIOS auto configuration |
| 10523 | */ |
| 10524 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10525 | { |
| 10526 | struct alc_spec *spec = codec->spec; |
| 10527 | int err; |
| 10528 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10529 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10530 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10531 | alc262_ignore); |
| 10532 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10533 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10534 | if (!spec->autocfg.line_outs) { |
| 10535 | if (spec->autocfg.dig_out_pin || spec->autocfg.dig_in_pin) { |
| 10536 | spec->multiout.max_channels = 2; |
| 10537 | spec->no_analog = 1; |
| 10538 | goto dig_only; |
| 10539 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10540 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10541 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10542 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10543 | if (err < 0) |
| 10544 | return err; |
| 10545 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10546 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10547 | return err; |
| 10548 | |
| 10549 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10550 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10551 | dig_only: |
| 10552 | if (spec->autocfg.dig_out_pin) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10553 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10554 | spec->dig_out_type = spec->autocfg.dig_out_type; |
| 10555 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10556 | if (spec->autocfg.dig_in_pin) |
| 10557 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10558 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10559 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10560 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10561 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10562 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10563 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 10564 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10565 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10566 | err = alc_auto_add_mic_boost(codec); |
| 10567 | if (err < 0) |
| 10568 | return err; |
| 10569 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 10570 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10571 | return 1; |
| 10572 | } |
| 10573 | |
| 10574 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10575 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10576 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10577 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10578 | |
| 10579 | |
| 10580 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10581 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10582 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10583 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10584 | alc262_auto_init_multi_out(codec); |
| 10585 | alc262_auto_init_hp_out(codec); |
| 10586 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10587 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10588 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10589 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10590 | } |
| 10591 | |
| 10592 | /* |
| 10593 | * configuration and preset |
| 10594 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10595 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10596 | [ALC262_BASIC] = "basic", |
| 10597 | [ALC262_HIPPO] = "hippo", |
| 10598 | [ALC262_HIPPO_1] = "hippo_1", |
| 10599 | [ALC262_FUJITSU] = "fujitsu", |
| 10600 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10601 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10602 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10603 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10604 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10605 | [ALC262_BENQ_T31] = "benq-t31", |
| 10606 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10607 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10608 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10609 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10610 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10611 | [ALC262_NEC] = "nec", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10612 | [ALC262_AUTO] = "auto", |
| 10613 | }; |
| 10614 | |
| 10615 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10616 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10617 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10618 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10619 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10620 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 10621 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10622 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10623 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10624 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10625 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10626 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10627 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10628 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10629 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10630 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10631 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10632 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10633 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10634 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10635 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10636 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10637 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10638 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10639 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10640 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10641 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10642 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10643 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10644 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | 57a5ef4 | 2008-11-28 14:46:28 +0100 | [diff] [blame] | 10645 | SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN", |
| 10646 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10647 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10648 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10649 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10650 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10651 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10652 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10653 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 10654 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10655 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10656 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10657 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10658 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10659 | {} |
| 10660 | }; |
| 10661 | |
| 10662 | static struct alc_config_preset alc262_presets[] = { |
| 10663 | [ALC262_BASIC] = { |
| 10664 | .mixers = { alc262_base_mixer }, |
| 10665 | .init_verbs = { alc262_init_verbs }, |
| 10666 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10667 | .dac_nids = alc262_dac_nids, |
| 10668 | .hp_nid = 0x03, |
| 10669 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10670 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10671 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10672 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10673 | [ALC262_HIPPO] = { |
| 10674 | .mixers = { alc262_base_mixer }, |
| 10675 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10676 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10677 | .dac_nids = alc262_dac_nids, |
| 10678 | .hp_nid = 0x03, |
| 10679 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10680 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10681 | .channel_mode = alc262_modes, |
| 10682 | .input_mux = &alc262_capture_source, |
| 10683 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10684 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10685 | }, |
| 10686 | [ALC262_HIPPO_1] = { |
| 10687 | .mixers = { alc262_hippo1_mixer }, |
| 10688 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10689 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10690 | .dac_nids = alc262_dac_nids, |
| 10691 | .hp_nid = 0x02, |
| 10692 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10693 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10694 | .channel_mode = alc262_modes, |
| 10695 | .input_mux = &alc262_capture_source, |
| 10696 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10697 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10698 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10699 | [ALC262_FUJITSU] = { |
| 10700 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10701 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10702 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10703 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10704 | .dac_nids = alc262_dac_nids, |
| 10705 | .hp_nid = 0x03, |
| 10706 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10707 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10708 | .channel_mode = alc262_modes, |
| 10709 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10710 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10711 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10712 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10713 | [ALC262_HP_BPC] = { |
| 10714 | .mixers = { alc262_HP_BPC_mixer }, |
| 10715 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10716 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10717 | .dac_nids = alc262_dac_nids, |
| 10718 | .hp_nid = 0x03, |
| 10719 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10720 | .channel_mode = alc262_modes, |
| 10721 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10722 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10723 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10724 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10725 | [ALC262_HP_BPC_D7000_WF] = { |
| 10726 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10727 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10728 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10729 | .dac_nids = alc262_dac_nids, |
| 10730 | .hp_nid = 0x03, |
| 10731 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10732 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10733 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10734 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10735 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10736 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10737 | [ALC262_HP_BPC_D7000_WL] = { |
| 10738 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10739 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10740 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10741 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10742 | .dac_nids = alc262_dac_nids, |
| 10743 | .hp_nid = 0x03, |
| 10744 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10745 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10746 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10747 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10748 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10749 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10750 | [ALC262_HP_TC_T5735] = { |
| 10751 | .mixers = { alc262_hp_t5735_mixer }, |
| 10752 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10753 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10754 | .dac_nids = alc262_dac_nids, |
| 10755 | .hp_nid = 0x03, |
| 10756 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10757 | .channel_mode = alc262_modes, |
| 10758 | .input_mux = &alc262_capture_source, |
| 10759 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10760 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10761 | }, |
| 10762 | [ALC262_HP_RP5700] = { |
| 10763 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10764 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10765 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10766 | .dac_nids = alc262_dac_nids, |
| 10767 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10768 | .channel_mode = alc262_modes, |
| 10769 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10770 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10771 | [ALC262_BENQ_ED8] = { |
| 10772 | .mixers = { alc262_base_mixer }, |
| 10773 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10774 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10775 | .dac_nids = alc262_dac_nids, |
| 10776 | .hp_nid = 0x03, |
| 10777 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10778 | .channel_mode = alc262_modes, |
| 10779 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10780 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10781 | [ALC262_SONY_ASSAMD] = { |
| 10782 | .mixers = { alc262_sony_mixer }, |
| 10783 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10784 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10785 | .dac_nids = alc262_dac_nids, |
| 10786 | .hp_nid = 0x02, |
| 10787 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10788 | .channel_mode = alc262_modes, |
| 10789 | .input_mux = &alc262_capture_source, |
| 10790 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10791 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10792 | }, |
| 10793 | [ALC262_BENQ_T31] = { |
| 10794 | .mixers = { alc262_benq_t31_mixer }, |
| 10795 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10796 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10797 | .dac_nids = alc262_dac_nids, |
| 10798 | .hp_nid = 0x03, |
| 10799 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10800 | .channel_mode = alc262_modes, |
| 10801 | .input_mux = &alc262_capture_source, |
| 10802 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10803 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10804 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10805 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10806 | .mixers = { alc262_ultra_mixer }, |
| 10807 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10808 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10809 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10810 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10811 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10812 | .channel_mode = alc262_modes, |
| 10813 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10814 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10815 | .capsrc_nids = alc262_capsrc_nids, |
| 10816 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10817 | .unsol_event = alc262_ultra_unsol_event, |
| 10818 | .init_hook = alc262_ultra_automute, |
| 10819 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10820 | [ALC262_LENOVO_3000] = { |
| 10821 | .mixers = { alc262_lenovo_3000_mixer }, |
| 10822 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10823 | alc262_lenovo_3000_unsol_verbs }, |
| 10824 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10825 | .dac_nids = alc262_dac_nids, |
| 10826 | .hp_nid = 0x03, |
| 10827 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10828 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10829 | .channel_mode = alc262_modes, |
| 10830 | .input_mux = &alc262_fujitsu_capture_source, |
| 10831 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 10832 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10833 | [ALC262_NEC] = { |
| 10834 | .mixers = { alc262_nec_mixer }, |
| 10835 | .init_verbs = { alc262_nec_verbs }, |
| 10836 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10837 | .dac_nids = alc262_dac_nids, |
| 10838 | .hp_nid = 0x03, |
| 10839 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10840 | .channel_mode = alc262_modes, |
| 10841 | .input_mux = &alc262_capture_source, |
| 10842 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10843 | [ALC262_TOSHIBA_S06] = { |
| 10844 | .mixers = { alc262_toshiba_s06_mixer }, |
| 10845 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 10846 | alc262_eapd_verbs }, |
| 10847 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10848 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 10849 | .dac_nids = alc262_dac_nids, |
| 10850 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 10851 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10852 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10853 | .channel_mode = alc262_modes, |
| 10854 | .input_mux = &alc262_dmic_capture_source, |
| 10855 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 10856 | .init_hook = alc262_toshiba_s06_init_hook, |
| 10857 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10858 | [ALC262_TOSHIBA_RX1] = { |
| 10859 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 10860 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 10861 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10862 | .dac_nids = alc262_dac_nids, |
| 10863 | .hp_nid = 0x03, |
| 10864 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10865 | .channel_mode = alc262_modes, |
| 10866 | .input_mux = &alc262_capture_source, |
| 10867 | .unsol_event = alc262_hippo_unsol_event, |
| 10868 | .init_hook = alc262_hippo_automute, |
| 10869 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10870 | }; |
| 10871 | |
| 10872 | static int patch_alc262(struct hda_codec *codec) |
| 10873 | { |
| 10874 | struct alc_spec *spec; |
| 10875 | int board_config; |
| 10876 | int err; |
| 10877 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 10878 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10879 | if (spec == NULL) |
| 10880 | return -ENOMEM; |
| 10881 | |
| 10882 | codec->spec = spec; |
| 10883 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10884 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 10885 | * under-run |
| 10886 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10887 | { |
| 10888 | int tmp; |
| 10889 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10890 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 10891 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10892 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 10893 | } |
| 10894 | #endif |
| 10895 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 10896 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10897 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10898 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 10899 | alc262_models, |
| 10900 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10901 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10902 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10903 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 10904 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10905 | board_config = ALC262_AUTO; |
| 10906 | } |
| 10907 | |
| 10908 | if (board_config == ALC262_AUTO) { |
| 10909 | /* automatic parse from the BIOS config */ |
| 10910 | err = alc262_parse_auto_config(codec); |
| 10911 | if (err < 0) { |
| 10912 | alc_free(codec); |
| 10913 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10914 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10915 | printk(KERN_INFO |
| 10916 | "hda_codec: Cannot set up configuration " |
| 10917 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10918 | board_config = ALC262_BASIC; |
| 10919 | } |
| 10920 | } |
| 10921 | |
| 10922 | if (board_config != ALC262_AUTO) |
| 10923 | setup_preset(spec, &alc262_presets[board_config]); |
| 10924 | |
| 10925 | spec->stream_name_analog = "ALC262 Analog"; |
| 10926 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 10927 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10928 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10929 | spec->stream_name_digital = "ALC262 Digital"; |
| 10930 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 10931 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 10932 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 10933 | spec->capture_style = CAPT_MIX; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10934 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10935 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 10936 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 10937 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10938 | /* get type */ |
| 10939 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10940 | if (wcap != AC_WID_AUD_IN) { |
| 10941 | spec->adc_nids = alc262_adc_nids_alt; |
| 10942 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10943 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10944 | } else { |
| 10945 | spec->adc_nids = alc262_adc_nids; |
| 10946 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10947 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10948 | } |
| 10949 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10950 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10951 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10952 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10953 | spec->vmaster_nid = 0x0c; |
| 10954 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10955 | codec->patch_ops = alc_patch_ops; |
| 10956 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10957 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10958 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10959 | if (!spec->loopback.amplist) |
| 10960 | spec->loopback.amplist = alc262_loopbacks; |
| 10961 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 10962 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10963 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10964 | return 0; |
| 10965 | } |
| 10966 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10967 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10968 | * ALC268 channel source setting (2 channel) |
| 10969 | */ |
| 10970 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 10971 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10972 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10973 | static hda_nid_t alc268_dac_nids[2] = { |
| 10974 | /* front, hp */ |
| 10975 | 0x02, 0x03 |
| 10976 | }; |
| 10977 | |
| 10978 | static hda_nid_t alc268_adc_nids[2] = { |
| 10979 | /* ADC0-1 */ |
| 10980 | 0x08, 0x07 |
| 10981 | }; |
| 10982 | |
| 10983 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 10984 | /* ADC0 */ |
| 10985 | 0x08 |
| 10986 | }; |
| 10987 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10988 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 10989 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10990 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 10991 | /* output mixer control */ |
| 10992 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10993 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10994 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10995 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10996 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10997 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10998 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10999 | { } |
| 11000 | }; |
| 11001 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11002 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11003 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11004 | .ops = &snd_hda_bind_sw, |
| 11005 | .values = { |
| 11006 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11007 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11008 | 0 |
| 11009 | }, |
| 11010 | }; |
| 11011 | |
| 11012 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11013 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11014 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11015 | { } |
| 11016 | }; |
| 11017 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11018 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11019 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11020 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11021 | { } |
| 11022 | }; |
| 11023 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11024 | /* Toshiba specific */ |
| 11025 | #define alc268_toshiba_automute alc262_hippo_automute |
| 11026 | |
| 11027 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11028 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11029 | { } /* end */ |
| 11030 | }; |
| 11031 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11032 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11033 | .num_items = 2, |
| 11034 | .items = { |
| 11035 | { "i-Mic", 0x6 }, |
| 11036 | { "E-Mic", 0x0 }, |
| 11037 | }, |
| 11038 | }; |
| 11039 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11040 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11041 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11042 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11043 | .ops = &snd_hda_bind_vol, |
| 11044 | .values = { |
| 11045 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11046 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11047 | 0 |
| 11048 | }, |
| 11049 | }; |
| 11050 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11051 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11052 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11053 | { |
| 11054 | struct alc_spec *spec = codec->spec; |
| 11055 | unsigned int mute; |
| 11056 | |
| 11057 | if (force || !spec->sense_updated) { |
| 11058 | unsigned int present; |
| 11059 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11060 | AC_VERB_GET_PIN_SENSE, 0); |
| 11061 | spec->jack_present = (present & 0x80000000) != 0; |
| 11062 | spec->sense_updated = 1; |
| 11063 | } |
| 11064 | if (spec->jack_present) |
| 11065 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11066 | else /* unmute internal speaker if necessary */ |
| 11067 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11068 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11069 | HDA_AMP_MUTE, mute); |
| 11070 | } |
| 11071 | |
| 11072 | |
| 11073 | /* bind hp and internal speaker mute (with plug check) */ |
| 11074 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11075 | struct snd_ctl_elem_value *ucontrol) |
| 11076 | { |
| 11077 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11078 | long *valp = ucontrol->value.integer.value; |
| 11079 | int change; |
| 11080 | |
| 11081 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11082 | HDA_AMP_MUTE, |
| 11083 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11084 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11085 | HDA_AMP_MUTE, |
| 11086 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11087 | if (change) |
| 11088 | alc268_acer_automute(codec, 0); |
| 11089 | return change; |
| 11090 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11091 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11092 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11093 | /* output mixer control */ |
| 11094 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11095 | { |
| 11096 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11097 | .name = "Master Playback Switch", |
| 11098 | .info = snd_hda_mixer_amp_switch_info, |
| 11099 | .get = snd_hda_mixer_amp_switch_get, |
| 11100 | .put = alc268_acer_master_sw_put, |
| 11101 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11102 | }, |
| 11103 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11104 | { } |
| 11105 | }; |
| 11106 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11107 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11108 | /* output mixer control */ |
| 11109 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11110 | { |
| 11111 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11112 | .name = "Master Playback Switch", |
| 11113 | .info = snd_hda_mixer_amp_switch_info, |
| 11114 | .get = snd_hda_mixer_amp_switch_get, |
| 11115 | .put = alc268_acer_master_sw_put, |
| 11116 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11117 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11118 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11119 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11120 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11121 | { } |
| 11122 | }; |
| 11123 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11124 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11125 | /* output mixer control */ |
| 11126 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11127 | { |
| 11128 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11129 | .name = "Master Playback Switch", |
| 11130 | .info = snd_hda_mixer_amp_switch_info, |
| 11131 | .get = snd_hda_mixer_amp_switch_get, |
| 11132 | .put = alc268_acer_master_sw_put, |
| 11133 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11134 | }, |
| 11135 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11136 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11137 | { } |
| 11138 | }; |
| 11139 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11140 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11141 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11142 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11143 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11144 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11145 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11146 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11147 | { } |
| 11148 | }; |
| 11149 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11150 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11151 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11152 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11153 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11154 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11155 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11156 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11157 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11158 | { } |
| 11159 | }; |
| 11160 | |
| 11161 | /* unsolicited event for HP jack sensing */ |
| 11162 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 11163 | unsigned int res) |
| 11164 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11165 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11166 | return; |
| 11167 | alc268_toshiba_automute(codec); |
| 11168 | } |
| 11169 | |
| 11170 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11171 | unsigned int res) |
| 11172 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11173 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11174 | return; |
| 11175 | alc268_acer_automute(codec, 1); |
| 11176 | } |
| 11177 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11178 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11179 | { |
| 11180 | alc268_acer_automute(codec, 1); |
| 11181 | } |
| 11182 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11183 | /* toggle speaker-output according to the hp-jack state */ |
| 11184 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11185 | { |
| 11186 | unsigned int present; |
| 11187 | unsigned char bits; |
| 11188 | |
| 11189 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11190 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11191 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11192 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11193 | AMP_IN_MUTE(0), bits); |
| 11194 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11195 | AMP_IN_MUTE(0), bits); |
| 11196 | } |
| 11197 | |
| 11198 | |
| 11199 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11200 | { |
| 11201 | unsigned int present; |
| 11202 | |
| 11203 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11204 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11205 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11206 | present ? 0x0 : 0x6); |
| 11207 | } |
| 11208 | |
| 11209 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11210 | unsigned int res) |
| 11211 | { |
| 11212 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11213 | alc268_aspire_one_speaker_automute(codec); |
| 11214 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11215 | alc268_acer_mic_automute(codec); |
| 11216 | } |
| 11217 | |
| 11218 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11219 | { |
| 11220 | alc268_aspire_one_speaker_automute(codec); |
| 11221 | alc268_acer_mic_automute(codec); |
| 11222 | } |
| 11223 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11224 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11225 | /* output mixer control */ |
| 11226 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11227 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11228 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11229 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11230 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11231 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11232 | { } |
| 11233 | }; |
| 11234 | |
| 11235 | static struct hda_verb alc268_dell_verbs[] = { |
| 11236 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11237 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11238 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11239 | { } |
| 11240 | }; |
| 11241 | |
| 11242 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11243 | static void alc268_dell_automute(struct hda_codec *codec) |
| 11244 | { |
| 11245 | unsigned int present; |
| 11246 | unsigned int mute; |
| 11247 | |
| 11248 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 11249 | if (present & 0x80000000) |
| 11250 | mute = HDA_AMP_MUTE; |
| 11251 | else |
| 11252 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 11253 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11254 | HDA_AMP_MUTE, mute); |
| 11255 | } |
| 11256 | |
| 11257 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 11258 | unsigned int res) |
| 11259 | { |
| 11260 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11261 | return; |
| 11262 | alc268_dell_automute(codec); |
| 11263 | } |
| 11264 | |
| 11265 | #define alc268_dell_init_hook alc268_dell_automute |
| 11266 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11267 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11268 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11269 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11270 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11271 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11272 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11273 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11274 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11275 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11276 | { } |
| 11277 | }; |
| 11278 | |
| 11279 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11280 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11281 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11282 | { } |
| 11283 | }; |
| 11284 | |
| 11285 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 11286 | { |
| 11287 | unsigned int present; |
| 11288 | |
| 11289 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11290 | & AC_PINSENSE_PRESENCE; |
| 11291 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11292 | present ? 0 : PIN_OUT); |
| 11293 | } |
| 11294 | |
| 11295 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11296 | { |
| 11297 | unsigned int present; |
| 11298 | |
| 11299 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11300 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11301 | snd_hda_codec_write(codec, 0x23, 0, |
| 11302 | AC_VERB_SET_CONNECT_SEL, |
| 11303 | present ? 0x00 : 0x01); |
| 11304 | } |
| 11305 | |
| 11306 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 11307 | { |
| 11308 | alc267_quanta_il1_hp_automute(codec); |
| 11309 | alc267_quanta_il1_mic_automute(codec); |
| 11310 | } |
| 11311 | |
| 11312 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11313 | unsigned int res) |
| 11314 | { |
| 11315 | switch (res >> 26) { |
| 11316 | case ALC880_HP_EVENT: |
| 11317 | alc267_quanta_il1_hp_automute(codec); |
| 11318 | break; |
| 11319 | case ALC880_MIC_EVENT: |
| 11320 | alc267_quanta_il1_mic_automute(codec); |
| 11321 | break; |
| 11322 | } |
| 11323 | } |
| 11324 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11325 | /* |
| 11326 | * generic initialization of ADC, input mixers and output mixers |
| 11327 | */ |
| 11328 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11329 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11330 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11331 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11332 | |
| 11333 | /* |
| 11334 | * Set up output mixers (0x0c - 0x0e) |
| 11335 | */ |
| 11336 | /* set vol=0 to output mixers */ |
| 11337 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11338 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11339 | |
| 11340 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11341 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11342 | |
| 11343 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11344 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11345 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11346 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11347 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11348 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11349 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11350 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11351 | |
| 11352 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11353 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11354 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11355 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11356 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11357 | |
| 11358 | /* set PCBEEP vol = 0, mute connections */ |
| 11359 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11360 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11361 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11362 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11363 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11364 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11365 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11367 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11368 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11369 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11370 | { } |
| 11371 | }; |
| 11372 | |
| 11373 | /* |
| 11374 | * generic initialization of ADC, input mixers and output mixers |
| 11375 | */ |
| 11376 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11377 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11378 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11379 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11380 | |
| 11381 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11382 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11383 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11384 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11385 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11386 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11387 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11388 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11389 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11390 | |
| 11391 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11392 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11393 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11394 | /* set PCBEEP vol = 0, mute connections */ |
| 11395 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11396 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11397 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11398 | |
| 11399 | { } |
| 11400 | }; |
| 11401 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11402 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11403 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11404 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11405 | { |
| 11406 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11407 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11408 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11409 | */ |
| 11410 | /* .name = "Capture Source", */ |
| 11411 | .name = "Input Source", |
| 11412 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11413 | .info = alc_mux_enum_info, |
| 11414 | .get = alc_mux_enum_get, |
| 11415 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11416 | }, |
| 11417 | { } /* end */ |
| 11418 | }; |
| 11419 | |
| 11420 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11421 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11422 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11423 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11424 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11425 | { |
| 11426 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11427 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11428 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11429 | */ |
| 11430 | /* .name = "Capture Source", */ |
| 11431 | .name = "Input Source", |
| 11432 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11433 | .info = alc_mux_enum_info, |
| 11434 | .get = alc_mux_enum_get, |
| 11435 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11436 | }, |
| 11437 | { } /* end */ |
| 11438 | }; |
| 11439 | |
| 11440 | static struct hda_input_mux alc268_capture_source = { |
| 11441 | .num_items = 4, |
| 11442 | .items = { |
| 11443 | { "Mic", 0x0 }, |
| 11444 | { "Front Mic", 0x1 }, |
| 11445 | { "Line", 0x2 }, |
| 11446 | { "CD", 0x3 }, |
| 11447 | }, |
| 11448 | }; |
| 11449 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11450 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11451 | .num_items = 3, |
| 11452 | .items = { |
| 11453 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11454 | { "Internal Mic", 0x1 }, |
| 11455 | { "Line", 0x2 }, |
| 11456 | }, |
| 11457 | }; |
| 11458 | |
| 11459 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11460 | .num_items = 3, |
| 11461 | .items = { |
| 11462 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11463 | { "Internal Mic", 0x6 }, |
| 11464 | { "Line", 0x2 }, |
| 11465 | }, |
| 11466 | }; |
| 11467 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11468 | #ifdef CONFIG_SND_DEBUG |
| 11469 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11470 | /* Volume widgets */ |
| 11471 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11472 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11473 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11474 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11475 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11476 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11477 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11478 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11479 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11480 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11481 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11482 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11483 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11484 | /* The below appears problematic on some hardwares */ |
| 11485 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11486 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11487 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11488 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11489 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11490 | |
| 11491 | /* Modes for retasking pin widgets */ |
| 11492 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11493 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11494 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11495 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11496 | |
| 11497 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11498 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11499 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11500 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11501 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11502 | |
| 11503 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11504 | * The ALC268 does not have an SPDIF input. |
| 11505 | */ |
| 11506 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11507 | |
| 11508 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11509 | * this output to turn on an external amplifier. |
| 11510 | */ |
| 11511 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11512 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11513 | |
| 11514 | { } /* end */ |
| 11515 | }; |
| 11516 | #endif |
| 11517 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11518 | /* create input playback/capture controls for the given pin */ |
| 11519 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11520 | const char *ctlname, int idx) |
| 11521 | { |
| 11522 | char name[32]; |
| 11523 | int err; |
| 11524 | |
| 11525 | sprintf(name, "%s Playback Volume", ctlname); |
| 11526 | if (nid == 0x14) { |
| 11527 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11528 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11529 | HDA_OUTPUT)); |
| 11530 | if (err < 0) |
| 11531 | return err; |
| 11532 | } else if (nid == 0x15) { |
| 11533 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11534 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11535 | HDA_OUTPUT)); |
| 11536 | if (err < 0) |
| 11537 | return err; |
| 11538 | } else |
| 11539 | return -1; |
| 11540 | sprintf(name, "%s Playback Switch", ctlname); |
| 11541 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11542 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11543 | if (err < 0) |
| 11544 | return err; |
| 11545 | return 0; |
| 11546 | } |
| 11547 | |
| 11548 | /* add playback controls from the parsed DAC table */ |
| 11549 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11550 | const struct auto_pin_cfg *cfg) |
| 11551 | { |
| 11552 | hda_nid_t nid; |
| 11553 | int err; |
| 11554 | |
| 11555 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11556 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11557 | spec->multiout.dac_nids[0] = 2; |
| 11558 | spec->multiout.dac_nids[1] = 3; |
| 11559 | |
| 11560 | nid = cfg->line_out_pins[0]; |
| 11561 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11562 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11563 | |
| 11564 | nid = cfg->speaker_pins[0]; |
| 11565 | if (nid == 0x1d) { |
| 11566 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11567 | "Speaker Playback Volume", |
| 11568 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11569 | if (err < 0) |
| 11570 | return err; |
| 11571 | } |
| 11572 | nid = cfg->hp_pins[0]; |
| 11573 | if (nid) |
| 11574 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11575 | |
| 11576 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11577 | if (nid == 0x16) { |
| 11578 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11579 | "Mono Playback Switch", |
| 11580 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11581 | if (err < 0) |
| 11582 | return err; |
| 11583 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11584 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11585 | } |
| 11586 | |
| 11587 | /* create playback/capture controls for input pins */ |
| 11588 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11589 | const struct auto_pin_cfg *cfg) |
| 11590 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 11591 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11592 | int i, idx1; |
| 11593 | |
| 11594 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11595 | switch(cfg->input_pins[i]) { |
| 11596 | case 0x18: |
| 11597 | idx1 = 0; /* Mic 1 */ |
| 11598 | break; |
| 11599 | case 0x19: |
| 11600 | idx1 = 1; /* Mic 2 */ |
| 11601 | break; |
| 11602 | case 0x1a: |
| 11603 | idx1 = 2; /* Line In */ |
| 11604 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11605 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11606 | idx1 = 3; /* CD */ |
| 11607 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11608 | case 0x12: |
| 11609 | case 0x13: |
| 11610 | idx1 = 6; /* digital mics */ |
| 11611 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11612 | default: |
| 11613 | continue; |
| 11614 | } |
| 11615 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11616 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11617 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11618 | } |
| 11619 | return 0; |
| 11620 | } |
| 11621 | |
| 11622 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11623 | { |
| 11624 | struct alc_spec *spec = codec->spec; |
| 11625 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11626 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11627 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11628 | unsigned int dac_vol1, dac_vol2; |
| 11629 | |
| 11630 | if (speaker_nid) { |
| 11631 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11632 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11633 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11634 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11635 | AMP_IN_UNMUTE(1)); |
| 11636 | snd_hda_codec_write(codec, 0x10, 0, |
| 11637 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11638 | AMP_IN_UNMUTE(1)); |
| 11639 | } else { |
| 11640 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11641 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11642 | snd_hda_codec_write(codec, 0x10, 0, |
| 11643 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11644 | } |
| 11645 | |
| 11646 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11647 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11648 | dac_vol2 = AMP_OUT_ZERO; |
| 11649 | else if (line_nid == 0x15) |
| 11650 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11651 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11652 | dac_vol2 = AMP_OUT_ZERO; |
| 11653 | else if (hp_nid == 0x15) |
| 11654 | dac_vol1 = AMP_OUT_ZERO; |
| 11655 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11656 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11657 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11658 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11659 | |
| 11660 | snd_hda_codec_write(codec, 0x02, 0, |
| 11661 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11662 | snd_hda_codec_write(codec, 0x03, 0, |
| 11663 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11664 | } |
| 11665 | |
| 11666 | /* pcm configuration: identiacal with ALC880 */ |
| 11667 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11668 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11669 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11670 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11671 | |
| 11672 | /* |
| 11673 | * BIOS auto configuration |
| 11674 | */ |
| 11675 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11676 | { |
| 11677 | struct alc_spec *spec = codec->spec; |
| 11678 | int err; |
| 11679 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11680 | |
| 11681 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11682 | alc268_ignore); |
| 11683 | if (err < 0) |
| 11684 | return err; |
| 11685 | if (!spec->autocfg.line_outs) |
| 11686 | return 0; /* can't find valid BIOS pin config */ |
| 11687 | |
| 11688 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11689 | if (err < 0) |
| 11690 | return err; |
| 11691 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11692 | if (err < 0) |
| 11693 | return err; |
| 11694 | |
| 11695 | spec->multiout.max_channels = 2; |
| 11696 | |
| 11697 | /* digital only support output */ |
| 11698 | if (spec->autocfg.dig_out_pin) |
| 11699 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 11700 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11701 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11702 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11703 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11704 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11705 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11706 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11707 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11708 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 11709 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11710 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11711 | err = alc_auto_add_mic_boost(codec); |
| 11712 | if (err < 0) |
| 11713 | return err; |
| 11714 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 11715 | store_pin_configs(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11716 | return 1; |
| 11717 | } |
| 11718 | |
| 11719 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11720 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11721 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11722 | |
| 11723 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11724 | static void alc268_auto_init(struct hda_codec *codec) |
| 11725 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11726 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11727 | alc268_auto_init_multi_out(codec); |
| 11728 | alc268_auto_init_hp_out(codec); |
| 11729 | alc268_auto_init_mono_speaker_out(codec); |
| 11730 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11731 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11732 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11733 | } |
| 11734 | |
| 11735 | /* |
| 11736 | * configuration and preset |
| 11737 | */ |
| 11738 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11739 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11740 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11741 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11742 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11743 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11744 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11745 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11746 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11747 | #ifdef CONFIG_SND_DEBUG |
| 11748 | [ALC268_TEST] = "test", |
| 11749 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11750 | [ALC268_AUTO] = "auto", |
| 11751 | }; |
| 11752 | |
| 11753 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 11754 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11755 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11756 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11757 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11758 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11759 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 11760 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11761 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 11762 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11763 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11764 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11765 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11766 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 11767 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11768 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11769 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11770 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11771 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11772 | {} |
| 11773 | }; |
| 11774 | |
| 11775 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11776 | [ALC267_QUANTA_IL1] = { |
| 11777 | .mixers = { alc267_quanta_il1_mixer }, |
| 11778 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11779 | alc267_quanta_il1_verbs }, |
| 11780 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11781 | .dac_nids = alc268_dac_nids, |
| 11782 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11783 | .adc_nids = alc268_adc_nids_alt, |
| 11784 | .hp_nid = 0x03, |
| 11785 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11786 | .channel_mode = alc268_modes, |
| 11787 | .input_mux = &alc268_capture_source, |
| 11788 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 11789 | .init_hook = alc267_quanta_il1_automute, |
| 11790 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11791 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11792 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11793 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11794 | .init_verbs = { alc268_base_init_verbs }, |
| 11795 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11796 | .dac_nids = alc268_dac_nids, |
| 11797 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11798 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11799 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11800 | .hp_nid = 0x03, |
| 11801 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11802 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11803 | .channel_mode = alc268_modes, |
| 11804 | .input_mux = &alc268_capture_source, |
| 11805 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11806 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11807 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11808 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11809 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11810 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11811 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11812 | .dac_nids = alc268_dac_nids, |
| 11813 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11814 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11815 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11816 | .hp_nid = 0x03, |
| 11817 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11818 | .channel_mode = alc268_modes, |
| 11819 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11820 | .unsol_event = alc268_toshiba_unsol_event, |
| 11821 | .init_hook = alc268_toshiba_automute, |
| 11822 | }, |
| 11823 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11824 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 11825 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11826 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11827 | alc268_acer_verbs }, |
| 11828 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11829 | .dac_nids = alc268_dac_nids, |
| 11830 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11831 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11832 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11833 | .hp_nid = 0x02, |
| 11834 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11835 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11836 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11837 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11838 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11839 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11840 | [ALC268_ACER_DMIC] = { |
| 11841 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 11842 | alc268_beep_mixer }, |
| 11843 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11844 | alc268_acer_verbs }, |
| 11845 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11846 | .dac_nids = alc268_dac_nids, |
| 11847 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11848 | .adc_nids = alc268_adc_nids_alt, |
| 11849 | .capsrc_nids = alc268_capsrc_nids, |
| 11850 | .hp_nid = 0x02, |
| 11851 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11852 | .channel_mode = alc268_modes, |
| 11853 | .input_mux = &alc268_acer_dmic_capture_source, |
| 11854 | .unsol_event = alc268_acer_unsol_event, |
| 11855 | .init_hook = alc268_acer_init_hook, |
| 11856 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11857 | [ALC268_ACER_ASPIRE_ONE] = { |
| 11858 | .mixers = { alc268_acer_aspire_one_mixer, |
| 11859 | alc268_capture_alt_mixer }, |
| 11860 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11861 | alc268_acer_aspire_one_verbs }, |
| 11862 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11863 | .dac_nids = alc268_dac_nids, |
| 11864 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11865 | .adc_nids = alc268_adc_nids_alt, |
| 11866 | .capsrc_nids = alc268_capsrc_nids, |
| 11867 | .hp_nid = 0x03, |
| 11868 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11869 | .channel_mode = alc268_modes, |
| 11870 | .input_mux = &alc268_acer_lc_capture_source, |
| 11871 | .unsol_event = alc268_acer_lc_unsol_event, |
| 11872 | .init_hook = alc268_acer_lc_init_hook, |
| 11873 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11874 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11875 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11876 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11877 | alc268_dell_verbs }, |
| 11878 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11879 | .dac_nids = alc268_dac_nids, |
| 11880 | .hp_nid = 0x02, |
| 11881 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11882 | .channel_mode = alc268_modes, |
| 11883 | .unsol_event = alc268_dell_unsol_event, |
| 11884 | .init_hook = alc268_dell_init_hook, |
| 11885 | .input_mux = &alc268_capture_source, |
| 11886 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11887 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11888 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11889 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11890 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11891 | alc268_toshiba_verbs }, |
| 11892 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11893 | .dac_nids = alc268_dac_nids, |
| 11894 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11895 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11896 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11897 | .hp_nid = 0x03, |
| 11898 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11899 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11900 | .channel_mode = alc268_modes, |
| 11901 | .input_mux = &alc268_capture_source, |
| 11902 | .unsol_event = alc268_toshiba_unsol_event, |
| 11903 | .init_hook = alc268_toshiba_automute |
| 11904 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11905 | #ifdef CONFIG_SND_DEBUG |
| 11906 | [ALC268_TEST] = { |
| 11907 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 11908 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11909 | alc268_volume_init_verbs }, |
| 11910 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11911 | .dac_nids = alc268_dac_nids, |
| 11912 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11913 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11914 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11915 | .hp_nid = 0x03, |
| 11916 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11917 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11918 | .channel_mode = alc268_modes, |
| 11919 | .input_mux = &alc268_capture_source, |
| 11920 | }, |
| 11921 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11922 | }; |
| 11923 | |
| 11924 | static int patch_alc268(struct hda_codec *codec) |
| 11925 | { |
| 11926 | struct alc_spec *spec; |
| 11927 | int board_config; |
| 11928 | int err; |
| 11929 | |
| 11930 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 11931 | if (spec == NULL) |
| 11932 | return -ENOMEM; |
| 11933 | |
| 11934 | codec->spec = spec; |
| 11935 | |
| 11936 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 11937 | alc268_models, |
| 11938 | alc268_cfg_tbl); |
| 11939 | |
| 11940 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 11941 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 11942 | "trying auto-probe from BIOS...\n"); |
| 11943 | board_config = ALC268_AUTO; |
| 11944 | } |
| 11945 | |
| 11946 | if (board_config == ALC268_AUTO) { |
| 11947 | /* automatic parse from the BIOS config */ |
| 11948 | err = alc268_parse_auto_config(codec); |
| 11949 | if (err < 0) { |
| 11950 | alc_free(codec); |
| 11951 | return err; |
| 11952 | } else if (!err) { |
| 11953 | printk(KERN_INFO |
| 11954 | "hda_codec: Cannot set up configuration " |
| 11955 | "from BIOS. Using base mode...\n"); |
| 11956 | board_config = ALC268_3ST; |
| 11957 | } |
| 11958 | } |
| 11959 | |
| 11960 | if (board_config != ALC268_AUTO) |
| 11961 | setup_preset(spec, &alc268_presets[board_config]); |
| 11962 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11963 | if (codec->vendor_id == 0x10ec0267) { |
| 11964 | spec->stream_name_analog = "ALC267 Analog"; |
| 11965 | spec->stream_name_digital = "ALC267 Digital"; |
| 11966 | } else { |
| 11967 | spec->stream_name_analog = "ALC268 Analog"; |
| 11968 | spec->stream_name_digital = "ALC268 Digital"; |
| 11969 | } |
| 11970 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11971 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 11972 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11973 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11974 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11975 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 11976 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11977 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 11978 | /* override the amp caps for beep generator */ |
| 11979 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 11980 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 11981 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 11982 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 11983 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 11984 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11985 | if (!spec->adc_nids && spec->input_mux) { |
| 11986 | /* check whether NID 0x07 is valid */ |
| 11987 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11988 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11989 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11990 | /* get type */ |
| 11991 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 11992 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11993 | spec->adc_nids = alc268_adc_nids_alt; |
| 11994 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11995 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11996 | } else { |
| 11997 | spec->adc_nids = alc268_adc_nids; |
| 11998 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11999 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12000 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12001 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12002 | /* set default input source */ |
| 12003 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12004 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12005 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12006 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12007 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12008 | |
| 12009 | spec->vmaster_nid = 0x02; |
| 12010 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12011 | codec->patch_ops = alc_patch_ops; |
| 12012 | if (board_config == ALC268_AUTO) |
| 12013 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12014 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12015 | codec->proc_widget_hook = print_realtek_coef; |
| 12016 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12017 | return 0; |
| 12018 | } |
| 12019 | |
| 12020 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12021 | * ALC269 channel source setting (2 channel) |
| 12022 | */ |
| 12023 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12024 | |
| 12025 | #define alc269_dac_nids alc260_dac_nids |
| 12026 | |
| 12027 | static hda_nid_t alc269_adc_nids[1] = { |
| 12028 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12029 | 0x08, |
| 12030 | }; |
| 12031 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12032 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12033 | 0x23, |
| 12034 | }; |
| 12035 | |
| 12036 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12037 | * not a mux! |
| 12038 | */ |
| 12039 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12040 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12041 | .num_items = 2, |
| 12042 | .items = { |
| 12043 | { "i-Mic", 0x5 }, |
| 12044 | { "e-Mic", 0x0 }, |
| 12045 | }, |
| 12046 | }; |
| 12047 | |
| 12048 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12049 | .num_items = 2, |
| 12050 | .items = { |
| 12051 | { "i-Mic", 0x1 }, |
| 12052 | { "e-Mic", 0x0 }, |
| 12053 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12054 | }; |
| 12055 | |
| 12056 | #define alc269_modes alc260_modes |
| 12057 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12058 | |
| 12059 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12060 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12061 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12062 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12063 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12064 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12065 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12066 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 12067 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12068 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12069 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12070 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12071 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12072 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12073 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12074 | { } /* end */ |
| 12075 | }; |
| 12076 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12077 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12078 | /* output mixer control */ |
| 12079 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12080 | { |
| 12081 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12082 | .name = "Master Playback Switch", |
| 12083 | .info = snd_hda_mixer_amp_switch_info, |
| 12084 | .get = snd_hda_mixer_amp_switch_get, |
| 12085 | .put = alc268_acer_master_sw_put, |
| 12086 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12087 | }, |
| 12088 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12089 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12090 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12091 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12092 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12093 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12094 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12095 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12096 | { } |
| 12097 | }; |
| 12098 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12099 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12100 | /* output mixer control */ |
| 12101 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12102 | { |
| 12103 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12104 | .name = "Master Playback Switch", |
| 12105 | .info = snd_hda_mixer_amp_switch_info, |
| 12106 | .get = snd_hda_mixer_amp_switch_get, |
| 12107 | .put = alc268_acer_master_sw_put, |
| 12108 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12109 | }, |
| 12110 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12111 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12112 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12113 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12114 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12115 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12116 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12117 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12118 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
| 12119 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12120 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12121 | { } |
| 12122 | }; |
| 12123 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12124 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12125 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12126 | .ops = &snd_hda_bind_vol, |
| 12127 | .values = { |
| 12128 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12129 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12130 | 0 |
| 12131 | }, |
| 12132 | }; |
| 12133 | |
| 12134 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12135 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12136 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12137 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12138 | { } /* end */ |
| 12139 | }; |
| 12140 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12141 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12142 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12143 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12144 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12145 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12146 | { } /* end */ |
| 12147 | }; |
| 12148 | |
| 12149 | /* FSC amilo */ |
| 12150 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12151 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12152 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12153 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12154 | { } /* end */ |
| 12155 | }; |
| 12156 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12157 | /* beep control */ |
| 12158 | static struct snd_kcontrol_new alc269_beep_mixer[] = { |
| 12159 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 12160 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
| 12161 | { } /* end */ |
| 12162 | }; |
| 12163 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12164 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12165 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12166 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12167 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12168 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12169 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12170 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12171 | { } |
| 12172 | }; |
| 12173 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12174 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12175 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12176 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12177 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12178 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12179 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12180 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12181 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12182 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12183 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12184 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12185 | { } |
| 12186 | }; |
| 12187 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12188 | /* toggle speaker-output according to the hp-jack state */ |
| 12189 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12190 | { |
| 12191 | unsigned int present; |
| 12192 | unsigned char bits; |
| 12193 | |
| 12194 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12195 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12196 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12197 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12198 | AMP_IN_MUTE(0), bits); |
| 12199 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12200 | AMP_IN_MUTE(0), bits); |
| 12201 | |
| 12202 | snd_hda_codec_write(codec, 0x20, 0, |
| 12203 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12204 | snd_hda_codec_write(codec, 0x20, 0, |
| 12205 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12206 | |
| 12207 | snd_hda_codec_write(codec, 0x20, 0, |
| 12208 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12209 | snd_hda_codec_write(codec, 0x20, 0, |
| 12210 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12211 | } |
| 12212 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12213 | /* toggle speaker-output according to the hp-jacks state */ |
| 12214 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12215 | { |
| 12216 | unsigned int present; |
| 12217 | unsigned char bits; |
| 12218 | |
| 12219 | /* Check laptop headphone socket */ |
| 12220 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12221 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12222 | |
| 12223 | /* Check port replicator headphone socket */ |
| 12224 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12225 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12226 | |
| 12227 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12228 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12229 | AMP_IN_MUTE(0), bits); |
| 12230 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12231 | AMP_IN_MUTE(0), bits); |
| 12232 | |
| 12233 | snd_hda_codec_write(codec, 0x20, 0, |
| 12234 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12235 | snd_hda_codec_write(codec, 0x20, 0, |
| 12236 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12237 | |
| 12238 | snd_hda_codec_write(codec, 0x20, 0, |
| 12239 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12240 | snd_hda_codec_write(codec, 0x20, 0, |
| 12241 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12242 | } |
| 12243 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12244 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12245 | { |
| 12246 | unsigned int present; |
| 12247 | |
| 12248 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12249 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12250 | snd_hda_codec_write(codec, 0x23, 0, |
| 12251 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12252 | } |
| 12253 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12254 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12255 | { |
| 12256 | unsigned int present_laptop; |
| 12257 | unsigned int present_dock; |
| 12258 | |
| 12259 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12260 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12261 | |
| 12262 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12263 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12264 | |
| 12265 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12266 | if (present_dock) |
| 12267 | snd_hda_codec_write(codec, 0x23, 0, |
| 12268 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12269 | if (present_laptop) |
| 12270 | snd_hda_codec_write(codec, 0x23, 0, |
| 12271 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12272 | if (!present_dock && !present_laptop) |
| 12273 | snd_hda_codec_write(codec, 0x23, 0, |
| 12274 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12275 | } |
| 12276 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12277 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12278 | unsigned int res) |
| 12279 | { |
| 12280 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12281 | alc269_quanta_fl1_speaker_automute(codec); |
| 12282 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12283 | alc269_quanta_fl1_mic_automute(codec); |
| 12284 | } |
| 12285 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12286 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12287 | unsigned int res) |
| 12288 | { |
| 12289 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12290 | alc269_lifebook_speaker_automute(codec); |
| 12291 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12292 | alc269_lifebook_mic_autoswitch(codec); |
| 12293 | } |
| 12294 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12295 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12296 | { |
| 12297 | alc269_quanta_fl1_speaker_automute(codec); |
| 12298 | alc269_quanta_fl1_mic_automute(codec); |
| 12299 | } |
| 12300 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12301 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12302 | { |
| 12303 | alc269_lifebook_speaker_automute(codec); |
| 12304 | alc269_lifebook_mic_autoswitch(codec); |
| 12305 | } |
| 12306 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12307 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12308 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12309 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12310 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12311 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12312 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12313 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12314 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12315 | {} |
| 12316 | }; |
| 12317 | |
| 12318 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12319 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12320 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12321 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12322 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12323 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12324 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12325 | {} |
| 12326 | }; |
| 12327 | |
| 12328 | /* toggle speaker-output according to the hp-jack state */ |
| 12329 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12330 | { |
| 12331 | unsigned int present; |
| 12332 | unsigned char bits; |
| 12333 | |
| 12334 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12335 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12336 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12337 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12338 | AMP_IN_MUTE(0), bits); |
| 12339 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12340 | AMP_IN_MUTE(0), bits); |
| 12341 | } |
| 12342 | |
| 12343 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12344 | { |
| 12345 | unsigned int present; |
| 12346 | |
| 12347 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12348 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12349 | snd_hda_codec_write(codec, 0x23, 0, |
| 12350 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12351 | } |
| 12352 | |
| 12353 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12354 | { |
| 12355 | unsigned int present; |
| 12356 | |
| 12357 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12358 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12359 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12360 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12361 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12362 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12363 | } |
| 12364 | |
| 12365 | /* unsolicited event for HP jack sensing */ |
| 12366 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12367 | unsigned int res) |
| 12368 | { |
| 12369 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12370 | alc269_speaker_automute(codec); |
| 12371 | |
| 12372 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12373 | alc269_eeepc_dmic_automute(codec); |
| 12374 | } |
| 12375 | |
| 12376 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12377 | { |
| 12378 | alc269_speaker_automute(codec); |
| 12379 | alc269_eeepc_dmic_automute(codec); |
| 12380 | } |
| 12381 | |
| 12382 | /* unsolicited event for HP jack sensing */ |
| 12383 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12384 | unsigned int res) |
| 12385 | { |
| 12386 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12387 | alc269_speaker_automute(codec); |
| 12388 | |
| 12389 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12390 | alc269_eeepc_amic_automute(codec); |
| 12391 | } |
| 12392 | |
| 12393 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12394 | { |
| 12395 | alc269_speaker_automute(codec); |
| 12396 | alc269_eeepc_amic_automute(codec); |
| 12397 | } |
| 12398 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12399 | /* |
| 12400 | * generic initialization of ADC, input mixers and output mixers |
| 12401 | */ |
| 12402 | static struct hda_verb alc269_init_verbs[] = { |
| 12403 | /* |
| 12404 | * Unmute ADC0 and set the default input to mic-in |
| 12405 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12406 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12407 | |
| 12408 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12409 | * analog-loopback mixer widget |
| 12410 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12411 | * front panel mic (mic 2) |
| 12412 | */ |
| 12413 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12414 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12415 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12416 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12417 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12418 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12419 | |
| 12420 | /* |
| 12421 | * Set up output mixers (0x0c - 0x0e) |
| 12422 | */ |
| 12423 | /* set vol=0 to output mixers */ |
| 12424 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12425 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12426 | |
| 12427 | /* set up input amps for analog loopback */ |
| 12428 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12429 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12431 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12432 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12433 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12434 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12435 | |
| 12436 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12437 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12438 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12439 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12440 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12441 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12442 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12443 | |
| 12444 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12445 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12446 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12447 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12448 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12449 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12450 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12451 | |
| 12452 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12453 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12454 | |
| 12455 | /* FIXME: use matrix-type input source selection */ |
| 12456 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12457 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12458 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12459 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12460 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12461 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12462 | |
| 12463 | /* set EAPD */ |
| 12464 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12465 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12466 | { } |
| 12467 | }; |
| 12468 | |
| 12469 | /* add playback controls from the parsed DAC table */ |
| 12470 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12471 | const struct auto_pin_cfg *cfg) |
| 12472 | { |
| 12473 | hda_nid_t nid; |
| 12474 | int err; |
| 12475 | |
| 12476 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12477 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12478 | spec->multiout.dac_nids[0] = 2; |
| 12479 | |
| 12480 | nid = cfg->line_out_pins[0]; |
| 12481 | if (nid) { |
| 12482 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12483 | "Front Playback Volume", |
| 12484 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12485 | if (err < 0) |
| 12486 | return err; |
| 12487 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12488 | "Front Playback Switch", |
| 12489 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12490 | if (err < 0) |
| 12491 | return err; |
| 12492 | } |
| 12493 | |
| 12494 | nid = cfg->speaker_pins[0]; |
| 12495 | if (nid) { |
| 12496 | if (!cfg->line_out_pins[0]) { |
| 12497 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12498 | "Speaker Playback Volume", |
| 12499 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12500 | HDA_OUTPUT)); |
| 12501 | if (err < 0) |
| 12502 | return err; |
| 12503 | } |
| 12504 | if (nid == 0x16) { |
| 12505 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12506 | "Speaker Playback Switch", |
| 12507 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12508 | HDA_OUTPUT)); |
| 12509 | if (err < 0) |
| 12510 | return err; |
| 12511 | } else { |
| 12512 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12513 | "Speaker Playback Switch", |
| 12514 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12515 | HDA_OUTPUT)); |
| 12516 | if (err < 0) |
| 12517 | return err; |
| 12518 | } |
| 12519 | } |
| 12520 | nid = cfg->hp_pins[0]; |
| 12521 | if (nid) { |
| 12522 | /* spec->multiout.hp_nid = 2; */ |
| 12523 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12524 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12525 | "Headphone Playback Volume", |
| 12526 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12527 | HDA_OUTPUT)); |
| 12528 | if (err < 0) |
| 12529 | return err; |
| 12530 | } |
| 12531 | if (nid == 0x16) { |
| 12532 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12533 | "Headphone Playback Switch", |
| 12534 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12535 | HDA_OUTPUT)); |
| 12536 | if (err < 0) |
| 12537 | return err; |
| 12538 | } else { |
| 12539 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12540 | "Headphone Playback Switch", |
| 12541 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12542 | HDA_OUTPUT)); |
| 12543 | if (err < 0) |
| 12544 | return err; |
| 12545 | } |
| 12546 | } |
| 12547 | return 0; |
| 12548 | } |
| 12549 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12550 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12551 | const struct auto_pin_cfg *cfg) |
| 12552 | { |
| 12553 | int err; |
| 12554 | |
| 12555 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12556 | if (err < 0) |
| 12557 | return err; |
| 12558 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12559 | * because it's under 0x18 |
| 12560 | */ |
| 12561 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12562 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 12563 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12564 | imux->items[imux->num_items].label = "Int Mic"; |
| 12565 | imux->items[imux->num_items].index = 0x05; |
| 12566 | imux->num_items++; |
| 12567 | } |
| 12568 | return 0; |
| 12569 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12570 | |
| 12571 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12572 | #define alc269_loopbacks alc880_loopbacks |
| 12573 | #endif |
| 12574 | |
| 12575 | /* pcm configuration: identiacal with ALC880 */ |
| 12576 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12577 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12578 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12579 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12580 | |
| 12581 | /* |
| 12582 | * BIOS auto configuration |
| 12583 | */ |
| 12584 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12585 | { |
| 12586 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12587 | int i, err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12588 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12589 | |
| 12590 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12591 | alc269_ignore); |
| 12592 | if (err < 0) |
| 12593 | return err; |
| 12594 | |
| 12595 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12596 | if (err < 0) |
| 12597 | return err; |
| 12598 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12599 | if (err < 0) |
| 12600 | return err; |
| 12601 | |
| 12602 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12603 | |
| 12604 | if (spec->autocfg.dig_out_pin) |
| 12605 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12606 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12607 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12608 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12609 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12610 | /* create a beep mixer control if the pin 0x1d isn't assigned */ |
| 12611 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) |
| 12612 | if (spec->autocfg.input_pins[i] == 0x1d) |
| 12613 | break; |
| 12614 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12615 | add_mixer(spec, alc269_beep_mixer); |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12616 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12617 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12618 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 12619 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12620 | /* set default input source */ |
| 12621 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12622 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12623 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12624 | |
| 12625 | err = alc_auto_add_mic_boost(codec); |
| 12626 | if (err < 0) |
| 12627 | return err; |
| 12628 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12629 | if (!spec->cap_mixer) |
| 12630 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12631 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 12632 | store_pin_configs(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12633 | return 1; |
| 12634 | } |
| 12635 | |
| 12636 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12637 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12638 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12639 | |
| 12640 | |
| 12641 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12642 | static void alc269_auto_init(struct hda_codec *codec) |
| 12643 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12644 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12645 | alc269_auto_init_multi_out(codec); |
| 12646 | alc269_auto_init_hp_out(codec); |
| 12647 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12648 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12649 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12650 | } |
| 12651 | |
| 12652 | /* |
| 12653 | * configuration and preset |
| 12654 | */ |
| 12655 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12656 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12657 | [ALC269_QUANTA_FL1] = "quanta", |
| 12658 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12659 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12660 | [ALC269_FUJITSU] = "fujitsu", |
| 12661 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12662 | }; |
| 12663 | |
| 12664 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12665 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12666 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12667 | ALC269_ASUS_EEEPC_P703), |
| 12668 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12669 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12670 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12671 | ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12672 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12673 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12674 | {} |
| 12675 | }; |
| 12676 | |
| 12677 | static struct alc_config_preset alc269_presets[] = { |
| 12678 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12679 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12680 | .init_verbs = { alc269_init_verbs }, |
| 12681 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12682 | .dac_nids = alc269_dac_nids, |
| 12683 | .hp_nid = 0x03, |
| 12684 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12685 | .channel_mode = alc269_modes, |
| 12686 | .input_mux = &alc269_capture_source, |
| 12687 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12688 | [ALC269_QUANTA_FL1] = { |
| 12689 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12690 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12691 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12692 | .dac_nids = alc269_dac_nids, |
| 12693 | .hp_nid = 0x03, |
| 12694 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12695 | .channel_mode = alc269_modes, |
| 12696 | .input_mux = &alc269_capture_source, |
| 12697 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12698 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12699 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12700 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12701 | .mixers = { alc269_eeepc_mixer }, |
| 12702 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12703 | .init_verbs = { alc269_init_verbs, |
| 12704 | alc269_eeepc_amic_init_verbs }, |
| 12705 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12706 | .dac_nids = alc269_dac_nids, |
| 12707 | .hp_nid = 0x03, |
| 12708 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12709 | .channel_mode = alc269_modes, |
| 12710 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12711 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12712 | .init_hook = alc269_eeepc_amic_inithook, |
| 12713 | }, |
| 12714 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12715 | .mixers = { alc269_eeepc_mixer }, |
| 12716 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12717 | .init_verbs = { alc269_init_verbs, |
| 12718 | alc269_eeepc_dmic_init_verbs }, |
| 12719 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12720 | .dac_nids = alc269_dac_nids, |
| 12721 | .hp_nid = 0x03, |
| 12722 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12723 | .channel_mode = alc269_modes, |
| 12724 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12725 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12726 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12727 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12728 | [ALC269_FUJITSU] = { |
| 12729 | .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer }, |
| 12730 | .cap_mixer = alc269_epc_capture_mixer, |
| 12731 | .init_verbs = { alc269_init_verbs, |
| 12732 | alc269_eeepc_dmic_init_verbs }, |
| 12733 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12734 | .dac_nids = alc269_dac_nids, |
| 12735 | .hp_nid = 0x03, |
| 12736 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12737 | .channel_mode = alc269_modes, |
| 12738 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12739 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12740 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12741 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12742 | [ALC269_LIFEBOOK] = { |
| 12743 | .mixers = { alc269_lifebook_mixer }, |
| 12744 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 12745 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12746 | .dac_nids = alc269_dac_nids, |
| 12747 | .hp_nid = 0x03, |
| 12748 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12749 | .channel_mode = alc269_modes, |
| 12750 | .input_mux = &alc269_capture_source, |
| 12751 | .unsol_event = alc269_lifebook_unsol_event, |
| 12752 | .init_hook = alc269_lifebook_init_hook, |
| 12753 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12754 | }; |
| 12755 | |
| 12756 | static int patch_alc269(struct hda_codec *codec) |
| 12757 | { |
| 12758 | struct alc_spec *spec; |
| 12759 | int board_config; |
| 12760 | int err; |
| 12761 | |
| 12762 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12763 | if (spec == NULL) |
| 12764 | return -ENOMEM; |
| 12765 | |
| 12766 | codec->spec = spec; |
| 12767 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12768 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 12769 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12770 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 12771 | alc269_models, |
| 12772 | alc269_cfg_tbl); |
| 12773 | |
| 12774 | if (board_config < 0) { |
| 12775 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 12776 | "trying auto-probe from BIOS...\n"); |
| 12777 | board_config = ALC269_AUTO; |
| 12778 | } |
| 12779 | |
| 12780 | if (board_config == ALC269_AUTO) { |
| 12781 | /* automatic parse from the BIOS config */ |
| 12782 | err = alc269_parse_auto_config(codec); |
| 12783 | if (err < 0) { |
| 12784 | alc_free(codec); |
| 12785 | return err; |
| 12786 | } else if (!err) { |
| 12787 | printk(KERN_INFO |
| 12788 | "hda_codec: Cannot set up configuration " |
| 12789 | "from BIOS. Using base mode...\n"); |
| 12790 | board_config = ALC269_BASIC; |
| 12791 | } |
| 12792 | } |
| 12793 | |
| 12794 | if (board_config != ALC269_AUTO) |
| 12795 | setup_preset(spec, &alc269_presets[board_config]); |
| 12796 | |
| 12797 | spec->stream_name_analog = "ALC269 Analog"; |
| 12798 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 12799 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 12800 | |
| 12801 | spec->stream_name_digital = "ALC269 Digital"; |
| 12802 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 12803 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 12804 | |
| 12805 | spec->adc_nids = alc269_adc_nids; |
| 12806 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12807 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12808 | if (!spec->cap_mixer) |
| 12809 | set_capture_mixer(spec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12810 | |
| 12811 | codec->patch_ops = alc_patch_ops; |
| 12812 | if (board_config == ALC269_AUTO) |
| 12813 | spec->init_hook = alc269_auto_init; |
| 12814 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12815 | if (!spec->loopback.amplist) |
| 12816 | spec->loopback.amplist = alc269_loopbacks; |
| 12817 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12818 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12819 | |
| 12820 | return 0; |
| 12821 | } |
| 12822 | |
| 12823 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12824 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 12825 | */ |
| 12826 | |
| 12827 | /* |
| 12828 | * set the path ways for 2 channel output |
| 12829 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 12830 | */ |
| 12831 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 12832 | /* set pin widget 1Ah (line in) for input */ |
| 12833 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12834 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12835 | * the vref |
| 12836 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12837 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12838 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12839 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12840 | #if 0 |
| 12841 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12842 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12843 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12844 | { } /* end */ |
| 12845 | }; |
| 12846 | /* |
| 12847 | * 6ch mode |
| 12848 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 12849 | */ |
| 12850 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 12851 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12852 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12853 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12854 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12855 | |
| 12856 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12857 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12858 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12859 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12860 | #if 0 |
| 12861 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12862 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12863 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12864 | { } /* end */ |
| 12865 | }; |
| 12866 | |
| 12867 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 12868 | { 2, alc861_threestack_ch2_init }, |
| 12869 | { 6, alc861_threestack_ch6_init }, |
| 12870 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12871 | /* Set mic1 as input and unmute the mixer */ |
| 12872 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 12873 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12874 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12875 | { } /* end */ |
| 12876 | }; |
| 12877 | /* Set mic1 as output and mute mixer */ |
| 12878 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 12879 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12880 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12881 | { } /* end */ |
| 12882 | }; |
| 12883 | |
| 12884 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 12885 | { 2, alc861_uniwill_m31_ch2_init }, |
| 12886 | { 4, alc861_uniwill_m31_ch4_init }, |
| 12887 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12888 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12889 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 12890 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 12891 | /* set pin widget 1Ah (line in) for input */ |
| 12892 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12893 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12894 | * the vref |
| 12895 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12896 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12897 | |
| 12898 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12899 | #if 0 |
| 12900 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12901 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12902 | #endif |
| 12903 | { } /* end */ |
| 12904 | }; |
| 12905 | /* Set mic1 nad line-in as output and mute mixer */ |
| 12906 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 12907 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12908 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12909 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12910 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12911 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12912 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12913 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12914 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12915 | |
| 12916 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12917 | #if 0 |
| 12918 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12919 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12920 | #endif |
| 12921 | { } /* end */ |
| 12922 | }; |
| 12923 | |
| 12924 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 12925 | { 2, alc861_asus_ch2_init }, |
| 12926 | { 6, alc861_asus_ch6_init }, |
| 12927 | }; |
| 12928 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12929 | /* patch-ALC861 */ |
| 12930 | |
| 12931 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 12932 | /* output mixer control */ |
| 12933 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12934 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12935 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12936 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12937 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12938 | |
| 12939 | /*Input mixer control */ |
| 12940 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12941 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12942 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12943 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12944 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12945 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12946 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12947 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12948 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12949 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12950 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12951 | { } /* end */ |
| 12952 | }; |
| 12953 | |
| 12954 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 12955 | /* output mixer control */ |
| 12956 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12957 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12958 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12959 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12960 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12961 | |
| 12962 | /* Input mixer control */ |
| 12963 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12964 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12965 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12966 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12968 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12971 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12972 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12973 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12974 | { |
| 12975 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12976 | .name = "Channel Mode", |
| 12977 | .info = alc_ch_mode_info, |
| 12978 | .get = alc_ch_mode_get, |
| 12979 | .put = alc_ch_mode_put, |
| 12980 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 12981 | }, |
| 12982 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12983 | }; |
| 12984 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12985 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12986 | /* output mixer control */ |
| 12987 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12988 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12989 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12990 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12991 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12992 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12993 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12994 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 12995 | /* output mixer control */ |
| 12996 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12997 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12998 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12999 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13000 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13001 | |
| 13002 | /* Input mixer control */ |
| 13003 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13004 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13005 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13006 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13007 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13008 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13009 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13010 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13011 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13012 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13013 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13014 | { |
| 13015 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13016 | .name = "Channel Mode", |
| 13017 | .info = alc_ch_mode_info, |
| 13018 | .get = alc_ch_mode_get, |
| 13019 | .put = alc_ch_mode_put, |
| 13020 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13021 | }, |
| 13022 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13023 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13024 | |
| 13025 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13026 | /* output mixer control */ |
| 13027 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13028 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13029 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13030 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13031 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13032 | |
| 13033 | /* Input mixer control */ |
| 13034 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13035 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13036 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13037 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13039 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13040 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13041 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13042 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13043 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13044 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13045 | { |
| 13046 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13047 | .name = "Channel Mode", |
| 13048 | .info = alc_ch_mode_info, |
| 13049 | .get = alc_ch_mode_get, |
| 13050 | .put = alc_ch_mode_put, |
| 13051 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13052 | }, |
| 13053 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13054 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13055 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13056 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13057 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13058 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13059 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13060 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13061 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13062 | { } |
| 13063 | }; |
| 13064 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13065 | /* |
| 13066 | * generic initialization of ADC, input mixers and output mixers |
| 13067 | */ |
| 13068 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13069 | /* |
| 13070 | * Unmute ADC0 and set the default input to mic-in |
| 13071 | */ |
| 13072 | /* port-A for surround (rear panel) */ |
| 13073 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13074 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13075 | /* port-B for mic-in (rear panel) with vref */ |
| 13076 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13077 | /* port-C for line-in (rear panel) */ |
| 13078 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13079 | /* port-D for Front */ |
| 13080 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13081 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13082 | /* port-E for HP out (front panel) */ |
| 13083 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13084 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13085 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13086 | /* port-F for mic-in (front panel) with vref */ |
| 13087 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13088 | /* port-G for CLFE (rear panel) */ |
| 13089 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13090 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13091 | /* port-H for side (rear panel) */ |
| 13092 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13093 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13094 | /* CD-in */ |
| 13095 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13096 | /* route front mic to ADC1*/ |
| 13097 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13098 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13099 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13100 | /* Unmute DAC0~3 & spdif out*/ |
| 13101 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13102 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13103 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13104 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13105 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13106 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13107 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13108 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13109 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13110 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13111 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13112 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13113 | /* Unmute Stereo Mixer 15 */ |
| 13114 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13115 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13116 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13117 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13118 | |
| 13119 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13120 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13121 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13122 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13123 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13124 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13125 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13126 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13127 | /* hp used DAC 3 (Front) */ |
| 13128 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13129 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13130 | |
| 13131 | { } |
| 13132 | }; |
| 13133 | |
| 13134 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13135 | /* |
| 13136 | * Unmute ADC0 and set the default input to mic-in |
| 13137 | */ |
| 13138 | /* port-A for surround (rear panel) */ |
| 13139 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13140 | /* port-B for mic-in (rear panel) with vref */ |
| 13141 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13142 | /* port-C for line-in (rear panel) */ |
| 13143 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13144 | /* port-D for Front */ |
| 13145 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13146 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13147 | /* port-E for HP out (front panel) */ |
| 13148 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13149 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13150 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13151 | /* port-F for mic-in (front panel) with vref */ |
| 13152 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13153 | /* port-G for CLFE (rear panel) */ |
| 13154 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13155 | /* port-H for side (rear panel) */ |
| 13156 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13157 | /* CD-in */ |
| 13158 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13159 | /* route front mic to ADC1*/ |
| 13160 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13161 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13162 | /* Unmute DAC0~3 & spdif out*/ |
| 13163 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13164 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13165 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13166 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13167 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13168 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13169 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13170 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13171 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13172 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13173 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13174 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13175 | /* Unmute Stereo Mixer 15 */ |
| 13176 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13177 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13178 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13179 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13180 | |
| 13181 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13182 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13183 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13184 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13185 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13186 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13187 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13188 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13189 | /* hp used DAC 3 (Front) */ |
| 13190 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13191 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13192 | { } |
| 13193 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13194 | |
| 13195 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13196 | /* |
| 13197 | * Unmute ADC0 and set the default input to mic-in |
| 13198 | */ |
| 13199 | /* port-A for surround (rear panel) */ |
| 13200 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13201 | /* port-B for mic-in (rear panel) with vref */ |
| 13202 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13203 | /* port-C for line-in (rear panel) */ |
| 13204 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13205 | /* port-D for Front */ |
| 13206 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13207 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13208 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13209 | /* this has to be set to VREF80 */ |
| 13210 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13211 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13212 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13213 | /* port-F for mic-in (front panel) with vref */ |
| 13214 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13215 | /* port-G for CLFE (rear panel) */ |
| 13216 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13217 | /* port-H for side (rear panel) */ |
| 13218 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13219 | /* CD-in */ |
| 13220 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13221 | /* route front mic to ADC1*/ |
| 13222 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13223 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13224 | /* Unmute DAC0~3 & spdif out*/ |
| 13225 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13226 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13227 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13228 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13230 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13231 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13232 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13233 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13234 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13235 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13236 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13237 | /* Unmute Stereo Mixer 15 */ |
| 13238 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13239 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13240 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13241 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13242 | |
| 13243 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13244 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13245 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13246 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13247 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13248 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13249 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13250 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13251 | /* hp used DAC 3 (Front) */ |
| 13252 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13253 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13254 | { } |
| 13255 | }; |
| 13256 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13257 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13258 | /* |
| 13259 | * Unmute ADC0 and set the default input to mic-in |
| 13260 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13261 | /* port-A for surround (rear panel) |
| 13262 | * according to codec#0 this is the HP jack |
| 13263 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13264 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13265 | /* route front PCM to HP */ |
| 13266 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13267 | /* port-B for mic-in (rear panel) with vref */ |
| 13268 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13269 | /* port-C for line-in (rear panel) */ |
| 13270 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13271 | /* port-D for Front */ |
| 13272 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13273 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13274 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13275 | /* this has to be set to VREF80 */ |
| 13276 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13277 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13278 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13279 | /* port-F for mic-in (front panel) with vref */ |
| 13280 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13281 | /* port-G for CLFE (rear panel) */ |
| 13282 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13283 | /* port-H for side (rear panel) */ |
| 13284 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13285 | /* CD-in */ |
| 13286 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13287 | /* route front mic to ADC1*/ |
| 13288 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13290 | /* Unmute DAC0~3 & spdif out*/ |
| 13291 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13292 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13293 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13294 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13295 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13296 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13297 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13298 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13299 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13300 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13301 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13302 | /* Unmute Stereo Mixer 15 */ |
| 13303 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13304 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13305 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13306 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13307 | |
| 13308 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13309 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13310 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13311 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13312 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13313 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13314 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13315 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13316 | /* hp used DAC 3 (Front) */ |
| 13317 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13318 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13319 | { } |
| 13320 | }; |
| 13321 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13322 | /* additional init verbs for ASUS laptops */ |
| 13323 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13324 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13325 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13326 | { } |
| 13327 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13328 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13329 | /* |
| 13330 | * generic initialization of ADC, input mixers and output mixers |
| 13331 | */ |
| 13332 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13333 | /* |
| 13334 | * Unmute ADC0 and set the default input to mic-in |
| 13335 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13336 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13337 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13338 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13339 | /* Unmute DAC0~3 & spdif out*/ |
| 13340 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13341 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13342 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13343 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13344 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13345 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13346 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13347 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13348 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13349 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13350 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13351 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13352 | /* Unmute Stereo Mixer 15 */ |
| 13353 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13354 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13355 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13356 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13357 | |
| 13358 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13359 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13360 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13361 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13362 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13363 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13364 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13365 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13366 | |
| 13367 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13368 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13369 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13370 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13371 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13372 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13373 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13374 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13375 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13376 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13377 | |
| 13378 | { } |
| 13379 | }; |
| 13380 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13381 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13382 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13383 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13384 | { } |
| 13385 | }; |
| 13386 | |
| 13387 | /* toggle speaker-output according to the hp-jack state */ |
| 13388 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13389 | { |
| 13390 | unsigned int present; |
| 13391 | |
| 13392 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13393 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13394 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13395 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13396 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13397 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13398 | } |
| 13399 | |
| 13400 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13401 | unsigned int res) |
| 13402 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13403 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13404 | alc861_toshiba_automute(codec); |
| 13405 | } |
| 13406 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13407 | /* pcm configuration: identiacal with ALC880 */ |
| 13408 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13409 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13410 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13411 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13412 | |
| 13413 | |
| 13414 | #define ALC861_DIGOUT_NID 0x07 |
| 13415 | |
| 13416 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13417 | { 8, NULL } |
| 13418 | }; |
| 13419 | |
| 13420 | static hda_nid_t alc861_dac_nids[4] = { |
| 13421 | /* front, surround, clfe, side */ |
| 13422 | 0x03, 0x06, 0x05, 0x04 |
| 13423 | }; |
| 13424 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13425 | static hda_nid_t alc660_dac_nids[3] = { |
| 13426 | /* front, clfe, surround */ |
| 13427 | 0x03, 0x05, 0x06 |
| 13428 | }; |
| 13429 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13430 | static hda_nid_t alc861_adc_nids[1] = { |
| 13431 | /* ADC0-2 */ |
| 13432 | 0x08, |
| 13433 | }; |
| 13434 | |
| 13435 | static struct hda_input_mux alc861_capture_source = { |
| 13436 | .num_items = 5, |
| 13437 | .items = { |
| 13438 | { "Mic", 0x0 }, |
| 13439 | { "Front Mic", 0x3 }, |
| 13440 | { "Line", 0x1 }, |
| 13441 | { "CD", 0x4 }, |
| 13442 | { "Mixer", 0x5 }, |
| 13443 | }, |
| 13444 | }; |
| 13445 | |
| 13446 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13447 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13448 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13449 | { |
| 13450 | int i; |
| 13451 | hda_nid_t nid; |
| 13452 | |
| 13453 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13454 | for (i = 0; i < cfg->line_outs; i++) { |
| 13455 | nid = cfg->line_out_pins[i]; |
| 13456 | if (nid) { |
| 13457 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13458 | continue; |
| 13459 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13460 | } |
| 13461 | } |
| 13462 | spec->multiout.num_dacs = cfg->line_outs; |
| 13463 | return 0; |
| 13464 | } |
| 13465 | |
| 13466 | /* add playback controls from the parsed DAC table */ |
| 13467 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13468 | const struct auto_pin_cfg *cfg) |
| 13469 | { |
| 13470 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13471 | static const char *chname[4] = { |
| 13472 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13473 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13474 | hda_nid_t nid; |
| 13475 | int i, idx, err; |
| 13476 | |
| 13477 | for (i = 0; i < cfg->line_outs; i++) { |
| 13478 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13479 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13480 | continue; |
| 13481 | if (nid == 0x05) { |
| 13482 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13483 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13484 | "Center Playback Switch", |
| 13485 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13486 | HDA_OUTPUT)); |
| 13487 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13488 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13489 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13490 | "LFE Playback Switch", |
| 13491 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13492 | HDA_OUTPUT)); |
| 13493 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13494 | return err; |
| 13495 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13496 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13497 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13498 | if (nid == alc861_dac_nids[idx]) |
| 13499 | break; |
| 13500 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13501 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13502 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13503 | HDA_OUTPUT)); |
| 13504 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13505 | return err; |
| 13506 | } |
| 13507 | } |
| 13508 | return 0; |
| 13509 | } |
| 13510 | |
| 13511 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13512 | { |
| 13513 | int err; |
| 13514 | hda_nid_t nid; |
| 13515 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13516 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13517 | return 0; |
| 13518 | |
| 13519 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13520 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13521 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13522 | "Headphone Playback Switch", |
| 13523 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13524 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13525 | return err; |
| 13526 | spec->multiout.hp_nid = nid; |
| 13527 | } |
| 13528 | return 0; |
| 13529 | } |
| 13530 | |
| 13531 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13532 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13533 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13534 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 13535 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13536 | int i, err, idx, idx1; |
| 13537 | |
| 13538 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13539 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13540 | case 0x0c: |
| 13541 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13542 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13543 | break; |
| 13544 | case 0x0f: |
| 13545 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13546 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13547 | break; |
| 13548 | case 0x0d: |
| 13549 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13550 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13551 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13552 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13553 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13554 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13555 | break; |
| 13556 | case 0x11: |
| 13557 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13558 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13559 | break; |
| 13560 | default: |
| 13561 | continue; |
| 13562 | } |
| 13563 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13564 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13565 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13566 | if (err < 0) |
| 13567 | return err; |
| 13568 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13569 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13570 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13571 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13572 | } |
| 13573 | return 0; |
| 13574 | } |
| 13575 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13576 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13577 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13578 | int pin_type, int dac_idx) |
| 13579 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13580 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13581 | pin_type); |
| 13582 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13583 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13584 | } |
| 13585 | |
| 13586 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13587 | { |
| 13588 | struct alc_spec *spec = codec->spec; |
| 13589 | int i; |
| 13590 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13591 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13592 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13593 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13594 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13595 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13596 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13597 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13598 | } |
| 13599 | } |
| 13600 | |
| 13601 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13602 | { |
| 13603 | struct alc_spec *spec = codec->spec; |
| 13604 | hda_nid_t pin; |
| 13605 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13606 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13607 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13608 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13609 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13610 | pin = spec->autocfg.speaker_pins[0]; |
| 13611 | if (pin) |
| 13612 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13613 | } |
| 13614 | |
| 13615 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13616 | { |
| 13617 | struct alc_spec *spec = codec->spec; |
| 13618 | int i; |
| 13619 | |
| 13620 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13621 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13622 | if (nid >= 0x0c && nid <= 0x11) { |
| 13623 | snd_hda_codec_write(codec, nid, 0, |
| 13624 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13625 | i <= AUTO_PIN_FRONT_MIC ? |
| 13626 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13627 | } |
| 13628 | } |
| 13629 | } |
| 13630 | |
| 13631 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13632 | /* return 1 if successful, 0 if the proper config is not found, |
| 13633 | * or a negative error code |
| 13634 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13635 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13636 | { |
| 13637 | struct alc_spec *spec = codec->spec; |
| 13638 | int err; |
| 13639 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13640 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13641 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13642 | alc861_ignore); |
| 13643 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13644 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13645 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13646 | return 0; /* can't find valid BIOS pin config */ |
| 13647 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13648 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13649 | if (err < 0) |
| 13650 | return err; |
| 13651 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13652 | if (err < 0) |
| 13653 | return err; |
| 13654 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13655 | if (err < 0) |
| 13656 | return err; |
| 13657 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13658 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13659 | return err; |
| 13660 | |
| 13661 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13662 | |
| 13663 | if (spec->autocfg.dig_out_pin) |
| 13664 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13665 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13666 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13667 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13668 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13669 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13670 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13671 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 13672 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13673 | |
| 13674 | spec->adc_nids = alc861_adc_nids; |
| 13675 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13676 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13677 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 13678 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13679 | return 1; |
| 13680 | } |
| 13681 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13682 | /* additional initialization for auto-configuration model */ |
| 13683 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13684 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13685 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13686 | alc861_auto_init_multi_out(codec); |
| 13687 | alc861_auto_init_hp_out(codec); |
| 13688 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13689 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13690 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13691 | } |
| 13692 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13693 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13694 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13695 | { 0x15, HDA_INPUT, 0 }, |
| 13696 | { 0x15, HDA_INPUT, 1 }, |
| 13697 | { 0x15, HDA_INPUT, 2 }, |
| 13698 | { 0x15, HDA_INPUT, 3 }, |
| 13699 | { } /* end */ |
| 13700 | }; |
| 13701 | #endif |
| 13702 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13703 | |
| 13704 | /* |
| 13705 | * configuration and preset |
| 13706 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13707 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13708 | [ALC861_3ST] = "3stack", |
| 13709 | [ALC660_3ST] = "3stack-660", |
| 13710 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13711 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13712 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 13713 | [ALC861_TOSHIBA] = "toshiba", |
| 13714 | [ALC861_ASUS] = "asus", |
| 13715 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 13716 | [ALC861_AUTO] = "auto", |
| 13717 | }; |
| 13718 | |
| 13719 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 13720 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13721 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13722 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13723 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13724 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 13725 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 13726 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 13727 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 13728 | * Any other models that need this preset? |
| 13729 | */ |
| 13730 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 13731 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 13732 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13733 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 13734 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 13735 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 13736 | /* FIXME: the below seems conflict */ |
| 13737 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 13738 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 13739 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13740 | {} |
| 13741 | }; |
| 13742 | |
| 13743 | static struct alc_config_preset alc861_presets[] = { |
| 13744 | [ALC861_3ST] = { |
| 13745 | .mixers = { alc861_3ST_mixer }, |
| 13746 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13747 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13748 | .dac_nids = alc861_dac_nids, |
| 13749 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13750 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13751 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13752 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13753 | .adc_nids = alc861_adc_nids, |
| 13754 | .input_mux = &alc861_capture_source, |
| 13755 | }, |
| 13756 | [ALC861_3ST_DIG] = { |
| 13757 | .mixers = { alc861_base_mixer }, |
| 13758 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13759 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13760 | .dac_nids = alc861_dac_nids, |
| 13761 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13762 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13763 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13764 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13765 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13766 | .adc_nids = alc861_adc_nids, |
| 13767 | .input_mux = &alc861_capture_source, |
| 13768 | }, |
| 13769 | [ALC861_6ST_DIG] = { |
| 13770 | .mixers = { alc861_base_mixer }, |
| 13771 | .init_verbs = { alc861_base_init_verbs }, |
| 13772 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13773 | .dac_nids = alc861_dac_nids, |
| 13774 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13775 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 13776 | .channel_mode = alc861_8ch_modes, |
| 13777 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13778 | .adc_nids = alc861_adc_nids, |
| 13779 | .input_mux = &alc861_capture_source, |
| 13780 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13781 | [ALC660_3ST] = { |
| 13782 | .mixers = { alc861_3ST_mixer }, |
| 13783 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13784 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 13785 | .dac_nids = alc660_dac_nids, |
| 13786 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13787 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13788 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13789 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13790 | .adc_nids = alc861_adc_nids, |
| 13791 | .input_mux = &alc861_capture_source, |
| 13792 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13793 | [ALC861_UNIWILL_M31] = { |
| 13794 | .mixers = { alc861_uniwill_m31_mixer }, |
| 13795 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 13796 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13797 | .dac_nids = alc861_dac_nids, |
| 13798 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13799 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13800 | .channel_mode = alc861_uniwill_m31_modes, |
| 13801 | .need_dac_fix = 1, |
| 13802 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13803 | .adc_nids = alc861_adc_nids, |
| 13804 | .input_mux = &alc861_capture_source, |
| 13805 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13806 | [ALC861_TOSHIBA] = { |
| 13807 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13808 | .init_verbs = { alc861_base_init_verbs, |
| 13809 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13810 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13811 | .dac_nids = alc861_dac_nids, |
| 13812 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13813 | .channel_mode = alc883_3ST_2ch_modes, |
| 13814 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13815 | .adc_nids = alc861_adc_nids, |
| 13816 | .input_mux = &alc861_capture_source, |
| 13817 | .unsol_event = alc861_toshiba_unsol_event, |
| 13818 | .init_hook = alc861_toshiba_automute, |
| 13819 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13820 | [ALC861_ASUS] = { |
| 13821 | .mixers = { alc861_asus_mixer }, |
| 13822 | .init_verbs = { alc861_asus_init_verbs }, |
| 13823 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13824 | .dac_nids = alc861_dac_nids, |
| 13825 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13826 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 13827 | .channel_mode = alc861_asus_modes, |
| 13828 | .need_dac_fix = 1, |
| 13829 | .hp_nid = 0x06, |
| 13830 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13831 | .adc_nids = alc861_adc_nids, |
| 13832 | .input_mux = &alc861_capture_source, |
| 13833 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13834 | [ALC861_ASUS_LAPTOP] = { |
| 13835 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 13836 | .init_verbs = { alc861_asus_init_verbs, |
| 13837 | alc861_asus_laptop_init_verbs }, |
| 13838 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13839 | .dac_nids = alc861_dac_nids, |
| 13840 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13841 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13842 | .channel_mode = alc883_3ST_2ch_modes, |
| 13843 | .need_dac_fix = 1, |
| 13844 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13845 | .adc_nids = alc861_adc_nids, |
| 13846 | .input_mux = &alc861_capture_source, |
| 13847 | }, |
| 13848 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13849 | |
| 13850 | |
| 13851 | static int patch_alc861(struct hda_codec *codec) |
| 13852 | { |
| 13853 | struct alc_spec *spec; |
| 13854 | int board_config; |
| 13855 | int err; |
| 13856 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 13857 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13858 | if (spec == NULL) |
| 13859 | return -ENOMEM; |
| 13860 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13861 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13862 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13863 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 13864 | alc861_models, |
| 13865 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13866 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13867 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13868 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 13869 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13870 | board_config = ALC861_AUTO; |
| 13871 | } |
| 13872 | |
| 13873 | if (board_config == ALC861_AUTO) { |
| 13874 | /* automatic parse from the BIOS config */ |
| 13875 | err = alc861_parse_auto_config(codec); |
| 13876 | if (err < 0) { |
| 13877 | alc_free(codec); |
| 13878 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13879 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13880 | printk(KERN_INFO |
| 13881 | "hda_codec: Cannot set up configuration " |
| 13882 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13883 | board_config = ALC861_3ST_DIG; |
| 13884 | } |
| 13885 | } |
| 13886 | |
| 13887 | if (board_config != ALC861_AUTO) |
| 13888 | setup_preset(spec, &alc861_presets[board_config]); |
| 13889 | |
| 13890 | spec->stream_name_analog = "ALC861 Analog"; |
| 13891 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 13892 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 13893 | |
| 13894 | spec->stream_name_digital = "ALC861 Digital"; |
| 13895 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 13896 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 13897 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13898 | spec->vmaster_nid = 0x03; |
| 13899 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13900 | codec->patch_ops = alc_patch_ops; |
| 13901 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13902 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13903 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13904 | if (!spec->loopback.amplist) |
| 13905 | spec->loopback.amplist = alc861_loopbacks; |
| 13906 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13907 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13908 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13909 | return 0; |
| 13910 | } |
| 13911 | |
| 13912 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13913 | * ALC861-VD support |
| 13914 | * |
| 13915 | * Based on ALC882 |
| 13916 | * |
| 13917 | * In addition, an independent DAC |
| 13918 | */ |
| 13919 | #define ALC861VD_DIGOUT_NID 0x06 |
| 13920 | |
| 13921 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 13922 | /* front, surr, clfe, side surr */ |
| 13923 | 0x02, 0x03, 0x04, 0x05 |
| 13924 | }; |
| 13925 | |
| 13926 | /* dac_nids for ALC660vd are in a different order - according to |
| 13927 | * Realtek's driver. |
| 13928 | * This should probably tesult in a different mixer for 6stack models |
| 13929 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 13930 | * - and it is the same as in 861vd. |
| 13931 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 13932 | */ |
| 13933 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 13934 | /* front, rear, clfe, rear_surr */ |
| 13935 | 0x02, 0x04, 0x03 |
| 13936 | }; |
| 13937 | |
| 13938 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 13939 | /* ADC0 */ |
| 13940 | 0x09, |
| 13941 | }; |
| 13942 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13943 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 13944 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13945 | /* input MUX */ |
| 13946 | /* FIXME: should be a matrix-type input source selection */ |
| 13947 | static struct hda_input_mux alc861vd_capture_source = { |
| 13948 | .num_items = 4, |
| 13949 | .items = { |
| 13950 | { "Mic", 0x0 }, |
| 13951 | { "Front Mic", 0x1 }, |
| 13952 | { "Line", 0x2 }, |
| 13953 | { "CD", 0x4 }, |
| 13954 | }, |
| 13955 | }; |
| 13956 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13957 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13958 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13959 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13960 | { "Ext Mic", 0x0 }, |
| 13961 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13962 | }, |
| 13963 | }; |
| 13964 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13965 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 13966 | .num_items = 2, |
| 13967 | .items = { |
| 13968 | { "Front Mic", 0x0 }, |
| 13969 | { "ATAPI Mic", 0x1 }, |
| 13970 | }, |
| 13971 | }; |
| 13972 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13973 | /* |
| 13974 | * 2ch mode |
| 13975 | */ |
| 13976 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 13977 | { 2, NULL } |
| 13978 | }; |
| 13979 | |
| 13980 | /* |
| 13981 | * 6ch mode |
| 13982 | */ |
| 13983 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 13984 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13985 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13986 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13987 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13988 | { } /* end */ |
| 13989 | }; |
| 13990 | |
| 13991 | /* |
| 13992 | * 8ch mode |
| 13993 | */ |
| 13994 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 13995 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13996 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13997 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13998 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13999 | { } /* end */ |
| 14000 | }; |
| 14001 | |
| 14002 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14003 | { 6, alc861vd_6stack_ch6_init }, |
| 14004 | { 8, alc861vd_6stack_ch8_init }, |
| 14005 | }; |
| 14006 | |
| 14007 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14008 | { |
| 14009 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14010 | .name = "Channel Mode", |
| 14011 | .info = alc_ch_mode_info, |
| 14012 | .get = alc_ch_mode_get, |
| 14013 | .put = alc_ch_mode_put, |
| 14014 | }, |
| 14015 | { } /* end */ |
| 14016 | }; |
| 14017 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14018 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14019 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14020 | */ |
| 14021 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14022 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14023 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14024 | |
| 14025 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14026 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14027 | |
| 14028 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14029 | HDA_OUTPUT), |
| 14030 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14031 | HDA_OUTPUT), |
| 14032 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14033 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14034 | |
| 14035 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14036 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14037 | |
| 14038 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14039 | |
| 14040 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14041 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14042 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14043 | |
| 14044 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14045 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14046 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14047 | |
| 14048 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14049 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14050 | |
| 14051 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14052 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14053 | |
| 14054 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14055 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 14056 | |
| 14057 | { } /* end */ |
| 14058 | }; |
| 14059 | |
| 14060 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14061 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14062 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14063 | |
| 14064 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14065 | |
| 14066 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14067 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14068 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14069 | |
| 14070 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14071 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14072 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14073 | |
| 14074 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14075 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14076 | |
| 14077 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14078 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14079 | |
| 14080 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14081 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 14082 | |
| 14083 | { } /* end */ |
| 14084 | }; |
| 14085 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14086 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14087 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14088 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14089 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14090 | |
| 14091 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14092 | |
| 14093 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14094 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14095 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14096 | |
| 14097 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14098 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14099 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14100 | |
| 14101 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14102 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14103 | |
| 14104 | { } /* end */ |
| 14105 | }; |
| 14106 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14107 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14108 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14109 | */ |
| 14110 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14111 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14112 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14113 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14114 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14115 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14116 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14117 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14118 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14119 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14120 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14121 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 14122 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14123 | { } /* end */ |
| 14124 | }; |
| 14125 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14126 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14127 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14128 | */ |
| 14129 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14131 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14132 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14133 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14134 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14135 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14136 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14137 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14138 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14139 | { } /* end */ |
| 14140 | }; |
| 14141 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14142 | /* |
| 14143 | * generic initialization of ADC, input mixers and output mixers |
| 14144 | */ |
| 14145 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14146 | /* |
| 14147 | * Unmute ADC0 and set the default input to mic-in |
| 14148 | */ |
| 14149 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14150 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14151 | |
| 14152 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14153 | * the analog-loopback mixer widget |
| 14154 | */ |
| 14155 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14156 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14157 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14158 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14159 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14160 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14161 | |
| 14162 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14163 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14164 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14165 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14166 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14167 | |
| 14168 | /* |
| 14169 | * Set up output mixers (0x02 - 0x05) |
| 14170 | */ |
| 14171 | /* set vol=0 to output mixers */ |
| 14172 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14173 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14174 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14175 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14176 | |
| 14177 | /* set up input amps for analog loopback */ |
| 14178 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14179 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14180 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14181 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14182 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14183 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14184 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14185 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14186 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14187 | |
| 14188 | { } |
| 14189 | }; |
| 14190 | |
| 14191 | /* |
| 14192 | * 3-stack pin configuration: |
| 14193 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14194 | */ |
| 14195 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14196 | /* |
| 14197 | * Set pin mode and muting |
| 14198 | */ |
| 14199 | /* set front pin widgets 0x14 for output */ |
| 14200 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14201 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14202 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14203 | |
| 14204 | /* Mic (rear) pin: input vref at 80% */ |
| 14205 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14206 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14207 | /* Front Mic pin: input vref at 80% */ |
| 14208 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14209 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14210 | /* Line In pin: input */ |
| 14211 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14212 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14213 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14214 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14215 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14216 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14217 | /* CD pin widget for input */ |
| 14218 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14219 | |
| 14220 | { } |
| 14221 | }; |
| 14222 | |
| 14223 | /* |
| 14224 | * 6-stack pin configuration: |
| 14225 | */ |
| 14226 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14227 | /* |
| 14228 | * Set pin mode and muting |
| 14229 | */ |
| 14230 | /* set front pin widgets 0x14 for output */ |
| 14231 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14232 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14233 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14234 | |
| 14235 | /* Rear Pin: output 1 (0x0d) */ |
| 14236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14238 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14239 | /* CLFE Pin: output 2 (0x0e) */ |
| 14240 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14241 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14242 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14243 | /* Side Pin: output 3 (0x0f) */ |
| 14244 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14245 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14246 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14247 | |
| 14248 | /* Mic (rear) pin: input vref at 80% */ |
| 14249 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14250 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14251 | /* Front Mic pin: input vref at 80% */ |
| 14252 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14253 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14254 | /* Line In pin: input */ |
| 14255 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14256 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14257 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14258 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14259 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14260 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14261 | /* CD pin widget for input */ |
| 14262 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14263 | |
| 14264 | { } |
| 14265 | }; |
| 14266 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14267 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14268 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14269 | { } |
| 14270 | }; |
| 14271 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14272 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14273 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14274 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14275 | { } |
| 14276 | }; |
| 14277 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14278 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14280 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14281 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14282 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14283 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14284 | {} |
| 14285 | }; |
| 14286 | |
| 14287 | /* toggle speaker-output according to the hp-jack state */ |
| 14288 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 14289 | { |
| 14290 | unsigned int present; |
| 14291 | unsigned char bits; |
| 14292 | |
| 14293 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14294 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14295 | bits = present ? HDA_AMP_MUTE : 0; |
| 14296 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14297 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14298 | } |
| 14299 | |
| 14300 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14301 | { |
| 14302 | unsigned int present; |
| 14303 | unsigned char bits; |
| 14304 | |
| 14305 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14306 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14307 | bits = present ? HDA_AMP_MUTE : 0; |
| 14308 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14309 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14310 | } |
| 14311 | |
| 14312 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 14313 | { |
| 14314 | alc861vd_lenovo_hp_automute(codec); |
| 14315 | alc861vd_lenovo_mic_automute(codec); |
| 14316 | } |
| 14317 | |
| 14318 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14319 | unsigned int res) |
| 14320 | { |
| 14321 | switch (res >> 26) { |
| 14322 | case ALC880_HP_EVENT: |
| 14323 | alc861vd_lenovo_hp_automute(codec); |
| 14324 | break; |
| 14325 | case ALC880_MIC_EVENT: |
| 14326 | alc861vd_lenovo_mic_automute(codec); |
| 14327 | break; |
| 14328 | } |
| 14329 | } |
| 14330 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14331 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14332 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14333 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14334 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14335 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14336 | |
| 14337 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14338 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14339 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14340 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14341 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14342 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14343 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14344 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14345 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14346 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14347 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14348 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14349 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14350 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14351 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14352 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14353 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14354 | |
| 14355 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14356 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14357 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14358 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14359 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14360 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14361 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14362 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14363 | |
| 14364 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14365 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14366 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14367 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14368 | |
| 14369 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14370 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14371 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14372 | |
| 14373 | { } /* end */ |
| 14374 | }; |
| 14375 | |
| 14376 | /* toggle speaker-output according to the hp-jack state */ |
| 14377 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 14378 | { |
| 14379 | unsigned int present; |
| 14380 | |
| 14381 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14382 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14383 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14384 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14385 | } |
| 14386 | |
| 14387 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 14388 | { |
| 14389 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14390 | alc861vd_dallas_automute(codec); |
| 14391 | } |
| 14392 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14393 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14394 | #define alc861vd_loopbacks alc880_loopbacks |
| 14395 | #endif |
| 14396 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14397 | /* pcm configuration: identiacal with ALC880 */ |
| 14398 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14399 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14400 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14401 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14402 | |
| 14403 | /* |
| 14404 | * configuration and preset |
| 14405 | */ |
| 14406 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14407 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14408 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14409 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14410 | [ALC861VD_3ST] = "3stack", |
| 14411 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14412 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14413 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14414 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14415 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14416 | [ALC861VD_AUTO] = "auto", |
| 14417 | }; |
| 14418 | |
| 14419 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14420 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14421 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14422 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14423 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14424 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14425 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14426 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14427 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14428 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14429 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14430 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14431 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14432 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14433 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 14434 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Takashi Iwai | be321a89 | 2008-07-07 16:04:04 +0200 | [diff] [blame] | 14435 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14436 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14437 | {} |
| 14438 | }; |
| 14439 | |
| 14440 | static struct alc_config_preset alc861vd_presets[] = { |
| 14441 | [ALC660VD_3ST] = { |
| 14442 | .mixers = { alc861vd_3st_mixer }, |
| 14443 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14444 | alc861vd_3stack_init_verbs }, |
| 14445 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14446 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14447 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14448 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14449 | .input_mux = &alc861vd_capture_source, |
| 14450 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14451 | [ALC660VD_3ST_DIG] = { |
| 14452 | .mixers = { alc861vd_3st_mixer }, |
| 14453 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14454 | alc861vd_3stack_init_verbs }, |
| 14455 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14456 | .dac_nids = alc660vd_dac_nids, |
| 14457 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14458 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14459 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14460 | .input_mux = &alc861vd_capture_source, |
| 14461 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14462 | [ALC861VD_3ST] = { |
| 14463 | .mixers = { alc861vd_3st_mixer }, |
| 14464 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14465 | alc861vd_3stack_init_verbs }, |
| 14466 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14467 | .dac_nids = alc861vd_dac_nids, |
| 14468 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14469 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14470 | .input_mux = &alc861vd_capture_source, |
| 14471 | }, |
| 14472 | [ALC861VD_3ST_DIG] = { |
| 14473 | .mixers = { alc861vd_3st_mixer }, |
| 14474 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14475 | alc861vd_3stack_init_verbs }, |
| 14476 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14477 | .dac_nids = alc861vd_dac_nids, |
| 14478 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14479 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14480 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14481 | .input_mux = &alc861vd_capture_source, |
| 14482 | }, |
| 14483 | [ALC861VD_6ST_DIG] = { |
| 14484 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14485 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14486 | alc861vd_6stack_init_verbs }, |
| 14487 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14488 | .dac_nids = alc861vd_dac_nids, |
| 14489 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14490 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14491 | .channel_mode = alc861vd_6stack_modes, |
| 14492 | .input_mux = &alc861vd_capture_source, |
| 14493 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14494 | [ALC861VD_LENOVO] = { |
| 14495 | .mixers = { alc861vd_lenovo_mixer }, |
| 14496 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14497 | alc861vd_3stack_init_verbs, |
| 14498 | alc861vd_eapd_verbs, |
| 14499 | alc861vd_lenovo_unsol_verbs }, |
| 14500 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14501 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14502 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14503 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14504 | .input_mux = &alc861vd_capture_source, |
| 14505 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14506 | .init_hook = alc861vd_lenovo_automute, |
| 14507 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14508 | [ALC861VD_DALLAS] = { |
| 14509 | .mixers = { alc861vd_dallas_mixer }, |
| 14510 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14511 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14512 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14513 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14514 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14515 | .input_mux = &alc861vd_dallas_capture_source, |
| 14516 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14517 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14518 | }, |
| 14519 | [ALC861VD_HP] = { |
| 14520 | .mixers = { alc861vd_hp_mixer }, |
| 14521 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14522 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14523 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14524 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14525 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14526 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14527 | .input_mux = &alc861vd_hp_capture_source, |
| 14528 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14529 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14530 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14531 | [ALC660VD_ASUS_V1S] = { |
| 14532 | .mixers = { alc861vd_lenovo_mixer }, |
| 14533 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14534 | alc861vd_3stack_init_verbs, |
| 14535 | alc861vd_eapd_verbs, |
| 14536 | alc861vd_lenovo_unsol_verbs }, |
| 14537 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14538 | .dac_nids = alc660vd_dac_nids, |
| 14539 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14540 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14541 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14542 | .input_mux = &alc861vd_capture_source, |
| 14543 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14544 | .init_hook = alc861vd_lenovo_automute, |
| 14545 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14546 | }; |
| 14547 | |
| 14548 | /* |
| 14549 | * BIOS auto configuration |
| 14550 | */ |
| 14551 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14552 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14553 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14554 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14555 | } |
| 14556 | |
| 14557 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14558 | { |
| 14559 | struct alc_spec *spec = codec->spec; |
| 14560 | int i; |
| 14561 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14562 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14563 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14564 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14565 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14566 | if (nid) |
| 14567 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14568 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14569 | } |
| 14570 | } |
| 14571 | |
| 14572 | |
| 14573 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14574 | { |
| 14575 | struct alc_spec *spec = codec->spec; |
| 14576 | hda_nid_t pin; |
| 14577 | |
| 14578 | pin = spec->autocfg.hp_pins[0]; |
| 14579 | if (pin) /* connect to front and use dac 0 */ |
| 14580 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14581 | pin = spec->autocfg.speaker_pins[0]; |
| 14582 | if (pin) |
| 14583 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14584 | } |
| 14585 | |
| 14586 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14587 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14588 | |
| 14589 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14590 | { |
| 14591 | struct alc_spec *spec = codec->spec; |
| 14592 | int i; |
| 14593 | |
| 14594 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14595 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14596 | if (alc861vd_is_input_pin(nid)) { |
| 14597 | snd_hda_codec_write(codec, nid, 0, |
| 14598 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14599 | i <= AUTO_PIN_FRONT_MIC ? |
| 14600 | PIN_VREF80 : PIN_IN); |
| 14601 | if (nid != ALC861VD_PIN_CD_NID) |
| 14602 | snd_hda_codec_write(codec, nid, 0, |
| 14603 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14604 | AMP_OUT_MUTE); |
| 14605 | } |
| 14606 | } |
| 14607 | } |
| 14608 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14609 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14610 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14611 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14612 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14613 | |
| 14614 | /* add playback controls from the parsed DAC table */ |
| 14615 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14616 | * different NIDs for mute/unmute switch and volume control */ |
| 14617 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14618 | const struct auto_pin_cfg *cfg) |
| 14619 | { |
| 14620 | char name[32]; |
| 14621 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14622 | hda_nid_t nid_v, nid_s; |
| 14623 | int i, err; |
| 14624 | |
| 14625 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14626 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14627 | continue; |
| 14628 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14629 | alc880_dac_to_idx( |
| 14630 | spec->multiout.dac_nids[i])); |
| 14631 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14632 | alc880_dac_to_idx( |
| 14633 | spec->multiout.dac_nids[i])); |
| 14634 | |
| 14635 | if (i == 2) { |
| 14636 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14637 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14638 | "Center Playback Volume", |
| 14639 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14640 | HDA_OUTPUT)); |
| 14641 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14642 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14643 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14644 | "LFE Playback Volume", |
| 14645 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14646 | HDA_OUTPUT)); |
| 14647 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14648 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14649 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14650 | "Center Playback Switch", |
| 14651 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14652 | HDA_INPUT)); |
| 14653 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14654 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14655 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14656 | "LFE Playback Switch", |
| 14657 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14658 | HDA_INPUT)); |
| 14659 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14660 | return err; |
| 14661 | } else { |
| 14662 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14663 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14664 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14665 | HDA_OUTPUT)); |
| 14666 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14667 | return err; |
| 14668 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14669 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14670 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14671 | HDA_INPUT)); |
| 14672 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14673 | return err; |
| 14674 | } |
| 14675 | } |
| 14676 | return 0; |
| 14677 | } |
| 14678 | |
| 14679 | /* add playback controls for speaker and HP outputs */ |
| 14680 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14681 | * different NIDs for mute/unmute switch and volume control */ |
| 14682 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14683 | hda_nid_t pin, const char *pfx) |
| 14684 | { |
| 14685 | hda_nid_t nid_v, nid_s; |
| 14686 | int err; |
| 14687 | char name[32]; |
| 14688 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14689 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14690 | return 0; |
| 14691 | |
| 14692 | if (alc880_is_fixed_pin(pin)) { |
| 14693 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14694 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14695 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14696 | spec->multiout.hp_nid = nid_v; |
| 14697 | else |
| 14698 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14699 | /* control HP volume/switch on the output mixer amp */ |
| 14700 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14701 | alc880_fixed_pin_idx(pin)); |
| 14702 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14703 | alc880_fixed_pin_idx(pin)); |
| 14704 | |
| 14705 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14706 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14707 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14708 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14709 | return err; |
| 14710 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14711 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14712 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14713 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14714 | return err; |
| 14715 | } else if (alc880_is_multi_pin(pin)) { |
| 14716 | /* set manual connection */ |
| 14717 | /* we have only a switch on HP-out PIN */ |
| 14718 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14719 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14720 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14721 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14722 | return err; |
| 14723 | } |
| 14724 | return 0; |
| 14725 | } |
| 14726 | |
| 14727 | /* parse the BIOS configuration and set up the alc_spec |
| 14728 | * return 1 if successful, 0 if the proper config is not found, |
| 14729 | * or a negative error code |
| 14730 | * Based on ALC880 version - had to change it to override |
| 14731 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 14732 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 14733 | { |
| 14734 | struct alc_spec *spec = codec->spec; |
| 14735 | int err; |
| 14736 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 14737 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14738 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14739 | alc861vd_ignore); |
| 14740 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14741 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14742 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14743 | return 0; /* can't find valid BIOS pin config */ |
| 14744 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14745 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14746 | if (err < 0) |
| 14747 | return err; |
| 14748 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14749 | if (err < 0) |
| 14750 | return err; |
| 14751 | err = alc861vd_auto_create_extra_out(spec, |
| 14752 | spec->autocfg.speaker_pins[0], |
| 14753 | "Speaker"); |
| 14754 | if (err < 0) |
| 14755 | return err; |
| 14756 | err = alc861vd_auto_create_extra_out(spec, |
| 14757 | spec->autocfg.hp_pins[0], |
| 14758 | "Headphone"); |
| 14759 | if (err < 0) |
| 14760 | return err; |
| 14761 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14762 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14763 | return err; |
| 14764 | |
| 14765 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14766 | |
| 14767 | if (spec->autocfg.dig_out_pin) |
| 14768 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 14769 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14770 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14771 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14772 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14773 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14774 | |
| 14775 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 14776 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14777 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 14778 | err = alc_auto_add_mic_boost(codec); |
| 14779 | if (err < 0) |
| 14780 | return err; |
| 14781 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 14782 | store_pin_configs(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14783 | return 1; |
| 14784 | } |
| 14785 | |
| 14786 | /* additional initialization for auto-configuration model */ |
| 14787 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 14788 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14789 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14790 | alc861vd_auto_init_multi_out(codec); |
| 14791 | alc861vd_auto_init_hp_out(codec); |
| 14792 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14793 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14794 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14795 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14796 | } |
| 14797 | |
| 14798 | static int patch_alc861vd(struct hda_codec *codec) |
| 14799 | { |
| 14800 | struct alc_spec *spec; |
| 14801 | int err, board_config; |
| 14802 | |
| 14803 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14804 | if (spec == NULL) |
| 14805 | return -ENOMEM; |
| 14806 | |
| 14807 | codec->spec = spec; |
| 14808 | |
| 14809 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 14810 | alc861vd_models, |
| 14811 | alc861vd_cfg_tbl); |
| 14812 | |
| 14813 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 14814 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 14815 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 14816 | board_config = ALC861VD_AUTO; |
| 14817 | } |
| 14818 | |
| 14819 | if (board_config == ALC861VD_AUTO) { |
| 14820 | /* automatic parse from the BIOS config */ |
| 14821 | err = alc861vd_parse_auto_config(codec); |
| 14822 | if (err < 0) { |
| 14823 | alc_free(codec); |
| 14824 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14825 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14826 | printk(KERN_INFO |
| 14827 | "hda_codec: Cannot set up configuration " |
| 14828 | "from BIOS. Using base mode...\n"); |
| 14829 | board_config = ALC861VD_3ST; |
| 14830 | } |
| 14831 | } |
| 14832 | |
| 14833 | if (board_config != ALC861VD_AUTO) |
| 14834 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 14835 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14836 | if (codec->vendor_id == 0x10ec0660) { |
| 14837 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 14838 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14839 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14840 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14841 | } else { |
| 14842 | spec->stream_name_analog = "ALC861VD Analog"; |
| 14843 | spec->stream_name_digital = "ALC861VD Digital"; |
| 14844 | } |
| 14845 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14846 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 14847 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 14848 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14849 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 14850 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 14851 | |
| 14852 | spec->adc_nids = alc861vd_adc_nids; |
| 14853 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14854 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 14855 | spec->capture_style = CAPT_MIX; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14856 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14857 | set_capture_mixer(spec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14858 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14859 | spec->vmaster_nid = 0x02; |
| 14860 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14861 | codec->patch_ops = alc_patch_ops; |
| 14862 | |
| 14863 | if (board_config == ALC861VD_AUTO) |
| 14864 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14865 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14866 | if (!spec->loopback.amplist) |
| 14867 | spec->loopback.amplist = alc861vd_loopbacks; |
| 14868 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14869 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14870 | |
| 14871 | return 0; |
| 14872 | } |
| 14873 | |
| 14874 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14875 | * ALC662 support |
| 14876 | * |
| 14877 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 14878 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 14879 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 14880 | * 6-channel independent captures. |
| 14881 | * |
| 14882 | * In addition, an independent DAC for the multi-playback (not used in this |
| 14883 | * driver yet). |
| 14884 | */ |
| 14885 | #define ALC662_DIGOUT_NID 0x06 |
| 14886 | #define ALC662_DIGIN_NID 0x0a |
| 14887 | |
| 14888 | static hda_nid_t alc662_dac_nids[4] = { |
| 14889 | /* front, rear, clfe, rear_surr */ |
| 14890 | 0x02, 0x03, 0x04 |
| 14891 | }; |
| 14892 | |
| 14893 | static hda_nid_t alc662_adc_nids[1] = { |
| 14894 | /* ADC1-2 */ |
| 14895 | 0x09, |
| 14896 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14897 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 14898 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14899 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14900 | /* input MUX */ |
| 14901 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14902 | static struct hda_input_mux alc662_capture_source = { |
| 14903 | .num_items = 4, |
| 14904 | .items = { |
| 14905 | { "Mic", 0x0 }, |
| 14906 | { "Front Mic", 0x1 }, |
| 14907 | { "Line", 0x2 }, |
| 14908 | { "CD", 0x4 }, |
| 14909 | }, |
| 14910 | }; |
| 14911 | |
| 14912 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 14913 | .num_items = 2, |
| 14914 | .items = { |
| 14915 | { "Mic", 0x1 }, |
| 14916 | { "Line", 0x2 }, |
| 14917 | }, |
| 14918 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14919 | |
| 14920 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 14921 | .num_items = 2, |
| 14922 | .items = { |
| 14923 | { "i-Mic", 0x1 }, |
| 14924 | { "e-Mic", 0x0 }, |
| 14925 | }, |
| 14926 | }; |
| 14927 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14928 | static struct hda_input_mux alc663_capture_source = { |
| 14929 | .num_items = 3, |
| 14930 | .items = { |
| 14931 | { "Mic", 0x0 }, |
| 14932 | { "Front Mic", 0x1 }, |
| 14933 | { "Line", 0x2 }, |
| 14934 | }, |
| 14935 | }; |
| 14936 | |
| 14937 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 14938 | .num_items = 2, |
| 14939 | .items = { |
| 14940 | { "Ext-Mic", 0x0 }, |
| 14941 | { "D-Mic", 0x9 }, |
| 14942 | }, |
| 14943 | }; |
| 14944 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14945 | /* |
| 14946 | * 2ch mode |
| 14947 | */ |
| 14948 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 14949 | { 2, NULL } |
| 14950 | }; |
| 14951 | |
| 14952 | /* |
| 14953 | * 2ch mode |
| 14954 | */ |
| 14955 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 14956 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 14957 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14958 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 14959 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14960 | { } /* end */ |
| 14961 | }; |
| 14962 | |
| 14963 | /* |
| 14964 | * 6ch mode |
| 14965 | */ |
| 14966 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 14967 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14968 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14969 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 14970 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14971 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14972 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14973 | { } /* end */ |
| 14974 | }; |
| 14975 | |
| 14976 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 14977 | { 2, alc662_3ST_ch2_init }, |
| 14978 | { 6, alc662_3ST_ch6_init }, |
| 14979 | }; |
| 14980 | |
| 14981 | /* |
| 14982 | * 2ch mode |
| 14983 | */ |
| 14984 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 14985 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14986 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14987 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14988 | { } /* end */ |
| 14989 | }; |
| 14990 | |
| 14991 | /* |
| 14992 | * 6ch mode |
| 14993 | */ |
| 14994 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 14995 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14996 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14997 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14998 | { } /* end */ |
| 14999 | }; |
| 15000 | |
| 15001 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15002 | { 2, alc662_sixstack_ch6_init }, |
| 15003 | { 6, alc662_sixstack_ch8_init }, |
| 15004 | }; |
| 15005 | |
| 15006 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15007 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15008 | */ |
| 15009 | |
| 15010 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15011 | /* output mixer control */ |
| 15012 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15013 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15014 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15015 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15016 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15017 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15018 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15019 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15020 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15021 | |
| 15022 | /*Input mixer control */ |
| 15023 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15024 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15025 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15026 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15027 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15028 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15029 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15030 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15031 | { } /* end */ |
| 15032 | }; |
| 15033 | |
| 15034 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15035 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15036 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15037 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15038 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15039 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15040 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15041 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15042 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15043 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15044 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15045 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15046 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 15047 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15048 | { } /* end */ |
| 15049 | }; |
| 15050 | |
| 15051 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15052 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15053 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15054 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15055 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15056 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15057 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15058 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15059 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15060 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15061 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15062 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15063 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15064 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15065 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15066 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15067 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15068 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15069 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 15070 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15071 | { } /* end */ |
| 15072 | }; |
| 15073 | |
| 15074 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15075 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15076 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15077 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15078 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15079 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15080 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15081 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15082 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15083 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15084 | { } /* end */ |
| 15085 | }; |
| 15086 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15087 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15088 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15089 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 15090 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15091 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15092 | |
| 15093 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15094 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15095 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15096 | |
| 15097 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15098 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15099 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15100 | { } /* end */ |
| 15101 | }; |
| 15102 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15103 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 15104 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15105 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15106 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15107 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 15108 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15109 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 15110 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 15111 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15112 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15113 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15114 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15115 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15117 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15118 | { } /* end */ |
| 15119 | }; |
| 15120 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15121 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15122 | .ops = &snd_hda_bind_vol, |
| 15123 | .values = { |
| 15124 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15125 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15126 | 0 |
| 15127 | }, |
| 15128 | }; |
| 15129 | |
| 15130 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15131 | .ops = &snd_hda_bind_sw, |
| 15132 | .values = { |
| 15133 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15134 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15135 | 0 |
| 15136 | }, |
| 15137 | }; |
| 15138 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15139 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15140 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15141 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15142 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15143 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15144 | { } /* end */ |
| 15145 | }; |
| 15146 | |
| 15147 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15148 | .ops = &snd_hda_bind_sw, |
| 15149 | .values = { |
| 15150 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15151 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15152 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15153 | 0 |
| 15154 | }, |
| 15155 | }; |
| 15156 | |
| 15157 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15158 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15159 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15160 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15161 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15162 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15163 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15164 | |
| 15165 | { } /* end */ |
| 15166 | }; |
| 15167 | |
| 15168 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15169 | .ops = &snd_hda_bind_sw, |
| 15170 | .values = { |
| 15171 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15172 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15173 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15174 | 0 |
| 15175 | }, |
| 15176 | }; |
| 15177 | |
| 15178 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15179 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15180 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15181 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15182 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15183 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15184 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15185 | { } /* end */ |
| 15186 | }; |
| 15187 | |
| 15188 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15189 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15190 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15191 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15194 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15195 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15196 | { } /* end */ |
| 15197 | }; |
| 15198 | |
| 15199 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15200 | .ops = &snd_hda_bind_vol, |
| 15201 | .values = { |
| 15202 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15203 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15204 | 0 |
| 15205 | }, |
| 15206 | }; |
| 15207 | |
| 15208 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15209 | .ops = &snd_hda_bind_sw, |
| 15210 | .values = { |
| 15211 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15212 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15213 | 0 |
| 15214 | }, |
| 15215 | }; |
| 15216 | |
| 15217 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15218 | HDA_BIND_VOL("Master Playback Volume", |
| 15219 | &alc663_asus_two_bind_master_vol), |
| 15220 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15221 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15222 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15225 | { } /* end */ |
| 15226 | }; |
| 15227 | |
| 15228 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15229 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15230 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15231 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15232 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15233 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15234 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15235 | { } /* end */ |
| 15236 | }; |
| 15237 | |
| 15238 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15239 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15240 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15241 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15242 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15243 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15244 | |
| 15245 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15246 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15247 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15248 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15249 | { } /* end */ |
| 15250 | }; |
| 15251 | |
| 15252 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15253 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15254 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15255 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15256 | |
| 15257 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15258 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15259 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15260 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15261 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15262 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15263 | { } /* end */ |
| 15264 | }; |
| 15265 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15266 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15267 | { |
| 15268 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15269 | .name = "Channel Mode", |
| 15270 | .info = alc_ch_mode_info, |
| 15271 | .get = alc_ch_mode_get, |
| 15272 | .put = alc_ch_mode_put, |
| 15273 | }, |
| 15274 | { } /* end */ |
| 15275 | }; |
| 15276 | |
| 15277 | static struct hda_verb alc662_init_verbs[] = { |
| 15278 | /* ADC: mute amp left and right */ |
| 15279 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15280 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15281 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15282 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15283 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15284 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15285 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15286 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15287 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15288 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15289 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15290 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15291 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15292 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15293 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15294 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15295 | |
| 15296 | /* Front Pin: output 0 (0x0c) */ |
| 15297 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15298 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15299 | |
| 15300 | /* Rear Pin: output 1 (0x0d) */ |
| 15301 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15302 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15303 | |
| 15304 | /* CLFE Pin: output 2 (0x0e) */ |
| 15305 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15306 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15307 | |
| 15308 | /* Mic (rear) pin: input vref at 80% */ |
| 15309 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15310 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15311 | /* Front Mic pin: input vref at 80% */ |
| 15312 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15313 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15314 | /* Line In pin: input */ |
| 15315 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15316 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15317 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15318 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15319 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15320 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15321 | /* CD pin widget for input */ |
| 15322 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15323 | |
| 15324 | /* FIXME: use matrix-type input source selection */ |
| 15325 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15326 | /* Input mixer */ |
| 15327 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15328 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15329 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15330 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15331 | |
| 15332 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15333 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15334 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15335 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15336 | |
| 15337 | /* always trun on EAPD */ |
| 15338 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15339 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15340 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15341 | { } |
| 15342 | }; |
| 15343 | |
| 15344 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15345 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15346 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15347 | {} |
| 15348 | }; |
| 15349 | |
| 15350 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15351 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15352 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15353 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15354 | }; |
| 15355 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15356 | /* Set Unsolicited Event*/ |
| 15357 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15358 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15359 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15360 | {} |
| 15361 | }; |
| 15362 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15363 | /* |
| 15364 | * generic initialization of ADC, input mixers and output mixers |
| 15365 | */ |
| 15366 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15367 | /* |
| 15368 | * Unmute ADC and set the default input to mic-in |
| 15369 | */ |
| 15370 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15371 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15372 | |
| 15373 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15374 | * mixer widget |
| 15375 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15376 | * panel mic (mic 2) |
| 15377 | */ |
| 15378 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15379 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15380 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15381 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15382 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15383 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15384 | |
| 15385 | /* |
| 15386 | * Set up output mixers (0x0c - 0x0f) |
| 15387 | */ |
| 15388 | /* set vol=0 to output mixers */ |
| 15389 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15390 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15391 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15392 | |
| 15393 | /* set up input amps for analog loopback */ |
| 15394 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15395 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15396 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15397 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15398 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15399 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15400 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15401 | |
| 15402 | |
| 15403 | /* FIXME: use matrix-type input source selection */ |
| 15404 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15405 | /* Input mixer */ |
| 15406 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15407 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15408 | { } |
| 15409 | }; |
| 15410 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15411 | /* additional verbs for ALC663 */ |
| 15412 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15413 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15414 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15415 | { } |
| 15416 | }; |
| 15417 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15418 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15419 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15420 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15421 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15422 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15423 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15424 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15425 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15426 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15427 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15428 | {} |
| 15429 | }; |
| 15430 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15431 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15432 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15433 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15434 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15435 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15436 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15437 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15438 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15439 | {} |
| 15440 | }; |
| 15441 | |
| 15442 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15443 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15444 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15445 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15446 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15447 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15448 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15449 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15450 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15451 | {} |
| 15452 | }; |
| 15453 | |
| 15454 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15455 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15456 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15457 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15459 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15460 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15461 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15462 | {} |
| 15463 | }; |
| 15464 | |
| 15465 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15466 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15467 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15468 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15469 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15470 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15471 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15472 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15473 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15474 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15475 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15476 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15477 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15478 | {} |
| 15479 | }; |
| 15480 | |
| 15481 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15482 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15483 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15484 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15485 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15486 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15487 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15488 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15489 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15490 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15491 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15492 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15493 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15494 | {} |
| 15495 | }; |
| 15496 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15497 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15498 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15499 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15500 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15501 | |
| 15502 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15503 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15504 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15505 | |
| 15506 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15507 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15508 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15509 | {} |
| 15510 | }; |
| 15511 | |
| 15512 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15513 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15514 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15515 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15516 | |
| 15517 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15518 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15519 | {} |
| 15520 | }; |
| 15521 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15522 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15523 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15524 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15525 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15526 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15527 | {} |
| 15528 | }; |
| 15529 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15530 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15531 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15532 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15533 | { } /* end */ |
| 15534 | }; |
| 15535 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15536 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15537 | { |
| 15538 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15539 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15540 | |
| 15541 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15542 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15543 | bits = present ? HDA_AMP_MUTE : 0; |
| 15544 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15545 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15546 | } |
| 15547 | |
| 15548 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15549 | { |
| 15550 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15551 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15552 | |
| 15553 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15554 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15555 | bits = present ? HDA_AMP_MUTE : 0; |
| 15556 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15557 | HDA_AMP_MUTE, bits); |
| 15558 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15559 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15560 | } |
| 15561 | |
| 15562 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15563 | unsigned int res) |
| 15564 | { |
| 15565 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15566 | alc662_lenovo_101e_all_automute(codec); |
| 15567 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15568 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15569 | } |
| 15570 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15571 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15572 | { |
| 15573 | unsigned int present; |
| 15574 | |
| 15575 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15576 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15577 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15578 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15579 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15580 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15581 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15582 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15583 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15584 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15585 | } |
| 15586 | |
| 15587 | /* unsolicited event for HP jack sensing */ |
| 15588 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15589 | unsigned int res) |
| 15590 | { |
| 15591 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15592 | alc262_hippo1_automute( codec ); |
| 15593 | |
| 15594 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15595 | alc662_eeepc_mic_automute(codec); |
| 15596 | } |
| 15597 | |
| 15598 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15599 | { |
| 15600 | alc262_hippo1_automute( codec ); |
| 15601 | alc662_eeepc_mic_automute(codec); |
| 15602 | } |
| 15603 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15604 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 15605 | { |
| 15606 | unsigned int mute; |
| 15607 | unsigned int present; |
| 15608 | |
| 15609 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 15610 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15611 | AC_VERB_GET_PIN_SENSE, 0); |
| 15612 | present = (present & 0x80000000) != 0; |
| 15613 | if (present) { |
| 15614 | /* mute internal speaker */ |
| 15615 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15616 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15617 | } else { |
| 15618 | /* unmute internal speaker if necessary */ |
| 15619 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 15620 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15621 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15622 | } |
| 15623 | } |
| 15624 | |
| 15625 | /* unsolicited event for HP jack sensing */ |
| 15626 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 15627 | unsigned int res) |
| 15628 | { |
| 15629 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15630 | alc662_eeepc_ep20_automute(codec); |
| 15631 | } |
| 15632 | |
| 15633 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15634 | { |
| 15635 | alc662_eeepc_ep20_automute(codec); |
| 15636 | } |
| 15637 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15638 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15639 | { |
| 15640 | unsigned int present; |
| 15641 | unsigned char bits; |
| 15642 | |
| 15643 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15644 | AC_VERB_GET_PIN_SENSE, 0) |
| 15645 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15646 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15647 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15648 | AMP_IN_MUTE(0), bits); |
| 15649 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15650 | AMP_IN_MUTE(0), bits); |
| 15651 | } |
| 15652 | |
| 15653 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15654 | { |
| 15655 | unsigned int present; |
| 15656 | unsigned char bits; |
| 15657 | |
| 15658 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15659 | AC_VERB_GET_PIN_SENSE, 0) |
| 15660 | & AC_PINSENSE_PRESENCE; |
| 15661 | bits = present ? HDA_AMP_MUTE : 0; |
| 15662 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15663 | AMP_IN_MUTE(0), bits); |
| 15664 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15665 | AMP_IN_MUTE(0), bits); |
| 15666 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15667 | AMP_IN_MUTE(0), bits); |
| 15668 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15669 | AMP_IN_MUTE(0), bits); |
| 15670 | } |
| 15671 | |
| 15672 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15673 | { |
| 15674 | unsigned int present; |
| 15675 | unsigned char bits; |
| 15676 | |
| 15677 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15678 | AC_VERB_GET_PIN_SENSE, 0) |
| 15679 | & AC_PINSENSE_PRESENCE; |
| 15680 | bits = present ? HDA_AMP_MUTE : 0; |
| 15681 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15682 | AMP_IN_MUTE(0), bits); |
| 15683 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15684 | AMP_IN_MUTE(0), bits); |
| 15685 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15686 | AMP_IN_MUTE(0), bits); |
| 15687 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15688 | AMP_IN_MUTE(0), bits); |
| 15689 | } |
| 15690 | |
| 15691 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15692 | { |
| 15693 | unsigned int present; |
| 15694 | unsigned char bits; |
| 15695 | |
| 15696 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15697 | AC_VERB_GET_PIN_SENSE, 0) |
| 15698 | & AC_PINSENSE_PRESENCE; |
| 15699 | bits = present ? 0 : PIN_OUT; |
| 15700 | snd_hda_codec_write(codec, 0x14, 0, |
| 15701 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15702 | } |
| 15703 | |
| 15704 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15705 | { |
| 15706 | unsigned int present1, present2; |
| 15707 | |
| 15708 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15709 | AC_VERB_GET_PIN_SENSE, 0) |
| 15710 | & AC_PINSENSE_PRESENCE; |
| 15711 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15712 | AC_VERB_GET_PIN_SENSE, 0) |
| 15713 | & AC_PINSENSE_PRESENCE; |
| 15714 | |
| 15715 | if (present1 || present2) { |
| 15716 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15717 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 15718 | } else { |
| 15719 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15720 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 15721 | } |
| 15722 | } |
| 15723 | |
| 15724 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 15725 | { |
| 15726 | unsigned int present1, present2; |
| 15727 | |
| 15728 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 15729 | AC_VERB_GET_PIN_SENSE, 0) |
| 15730 | & AC_PINSENSE_PRESENCE; |
| 15731 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15732 | AC_VERB_GET_PIN_SENSE, 0) |
| 15733 | & AC_PINSENSE_PRESENCE; |
| 15734 | |
| 15735 | if (present1 || present2) { |
| 15736 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15737 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15738 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15739 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15740 | } else { |
| 15741 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15742 | AMP_IN_MUTE(0), 0); |
| 15743 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15744 | AMP_IN_MUTE(0), 0); |
| 15745 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15746 | } |
| 15747 | |
| 15748 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 15749 | { |
| 15750 | unsigned int present; |
| 15751 | |
| 15752 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15753 | AC_VERB_GET_PIN_SENSE, 0) |
| 15754 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15755 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15756 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15757 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15758 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15759 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15760 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15761 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15762 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15763 | } |
| 15764 | |
| 15765 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 15766 | unsigned int res) |
| 15767 | { |
| 15768 | switch (res >> 26) { |
| 15769 | case ALC880_HP_EVENT: |
| 15770 | alc663_m51va_speaker_automute(codec); |
| 15771 | break; |
| 15772 | case ALC880_MIC_EVENT: |
| 15773 | alc663_m51va_mic_automute(codec); |
| 15774 | break; |
| 15775 | } |
| 15776 | } |
| 15777 | |
| 15778 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 15779 | { |
| 15780 | alc663_m51va_speaker_automute(codec); |
| 15781 | alc663_m51va_mic_automute(codec); |
| 15782 | } |
| 15783 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15784 | /* ***************** Mode1 ******************************/ |
| 15785 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 15786 | unsigned int res) |
| 15787 | { |
| 15788 | switch (res >> 26) { |
| 15789 | case ALC880_HP_EVENT: |
| 15790 | alc663_m51va_speaker_automute(codec); |
| 15791 | break; |
| 15792 | case ALC880_MIC_EVENT: |
| 15793 | alc662_eeepc_mic_automute(codec); |
| 15794 | break; |
| 15795 | } |
| 15796 | } |
| 15797 | |
| 15798 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 15799 | { |
| 15800 | alc663_m51va_speaker_automute(codec); |
| 15801 | alc662_eeepc_mic_automute(codec); |
| 15802 | } |
| 15803 | /* ***************** Mode2 ******************************/ |
| 15804 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 15805 | unsigned int res) |
| 15806 | { |
| 15807 | switch (res >> 26) { |
| 15808 | case ALC880_HP_EVENT: |
| 15809 | alc662_f5z_speaker_automute(codec); |
| 15810 | break; |
| 15811 | case ALC880_MIC_EVENT: |
| 15812 | alc662_eeepc_mic_automute(codec); |
| 15813 | break; |
| 15814 | } |
| 15815 | } |
| 15816 | |
| 15817 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 15818 | { |
| 15819 | alc662_f5z_speaker_automute(codec); |
| 15820 | alc662_eeepc_mic_automute(codec); |
| 15821 | } |
| 15822 | /* ***************** Mode3 ******************************/ |
| 15823 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 15824 | unsigned int res) |
| 15825 | { |
| 15826 | switch (res >> 26) { |
| 15827 | case ALC880_HP_EVENT: |
| 15828 | alc663_two_hp_m1_speaker_automute(codec); |
| 15829 | break; |
| 15830 | case ALC880_MIC_EVENT: |
| 15831 | alc662_eeepc_mic_automute(codec); |
| 15832 | break; |
| 15833 | } |
| 15834 | } |
| 15835 | |
| 15836 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 15837 | { |
| 15838 | alc663_two_hp_m1_speaker_automute(codec); |
| 15839 | alc662_eeepc_mic_automute(codec); |
| 15840 | } |
| 15841 | /* ***************** Mode4 ******************************/ |
| 15842 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 15843 | unsigned int res) |
| 15844 | { |
| 15845 | switch (res >> 26) { |
| 15846 | case ALC880_HP_EVENT: |
| 15847 | alc663_21jd_two_speaker_automute(codec); |
| 15848 | break; |
| 15849 | case ALC880_MIC_EVENT: |
| 15850 | alc662_eeepc_mic_automute(codec); |
| 15851 | break; |
| 15852 | } |
| 15853 | } |
| 15854 | |
| 15855 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 15856 | { |
| 15857 | alc663_21jd_two_speaker_automute(codec); |
| 15858 | alc662_eeepc_mic_automute(codec); |
| 15859 | } |
| 15860 | /* ***************** Mode5 ******************************/ |
| 15861 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 15862 | unsigned int res) |
| 15863 | { |
| 15864 | switch (res >> 26) { |
| 15865 | case ALC880_HP_EVENT: |
| 15866 | alc663_15jd_two_speaker_automute(codec); |
| 15867 | break; |
| 15868 | case ALC880_MIC_EVENT: |
| 15869 | alc662_eeepc_mic_automute(codec); |
| 15870 | break; |
| 15871 | } |
| 15872 | } |
| 15873 | |
| 15874 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 15875 | { |
| 15876 | alc663_15jd_two_speaker_automute(codec); |
| 15877 | alc662_eeepc_mic_automute(codec); |
| 15878 | } |
| 15879 | /* ***************** Mode6 ******************************/ |
| 15880 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 15881 | unsigned int res) |
| 15882 | { |
| 15883 | switch (res >> 26) { |
| 15884 | case ALC880_HP_EVENT: |
| 15885 | alc663_two_hp_m2_speaker_automute(codec); |
| 15886 | break; |
| 15887 | case ALC880_MIC_EVENT: |
| 15888 | alc662_eeepc_mic_automute(codec); |
| 15889 | break; |
| 15890 | } |
| 15891 | } |
| 15892 | |
| 15893 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 15894 | { |
| 15895 | alc663_two_hp_m2_speaker_automute(codec); |
| 15896 | alc662_eeepc_mic_automute(codec); |
| 15897 | } |
| 15898 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15899 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 15900 | { |
| 15901 | unsigned int present; |
| 15902 | unsigned char bits; |
| 15903 | |
| 15904 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15905 | AC_VERB_GET_PIN_SENSE, 0) |
| 15906 | & AC_PINSENSE_PRESENCE; |
| 15907 | bits = present ? HDA_AMP_MUTE : 0; |
| 15908 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15909 | HDA_AMP_MUTE, bits); |
| 15910 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15911 | HDA_AMP_MUTE, bits); |
| 15912 | } |
| 15913 | |
| 15914 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 15915 | { |
| 15916 | unsigned int present; |
| 15917 | unsigned char bits; |
| 15918 | |
| 15919 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15920 | AC_VERB_GET_PIN_SENSE, 0) |
| 15921 | & AC_PINSENSE_PRESENCE; |
| 15922 | bits = present ? HDA_AMP_MUTE : 0; |
| 15923 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15924 | HDA_AMP_MUTE, bits); |
| 15925 | } |
| 15926 | |
| 15927 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 15928 | unsigned int res) |
| 15929 | { |
| 15930 | switch (res >> 26) { |
| 15931 | case ALC880_HP_EVENT: |
| 15932 | alc663_g71v_hp_automute(codec); |
| 15933 | break; |
| 15934 | case ALC880_FRONT_EVENT: |
| 15935 | alc663_g71v_front_automute(codec); |
| 15936 | break; |
| 15937 | case ALC880_MIC_EVENT: |
| 15938 | alc662_eeepc_mic_automute(codec); |
| 15939 | break; |
| 15940 | } |
| 15941 | } |
| 15942 | |
| 15943 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 15944 | { |
| 15945 | alc663_g71v_front_automute(codec); |
| 15946 | alc663_g71v_hp_automute(codec); |
| 15947 | alc662_eeepc_mic_automute(codec); |
| 15948 | } |
| 15949 | |
| 15950 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 15951 | unsigned int res) |
| 15952 | { |
| 15953 | switch (res >> 26) { |
| 15954 | case ALC880_HP_EVENT: |
| 15955 | alc663_m51va_speaker_automute(codec); |
| 15956 | break; |
| 15957 | case ALC880_MIC_EVENT: |
| 15958 | alc662_eeepc_mic_automute(codec); |
| 15959 | break; |
| 15960 | } |
| 15961 | } |
| 15962 | |
| 15963 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 15964 | { |
| 15965 | alc663_m51va_speaker_automute(codec); |
| 15966 | alc662_eeepc_mic_automute(codec); |
| 15967 | } |
| 15968 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15969 | /* bind hp and internal speaker mute (with plug check) */ |
| 15970 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 15971 | struct snd_ctl_elem_value *ucontrol) |
| 15972 | { |
| 15973 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 15974 | long *valp = ucontrol->value.integer.value; |
| 15975 | int change; |
| 15976 | |
| 15977 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 15978 | HDA_AMP_MUTE, |
| 15979 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 15980 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 15981 | HDA_AMP_MUTE, |
| 15982 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 15983 | if (change) |
| 15984 | alc262_hippo1_automute(codec); |
| 15985 | return change; |
| 15986 | } |
| 15987 | |
| 15988 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 15989 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15990 | { |
| 15991 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15992 | .name = "Master Playback Switch", |
| 15993 | .info = snd_hda_mixer_amp_switch_info, |
| 15994 | .get = snd_hda_mixer_amp_switch_get, |
| 15995 | .put = alc662_ecs_master_sw_put, |
| 15996 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15997 | }, |
| 15998 | |
| 15999 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16000 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16001 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16002 | |
| 16003 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16004 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16005 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16006 | { } /* end */ |
| 16007 | }; |
| 16008 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16009 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16010 | #define alc662_loopbacks alc880_loopbacks |
| 16011 | #endif |
| 16012 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16013 | |
| 16014 | /* pcm configuration: identiacal with ALC880 */ |
| 16015 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16016 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16017 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16018 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16019 | |
| 16020 | /* |
| 16021 | * configuration and preset |
| 16022 | */ |
| 16023 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16024 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16025 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16026 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16027 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16028 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16029 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16030 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16031 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16032 | [ALC663_ASUS_M51VA] = "m51va", |
| 16033 | [ALC663_ASUS_G71V] = "g71v", |
| 16034 | [ALC663_ASUS_H13] = "h13", |
| 16035 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16036 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16037 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16038 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16039 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16040 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16041 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16042 | [ALC662_AUTO] = "auto", |
| 16043 | }; |
| 16044 | |
| 16045 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16046 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16047 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16048 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16049 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16050 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16051 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16052 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), |
| 16053 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16054 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16055 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16056 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16057 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16058 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16059 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16060 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16061 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
| 16062 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16063 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16064 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
| 16065 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16066 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16067 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
| 16068 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16069 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
| 16070 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16071 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16072 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
| 16073 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16074 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16075 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
| 16076 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
| 16077 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16078 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
| 16079 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16080 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16081 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16082 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16083 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16084 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16085 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16086 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
| 16087 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16088 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16089 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16090 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16091 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16092 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16093 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
| 16094 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
| 16095 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16096 | {} |
| 16097 | }; |
| 16098 | |
| 16099 | static struct alc_config_preset alc662_presets[] = { |
| 16100 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16101 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16102 | .init_verbs = { alc662_init_verbs }, |
| 16103 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16104 | .dac_nids = alc662_dac_nids, |
| 16105 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16106 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16107 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16108 | .channel_mode = alc662_3ST_2ch_modes, |
| 16109 | .input_mux = &alc662_capture_source, |
| 16110 | }, |
| 16111 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16112 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16113 | .init_verbs = { alc662_init_verbs }, |
| 16114 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16115 | .dac_nids = alc662_dac_nids, |
| 16116 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16117 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16118 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16119 | .channel_mode = alc662_3ST_6ch_modes, |
| 16120 | .need_dac_fix = 1, |
| 16121 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16122 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16123 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16124 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16125 | .init_verbs = { alc662_init_verbs }, |
| 16126 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16127 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16128 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16129 | .channel_mode = alc662_3ST_6ch_modes, |
| 16130 | .need_dac_fix = 1, |
| 16131 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16132 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16133 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16134 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16135 | .init_verbs = { alc662_init_verbs }, |
| 16136 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16137 | .dac_nids = alc662_dac_nids, |
| 16138 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16139 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16140 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16141 | .channel_mode = alc662_5stack_modes, |
| 16142 | .input_mux = &alc662_capture_source, |
| 16143 | }, |
| 16144 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16145 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16146 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16147 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16148 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16149 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16150 | .channel_mode = alc662_3ST_2ch_modes, |
| 16151 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16152 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16153 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16154 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16155 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16156 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16157 | .init_verbs = { alc662_init_verbs, |
| 16158 | alc662_eeepc_sue_init_verbs }, |
| 16159 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16160 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16161 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16162 | .channel_mode = alc662_3ST_2ch_modes, |
| 16163 | .input_mux = &alc662_eeepc_capture_source, |
| 16164 | .unsol_event = alc662_eeepc_unsol_event, |
| 16165 | .init_hook = alc662_eeepc_inithook, |
| 16166 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16167 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16168 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16169 | alc662_chmode_mixer }, |
| 16170 | .init_verbs = { alc662_init_verbs, |
| 16171 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16172 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16173 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16174 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16175 | .channel_mode = alc662_3ST_6ch_modes, |
| 16176 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16177 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 16178 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16179 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16180 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16181 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16182 | .init_verbs = { alc662_init_verbs, |
| 16183 | alc662_ecs_init_verbs }, |
| 16184 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16185 | .dac_nids = alc662_dac_nids, |
| 16186 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16187 | .channel_mode = alc662_3ST_2ch_modes, |
| 16188 | .input_mux = &alc662_eeepc_capture_source, |
| 16189 | .unsol_event = alc662_eeepc_unsol_event, |
| 16190 | .init_hook = alc662_eeepc_inithook, |
| 16191 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16192 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16193 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16194 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16195 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16196 | .dac_nids = alc662_dac_nids, |
| 16197 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16198 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16199 | .channel_mode = alc662_3ST_2ch_modes, |
| 16200 | .input_mux = &alc663_m51va_capture_source, |
| 16201 | .unsol_event = alc663_m51va_unsol_event, |
| 16202 | .init_hook = alc663_m51va_inithook, |
| 16203 | }, |
| 16204 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16205 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16206 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16207 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16208 | .dac_nids = alc662_dac_nids, |
| 16209 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16210 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16211 | .channel_mode = alc662_3ST_2ch_modes, |
| 16212 | .input_mux = &alc662_eeepc_capture_source, |
| 16213 | .unsol_event = alc663_g71v_unsol_event, |
| 16214 | .init_hook = alc663_g71v_inithook, |
| 16215 | }, |
| 16216 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16217 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16218 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16219 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16220 | .dac_nids = alc662_dac_nids, |
| 16221 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16222 | .channel_mode = alc662_3ST_2ch_modes, |
| 16223 | .input_mux = &alc663_m51va_capture_source, |
| 16224 | .unsol_event = alc663_m51va_unsol_event, |
| 16225 | .init_hook = alc663_m51va_inithook, |
| 16226 | }, |
| 16227 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16228 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16229 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16230 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16231 | .dac_nids = alc662_dac_nids, |
| 16232 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16233 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16234 | .channel_mode = alc662_3ST_6ch_modes, |
| 16235 | .input_mux = &alc663_capture_source, |
| 16236 | .unsol_event = alc663_g50v_unsol_event, |
| 16237 | .init_hook = alc663_g50v_inithook, |
| 16238 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16239 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16240 | .mixers = { alc663_m51va_mixer }, |
| 16241 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16242 | .init_verbs = { alc662_init_verbs, |
| 16243 | alc663_21jd_amic_init_verbs }, |
| 16244 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16245 | .hp_nid = 0x03, |
| 16246 | .dac_nids = alc662_dac_nids, |
| 16247 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16248 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16249 | .channel_mode = alc662_3ST_2ch_modes, |
| 16250 | .input_mux = &alc662_eeepc_capture_source, |
| 16251 | .unsol_event = alc663_mode1_unsol_event, |
| 16252 | .init_hook = alc663_mode1_inithook, |
| 16253 | }, |
| 16254 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16255 | .mixers = { alc662_1bjd_mixer }, |
| 16256 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16257 | .init_verbs = { alc662_init_verbs, |
| 16258 | alc662_1bjd_amic_init_verbs }, |
| 16259 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16260 | .dac_nids = alc662_dac_nids, |
| 16261 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16262 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16263 | .channel_mode = alc662_3ST_2ch_modes, |
| 16264 | .input_mux = &alc662_eeepc_capture_source, |
| 16265 | .unsol_event = alc662_mode2_unsol_event, |
| 16266 | .init_hook = alc662_mode2_inithook, |
| 16267 | }, |
| 16268 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16269 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16270 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16271 | .init_verbs = { alc662_init_verbs, |
| 16272 | alc663_two_hp_amic_m1_init_verbs }, |
| 16273 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16274 | .hp_nid = 0x03, |
| 16275 | .dac_nids = alc662_dac_nids, |
| 16276 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16277 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16278 | .channel_mode = alc662_3ST_2ch_modes, |
| 16279 | .input_mux = &alc662_eeepc_capture_source, |
| 16280 | .unsol_event = alc663_mode3_unsol_event, |
| 16281 | .init_hook = alc663_mode3_inithook, |
| 16282 | }, |
| 16283 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16284 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16285 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16286 | .init_verbs = { alc662_init_verbs, |
| 16287 | alc663_21jd_amic_init_verbs}, |
| 16288 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16289 | .hp_nid = 0x03, |
| 16290 | .dac_nids = alc662_dac_nids, |
| 16291 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16292 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16293 | .channel_mode = alc662_3ST_2ch_modes, |
| 16294 | .input_mux = &alc662_eeepc_capture_source, |
| 16295 | .unsol_event = alc663_mode4_unsol_event, |
| 16296 | .init_hook = alc663_mode4_inithook, |
| 16297 | }, |
| 16298 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16299 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16300 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16301 | .init_verbs = { alc662_init_verbs, |
| 16302 | alc663_15jd_amic_init_verbs }, |
| 16303 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16304 | .hp_nid = 0x03, |
| 16305 | .dac_nids = alc662_dac_nids, |
| 16306 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16307 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16308 | .channel_mode = alc662_3ST_2ch_modes, |
| 16309 | .input_mux = &alc662_eeepc_capture_source, |
| 16310 | .unsol_event = alc663_mode5_unsol_event, |
| 16311 | .init_hook = alc663_mode5_inithook, |
| 16312 | }, |
| 16313 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16314 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16315 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16316 | .init_verbs = { alc662_init_verbs, |
| 16317 | alc663_two_hp_amic_m2_init_verbs }, |
| 16318 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16319 | .hp_nid = 0x03, |
| 16320 | .dac_nids = alc662_dac_nids, |
| 16321 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16322 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16323 | .channel_mode = alc662_3ST_2ch_modes, |
| 16324 | .input_mux = &alc662_eeepc_capture_source, |
| 16325 | .unsol_event = alc663_mode6_unsol_event, |
| 16326 | .init_hook = alc663_mode6_inithook, |
| 16327 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16328 | }; |
| 16329 | |
| 16330 | |
| 16331 | /* |
| 16332 | * BIOS auto configuration |
| 16333 | */ |
| 16334 | |
| 16335 | /* add playback controls from the parsed DAC table */ |
| 16336 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16337 | const struct auto_pin_cfg *cfg) |
| 16338 | { |
| 16339 | char name[32]; |
| 16340 | static const char *chname[4] = { |
| 16341 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16342 | }; |
| 16343 | hda_nid_t nid; |
| 16344 | int i, err; |
| 16345 | |
| 16346 | for (i = 0; i < cfg->line_outs; i++) { |
| 16347 | if (!spec->multiout.dac_nids[i]) |
| 16348 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16349 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16350 | if (i == 2) { |
| 16351 | /* Center/LFE */ |
| 16352 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16353 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16354 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16355 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16356 | if (err < 0) |
| 16357 | return err; |
| 16358 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16359 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16360 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16361 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16362 | if (err < 0) |
| 16363 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16364 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16365 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16366 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16367 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16368 | if (err < 0) |
| 16369 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16370 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16371 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16372 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16373 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16374 | if (err < 0) |
| 16375 | return err; |
| 16376 | } else { |
| 16377 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16378 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16379 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16380 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16381 | if (err < 0) |
| 16382 | return err; |
| 16383 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16384 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16385 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16386 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16387 | if (err < 0) |
| 16388 | return err; |
| 16389 | } |
| 16390 | } |
| 16391 | return 0; |
| 16392 | } |
| 16393 | |
| 16394 | /* add playback controls for speaker and HP outputs */ |
| 16395 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16396 | const char *pfx) |
| 16397 | { |
| 16398 | hda_nid_t nid; |
| 16399 | int err; |
| 16400 | char name[32]; |
| 16401 | |
| 16402 | if (!pin) |
| 16403 | return 0; |
| 16404 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16405 | if (pin == 0x17) { |
| 16406 | /* ALC663 has a mono output pin on 0x17 */ |
| 16407 | sprintf(name, "%s Playback Switch", pfx); |
| 16408 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16409 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16410 | return err; |
| 16411 | } |
| 16412 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16413 | if (alc880_is_fixed_pin(pin)) { |
| 16414 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16415 | /* printk("DAC nid=%x\n",nid); */ |
| 16416 | /* specify the DAC as the extra output */ |
| 16417 | if (!spec->multiout.hp_nid) |
| 16418 | spec->multiout.hp_nid = nid; |
| 16419 | else |
| 16420 | spec->multiout.extra_out_nid[0] = nid; |
| 16421 | /* control HP volume/switch on the output mixer amp */ |
| 16422 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16423 | sprintf(name, "%s Playback Volume", pfx); |
| 16424 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16425 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16426 | if (err < 0) |
| 16427 | return err; |
| 16428 | sprintf(name, "%s Playback Switch", pfx); |
| 16429 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16430 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16431 | if (err < 0) |
| 16432 | return err; |
| 16433 | } else if (alc880_is_multi_pin(pin)) { |
| 16434 | /* set manual connection */ |
| 16435 | /* we have only a switch on HP-out PIN */ |
| 16436 | sprintf(name, "%s Playback Switch", pfx); |
| 16437 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16438 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16439 | if (err < 0) |
| 16440 | return err; |
| 16441 | } |
| 16442 | return 0; |
| 16443 | } |
| 16444 | |
| 16445 | /* create playback/capture controls for input pins */ |
| 16446 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 16447 | const struct auto_pin_cfg *cfg) |
| 16448 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 16449 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16450 | int i, err, idx; |
| 16451 | |
| 16452 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16453 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 16454 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 16455 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16456 | auto_pin_cfg_labels[i], |
| 16457 | idx, 0x0b); |
| 16458 | if (err < 0) |
| 16459 | return err; |
| 16460 | imux->items[imux->num_items].label = |
| 16461 | auto_pin_cfg_labels[i]; |
| 16462 | imux->items[imux->num_items].index = |
| 16463 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 16464 | imux->num_items++; |
| 16465 | } |
| 16466 | } |
| 16467 | return 0; |
| 16468 | } |
| 16469 | |
| 16470 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16471 | hda_nid_t nid, int pin_type, |
| 16472 | int dac_idx) |
| 16473 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16474 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16475 | /* need the manual connection? */ |
| 16476 | if (alc880_is_multi_pin(nid)) { |
| 16477 | struct alc_spec *spec = codec->spec; |
| 16478 | int idx = alc880_multi_pin_idx(nid); |
| 16479 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16480 | AC_VERB_SET_CONNECT_SEL, |
| 16481 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16482 | } |
| 16483 | } |
| 16484 | |
| 16485 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16486 | { |
| 16487 | struct alc_spec *spec = codec->spec; |
| 16488 | int i; |
| 16489 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16490 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16491 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16492 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16493 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16494 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16495 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16496 | i); |
| 16497 | } |
| 16498 | } |
| 16499 | |
| 16500 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16501 | { |
| 16502 | struct alc_spec *spec = codec->spec; |
| 16503 | hda_nid_t pin; |
| 16504 | |
| 16505 | pin = spec->autocfg.hp_pins[0]; |
| 16506 | if (pin) /* connect to front */ |
| 16507 | /* use dac 0 */ |
| 16508 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16509 | pin = spec->autocfg.speaker_pins[0]; |
| 16510 | if (pin) |
| 16511 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16512 | } |
| 16513 | |
| 16514 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 16515 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16516 | |
| 16517 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16518 | { |
| 16519 | struct alc_spec *spec = codec->spec; |
| 16520 | int i; |
| 16521 | |
| 16522 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16523 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 16524 | if (alc662_is_input_pin(nid)) { |
| 16525 | snd_hda_codec_write(codec, nid, 0, |
| 16526 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16527 | (i <= AUTO_PIN_FRONT_MIC ? |
| 16528 | PIN_VREF80 : PIN_IN)); |
| 16529 | if (nid != ALC662_PIN_CD_NID) |
| 16530 | snd_hda_codec_write(codec, nid, 0, |
| 16531 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16532 | AMP_OUT_MUTE); |
| 16533 | } |
| 16534 | } |
| 16535 | } |
| 16536 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16537 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16538 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16539 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16540 | { |
| 16541 | struct alc_spec *spec = codec->spec; |
| 16542 | int err; |
| 16543 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16544 | |
| 16545 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16546 | alc662_ignore); |
| 16547 | if (err < 0) |
| 16548 | return err; |
| 16549 | if (!spec->autocfg.line_outs) |
| 16550 | return 0; /* can't find valid BIOS pin config */ |
| 16551 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16552 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16553 | if (err < 0) |
| 16554 | return err; |
| 16555 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16556 | if (err < 0) |
| 16557 | return err; |
| 16558 | err = alc662_auto_create_extra_out(spec, |
| 16559 | spec->autocfg.speaker_pins[0], |
| 16560 | "Speaker"); |
| 16561 | if (err < 0) |
| 16562 | return err; |
| 16563 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16564 | "Headphone"); |
| 16565 | if (err < 0) |
| 16566 | return err; |
| 16567 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 16568 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16569 | return err; |
| 16570 | |
| 16571 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16572 | |
| 16573 | if (spec->autocfg.dig_out_pin) |
| 16574 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16575 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16576 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16577 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16578 | |
| 16579 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 16580 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16581 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16582 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16583 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16584 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16585 | |
| 16586 | err = alc_auto_add_mic_boost(codec); |
| 16587 | if (err < 0) |
| 16588 | return err; |
| 16589 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 16590 | store_pin_configs(codec); |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16591 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16592 | } |
| 16593 | |
| 16594 | /* additional initialization for auto-configuration model */ |
| 16595 | static void alc662_auto_init(struct hda_codec *codec) |
| 16596 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16597 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16598 | alc662_auto_init_multi_out(codec); |
| 16599 | alc662_auto_init_hp_out(codec); |
| 16600 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16601 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16602 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16603 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16604 | } |
| 16605 | |
| 16606 | static int patch_alc662(struct hda_codec *codec) |
| 16607 | { |
| 16608 | struct alc_spec *spec; |
| 16609 | int err, board_config; |
| 16610 | |
| 16611 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16612 | if (!spec) |
| 16613 | return -ENOMEM; |
| 16614 | |
| 16615 | codec->spec = spec; |
| 16616 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16617 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16618 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16619 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16620 | alc662_models, |
| 16621 | alc662_cfg_tbl); |
| 16622 | if (board_config < 0) { |
| 16623 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16624 | "trying auto-probe from BIOS...\n"); |
| 16625 | board_config = ALC662_AUTO; |
| 16626 | } |
| 16627 | |
| 16628 | if (board_config == ALC662_AUTO) { |
| 16629 | /* automatic parse from the BIOS config */ |
| 16630 | err = alc662_parse_auto_config(codec); |
| 16631 | if (err < 0) { |
| 16632 | alc_free(codec); |
| 16633 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16634 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16635 | printk(KERN_INFO |
| 16636 | "hda_codec: Cannot set up configuration " |
| 16637 | "from BIOS. Using base mode...\n"); |
| 16638 | board_config = ALC662_3ST_2ch_DIG; |
| 16639 | } |
| 16640 | } |
| 16641 | |
| 16642 | if (board_config != ALC662_AUTO) |
| 16643 | setup_preset(spec, &alc662_presets[board_config]); |
| 16644 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16645 | if (codec->vendor_id == 0x10ec0663) { |
| 16646 | spec->stream_name_analog = "ALC663 Analog"; |
| 16647 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16648 | } else if (codec->vendor_id == 0x10ec0272) { |
| 16649 | spec->stream_name_analog = "ALC272 Analog"; |
| 16650 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16651 | } else { |
| 16652 | spec->stream_name_analog = "ALC662 Analog"; |
| 16653 | spec->stream_name_digital = "ALC662 Digital"; |
| 16654 | } |
| 16655 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16656 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16657 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16658 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16659 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16660 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16661 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16662 | spec->adc_nids = alc662_adc_nids; |
| 16663 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16664 | spec->capsrc_nids = alc662_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame^] | 16665 | spec->capture_style = CAPT_MIX; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16666 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16667 | if (!spec->cap_mixer) |
| 16668 | set_capture_mixer(spec); |
| 16669 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16670 | spec->vmaster_nid = 0x02; |
| 16671 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16672 | codec->patch_ops = alc_patch_ops; |
| 16673 | if (board_config == ALC662_AUTO) |
| 16674 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16675 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16676 | if (!spec->loopback.amplist) |
| 16677 | spec->loopback.amplist = alc662_loopbacks; |
| 16678 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 16679 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16680 | |
| 16681 | return 0; |
| 16682 | } |
| 16683 | |
| 16684 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16685 | * patch entries |
| 16686 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 16687 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16688 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16689 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16690 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 16691 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16692 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16693 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16694 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16695 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16696 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 16697 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 16698 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16699 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 16700 | .patch = patch_alc883 }, |
| 16701 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 16702 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16703 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16704 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16705 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16706 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 16707 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 16708 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 16709 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 16710 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16711 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 16712 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 16713 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 16714 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 16715 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16716 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16717 | {} /* terminator */ |
| 16718 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 16719 | |
| 16720 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 16721 | |
| 16722 | MODULE_LICENSE("GPL"); |
| 16723 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 16724 | |
| 16725 | static struct hda_codec_preset_list realtek_list = { |
| 16726 | .preset = snd_hda_preset_realtek, |
| 16727 | .owner = THIS_MODULE, |
| 16728 | }; |
| 16729 | |
| 16730 | static int __init patch_realtek_init(void) |
| 16731 | { |
| 16732 | return snd_hda_add_codec_preset(&realtek_list); |
| 16733 | } |
| 16734 | |
| 16735 | static void __exit patch_realtek_exit(void) |
| 16736 | { |
| 16737 | snd_hda_delete_codec_preset(&realtek_list); |
| 16738 | } |
| 16739 | |
| 16740 | module_init(patch_realtek_init) |
| 16741 | module_exit(patch_realtek_exit) |