Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 81 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_SND_DEBUG |
| 83 | ALC260_TEST, |
| 84 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 86 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 89 | /* ALC262 models */ |
| 90 | enum { |
| 91 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 92 | ALC262_HIPPO, |
| 93 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 94 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 95 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 96 | ALC262_HP_BPC_D7000_WL, |
| 97 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 98 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 99 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 100 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 101 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 102 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 103 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 104 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 105 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 108 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | ALC262_AUTO, |
| 110 | ALC262_MODEL_LAST /* last tag */ |
| 111 | }; |
| 112 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | /* ALC268 models */ |
| 114 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 115 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 117 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 118 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 119 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 120 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 121 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 122 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_SND_DEBUG |
| 124 | ALC268_TEST, |
| 125 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 126 | ALC268_AUTO, |
| 127 | ALC268_MODEL_LAST /* last tag */ |
| 128 | }; |
| 129 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | /* ALC269 models */ |
| 131 | enum { |
| 132 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 133 | ALC269_QUANTA_FL1, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 134 | ALC269_ASUS_EEEPC_P703, |
| 135 | ALC269_ASUS_EEEPC_P901, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 136 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 137 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 138 | ALC269_AUTO, |
| 139 | ALC269_MODEL_LAST /* last tag */ |
| 140 | }; |
| 141 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 142 | /* ALC861 models */ |
| 143 | enum { |
| 144 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 145 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | ALC861_3ST_DIG, |
| 147 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 148 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 149 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 150 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 151 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 152 | ALC861_AUTO, |
| 153 | ALC861_MODEL_LAST, |
| 154 | }; |
| 155 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 156 | /* ALC861-VD models */ |
| 157 | enum { |
| 158 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 159 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 160 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 161 | ALC861VD_3ST, |
| 162 | ALC861VD_3ST_DIG, |
| 163 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 164 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 165 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 166 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 167 | ALC861VD_AUTO, |
| 168 | ALC861VD_MODEL_LAST, |
| 169 | }; |
| 170 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 171 | /* ALC662 models */ |
| 172 | enum { |
| 173 | ALC662_3ST_2ch_DIG, |
| 174 | ALC662_3ST_6ch_DIG, |
| 175 | ALC662_3ST_6ch, |
| 176 | ALC662_5ST_DIG, |
| 177 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 178 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 179 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 180 | ALC663_ASUS_M51VA, |
| 181 | ALC663_ASUS_G71V, |
| 182 | ALC663_ASUS_H13, |
| 183 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 184 | ALC662_ECS, |
| 185 | ALC663_ASUS_MODE1, |
| 186 | ALC662_ASUS_MODE2, |
| 187 | ALC663_ASUS_MODE3, |
| 188 | ALC663_ASUS_MODE4, |
| 189 | ALC663_ASUS_MODE5, |
| 190 | ALC663_ASUS_MODE6, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 191 | ALC272_DELL, |
| 192 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 193 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 194 | ALC662_AUTO, |
| 195 | ALC662_MODEL_LAST, |
| 196 | }; |
| 197 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 198 | /* ALC882 models */ |
| 199 | enum { |
| 200 | ALC882_3ST_DIG, |
| 201 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 202 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 203 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 204 | ALC882_TARGA, |
| 205 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 206 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 207 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 208 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 209 | ALC885_MB5, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 210 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 211 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 212 | ALC882_MODEL_LAST, |
| 213 | }; |
| 214 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 215 | /* ALC883 models */ |
| 216 | enum { |
| 217 | ALC883_3ST_2ch_DIG, |
| 218 | ALC883_3ST_6ch_DIG, |
| 219 | ALC883_3ST_6ch, |
| 220 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 221 | ALC883_TARGA_DIG, |
| 222 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 223 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 224 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 225 | ALC888_ACER_ASPIRE_4930G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 226 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 227 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 228 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 229 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 230 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 231 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 232 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 233 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 234 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 235 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 236 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 237 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 238 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 239 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 240 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 241 | ALC888_ASUS_M90V, |
| 242 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 243 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 244 | ALC1200_ASUS_P5Q, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 245 | ALC883_AUTO, |
| 246 | ALC883_MODEL_LAST, |
| 247 | }; |
| 248 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 249 | /* styles of capture selection */ |
| 250 | enum { |
| 251 | CAPT_MUX = 0, /* only mux based */ |
| 252 | CAPT_MIX, /* only mixer based */ |
| 253 | CAPT_1MUX_MIX, /* first mux and other mixers */ |
| 254 | }; |
| 255 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 256 | /* for GPIO Poll */ |
| 257 | #define GPIO_MASK 0x03 |
| 258 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 259 | /* extra amp-initialization sequence types */ |
| 260 | enum { |
| 261 | ALC_INIT_NONE, |
| 262 | ALC_INIT_DEFAULT, |
| 263 | ALC_INIT_GPIO1, |
| 264 | ALC_INIT_GPIO2, |
| 265 | ALC_INIT_GPIO3, |
| 266 | }; |
| 267 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | struct alc_spec { |
| 269 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 270 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 272 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 273 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 275 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 276 | * don't forget NULL |
| 277 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 278 | */ |
| 279 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 281 | char stream_name_analog[16]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | struct hda_pcm_stream *stream_analog_playback; |
| 283 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 284 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 285 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 287 | char stream_name_digital[16]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | struct hda_pcm_stream *stream_digital_playback; |
| 289 | struct hda_pcm_stream *stream_digital_capture; |
| 290 | |
| 291 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 292 | struct hda_multi_out multiout; /* playback set-up |
| 293 | * max_channels, dacs must be set |
| 294 | * dig_out_nid and hp_nid are optional |
| 295 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 296 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 297 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 298 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | |
| 300 | /* capture */ |
| 301 | unsigned int num_adc_nids; |
| 302 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 303 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 304 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 305 | int capture_style; /* capture style (CAPT_*) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | |
| 307 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 308 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | const struct hda_input_mux *input_mux; |
| 310 | unsigned int cur_mux[3]; |
| 311 | |
| 312 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 313 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 315 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | |
| 317 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 318 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 319 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 320 | /* dynamic controls, init_verbs and input_mux */ |
| 321 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 322 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 323 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 324 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 325 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 326 | /* hooks */ |
| 327 | void (*init_hook)(struct hda_codec *codec); |
| 328 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 329 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 330 | /* for pin sensing */ |
| 331 | unsigned int sense_updated: 1; |
| 332 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 333 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 334 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 335 | /* other flags */ |
| 336 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 337 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 338 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 339 | /* for virtual master */ |
| 340 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 341 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 342 | struct hda_loopback_check loopback; |
| 343 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 344 | |
| 345 | /* for PLL fix */ |
| 346 | hda_nid_t pll_nid; |
| 347 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 348 | }; |
| 349 | |
| 350 | /* |
| 351 | * configuration template - to be copied to the spec instance |
| 352 | */ |
| 353 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 354 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 355 | * with spec |
| 356 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 357 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 358 | const struct hda_verb *init_verbs[5]; |
| 359 | unsigned int num_dacs; |
| 360 | hda_nid_t *dac_nids; |
| 361 | hda_nid_t dig_out_nid; /* optional */ |
| 362 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 363 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 364 | unsigned int num_adc_nids; |
| 365 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 366 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 367 | hda_nid_t dig_in_nid; |
| 368 | unsigned int num_channel_mode; |
| 369 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 370 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 371 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 372 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 373 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 374 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 375 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 376 | struct hda_amp_list *loopbacks; |
| 377 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | }; |
| 379 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | |
| 381 | /* |
| 382 | * input MUX handling |
| 383 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 384 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 385 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | { |
| 387 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 388 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 389 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 390 | if (mux_idx >= spec->num_mux_defs) |
| 391 | mux_idx = 0; |
| 392 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 | } |
| 394 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 395 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 396 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | { |
| 398 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 399 | struct alc_spec *spec = codec->spec; |
| 400 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 401 | |
| 402 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 403 | return 0; |
| 404 | } |
| 405 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 406 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 407 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 | { |
| 409 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 410 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 411 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 413 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 414 | hda_nid_t nid = spec->capsrc_nids ? |
| 415 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 417 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 418 | imux = &spec->input_mux[mux_idx]; |
| 419 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 420 | if (spec->capture_style && |
| 421 | !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 422 | /* Matrix-mixer style (e.g. ALC882) */ |
| 423 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 424 | unsigned int i, idx; |
| 425 | |
| 426 | idx = ucontrol->value.enumerated.item[0]; |
| 427 | if (idx >= imux->num_items) |
| 428 | idx = imux->num_items - 1; |
| 429 | if (*cur_val == idx) |
| 430 | return 0; |
| 431 | for (i = 0; i < imux->num_items; i++) { |
| 432 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 433 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 434 | imux->items[i].index, |
| 435 | HDA_AMP_MUTE, v); |
| 436 | } |
| 437 | *cur_val = idx; |
| 438 | return 1; |
| 439 | } else { |
| 440 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 441 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 442 | &spec->cur_mux[adc_idx]); |
| 443 | } |
| 444 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 445 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | /* |
| 447 | * channel mode setting |
| 448 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 449 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 450 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | { |
| 452 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 453 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 454 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 455 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | } |
| 457 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 459 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | { |
| 461 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 462 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 463 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 464 | spec->num_channel_mode, |
| 465 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | } |
| 467 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 468 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 469 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | { |
| 471 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 472 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 473 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 474 | spec->num_channel_mode, |
| 475 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 476 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 477 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 478 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | } |
| 480 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 482 | * 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] | 483 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 484 | * being part of a format specifier. Maximum allowed length of a value is |
| 485 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 486 | * |
| 487 | * Note: some retasking pin complexes seem to ignore requests for input |
| 488 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 489 | * are requested. Therefore order this list so that this behaviour will not |
| 490 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 491 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 492 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 493 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 494 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 495 | "Mic 50pc bias", "Mic 80pc bias", |
| 496 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 497 | }; |
| 498 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 499 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 500 | }; |
| 501 | /* 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] | 502 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 503 | * addition, "input" pins may or may not process the mic bias option |
| 504 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 505 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 506 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 507 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 508 | #define ALC_PIN_DIR_IN 0x00 |
| 509 | #define ALC_PIN_DIR_OUT 0x01 |
| 510 | #define ALC_PIN_DIR_INOUT 0x02 |
| 511 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 512 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 513 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 514 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 515 | * For each direction the minimum and maximum values are given. |
| 516 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 517 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 518 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 519 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 520 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 521 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 522 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 523 | }; |
| 524 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 525 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 526 | #define alc_pin_mode_n_items(_dir) \ |
| 527 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 528 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 529 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 530 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 531 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 532 | unsigned int item_num = uinfo->value.enumerated.item; |
| 533 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 534 | |
| 535 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 536 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 537 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 538 | |
| 539 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 540 | item_num = alc_pin_mode_min(dir); |
| 541 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 542 | return 0; |
| 543 | } |
| 544 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 545 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 546 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 547 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 548 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 549 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 550 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 551 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 552 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 553 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 554 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 555 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 556 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 557 | /* Find enumerated value for current pinctl setting */ |
| 558 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 559 | 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] | 560 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 561 | *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] | 562 | return 0; |
| 563 | } |
| 564 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 565 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 566 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 567 | { |
| 568 | signed int change; |
| 569 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 570 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 571 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 572 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 573 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 574 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 575 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 576 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 577 | 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] | 578 | val = alc_pin_mode_min(dir); |
| 579 | |
| 580 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 581 | if (change) { |
| 582 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 583 | snd_hda_codec_write_cache(codec, nid, 0, |
| 584 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 585 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 586 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 587 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 588 | * for the requested pin mode. Enum values of 2 or less are |
| 589 | * input modes. |
| 590 | * |
| 591 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 592 | * reduces noise slightly (particularly on input) so we'll |
| 593 | * do it. However, having both input and output buffers |
| 594 | * enabled simultaneously doesn't seem to be problematic if |
| 595 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 596 | */ |
| 597 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 598 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 599 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 600 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 601 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 602 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 603 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 604 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 605 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 606 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 607 | } |
| 608 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 609 | return change; |
| 610 | } |
| 611 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 612 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 613 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 614 | .info = alc_pin_mode_info, \ |
| 615 | .get = alc_pin_mode_get, \ |
| 616 | .put = alc_pin_mode_put, \ |
| 617 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 618 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 619 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 620 | * together using a mask with more than one bit set. This control is |
| 621 | * currently used only by the ALC260 test model. At this stage they are not |
| 622 | * needed for any "production" models. |
| 623 | */ |
| 624 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 625 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 626 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 627 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 628 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 629 | { |
| 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 *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 634 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 635 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 636 | |
| 637 | *valp = (val & mask) != 0; |
| 638 | return 0; |
| 639 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 640 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 641 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 642 | { |
| 643 | signed int change; |
| 644 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 645 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 646 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 647 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 648 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 649 | AC_VERB_GET_GPIO_DATA, |
| 650 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 651 | |
| 652 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 653 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 654 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 655 | gpio_data &= ~mask; |
| 656 | else |
| 657 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 658 | snd_hda_codec_write_cache(codec, nid, 0, |
| 659 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 660 | |
| 661 | return change; |
| 662 | } |
| 663 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 664 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 665 | .info = alc_gpio_data_info, \ |
| 666 | .get = alc_gpio_data_get, \ |
| 667 | .put = alc_gpio_data_put, \ |
| 668 | .private_value = nid | (mask<<16) } |
| 669 | #endif /* CONFIG_SND_DEBUG */ |
| 670 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 671 | /* A switch control to allow the enabling of the digital IO pins on the |
| 672 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 673 | * to provide something in the test model allowing digital outputs to be |
| 674 | * identified if present. If models are found which can utilise these |
| 675 | * outputs a more complete mixer control can be devised for those models if |
| 676 | * necessary. |
| 677 | */ |
| 678 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 679 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 680 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 681 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 682 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 683 | { |
| 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 *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 688 | unsigned int val = 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, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 690 | |
| 691 | *valp = (val & mask) != 0; |
| 692 | return 0; |
| 693 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 694 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 695 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 696 | { |
| 697 | signed int change; |
| 698 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 699 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 700 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 701 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 702 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 703 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 704 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 705 | |
| 706 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 707 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 708 | if (val==0) |
| 709 | ctrl_data &= ~mask; |
| 710 | else |
| 711 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 712 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 713 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 714 | |
| 715 | return change; |
| 716 | } |
| 717 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 718 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 719 | .info = alc_spdif_ctrl_info, \ |
| 720 | .get = alc_spdif_ctrl_get, \ |
| 721 | .put = alc_spdif_ctrl_put, \ |
| 722 | .private_value = nid | (mask<<16) } |
| 723 | #endif /* CONFIG_SND_DEBUG */ |
| 724 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 725 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 726 | * Again, this is only used in the ALC26x test models to help identify when |
| 727 | * the EAPD line must be asserted for features to work. |
| 728 | */ |
| 729 | #ifdef CONFIG_SND_DEBUG |
| 730 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 731 | |
| 732 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 733 | struct snd_ctl_elem_value *ucontrol) |
| 734 | { |
| 735 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 736 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 737 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 738 | long *valp = ucontrol->value.integer.value; |
| 739 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 740 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 741 | |
| 742 | *valp = (val & mask) != 0; |
| 743 | return 0; |
| 744 | } |
| 745 | |
| 746 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 747 | struct snd_ctl_elem_value *ucontrol) |
| 748 | { |
| 749 | int change; |
| 750 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 751 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 752 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 753 | long val = *ucontrol->value.integer.value; |
| 754 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 755 | AC_VERB_GET_EAPD_BTLENABLE, |
| 756 | 0x00); |
| 757 | |
| 758 | /* Set/unset the masked control bit(s) as needed */ |
| 759 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 760 | if (!val) |
| 761 | ctrl_data &= ~mask; |
| 762 | else |
| 763 | ctrl_data |= mask; |
| 764 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 765 | ctrl_data); |
| 766 | |
| 767 | return change; |
| 768 | } |
| 769 | |
| 770 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 771 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 772 | .info = alc_eapd_ctrl_info, \ |
| 773 | .get = alc_eapd_ctrl_get, \ |
| 774 | .put = alc_eapd_ctrl_put, \ |
| 775 | .private_value = nid | (mask<<16) } |
| 776 | #endif /* CONFIG_SND_DEBUG */ |
| 777 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 778 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 779 | * set up the input pin config (depending on the given auto-pin type) |
| 780 | */ |
| 781 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 782 | int auto_pin_type) |
| 783 | { |
| 784 | unsigned int val = PIN_IN; |
| 785 | |
| 786 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 787 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 788 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 789 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 790 | if (pincap & AC_PINCAP_VREF_80) |
| 791 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 792 | else if (pincap & AC_PINCAP_VREF_50) |
| 793 | val = PIN_VREF50; |
| 794 | else if (pincap & AC_PINCAP_VREF_100) |
| 795 | val = PIN_VREF100; |
| 796 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 797 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 798 | } |
| 799 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 800 | } |
| 801 | |
| 802 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 803 | */ |
| 804 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 805 | { |
| 806 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 807 | return; |
| 808 | spec->mixers[spec->num_mixers++] = mix; |
| 809 | } |
| 810 | |
| 811 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 812 | { |
| 813 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 814 | return; |
| 815 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 816 | } |
| 817 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 818 | #ifdef CONFIG_PROC_FS |
| 819 | /* |
| 820 | * hook for proc |
| 821 | */ |
| 822 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 823 | struct hda_codec *codec, hda_nid_t nid) |
| 824 | { |
| 825 | int coeff; |
| 826 | |
| 827 | if (nid != 0x20) |
| 828 | return; |
| 829 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 830 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 831 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 832 | AC_VERB_GET_COEF_INDEX, 0); |
| 833 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 834 | } |
| 835 | #else |
| 836 | #define print_realtek_coef NULL |
| 837 | #endif |
| 838 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 839 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 840 | * set up from the preset table |
| 841 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 842 | static void setup_preset(struct alc_spec *spec, |
| 843 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 844 | { |
| 845 | int i; |
| 846 | |
| 847 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 848 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 849 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 850 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 851 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 852 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 853 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 854 | spec->channel_mode = preset->channel_mode; |
| 855 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 856 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 857 | |
| 858 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 859 | |
| 860 | spec->multiout.num_dacs = preset->num_dacs; |
| 861 | spec->multiout.dac_nids = preset->dac_nids; |
| 862 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 863 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 864 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 865 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 866 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 867 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 868 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 869 | spec->input_mux = preset->input_mux; |
| 870 | |
| 871 | spec->num_adc_nids = preset->num_adc_nids; |
| 872 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 873 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 874 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 875 | |
| 876 | spec->unsol_event = preset->unsol_event; |
| 877 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 878 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 879 | spec->loopback.amplist = preset->loopbacks; |
| 880 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 881 | } |
| 882 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 883 | /* Enable GPIO mask and set output */ |
| 884 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 885 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 886 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 887 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 888 | { } |
| 889 | }; |
| 890 | |
| 891 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 892 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 893 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 894 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 895 | { } |
| 896 | }; |
| 897 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 898 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 899 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 900 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 901 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 902 | { } |
| 903 | }; |
| 904 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 905 | /* |
| 906 | * Fix hardware PLL issue |
| 907 | * On some codecs, the analog PLL gating control must be off while |
| 908 | * the default value is 1. |
| 909 | */ |
| 910 | static void alc_fix_pll(struct hda_codec *codec) |
| 911 | { |
| 912 | struct alc_spec *spec = codec->spec; |
| 913 | unsigned int val; |
| 914 | |
| 915 | if (!spec->pll_nid) |
| 916 | return; |
| 917 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 918 | spec->pll_coef_idx); |
| 919 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 920 | AC_VERB_GET_PROC_COEF, 0); |
| 921 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 922 | spec->pll_coef_idx); |
| 923 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 924 | val & ~(1 << spec->pll_coef_bit)); |
| 925 | } |
| 926 | |
| 927 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 928 | unsigned int coef_idx, unsigned int coef_bit) |
| 929 | { |
| 930 | struct alc_spec *spec = codec->spec; |
| 931 | spec->pll_nid = nid; |
| 932 | spec->pll_coef_idx = coef_idx; |
| 933 | spec->pll_coef_bit = coef_bit; |
| 934 | alc_fix_pll(codec); |
| 935 | } |
| 936 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 937 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 938 | { |
| 939 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 940 | unsigned int present; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 941 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 942 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 943 | |
| 944 | /* need to execute and sync at first */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 945 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 946 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 947 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 948 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 949 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 950 | nid = spec->autocfg.speaker_pins[i]; |
| 951 | if (!nid) |
| 952 | break; |
| 953 | snd_hda_codec_write(codec, nid, 0, |
| 954 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 955 | spec->jack_present ? 0 : PIN_OUT); |
| 956 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 957 | } |
| 958 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 959 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 960 | static void alc_mic_automute(struct hda_codec *codec) |
| 961 | { |
| 962 | struct alc_spec *spec = codec->spec; |
| 963 | unsigned int present; |
| 964 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 965 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 966 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 967 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 968 | |
| 969 | capsrc_idx_mic = mic_nid - 0x18; |
| 970 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 971 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 972 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 973 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 974 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 975 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 976 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 977 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 978 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 979 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 980 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 981 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 982 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 983 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 984 | /* unsolicited event for HP jack sensing */ |
| 985 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 986 | { |
| 987 | if (codec->vendor_id == 0x10ec0880) |
| 988 | res >>= 28; |
| 989 | else |
| 990 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 991 | switch (res) { |
| 992 | case ALC880_HP_EVENT: |
| 993 | alc_automute_pin(codec); |
| 994 | break; |
| 995 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 996 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 997 | break; |
| 998 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 999 | } |
| 1000 | |
| 1001 | static void alc_inithook(struct hda_codec *codec) |
| 1002 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1003 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1004 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1005 | } |
| 1006 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1007 | /* additional initialization for ALC888 variants */ |
| 1008 | static void alc888_coef_init(struct hda_codec *codec) |
| 1009 | { |
| 1010 | unsigned int tmp; |
| 1011 | |
| 1012 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1013 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1014 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
Takashi Iwai | 37db623 | 2009-03-05 09:40:16 +0100 | [diff] [blame] | 1015 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1016 | /* alc888S-VC */ |
| 1017 | snd_hda_codec_read(codec, 0x20, 0, |
| 1018 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1019 | else |
| 1020 | /* alc888-VB */ |
| 1021 | snd_hda_codec_read(codec, 0x20, 0, |
| 1022 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1023 | } |
| 1024 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1025 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1026 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1027 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1028 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1029 | switch (type) { |
| 1030 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1031 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1032 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1033 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1034 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1035 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1036 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1037 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1038 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1039 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1040 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1041 | case 0x10ec0260: |
| 1042 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1043 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1044 | snd_hda_codec_write(codec, 0x10, 0, |
| 1045 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1046 | break; |
| 1047 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1048 | case 0x10ec0267: |
| 1049 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1050 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1051 | case 0x10ec0272: |
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 | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1080 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1081 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1082 | snd_hda_codec_write(codec, 0x20, 0, |
| 1083 | AC_VERB_SET_COEF_INDEX, 7); |
| 1084 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1085 | AC_VERB_GET_PROC_COEF, 0); |
| 1086 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1087 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1088 | snd_hda_codec_write(codec, 0x20, 0, |
| 1089 | AC_VERB_SET_PROC_COEF, |
| 1090 | tmp | 0x2010); |
| 1091 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1092 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1093 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1094 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1095 | case 0x10ec0267: |
| 1096 | case 0x10ec0268: |
| 1097 | snd_hda_codec_write(codec, 0x20, 0, |
| 1098 | AC_VERB_SET_COEF_INDEX, 7); |
| 1099 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1100 | AC_VERB_GET_PROC_COEF, 0); |
| 1101 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1102 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1103 | snd_hda_codec_write(codec, 0x20, 0, |
| 1104 | AC_VERB_SET_PROC_COEF, |
| 1105 | tmp | 0x3000); |
| 1106 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1107 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1108 | break; |
| 1109 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1110 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1111 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1112 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1113 | { |
| 1114 | struct alc_spec *spec = codec->spec; |
| 1115 | |
| 1116 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1117 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1118 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1119 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1120 | if (spec->autocfg.line_out_pins[0] && |
| 1121 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1122 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1123 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1124 | else |
| 1125 | return; |
| 1126 | } |
| 1127 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1128 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1129 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1130 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1131 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1132 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1133 | spec->unsol_event = alc_sku_unsol_event; |
| 1134 | } |
| 1135 | |
| 1136 | /* check subsystem ID and set up device-specific initialization; |
| 1137 | * return 1 if initialized, 0 if invalid SSID |
| 1138 | */ |
| 1139 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1140 | * 31 ~ 16 : Manufacture ID |
| 1141 | * 15 ~ 8 : SKU ID |
| 1142 | * 7 ~ 0 : Assembly ID |
| 1143 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1144 | */ |
| 1145 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1146 | hda_nid_t porta, hda_nid_t porte, |
| 1147 | hda_nid_t portd) |
| 1148 | { |
| 1149 | unsigned int ass, tmp, i; |
| 1150 | unsigned nid; |
| 1151 | struct alc_spec *spec = codec->spec; |
| 1152 | |
| 1153 | ass = codec->subsystem_id & 0xffff; |
| 1154 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1155 | goto do_sku; |
| 1156 | |
| 1157 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1158 | /* |
| 1159 | * 31~30 : port conetcivity |
| 1160 | * 29~21 : reserve |
| 1161 | * 20 : PCBEEP input |
| 1162 | * 19~16 : Check sum (15:1) |
| 1163 | * 15~1 : Custom |
| 1164 | * 0 : override |
| 1165 | */ |
| 1166 | nid = 0x1d; |
| 1167 | if (codec->vendor_id == 0x10ec0260) |
| 1168 | nid = 0x17; |
| 1169 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1170 | snd_printd("realtek: No valid SSID, " |
| 1171 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1172 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1173 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1174 | return 0; |
| 1175 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1176 | return 0; |
| 1177 | |
| 1178 | /* check sum */ |
| 1179 | tmp = 0; |
| 1180 | for (i = 1; i < 16; i++) { |
| 1181 | if ((ass >> i) & 1) |
| 1182 | tmp++; |
| 1183 | } |
| 1184 | if (((ass >> 16) & 0xf) != tmp) |
| 1185 | return 0; |
| 1186 | do_sku: |
| 1187 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1188 | ass & 0xffff, codec->vendor_id); |
| 1189 | /* |
| 1190 | * 0 : override |
| 1191 | * 1 : Swap Jack |
| 1192 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1193 | * 3~5 : External Amplifier control |
| 1194 | * 7~6 : Reserved |
| 1195 | */ |
| 1196 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1197 | switch (tmp) { |
| 1198 | case 1: |
| 1199 | spec->init_amp = ALC_INIT_GPIO1; |
| 1200 | break; |
| 1201 | case 3: |
| 1202 | spec->init_amp = ALC_INIT_GPIO2; |
| 1203 | break; |
| 1204 | case 7: |
| 1205 | spec->init_amp = ALC_INIT_GPIO3; |
| 1206 | break; |
| 1207 | case 5: |
| 1208 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1209 | break; |
| 1210 | } |
| 1211 | |
| 1212 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1213 | * when the external headphone out jack is plugged" |
| 1214 | */ |
| 1215 | if (!(ass & 0x8000)) |
| 1216 | return 1; |
| 1217 | /* |
| 1218 | * 10~8 : Jack location |
| 1219 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1220 | * 14~13: Resvered |
| 1221 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1222 | * when the external headphone out jack is plugged" |
| 1223 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1224 | if (!spec->autocfg.hp_pins[0]) { |
| 1225 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1226 | if (tmp == 0) |
| 1227 | spec->autocfg.hp_pins[0] = porta; |
| 1228 | else if (tmp == 1) |
| 1229 | spec->autocfg.hp_pins[0] = porte; |
| 1230 | else if (tmp == 2) |
| 1231 | spec->autocfg.hp_pins[0] = portd; |
| 1232 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1233 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1234 | } |
| 1235 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1236 | alc_init_auto_hp(codec); |
| 1237 | return 1; |
| 1238 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1239 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1240 | static void alc_ssid_check(struct hda_codec *codec, |
| 1241 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1242 | { |
| 1243 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1244 | struct alc_spec *spec = codec->spec; |
| 1245 | snd_printd("realtek: " |
| 1246 | "Enable default setup for auto mode as fallback\n"); |
| 1247 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1248 | alc_init_auto_hp(codec); |
| 1249 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1250 | } |
| 1251 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1252 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1253 | * Fix-up pin default configurations |
| 1254 | */ |
| 1255 | |
| 1256 | struct alc_pincfg { |
| 1257 | hda_nid_t nid; |
| 1258 | u32 val; |
| 1259 | }; |
| 1260 | |
| 1261 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1262 | const struct snd_pci_quirk *quirk, |
| 1263 | const struct alc_pincfg **pinfix) |
| 1264 | { |
| 1265 | const struct alc_pincfg *cfg; |
| 1266 | |
| 1267 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1268 | if (!quirk) |
| 1269 | return; |
| 1270 | |
| 1271 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1272 | for (; cfg->nid; cfg++) |
| 1273 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1274 | } |
| 1275 | |
| 1276 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1277 | * ALC888 |
| 1278 | */ |
| 1279 | |
| 1280 | /* |
| 1281 | * 2ch mode |
| 1282 | */ |
| 1283 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1284 | /* Mic-in jack as mic in */ |
| 1285 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1286 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1287 | /* Line-in jack as Line in */ |
| 1288 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1289 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1290 | /* Line-Out as Front */ |
| 1291 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1292 | { } /* end */ |
| 1293 | }; |
| 1294 | |
| 1295 | /* |
| 1296 | * 4ch mode |
| 1297 | */ |
| 1298 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1299 | /* Mic-in jack as mic in */ |
| 1300 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1301 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1302 | /* Line-in jack as Surround */ |
| 1303 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1304 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1305 | /* Line-Out as Front */ |
| 1306 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1307 | { } /* end */ |
| 1308 | }; |
| 1309 | |
| 1310 | /* |
| 1311 | * 6ch mode |
| 1312 | */ |
| 1313 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1314 | /* Mic-in jack as CLFE */ |
| 1315 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1316 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1317 | /* Line-in jack as Surround */ |
| 1318 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1319 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1320 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1321 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1322 | { } /* end */ |
| 1323 | }; |
| 1324 | |
| 1325 | /* |
| 1326 | * 8ch mode |
| 1327 | */ |
| 1328 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1329 | /* Mic-in jack as CLFE */ |
| 1330 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1331 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1332 | /* Line-in jack as Surround */ |
| 1333 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1334 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1335 | /* Line-Out as Side */ |
| 1336 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1337 | { } /* end */ |
| 1338 | }; |
| 1339 | |
| 1340 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1341 | { 2, alc888_4ST_ch2_intel_init }, |
| 1342 | { 4, alc888_4ST_ch4_intel_init }, |
| 1343 | { 6, alc888_4ST_ch6_intel_init }, |
| 1344 | { 8, alc888_4ST_ch8_intel_init }, |
| 1345 | }; |
| 1346 | |
| 1347 | /* |
| 1348 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1349 | */ |
| 1350 | |
| 1351 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1352 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1353 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1354 | /* Connect Internal HP to Front */ |
| 1355 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1356 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1357 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1358 | /* Connect Bass HP to Front */ |
| 1359 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1360 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1361 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1362 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1363 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1364 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1365 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1366 | /* Connect Mic jack to CLFE */ |
| 1367 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1368 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1369 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1370 | /* Connect Line-in jack to Surround */ |
| 1371 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1372 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1373 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1374 | /* Connect HP out jack to Front */ |
| 1375 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1376 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1377 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1378 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1379 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1380 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1381 | {} |
| 1382 | }; |
| 1383 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1384 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1385 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1386 | struct alc_spec *spec = codec->spec; |
| 1387 | unsigned int val, mute; |
| 1388 | hda_nid_t nid; |
| 1389 | int i; |
| 1390 | |
| 1391 | spec->jack_present = 0; |
| 1392 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1393 | nid = spec->autocfg.hp_pins[i]; |
| 1394 | if (!nid) |
| 1395 | break; |
| 1396 | val = snd_hda_codec_read(codec, nid, 0, |
| 1397 | AC_VERB_GET_PIN_SENSE, 0); |
| 1398 | if (val & AC_PINSENSE_PRESENCE) { |
| 1399 | spec->jack_present = 1; |
| 1400 | break; |
| 1401 | } |
| 1402 | } |
| 1403 | |
| 1404 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1405 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1406 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1407 | nid = spec->autocfg.speaker_pins[i]; |
| 1408 | if (!nid) |
| 1409 | break; |
| 1410 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1411 | HDA_AMP_MUTE, mute); |
| 1412 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1413 | } |
| 1414 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1415 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1416 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1417 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1418 | if (codec->vendor_id == 0x10ec0880) |
| 1419 | res >>= 28; |
| 1420 | else |
| 1421 | res >>= 26; |
| 1422 | if (res == ALC880_HP_EVENT) |
| 1423 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1424 | } |
| 1425 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1426 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) |
| 1427 | { |
| 1428 | struct alc_spec *spec = codec->spec; |
| 1429 | |
| 1430 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1431 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1432 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1433 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
| 1434 | alc_automute_amp(codec); |
| 1435 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1436 | |
| 1437 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1438 | * ALC888 Acer Aspire 4930G model |
| 1439 | */ |
| 1440 | |
| 1441 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1442 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1443 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1444 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1445 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1446 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1447 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1448 | /* Connect Internal HP to front */ |
| 1449 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1450 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1451 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1452 | /* Connect HP out to front */ |
| 1453 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1454 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1455 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1456 | { } |
| 1457 | }; |
| 1458 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1459 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1460 | /* Front mic only available on one ADC */ |
| 1461 | { |
| 1462 | .num_items = 4, |
| 1463 | .items = { |
| 1464 | { "Mic", 0x0 }, |
| 1465 | { "Line", 0x2 }, |
| 1466 | { "CD", 0x4 }, |
| 1467 | { "Front Mic", 0xb }, |
| 1468 | }, |
| 1469 | }, |
| 1470 | { |
| 1471 | .num_items = 3, |
| 1472 | .items = { |
| 1473 | { "Mic", 0x0 }, |
| 1474 | { "Line", 0x2 }, |
| 1475 | { "CD", 0x4 }, |
| 1476 | }, |
| 1477 | } |
| 1478 | }; |
| 1479 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1480 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1481 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1482 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1483 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1484 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1485 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1486 | HDA_OUTPUT), |
| 1487 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1488 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1489 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1490 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1491 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1492 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1493 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1494 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1495 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1496 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1497 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1498 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1499 | { } /* end */ |
| 1500 | }; |
| 1501 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1502 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1503 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1504 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1505 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1506 | spec->autocfg.hp_pins[0] = 0x15; |
| 1507 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1508 | alc_automute_amp(codec); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1509 | } |
| 1510 | |
| 1511 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1512 | * ALC880 3-stack model |
| 1513 | * |
| 1514 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1515 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1516 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1517 | */ |
| 1518 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1519 | static hda_nid_t alc880_dac_nids[4] = { |
| 1520 | /* front, rear, clfe, rear_surr */ |
| 1521 | 0x02, 0x05, 0x04, 0x03 |
| 1522 | }; |
| 1523 | |
| 1524 | static hda_nid_t alc880_adc_nids[3] = { |
| 1525 | /* ADC0-2 */ |
| 1526 | 0x07, 0x08, 0x09, |
| 1527 | }; |
| 1528 | |
| 1529 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1530 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1531 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1532 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1533 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1534 | /* ADC1-2 */ |
| 1535 | 0x08, 0x09, |
| 1536 | }; |
| 1537 | |
| 1538 | #define ALC880_DIGOUT_NID 0x06 |
| 1539 | #define ALC880_DIGIN_NID 0x0a |
| 1540 | |
| 1541 | static struct hda_input_mux alc880_capture_source = { |
| 1542 | .num_items = 4, |
| 1543 | .items = { |
| 1544 | { "Mic", 0x0 }, |
| 1545 | { "Front Mic", 0x3 }, |
| 1546 | { "Line", 0x2 }, |
| 1547 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1548 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1549 | }; |
| 1550 | |
| 1551 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1552 | /* 2ch mode */ |
| 1553 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1554 | /* set line-in to input, mute it */ |
| 1555 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1556 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1557 | /* set mic-in to input vref 80%, mute it */ |
| 1558 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1559 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1560 | { } /* end */ |
| 1561 | }; |
| 1562 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1563 | /* 6ch mode */ |
| 1564 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1565 | /* set line-in to output, unmute it */ |
| 1566 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1567 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1568 | /* set mic-in to output, unmute it */ |
| 1569 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1570 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1571 | { } /* end */ |
| 1572 | }; |
| 1573 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1574 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1575 | { 2, alc880_threestack_ch2_init }, |
| 1576 | { 6, alc880_threestack_ch6_init }, |
| 1577 | }; |
| 1578 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1579 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1580 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1581 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1582 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1583 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1584 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1585 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1586 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1587 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1588 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1589 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1590 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1591 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1592 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1593 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1594 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1595 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1596 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1597 | { |
| 1598 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1599 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1600 | .info = alc_ch_mode_info, |
| 1601 | .get = alc_ch_mode_get, |
| 1602 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1603 | }, |
| 1604 | { } /* end */ |
| 1605 | }; |
| 1606 | |
| 1607 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1608 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1609 | struct snd_ctl_elem_info *uinfo) |
| 1610 | { |
| 1611 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1612 | struct alc_spec *spec = codec->spec; |
| 1613 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1614 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1615 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1616 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1617 | HDA_INPUT); |
| 1618 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1619 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1620 | return err; |
| 1621 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1622 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1623 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1624 | unsigned int size, unsigned int __user *tlv) |
| 1625 | { |
| 1626 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1627 | struct alc_spec *spec = codec->spec; |
| 1628 | int err; |
| 1629 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1630 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1631 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1632 | HDA_INPUT); |
| 1633 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1634 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1635 | return err; |
| 1636 | } |
| 1637 | |
| 1638 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1639 | struct snd_ctl_elem_value *ucontrol); |
| 1640 | |
| 1641 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1642 | struct snd_ctl_elem_value *ucontrol, |
| 1643 | getput_call_t func) |
| 1644 | { |
| 1645 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1646 | struct alc_spec *spec = codec->spec; |
| 1647 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1648 | int err; |
| 1649 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1650 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1651 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1652 | 3, 0, HDA_INPUT); |
| 1653 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1654 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1655 | return err; |
| 1656 | } |
| 1657 | |
| 1658 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1659 | struct snd_ctl_elem_value *ucontrol) |
| 1660 | { |
| 1661 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1662 | snd_hda_mixer_amp_volume_get); |
| 1663 | } |
| 1664 | |
| 1665 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1666 | struct snd_ctl_elem_value *ucontrol) |
| 1667 | { |
| 1668 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1669 | snd_hda_mixer_amp_volume_put); |
| 1670 | } |
| 1671 | |
| 1672 | /* capture mixer elements */ |
| 1673 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1674 | |
| 1675 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1676 | struct snd_ctl_elem_value *ucontrol) |
| 1677 | { |
| 1678 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1679 | snd_hda_mixer_amp_switch_get); |
| 1680 | } |
| 1681 | |
| 1682 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1683 | struct snd_ctl_elem_value *ucontrol) |
| 1684 | { |
| 1685 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1686 | snd_hda_mixer_amp_switch_put); |
| 1687 | } |
| 1688 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1689 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1690 | { \ |
| 1691 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1692 | .name = "Capture Switch", \ |
| 1693 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1694 | .count = num, \ |
| 1695 | .info = alc_cap_sw_info, \ |
| 1696 | .get = alc_cap_sw_get, \ |
| 1697 | .put = alc_cap_sw_put, \ |
| 1698 | }, \ |
| 1699 | { \ |
| 1700 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1701 | .name = "Capture Volume", \ |
| 1702 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1703 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1704 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1705 | .count = num, \ |
| 1706 | .info = alc_cap_vol_info, \ |
| 1707 | .get = alc_cap_vol_get, \ |
| 1708 | .put = alc_cap_vol_put, \ |
| 1709 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1710 | } |
| 1711 | |
| 1712 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1713 | { \ |
| 1714 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1715 | /* .name = "Capture Source", */ \ |
| 1716 | .name = "Input Source", \ |
| 1717 | .count = num, \ |
| 1718 | .info = alc_mux_enum_info, \ |
| 1719 | .get = alc_mux_enum_get, \ |
| 1720 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1721 | } |
| 1722 | |
| 1723 | #define DEFINE_CAPMIX(num) \ |
| 1724 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1725 | _DEFINE_CAPMIX(num), \ |
| 1726 | _DEFINE_CAPSRC(num), \ |
| 1727 | { } /* end */ \ |
| 1728 | } |
| 1729 | |
| 1730 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 1731 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 1732 | _DEFINE_CAPMIX(num), \ |
| 1733 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1734 | } |
| 1735 | |
| 1736 | /* up to three ADCs */ |
| 1737 | DEFINE_CAPMIX(1); |
| 1738 | DEFINE_CAPMIX(2); |
| 1739 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1740 | DEFINE_CAPMIX_NOSRC(1); |
| 1741 | DEFINE_CAPMIX_NOSRC(2); |
| 1742 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1743 | |
| 1744 | /* |
| 1745 | * ALC880 5-stack model |
| 1746 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1747 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1748 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1749 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1750 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1751 | */ |
| 1752 | |
| 1753 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1754 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1755 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1756 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1757 | { } /* end */ |
| 1758 | }; |
| 1759 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1760 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1761 | /* 6ch mode */ |
| 1762 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1763 | /* set line-in to input, mute it */ |
| 1764 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1765 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1766 | { } /* end */ |
| 1767 | }; |
| 1768 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1769 | /* 8ch mode */ |
| 1770 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1771 | /* set line-in to output, unmute it */ |
| 1772 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1773 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1774 | { } /* end */ |
| 1775 | }; |
| 1776 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1777 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1778 | { 6, alc880_fivestack_ch6_init }, |
| 1779 | { 8, alc880_fivestack_ch8_init }, |
| 1780 | }; |
| 1781 | |
| 1782 | |
| 1783 | /* |
| 1784 | * ALC880 6-stack model |
| 1785 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1786 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1787 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1788 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1789 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1790 | */ |
| 1791 | |
| 1792 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1793 | /* front, rear, clfe, rear_surr */ |
| 1794 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1795 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1796 | |
| 1797 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1798 | .num_items = 4, |
| 1799 | .items = { |
| 1800 | { "Mic", 0x0 }, |
| 1801 | { "Front Mic", 0x1 }, |
| 1802 | { "Line", 0x2 }, |
| 1803 | { "CD", 0x4 }, |
| 1804 | }, |
| 1805 | }; |
| 1806 | |
| 1807 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1808 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1809 | { 8, NULL }, |
| 1810 | }; |
| 1811 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1812 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1813 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1814 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1815 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1816 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1817 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1818 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1819 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1820 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1821 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1822 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1823 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1824 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1825 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1826 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1828 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1829 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1830 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1831 | { |
| 1832 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1833 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1834 | .info = alc_ch_mode_info, |
| 1835 | .get = alc_ch_mode_get, |
| 1836 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1837 | }, |
| 1838 | { } /* end */ |
| 1839 | }; |
| 1840 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1841 | |
| 1842 | /* |
| 1843 | * ALC880 W810 model |
| 1844 | * |
| 1845 | * W810 has rear IO for: |
| 1846 | * Front (DAC 02) |
| 1847 | * Surround (DAC 03) |
| 1848 | * Center/LFE (DAC 04) |
| 1849 | * Digital out (06) |
| 1850 | * |
| 1851 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1852 | * 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] | 1853 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1854 | * There is a variable resistor to control the speaker or headphone |
| 1855 | * volume. This is a hardware-only device without a software API. |
| 1856 | * |
| 1857 | * Plugging headphones in will disable the internal speakers. This is |
| 1858 | * implemented in hardware, not via the driver using jack sense. In |
| 1859 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1860 | * disable both the speakers and headphones. |
| 1861 | * |
| 1862 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1863 | * These may not do anything useful with this driver yet, because I |
| 1864 | * haven't setup any initialization verbs for these yet... |
| 1865 | */ |
| 1866 | |
| 1867 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1868 | /* front, rear/surround, clfe */ |
| 1869 | 0x02, 0x03, 0x04 |
| 1870 | }; |
| 1871 | |
| 1872 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1873 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1874 | { 6, NULL } |
| 1875 | }; |
| 1876 | |
| 1877 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1878 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1879 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1880 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1881 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1882 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1883 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1884 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1885 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1886 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1887 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1888 | { } /* end */ |
| 1889 | }; |
| 1890 | |
| 1891 | |
| 1892 | /* |
| 1893 | * Z710V model |
| 1894 | * |
| 1895 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1896 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1897 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1898 | */ |
| 1899 | |
| 1900 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1901 | 0x02 |
| 1902 | }; |
| 1903 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1904 | |
| 1905 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1906 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1907 | { 2, NULL } |
| 1908 | }; |
| 1909 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1910 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1911 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1912 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1913 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1914 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1915 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1916 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1917 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1918 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1919 | { } /* end */ |
| 1920 | }; |
| 1921 | |
| 1922 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1923 | /* |
| 1924 | * ALC880 F1734 model |
| 1925 | * |
| 1926 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1927 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1928 | */ |
| 1929 | |
| 1930 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1931 | 0x03 |
| 1932 | }; |
| 1933 | #define ALC880_F1734_HP_DAC 0x02 |
| 1934 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1935 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1936 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1937 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1938 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1939 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1940 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1941 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1943 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1944 | { } /* end */ |
| 1945 | }; |
| 1946 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1947 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1948 | .num_items = 2, |
| 1949 | .items = { |
| 1950 | { "Mic", 0x1 }, |
| 1951 | { "CD", 0x4 }, |
| 1952 | }, |
| 1953 | }; |
| 1954 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1955 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1956 | /* |
| 1957 | * ALC880 ASUS model |
| 1958 | * |
| 1959 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1960 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1961 | * Mic = 0x18, Line = 0x1a |
| 1962 | */ |
| 1963 | |
| 1964 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1965 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1966 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1967 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1968 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1969 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1970 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1971 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1972 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1973 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1974 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1975 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1976 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1977 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1978 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1979 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1980 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1981 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1982 | { |
| 1983 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1984 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1985 | .info = alc_ch_mode_info, |
| 1986 | .get = alc_ch_mode_get, |
| 1987 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1988 | }, |
| 1989 | { } /* end */ |
| 1990 | }; |
| 1991 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1992 | /* |
| 1993 | * ALC880 ASUS W1V model |
| 1994 | * |
| 1995 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1996 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1997 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1998 | */ |
| 1999 | |
| 2000 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2001 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2002 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2003 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2004 | { } /* end */ |
| 2005 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2006 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2007 | /* TCL S700 */ |
| 2008 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2009 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2010 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2011 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2012 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2013 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2014 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2015 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2016 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2017 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2018 | { } /* end */ |
| 2019 | }; |
| 2020 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2021 | /* Uniwill */ |
| 2022 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2023 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2024 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2025 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2026 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2027 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2028 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2029 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2030 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2031 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2032 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2033 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2034 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2035 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2036 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2037 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2038 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2039 | { |
| 2040 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2041 | .name = "Channel Mode", |
| 2042 | .info = alc_ch_mode_info, |
| 2043 | .get = alc_ch_mode_get, |
| 2044 | .put = alc_ch_mode_put, |
| 2045 | }, |
| 2046 | { } /* end */ |
| 2047 | }; |
| 2048 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2049 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2050 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2051 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2052 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2053 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2054 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2055 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2056 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2057 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2058 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2059 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2060 | { } /* end */ |
| 2061 | }; |
| 2062 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2063 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2064 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2065 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2066 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2067 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2068 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2069 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2070 | { } /* end */ |
| 2071 | }; |
| 2072 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2073 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2074 | * virtual master controls |
| 2075 | */ |
| 2076 | |
| 2077 | /* |
| 2078 | * slave controls for virtual master |
| 2079 | */ |
| 2080 | static const char *alc_slave_vols[] = { |
| 2081 | "Front Playback Volume", |
| 2082 | "Surround Playback Volume", |
| 2083 | "Center Playback Volume", |
| 2084 | "LFE Playback Volume", |
| 2085 | "Side Playback Volume", |
| 2086 | "Headphone Playback Volume", |
| 2087 | "Speaker Playback Volume", |
| 2088 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2089 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2090 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2091 | NULL, |
| 2092 | }; |
| 2093 | |
| 2094 | static const char *alc_slave_sws[] = { |
| 2095 | "Front Playback Switch", |
| 2096 | "Surround Playback Switch", |
| 2097 | "Center Playback Switch", |
| 2098 | "LFE Playback Switch", |
| 2099 | "Side Playback Switch", |
| 2100 | "Headphone Playback Switch", |
| 2101 | "Speaker Playback Switch", |
| 2102 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2103 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2104 | NULL, |
| 2105 | }; |
| 2106 | |
| 2107 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2108 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2109 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2110 | |
| 2111 | static void alc_free_kctls(struct hda_codec *codec); |
| 2112 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2113 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2114 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2115 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2116 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2117 | { } /* end */ |
| 2118 | }; |
| 2119 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2120 | static int alc_build_controls(struct hda_codec *codec) |
| 2121 | { |
| 2122 | struct alc_spec *spec = codec->spec; |
| 2123 | int err; |
| 2124 | int i; |
| 2125 | |
| 2126 | for (i = 0; i < spec->num_mixers; i++) { |
| 2127 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2128 | if (err < 0) |
| 2129 | return err; |
| 2130 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2131 | if (spec->cap_mixer) { |
| 2132 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2133 | if (err < 0) |
| 2134 | return err; |
| 2135 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2136 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2137 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2138 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2139 | if (err < 0) |
| 2140 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2141 | if (!spec->no_analog) { |
| 2142 | err = snd_hda_create_spdif_share_sw(codec, |
| 2143 | &spec->multiout); |
| 2144 | if (err < 0) |
| 2145 | return err; |
| 2146 | spec->multiout.share_spdif = 1; |
| 2147 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2148 | } |
| 2149 | if (spec->dig_in_nid) { |
| 2150 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2151 | if (err < 0) |
| 2152 | return err; |
| 2153 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2154 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2155 | /* create beep controls if needed */ |
| 2156 | if (spec->beep_amp) { |
| 2157 | struct snd_kcontrol_new *knew; |
| 2158 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2159 | struct snd_kcontrol *kctl; |
| 2160 | kctl = snd_ctl_new1(knew, codec); |
| 2161 | if (!kctl) |
| 2162 | return -ENOMEM; |
| 2163 | kctl->private_value = spec->beep_amp; |
| 2164 | err = snd_hda_ctl_add(codec, kctl); |
| 2165 | if (err < 0) |
| 2166 | return err; |
| 2167 | } |
| 2168 | } |
| 2169 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2170 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2171 | if (!spec->no_analog && |
| 2172 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2173 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2174 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2175 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2176 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2177 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2178 | if (err < 0) |
| 2179 | return err; |
| 2180 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2181 | if (!spec->no_analog && |
| 2182 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2183 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2184 | NULL, alc_slave_sws); |
| 2185 | if (err < 0) |
| 2186 | return err; |
| 2187 | } |
| 2188 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2189 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2190 | return 0; |
| 2191 | } |
| 2192 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2193 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2194 | /* |
| 2195 | * initialize the codec volumes, etc |
| 2196 | */ |
| 2197 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2198 | /* |
| 2199 | * generic initialization of ADC, input mixers and output mixers |
| 2200 | */ |
| 2201 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2202 | /* |
| 2203 | * Unmute ADC0-2 and set the default input to mic-in |
| 2204 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2205 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2206 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2207 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2208 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2209 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2210 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2211 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2212 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2213 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2214 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2215 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2216 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2217 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2218 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2219 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2220 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2221 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2222 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2223 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2224 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2225 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2226 | /* |
| 2227 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2228 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2229 | /* set vol=0 to output mixers */ |
| 2230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2231 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2232 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2233 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2234 | /* set up input amps for analog loopback */ |
| 2235 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2236 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2237 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2238 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2239 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2240 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2241 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2242 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2243 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2244 | |
| 2245 | { } |
| 2246 | }; |
| 2247 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2248 | /* |
| 2249 | * 3-stack pin configuration: |
| 2250 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2251 | */ |
| 2252 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2253 | /* |
| 2254 | * preset connection lists of input pins |
| 2255 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2256 | */ |
| 2257 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2258 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2259 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2260 | |
| 2261 | /* |
| 2262 | * Set pin mode and muting |
| 2263 | */ |
| 2264 | /* set front pin widgets 0x14 for output */ |
| 2265 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2266 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2267 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2268 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2269 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2270 | /* Mic2 (as headphone out) for HP output */ |
| 2271 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2272 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2273 | /* Line In pin widget for input */ |
| 2274 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2275 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2276 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2277 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2278 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2279 | /* CD pin widget for input */ |
| 2280 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2281 | |
| 2282 | { } |
| 2283 | }; |
| 2284 | |
| 2285 | /* |
| 2286 | * 5-stack pin configuration: |
| 2287 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2288 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2289 | */ |
| 2290 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2291 | /* |
| 2292 | * preset connection lists of input pins |
| 2293 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2294 | */ |
| 2295 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2296 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2297 | |
| 2298 | /* |
| 2299 | * Set pin mode and muting |
| 2300 | */ |
| 2301 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2302 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2303 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2304 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2305 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2306 | /* unmute pins for output (no gain on this amp) */ |
| 2307 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2308 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2309 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2310 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2311 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2312 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2313 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2314 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2315 | /* Mic2 (as headphone out) for HP output */ |
| 2316 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2317 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2318 | /* Line In pin widget for input */ |
| 2319 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2320 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2321 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2322 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2323 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2324 | /* CD pin widget for input */ |
| 2325 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2326 | |
| 2327 | { } |
| 2328 | }; |
| 2329 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2330 | /* |
| 2331 | * W810 pin configuration: |
| 2332 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2333 | */ |
| 2334 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2335 | /* hphone/speaker input selector: front DAC */ |
| 2336 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2337 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2338 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2339 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2340 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2341 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2342 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2343 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2344 | |
| 2345 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2346 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2347 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2348 | { } |
| 2349 | }; |
| 2350 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2351 | /* |
| 2352 | * Z71V pin configuration: |
| 2353 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2354 | */ |
| 2355 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2356 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2357 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2358 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2359 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2360 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2361 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2362 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2363 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2364 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2365 | |
| 2366 | { } |
| 2367 | }; |
| 2368 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2369 | /* |
| 2370 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2371 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2372 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2373 | */ |
| 2374 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2375 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2376 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2377 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2378 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2379 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2380 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2381 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2382 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2383 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2384 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2385 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2386 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2387 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2388 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2389 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2390 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2391 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2392 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2393 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2394 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2395 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2396 | { } |
| 2397 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2398 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2399 | /* |
| 2400 | * Uniwill pin configuration: |
| 2401 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2402 | * line = 0x1a |
| 2403 | */ |
| 2404 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2405 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2406 | |
| 2407 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2408 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2409 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2410 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2411 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2412 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2413 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2414 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2415 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2416 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2417 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2418 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2419 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2420 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2421 | |
| 2422 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2423 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2424 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2425 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2426 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2427 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2428 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2429 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2430 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2431 | |
| 2432 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2433 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2434 | |
| 2435 | { } |
| 2436 | }; |
| 2437 | |
| 2438 | /* |
| 2439 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2440 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2441 | */ |
| 2442 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2443 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2444 | |
| 2445 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2446 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2447 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2449 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2450 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2451 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2452 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2453 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2454 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2455 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2456 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2457 | |
| 2458 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2459 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2460 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2461 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2462 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2463 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2464 | |
| 2465 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2466 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2467 | |
| 2468 | { } |
| 2469 | }; |
| 2470 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2471 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2472 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2473 | { } |
| 2474 | }; |
| 2475 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2476 | /* auto-toggle front mic */ |
| 2477 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2478 | { |
| 2479 | unsigned int present; |
| 2480 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2481 | |
| 2482 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2483 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2484 | bits = present ? HDA_AMP_MUTE : 0; |
| 2485 | 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] | 2486 | } |
| 2487 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2488 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2489 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2490 | struct alc_spec *spec = codec->spec; |
| 2491 | |
| 2492 | spec->autocfg.hp_pins[0] = 0x14; |
| 2493 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2494 | spec->autocfg.speaker_pins[0] = 0x16; |
| 2495 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2496 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2497 | } |
| 2498 | |
| 2499 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2500 | unsigned int res) |
| 2501 | { |
| 2502 | /* Looks like the unsol event is incompatible with the standard |
| 2503 | * definition. 4bit tag is placed at 28 bit! |
| 2504 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2505 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2506 | case ALC880_MIC_EVENT: |
| 2507 | alc880_uniwill_mic_automute(codec); |
| 2508 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2509 | default: |
| 2510 | alc_automute_amp_unsol_event(codec, res); |
| 2511 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2512 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2513 | } |
| 2514 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2515 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2516 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2517 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2518 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2519 | spec->autocfg.hp_pins[0] = 0x14; |
| 2520 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2521 | alc_automute_amp(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2522 | } |
| 2523 | |
| 2524 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2525 | { |
| 2526 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2527 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2528 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2529 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2530 | present &= HDA_AMP_VOLMASK; |
| 2531 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2532 | HDA_AMP_VOLMASK, present); |
| 2533 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2534 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2535 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2536 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2537 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2538 | unsigned int res) |
| 2539 | { |
| 2540 | /* Looks like the unsol event is incompatible with the standard |
| 2541 | * definition. 4bit tag is placed at 28 bit! |
| 2542 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2543 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2544 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2545 | else |
| 2546 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2547 | } |
| 2548 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2549 | /* |
| 2550 | * F1734 pin configuration: |
| 2551 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2552 | */ |
| 2553 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2554 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2555 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2556 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2557 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2558 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2559 | |
| 2560 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2561 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2562 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2563 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2564 | |
| 2565 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2566 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2567 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2568 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2569 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2570 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2571 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2572 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2573 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2574 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2575 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2576 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2577 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2578 | { } |
| 2579 | }; |
| 2580 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2581 | /* |
| 2582 | * ASUS pin configuration: |
| 2583 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2584 | */ |
| 2585 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2586 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2587 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2588 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2589 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2590 | |
| 2591 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2592 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2593 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2594 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2595 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2596 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2597 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2598 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2599 | |
| 2600 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2601 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2602 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2603 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2604 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2605 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2606 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2607 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2608 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2609 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2610 | { } |
| 2611 | }; |
| 2612 | |
| 2613 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2614 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2615 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2616 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2617 | /* Clevo m520g init */ |
| 2618 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2619 | /* headphone output */ |
| 2620 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2621 | /* line-out */ |
| 2622 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2623 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2624 | /* Line-in */ |
| 2625 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2626 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2627 | /* CD */ |
| 2628 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2629 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2630 | /* Mic1 (rear panel) */ |
| 2631 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2632 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2633 | /* Mic2 (front panel) */ |
| 2634 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2635 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2636 | /* headphone */ |
| 2637 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2638 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2639 | /* change to EAPD mode */ |
| 2640 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2641 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2642 | |
| 2643 | { } |
| 2644 | }; |
| 2645 | |
| 2646 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2647 | /* change to EAPD mode */ |
| 2648 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2649 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2650 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2651 | /* Headphone output */ |
| 2652 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2653 | /* Front output*/ |
| 2654 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2655 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2656 | |
| 2657 | /* Line In pin widget for input */ |
| 2658 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2659 | /* CD pin widget for input */ |
| 2660 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2661 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2662 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2663 | |
| 2664 | /* change to EAPD mode */ |
| 2665 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2666 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2667 | |
| 2668 | { } |
| 2669 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2670 | |
| 2671 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2672 | * LG m1 express dual |
| 2673 | * |
| 2674 | * Pin assignment: |
| 2675 | * Rear Line-In/Out (blue): 0x14 |
| 2676 | * Build-in Mic-In: 0x15 |
| 2677 | * Speaker-out: 0x17 |
| 2678 | * HP-Out (green): 0x1b |
| 2679 | * Mic-In/Out (red): 0x19 |
| 2680 | * SPDIF-Out: 0x1e |
| 2681 | */ |
| 2682 | |
| 2683 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2684 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2685 | 0x05, 0x02, 0x03 |
| 2686 | }; |
| 2687 | |
| 2688 | /* seems analog CD is not working */ |
| 2689 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2690 | .num_items = 3, |
| 2691 | .items = { |
| 2692 | { "Mic", 0x1 }, |
| 2693 | { "Line", 0x5 }, |
| 2694 | { "Internal Mic", 0x6 }, |
| 2695 | }, |
| 2696 | }; |
| 2697 | |
| 2698 | /* 2,4,6 channel modes */ |
| 2699 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2700 | /* set line-in and mic-in to input */ |
| 2701 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2702 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2703 | { } |
| 2704 | }; |
| 2705 | |
| 2706 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2707 | /* set line-in to out and mic-in to input */ |
| 2708 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2709 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2710 | { } |
| 2711 | }; |
| 2712 | |
| 2713 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2714 | /* set line-in and mic-in to output */ |
| 2715 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2716 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2717 | { } |
| 2718 | }; |
| 2719 | |
| 2720 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2721 | { 2, alc880_lg_ch2_init }, |
| 2722 | { 4, alc880_lg_ch4_init }, |
| 2723 | { 6, alc880_lg_ch6_init }, |
| 2724 | }; |
| 2725 | |
| 2726 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2727 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2728 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2729 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2730 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2731 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2732 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2733 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2734 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2735 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2736 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2737 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2738 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2739 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2740 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2741 | { |
| 2742 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2743 | .name = "Channel Mode", |
| 2744 | .info = alc_ch_mode_info, |
| 2745 | .get = alc_ch_mode_get, |
| 2746 | .put = alc_ch_mode_put, |
| 2747 | }, |
| 2748 | { } /* end */ |
| 2749 | }; |
| 2750 | |
| 2751 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2752 | /* set capture source to mic-in */ |
| 2753 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2754 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2755 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2756 | /* mute all amp mixer inputs */ |
| 2757 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2758 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2759 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2760 | /* line-in to input */ |
| 2761 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2762 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2763 | /* built-in mic */ |
| 2764 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2765 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2766 | /* speaker-out */ |
| 2767 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2768 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2769 | /* mic-in to input */ |
| 2770 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2771 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2772 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2773 | /* HP-out */ |
| 2774 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2775 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2776 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2777 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2778 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2779 | { } |
| 2780 | }; |
| 2781 | |
| 2782 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2783 | static void alc880_lg_init_hook(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2784 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2785 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2786 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2787 | spec->autocfg.hp_pins[0] = 0x1b; |
| 2788 | spec->autocfg.speaker_pins[0] = 0x17; |
| 2789 | alc_automute_amp(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2790 | } |
| 2791 | |
| 2792 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2793 | * LG LW20 |
| 2794 | * |
| 2795 | * Pin assignment: |
| 2796 | * Speaker-out: 0x14 |
| 2797 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2798 | * Built-in Mic-In: 0x19 |
| 2799 | * Line-In: 0x1b |
| 2800 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2801 | * SPDIF-Out: 0x1e |
| 2802 | */ |
| 2803 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2804 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2805 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2806 | .items = { |
| 2807 | { "Mic", 0x0 }, |
| 2808 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2809 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2810 | }, |
| 2811 | }; |
| 2812 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2813 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2814 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2815 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2816 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2817 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2818 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2819 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2820 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2821 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2822 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2823 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2824 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2825 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2826 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2827 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2828 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2829 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2830 | { |
| 2831 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2832 | .name = "Channel Mode", |
| 2833 | .info = alc_ch_mode_info, |
| 2834 | .get = alc_ch_mode_get, |
| 2835 | .put = alc_ch_mode_put, |
| 2836 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2837 | { } /* end */ |
| 2838 | }; |
| 2839 | |
| 2840 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2841 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2842 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2843 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2844 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2845 | /* set capture source to mic-in */ |
| 2846 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2847 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2848 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2849 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2850 | /* speaker-out */ |
| 2851 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2852 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2853 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2854 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2855 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2856 | /* mic-in to input */ |
| 2857 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2858 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2859 | /* built-in mic */ |
| 2860 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2861 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2862 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2863 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2864 | { } |
| 2865 | }; |
| 2866 | |
| 2867 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2868 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2869 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2870 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2871 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2872 | spec->autocfg.hp_pins[0] = 0x1b; |
| 2873 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2874 | alc_automute_amp(codec); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2875 | } |
| 2876 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2877 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2878 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2879 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2880 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2881 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2882 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2883 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2884 | { } /* end */ |
| 2885 | }; |
| 2886 | |
| 2887 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2888 | .num_items = 2, |
| 2889 | .items = { |
| 2890 | { "Mic", 0x0 }, |
| 2891 | { "Internal Mic", 0x1 }, |
| 2892 | }, |
| 2893 | }; |
| 2894 | |
| 2895 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2896 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2897 | |
| 2898 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2899 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2900 | |
| 2901 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2902 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2903 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2904 | /* Mic2 (as headphone out) for HP output */ |
| 2905 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2906 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2907 | /* Internal Speaker */ |
| 2908 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2909 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2910 | |
| 2911 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2912 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2913 | |
| 2914 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2915 | { } |
| 2916 | }; |
| 2917 | |
| 2918 | /* toggle speaker-output according to the hp-jack state */ |
| 2919 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2920 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2921 | struct alc_spec *spec = codec->spec; |
| 2922 | alc_automute_amp(codec); |
| 2923 | /* toggle EAPD */ |
| 2924 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2925 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2926 | else |
| 2927 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2928 | } |
| 2929 | |
| 2930 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2931 | unsigned int res) |
| 2932 | { |
| 2933 | /* Looks like the unsol event is incompatible with the standard |
| 2934 | * definition. 4bit tag is placed at 28 bit! |
| 2935 | */ |
| 2936 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2937 | alc880_medion_rim_automute(codec); |
| 2938 | } |
| 2939 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2940 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) |
| 2941 | { |
| 2942 | struct alc_spec *spec = codec->spec; |
| 2943 | |
| 2944 | spec->autocfg.hp_pins[0] = 0x14; |
| 2945 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 2946 | alc880_medion_rim_automute(codec); |
| 2947 | } |
| 2948 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2949 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2950 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2951 | { 0x0b, HDA_INPUT, 0 }, |
| 2952 | { 0x0b, HDA_INPUT, 1 }, |
| 2953 | { 0x0b, HDA_INPUT, 2 }, |
| 2954 | { 0x0b, HDA_INPUT, 3 }, |
| 2955 | { 0x0b, HDA_INPUT, 4 }, |
| 2956 | { } /* end */ |
| 2957 | }; |
| 2958 | |
| 2959 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2960 | { 0x0b, HDA_INPUT, 1 }, |
| 2961 | { 0x0b, HDA_INPUT, 6 }, |
| 2962 | { 0x0b, HDA_INPUT, 7 }, |
| 2963 | { } /* end */ |
| 2964 | }; |
| 2965 | #endif |
| 2966 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2967 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2968 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2969 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2970 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2971 | static int alc_init(struct hda_codec *codec) |
| 2972 | { |
| 2973 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2974 | unsigned int i; |
| 2975 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2976 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 2977 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2978 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2979 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2980 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2981 | |
| 2982 | if (spec->init_hook) |
| 2983 | spec->init_hook(codec); |
| 2984 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2985 | return 0; |
| 2986 | } |
| 2987 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2988 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2989 | { |
| 2990 | struct alc_spec *spec = codec->spec; |
| 2991 | |
| 2992 | if (spec->unsol_event) |
| 2993 | spec->unsol_event(codec, res); |
| 2994 | } |
| 2995 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2996 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2997 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2998 | { |
| 2999 | struct alc_spec *spec = codec->spec; |
| 3000 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3001 | } |
| 3002 | #endif |
| 3003 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3004 | /* |
| 3005 | * Analog playback callbacks |
| 3006 | */ |
| 3007 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3008 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3009 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3010 | { |
| 3011 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3012 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3013 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3014 | } |
| 3015 | |
| 3016 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3017 | struct hda_codec *codec, |
| 3018 | unsigned int stream_tag, |
| 3019 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3020 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3021 | { |
| 3022 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3023 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3024 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3025 | } |
| 3026 | |
| 3027 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3028 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3029 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3030 | { |
| 3031 | struct alc_spec *spec = codec->spec; |
| 3032 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3033 | } |
| 3034 | |
| 3035 | /* |
| 3036 | * Digital out |
| 3037 | */ |
| 3038 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3039 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3040 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3041 | { |
| 3042 | struct alc_spec *spec = codec->spec; |
| 3043 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3044 | } |
| 3045 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3046 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3047 | struct hda_codec *codec, |
| 3048 | unsigned int stream_tag, |
| 3049 | unsigned int format, |
| 3050 | struct snd_pcm_substream *substream) |
| 3051 | { |
| 3052 | struct alc_spec *spec = codec->spec; |
| 3053 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3054 | stream_tag, format, substream); |
| 3055 | } |
| 3056 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3057 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3058 | struct hda_codec *codec, |
| 3059 | struct snd_pcm_substream *substream) |
| 3060 | { |
| 3061 | struct alc_spec *spec = codec->spec; |
| 3062 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3063 | } |
| 3064 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3065 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3066 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3067 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3068 | { |
| 3069 | struct alc_spec *spec = codec->spec; |
| 3070 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3071 | } |
| 3072 | |
| 3073 | /* |
| 3074 | * Analog capture |
| 3075 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3076 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3077 | struct hda_codec *codec, |
| 3078 | unsigned int stream_tag, |
| 3079 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3080 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3081 | { |
| 3082 | struct alc_spec *spec = codec->spec; |
| 3083 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3084 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3085 | stream_tag, 0, format); |
| 3086 | return 0; |
| 3087 | } |
| 3088 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3089 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3090 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3091 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3092 | { |
| 3093 | struct alc_spec *spec = codec->spec; |
| 3094 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3095 | snd_hda_codec_cleanup_stream(codec, |
| 3096 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3097 | return 0; |
| 3098 | } |
| 3099 | |
| 3100 | |
| 3101 | /* |
| 3102 | */ |
| 3103 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3104 | .substreams = 1, |
| 3105 | .channels_min = 2, |
| 3106 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3107 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3108 | .ops = { |
| 3109 | .open = alc880_playback_pcm_open, |
| 3110 | .prepare = alc880_playback_pcm_prepare, |
| 3111 | .cleanup = alc880_playback_pcm_cleanup |
| 3112 | }, |
| 3113 | }; |
| 3114 | |
| 3115 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3116 | .substreams = 1, |
| 3117 | .channels_min = 2, |
| 3118 | .channels_max = 2, |
| 3119 | /* NID is set in alc_build_pcms */ |
| 3120 | }; |
| 3121 | |
| 3122 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3123 | .substreams = 1, |
| 3124 | .channels_min = 2, |
| 3125 | .channels_max = 2, |
| 3126 | /* NID is set in alc_build_pcms */ |
| 3127 | }; |
| 3128 | |
| 3129 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3130 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3131 | .channels_min = 2, |
| 3132 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3133 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3134 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3135 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3136 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3137 | }, |
| 3138 | }; |
| 3139 | |
| 3140 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3141 | .substreams = 1, |
| 3142 | .channels_min = 2, |
| 3143 | .channels_max = 2, |
| 3144 | /* NID is set in alc_build_pcms */ |
| 3145 | .ops = { |
| 3146 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3147 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3148 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3149 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3150 | }, |
| 3151 | }; |
| 3152 | |
| 3153 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3154 | .substreams = 1, |
| 3155 | .channels_min = 2, |
| 3156 | .channels_max = 2, |
| 3157 | /* NID is set in alc_build_pcms */ |
| 3158 | }; |
| 3159 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3160 | /* 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] | 3161 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3162 | .substreams = 0, |
| 3163 | .channels_min = 0, |
| 3164 | .channels_max = 0, |
| 3165 | }; |
| 3166 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3167 | static int alc_build_pcms(struct hda_codec *codec) |
| 3168 | { |
| 3169 | struct alc_spec *spec = codec->spec; |
| 3170 | struct hda_pcm *info = spec->pcm_rec; |
| 3171 | int i; |
| 3172 | |
| 3173 | codec->num_pcms = 1; |
| 3174 | codec->pcm_info = info; |
| 3175 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3176 | if (spec->no_analog) |
| 3177 | goto skip_analog; |
| 3178 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3179 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3180 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3181 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3182 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3183 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3184 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3185 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3186 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3187 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3188 | } |
| 3189 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3190 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3191 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3192 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3193 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3194 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3195 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3196 | if (spec->channel_mode) { |
| 3197 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3198 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3199 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3200 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3201 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3202 | } |
| 3203 | } |
| 3204 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3205 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3206 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3207 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3208 | snprintf(spec->stream_name_digital, |
| 3209 | sizeof(spec->stream_name_digital), |
| 3210 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3211 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3212 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3213 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3214 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3215 | if (spec->dig_out_type) |
| 3216 | info->pcm_type = spec->dig_out_type; |
| 3217 | else |
| 3218 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3219 | if (spec->multiout.dig_out_nid && |
| 3220 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3221 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3222 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3223 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3224 | if (spec->dig_in_nid && |
| 3225 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3226 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3227 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3228 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3229 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3230 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3231 | } |
| 3232 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3233 | if (spec->no_analog) |
| 3234 | return 0; |
| 3235 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3236 | /* If the use of more than one ADC is requested for the current |
| 3237 | * model, configure a second analog capture-only PCM. |
| 3238 | */ |
| 3239 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3240 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3241 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3242 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3243 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3244 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3245 | if (spec->alt_dac_nid) { |
| 3246 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3247 | *spec->stream_analog_alt_playback; |
| 3248 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3249 | spec->alt_dac_nid; |
| 3250 | } else { |
| 3251 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3252 | alc_pcm_null_stream; |
| 3253 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3254 | } |
| 3255 | if (spec->num_adc_nids > 1) { |
| 3256 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3257 | *spec->stream_analog_alt_capture; |
| 3258 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3259 | spec->adc_nids[1]; |
| 3260 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3261 | spec->num_adc_nids - 1; |
| 3262 | } else { |
| 3263 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3264 | alc_pcm_null_stream; |
| 3265 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3266 | } |
| 3267 | } |
| 3268 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3269 | return 0; |
| 3270 | } |
| 3271 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3272 | static void alc_free_kctls(struct hda_codec *codec) |
| 3273 | { |
| 3274 | struct alc_spec *spec = codec->spec; |
| 3275 | |
| 3276 | if (spec->kctls.list) { |
| 3277 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3278 | int i; |
| 3279 | for (i = 0; i < spec->kctls.used; i++) |
| 3280 | kfree(kctl[i].name); |
| 3281 | } |
| 3282 | snd_array_free(&spec->kctls); |
| 3283 | } |
| 3284 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3285 | static void alc_free(struct hda_codec *codec) |
| 3286 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3287 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3288 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3289 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3290 | return; |
| 3291 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3292 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3293 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3294 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3295 | } |
| 3296 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3297 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3298 | static int alc_resume(struct hda_codec *codec) |
| 3299 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3300 | codec->patch_ops.init(codec); |
| 3301 | snd_hda_codec_resume_amp(codec); |
| 3302 | snd_hda_codec_resume_cache(codec); |
| 3303 | return 0; |
| 3304 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3305 | #endif |
| 3306 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3307 | /* |
| 3308 | */ |
| 3309 | static struct hda_codec_ops alc_patch_ops = { |
| 3310 | .build_controls = alc_build_controls, |
| 3311 | .build_pcms = alc_build_pcms, |
| 3312 | .init = alc_init, |
| 3313 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3314 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3315 | #ifdef SND_HDA_NEEDS_RESUME |
| 3316 | .resume = alc_resume, |
| 3317 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3318 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3319 | .check_power_status = alc_check_power_status, |
| 3320 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3321 | }; |
| 3322 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3323 | |
| 3324 | /* |
| 3325 | * Test configuration for debugging |
| 3326 | * |
| 3327 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3328 | * enum controls. |
| 3329 | */ |
| 3330 | #ifdef CONFIG_SND_DEBUG |
| 3331 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3332 | 0x02, 0x03, 0x04, 0x05 |
| 3333 | }; |
| 3334 | |
| 3335 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3336 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3337 | .items = { |
| 3338 | { "In-1", 0x0 }, |
| 3339 | { "In-2", 0x1 }, |
| 3340 | { "In-3", 0x2 }, |
| 3341 | { "In-4", 0x3 }, |
| 3342 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3343 | { "Front", 0x5 }, |
| 3344 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3345 | }, |
| 3346 | }; |
| 3347 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3348 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3349 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3350 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3351 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3352 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3353 | }; |
| 3354 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3355 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3356 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3357 | { |
| 3358 | static char *texts[] = { |
| 3359 | "N/A", "Line Out", "HP Out", |
| 3360 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3361 | }; |
| 3362 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3363 | uinfo->count = 1; |
| 3364 | uinfo->value.enumerated.items = 8; |
| 3365 | if (uinfo->value.enumerated.item >= 8) |
| 3366 | uinfo->value.enumerated.item = 7; |
| 3367 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3368 | return 0; |
| 3369 | } |
| 3370 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3371 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3372 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3373 | { |
| 3374 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3375 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3376 | unsigned int pin_ctl, item = 0; |
| 3377 | |
| 3378 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3379 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3380 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3381 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3382 | item = 2; |
| 3383 | else |
| 3384 | item = 1; |
| 3385 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3386 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3387 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3388 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3389 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3390 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3391 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3392 | } |
| 3393 | } |
| 3394 | ucontrol->value.enumerated.item[0] = item; |
| 3395 | return 0; |
| 3396 | } |
| 3397 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3398 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3399 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3400 | { |
| 3401 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3402 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3403 | static unsigned int ctls[] = { |
| 3404 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3405 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3406 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3407 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3408 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3409 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3410 | }; |
| 3411 | unsigned int old_ctl, new_ctl; |
| 3412 | |
| 3413 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3414 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3415 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3416 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3417 | int val; |
| 3418 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3419 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3420 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3421 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3422 | HDA_AMP_MUTE : 0; |
| 3423 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3424 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3425 | return 1; |
| 3426 | } |
| 3427 | return 0; |
| 3428 | } |
| 3429 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3430 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3431 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3432 | { |
| 3433 | static char *texts[] = { |
| 3434 | "Front", "Surround", "CLFE", "Side" |
| 3435 | }; |
| 3436 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3437 | uinfo->count = 1; |
| 3438 | uinfo->value.enumerated.items = 4; |
| 3439 | if (uinfo->value.enumerated.item >= 4) |
| 3440 | uinfo->value.enumerated.item = 3; |
| 3441 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3442 | return 0; |
| 3443 | } |
| 3444 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3445 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3446 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3447 | { |
| 3448 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3449 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3450 | unsigned int sel; |
| 3451 | |
| 3452 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3453 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3454 | return 0; |
| 3455 | } |
| 3456 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3457 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3458 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3459 | { |
| 3460 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3461 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3462 | unsigned int sel; |
| 3463 | |
| 3464 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3465 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3466 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3467 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3468 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3469 | return 1; |
| 3470 | } |
| 3471 | return 0; |
| 3472 | } |
| 3473 | |
| 3474 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3475 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3476 | .name = xname, \ |
| 3477 | .info = alc_test_pin_ctl_info, \ |
| 3478 | .get = alc_test_pin_ctl_get, \ |
| 3479 | .put = alc_test_pin_ctl_put, \ |
| 3480 | .private_value = nid \ |
| 3481 | } |
| 3482 | |
| 3483 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3484 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3485 | .name = xname, \ |
| 3486 | .info = alc_test_pin_src_info, \ |
| 3487 | .get = alc_test_pin_src_get, \ |
| 3488 | .put = alc_test_pin_src_put, \ |
| 3489 | .private_value = nid \ |
| 3490 | } |
| 3491 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3492 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3493 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3494 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3495 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3496 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3497 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3498 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3499 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3500 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3501 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3502 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3503 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3504 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3505 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3506 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3507 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3508 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3509 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3510 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3511 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3512 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3513 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3514 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3515 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3516 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3517 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3518 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3519 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3520 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3521 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3522 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3523 | { |
| 3524 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3525 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3526 | .info = alc_ch_mode_info, |
| 3527 | .get = alc_ch_mode_get, |
| 3528 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3529 | }, |
| 3530 | { } /* end */ |
| 3531 | }; |
| 3532 | |
| 3533 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3534 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3535 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3536 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3537 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3538 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3539 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3540 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3541 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3542 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3543 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3544 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3545 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3546 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3547 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3548 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3549 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3550 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3551 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3552 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3553 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3554 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3555 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3556 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3557 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3558 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3559 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3560 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3561 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3562 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3563 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3564 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3565 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3566 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3567 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3568 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3569 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3570 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3571 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3572 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3573 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3574 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3575 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3576 | /* Analog input/passthru */ |
| 3577 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3578 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3579 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3580 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3581 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3582 | { } |
| 3583 | }; |
| 3584 | #endif |
| 3585 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3586 | /* |
| 3587 | */ |
| 3588 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3589 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3590 | [ALC880_3ST] = "3stack", |
| 3591 | [ALC880_TCL_S700] = "tcl", |
| 3592 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3593 | [ALC880_CLEVO] = "clevo", |
| 3594 | [ALC880_5ST] = "5stack", |
| 3595 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3596 | [ALC880_W810] = "w810", |
| 3597 | [ALC880_Z71V] = "z71v", |
| 3598 | [ALC880_6ST] = "6stack", |
| 3599 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3600 | [ALC880_ASUS] = "asus", |
| 3601 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3602 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3603 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3604 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3605 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3606 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3607 | [ALC880_F1734] = "F1734", |
| 3608 | [ALC880_LG] = "lg", |
| 3609 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3610 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3611 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3612 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3613 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3614 | [ALC880_AUTO] = "auto", |
| 3615 | }; |
| 3616 | |
| 3617 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3618 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3619 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3620 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3621 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3622 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3623 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3624 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3625 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3626 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3627 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3628 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3629 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3630 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3631 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3632 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3633 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3634 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3635 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3636 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3637 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3638 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3639 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3640 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3641 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3642 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3643 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3644 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3645 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3646 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3647 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3648 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3649 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3650 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3651 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3652 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3653 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3654 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3655 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3656 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3657 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3658 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3659 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3660 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3661 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3662 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3663 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3664 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3665 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3666 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3667 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3668 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3669 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3670 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3671 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3672 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3673 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3674 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3675 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3676 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3677 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3678 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3679 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3680 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3681 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3682 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3683 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3684 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3685 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3686 | /* default Intel */ |
| 3687 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3688 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3689 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3690 | {} |
| 3691 | }; |
| 3692 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3693 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3694 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3695 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3696 | static struct alc_config_preset alc880_presets[] = { |
| 3697 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3698 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3699 | .init_verbs = { alc880_volume_init_verbs, |
| 3700 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3701 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3702 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3703 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3704 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3705 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3706 | .input_mux = &alc880_capture_source, |
| 3707 | }, |
| 3708 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3709 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3710 | .init_verbs = { alc880_volume_init_verbs, |
| 3711 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3712 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3713 | .dac_nids = alc880_dac_nids, |
| 3714 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3715 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3716 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3717 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3718 | .input_mux = &alc880_capture_source, |
| 3719 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3720 | [ALC880_TCL_S700] = { |
| 3721 | .mixers = { alc880_tcl_s700_mixer }, |
| 3722 | .init_verbs = { alc880_volume_init_verbs, |
| 3723 | alc880_pin_tcl_S700_init_verbs, |
| 3724 | alc880_gpio2_init_verbs }, |
| 3725 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3726 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3727 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3728 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3729 | .hp_nid = 0x03, |
| 3730 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3731 | .channel_mode = alc880_2_jack_modes, |
| 3732 | .input_mux = &alc880_capture_source, |
| 3733 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3734 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3735 | .mixers = { alc880_three_stack_mixer, |
| 3736 | alc880_five_stack_mixer}, |
| 3737 | .init_verbs = { alc880_volume_init_verbs, |
| 3738 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3739 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3740 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3741 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3742 | .channel_mode = alc880_fivestack_modes, |
| 3743 | .input_mux = &alc880_capture_source, |
| 3744 | }, |
| 3745 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3746 | .mixers = { alc880_three_stack_mixer, |
| 3747 | alc880_five_stack_mixer }, |
| 3748 | .init_verbs = { alc880_volume_init_verbs, |
| 3749 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3750 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3751 | .dac_nids = alc880_dac_nids, |
| 3752 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3753 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3754 | .channel_mode = alc880_fivestack_modes, |
| 3755 | .input_mux = &alc880_capture_source, |
| 3756 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3757 | [ALC880_6ST] = { |
| 3758 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3759 | .init_verbs = { alc880_volume_init_verbs, |
| 3760 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3761 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3762 | .dac_nids = alc880_6st_dac_nids, |
| 3763 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3764 | .channel_mode = alc880_sixstack_modes, |
| 3765 | .input_mux = &alc880_6stack_capture_source, |
| 3766 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3767 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3768 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3769 | .init_verbs = { alc880_volume_init_verbs, |
| 3770 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3771 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3772 | .dac_nids = alc880_6st_dac_nids, |
| 3773 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3774 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3775 | .channel_mode = alc880_sixstack_modes, |
| 3776 | .input_mux = &alc880_6stack_capture_source, |
| 3777 | }, |
| 3778 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3779 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3780 | .init_verbs = { alc880_volume_init_verbs, |
| 3781 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3782 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3783 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3784 | .dac_nids = alc880_w810_dac_nids, |
| 3785 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3786 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3787 | .channel_mode = alc880_w810_modes, |
| 3788 | .input_mux = &alc880_capture_source, |
| 3789 | }, |
| 3790 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3791 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3792 | .init_verbs = { alc880_volume_init_verbs, |
| 3793 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3794 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3795 | .dac_nids = alc880_z71v_dac_nids, |
| 3796 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3797 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3798 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3799 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3800 | .input_mux = &alc880_capture_source, |
| 3801 | }, |
| 3802 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3803 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3804 | .init_verbs = { alc880_volume_init_verbs, |
| 3805 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3806 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3807 | .dac_nids = alc880_f1734_dac_nids, |
| 3808 | .hp_nid = 0x02, |
| 3809 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3810 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3811 | .input_mux = &alc880_f1734_capture_source, |
| 3812 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3813 | .init_hook = alc880_uniwill_p53_init_hook, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3814 | }, |
| 3815 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3816 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3817 | .init_verbs = { alc880_volume_init_verbs, |
| 3818 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3819 | alc880_gpio1_init_verbs }, |
| 3820 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3821 | .dac_nids = alc880_asus_dac_nids, |
| 3822 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3823 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3824 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3825 | .input_mux = &alc880_capture_source, |
| 3826 | }, |
| 3827 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3828 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3829 | .init_verbs = { alc880_volume_init_verbs, |
| 3830 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3831 | alc880_gpio1_init_verbs }, |
| 3832 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3833 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3834 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3835 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3836 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3837 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3838 | .input_mux = &alc880_capture_source, |
| 3839 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3840 | [ALC880_ASUS_DIG2] = { |
| 3841 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3842 | .init_verbs = { alc880_volume_init_verbs, |
| 3843 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3844 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3845 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3846 | .dac_nids = alc880_asus_dac_nids, |
| 3847 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3848 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3849 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3850 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3851 | .input_mux = &alc880_capture_source, |
| 3852 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3853 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3854 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3855 | .init_verbs = { alc880_volume_init_verbs, |
| 3856 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3857 | alc880_gpio1_init_verbs }, |
| 3858 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3859 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3860 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3861 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3862 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3863 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3864 | .input_mux = &alc880_capture_source, |
| 3865 | }, |
| 3866 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3867 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3868 | .init_verbs = { alc880_volume_init_verbs, |
| 3869 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3870 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3871 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3872 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3873 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3874 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3875 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3876 | .input_mux = &alc880_capture_source, |
| 3877 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3878 | [ALC880_UNIWILL] = { |
| 3879 | .mixers = { alc880_uniwill_mixer }, |
| 3880 | .init_verbs = { alc880_volume_init_verbs, |
| 3881 | alc880_uniwill_init_verbs }, |
| 3882 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3883 | .dac_nids = alc880_asus_dac_nids, |
| 3884 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3885 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3886 | .channel_mode = alc880_threestack_modes, |
| 3887 | .need_dac_fix = 1, |
| 3888 | .input_mux = &alc880_capture_source, |
| 3889 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3890 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3891 | }, |
| 3892 | [ALC880_UNIWILL_P53] = { |
| 3893 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3894 | .init_verbs = { alc880_volume_init_verbs, |
| 3895 | alc880_uniwill_p53_init_verbs }, |
| 3896 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3897 | .dac_nids = alc880_asus_dac_nids, |
| 3898 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3899 | .channel_mode = alc880_threestack_modes, |
| 3900 | .input_mux = &alc880_capture_source, |
| 3901 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3902 | .init_hook = alc880_uniwill_p53_init_hook, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3903 | }, |
| 3904 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3905 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3906 | .init_verbs = { alc880_volume_init_verbs, |
| 3907 | alc880_uniwill_p53_init_verbs, |
| 3908 | alc880_beep_init_verbs }, |
| 3909 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3910 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3911 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3912 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3913 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3914 | .input_mux = &alc880_capture_source, |
| 3915 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3916 | .init_hook = alc880_uniwill_p53_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3917 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3918 | [ALC880_CLEVO] = { |
| 3919 | .mixers = { alc880_three_stack_mixer }, |
| 3920 | .init_verbs = { alc880_volume_init_verbs, |
| 3921 | alc880_pin_clevo_init_verbs }, |
| 3922 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3923 | .dac_nids = alc880_dac_nids, |
| 3924 | .hp_nid = 0x03, |
| 3925 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3926 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3927 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3928 | .input_mux = &alc880_capture_source, |
| 3929 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3930 | [ALC880_LG] = { |
| 3931 | .mixers = { alc880_lg_mixer }, |
| 3932 | .init_verbs = { alc880_volume_init_verbs, |
| 3933 | alc880_lg_init_verbs }, |
| 3934 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3935 | .dac_nids = alc880_lg_dac_nids, |
| 3936 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3937 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3938 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3939 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3940 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3941 | .unsol_event = alc_automute_amp_unsol_event, |
| 3942 | .init_hook = alc880_lg_init_hook, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3943 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3944 | .loopbacks = alc880_lg_loopbacks, |
| 3945 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3946 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3947 | [ALC880_LG_LW] = { |
| 3948 | .mixers = { alc880_lg_lw_mixer }, |
| 3949 | .init_verbs = { alc880_volume_init_verbs, |
| 3950 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3951 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3952 | .dac_nids = alc880_dac_nids, |
| 3953 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3954 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3955 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3956 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3957 | .unsol_event = alc_automute_amp_unsol_event, |
| 3958 | .init_hook = alc880_lg_lw_init_hook, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3959 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3960 | [ALC880_MEDION_RIM] = { |
| 3961 | .mixers = { alc880_medion_rim_mixer }, |
| 3962 | .init_verbs = { alc880_volume_init_verbs, |
| 3963 | alc880_medion_rim_init_verbs, |
| 3964 | alc_gpio2_init_verbs }, |
| 3965 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3966 | .dac_nids = alc880_dac_nids, |
| 3967 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3968 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3969 | .channel_mode = alc880_2_jack_modes, |
| 3970 | .input_mux = &alc880_medion_rim_capture_source, |
| 3971 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3972 | .init_hook = alc880_medion_rim_init_hook, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3973 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3974 | #ifdef CONFIG_SND_DEBUG |
| 3975 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3976 | .mixers = { alc880_test_mixer }, |
| 3977 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3978 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3979 | .dac_nids = alc880_test_dac_nids, |
| 3980 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3981 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3982 | .channel_mode = alc880_test_modes, |
| 3983 | .input_mux = &alc880_test_capture_source, |
| 3984 | }, |
| 3985 | #endif |
| 3986 | }; |
| 3987 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3988 | /* |
| 3989 | * Automatic parse of I/O pins from the BIOS configuration |
| 3990 | */ |
| 3991 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3992 | enum { |
| 3993 | ALC_CTL_WIDGET_VOL, |
| 3994 | ALC_CTL_WIDGET_MUTE, |
| 3995 | ALC_CTL_BIND_MUTE, |
| 3996 | }; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3997 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3998 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3999 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4000 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4001 | }; |
| 4002 | |
| 4003 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4004 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4005 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4006 | { |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4007 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4008 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4009 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4010 | knew = snd_array_new(&spec->kctls); |
| 4011 | if (!knew) |
| 4012 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4013 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4014 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4015 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4016 | return -ENOMEM; |
| 4017 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4018 | return 0; |
| 4019 | } |
| 4020 | |
| 4021 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4022 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4023 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4024 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4025 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4026 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4027 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4028 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4029 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4030 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4031 | #define ALC880_PIN_CD_NID 0x1c |
| 4032 | |
| 4033 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4034 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4035 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4036 | { |
| 4037 | hda_nid_t nid; |
| 4038 | int assigned[4]; |
| 4039 | int i, j; |
| 4040 | |
| 4041 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4042 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4043 | |
| 4044 | /* check the pins hardwired to audio widget */ |
| 4045 | for (i = 0; i < cfg->line_outs; i++) { |
| 4046 | nid = cfg->line_out_pins[i]; |
| 4047 | if (alc880_is_fixed_pin(nid)) { |
| 4048 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4049 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4050 | assigned[idx] = 1; |
| 4051 | } |
| 4052 | } |
| 4053 | /* left pins can be connect to any audio widget */ |
| 4054 | for (i = 0; i < cfg->line_outs; i++) { |
| 4055 | nid = cfg->line_out_pins[i]; |
| 4056 | if (alc880_is_fixed_pin(nid)) |
| 4057 | continue; |
| 4058 | /* search for an empty channel */ |
| 4059 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4060 | if (!assigned[j]) { |
| 4061 | spec->multiout.dac_nids[i] = |
| 4062 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4063 | assigned[j] = 1; |
| 4064 | break; |
| 4065 | } |
| 4066 | } |
| 4067 | } |
| 4068 | spec->multiout.num_dacs = cfg->line_outs; |
| 4069 | return 0; |
| 4070 | } |
| 4071 | |
| 4072 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4073 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4074 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4075 | { |
| 4076 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4077 | static const char *chname[4] = { |
| 4078 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4079 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4080 | hda_nid_t nid; |
| 4081 | int i, err; |
| 4082 | |
| 4083 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4084 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4085 | continue; |
| 4086 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4087 | if (i == 2) { |
| 4088 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4089 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4090 | "Center Playback Volume", |
| 4091 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4092 | HDA_OUTPUT)); |
| 4093 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4094 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4095 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4096 | "LFE Playback Volume", |
| 4097 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4098 | HDA_OUTPUT)); |
| 4099 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4100 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4101 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4102 | "Center Playback Switch", |
| 4103 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4104 | HDA_INPUT)); |
| 4105 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4106 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4107 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4108 | "LFE Playback Switch", |
| 4109 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4110 | HDA_INPUT)); |
| 4111 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4112 | return err; |
| 4113 | } else { |
| 4114 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4115 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4116 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4117 | HDA_OUTPUT)); |
| 4118 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4119 | return err; |
| 4120 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4121 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4122 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4123 | HDA_INPUT)); |
| 4124 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4125 | return err; |
| 4126 | } |
| 4127 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4128 | return 0; |
| 4129 | } |
| 4130 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4131 | /* add playback controls for speaker and HP outputs */ |
| 4132 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4133 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4134 | { |
| 4135 | hda_nid_t nid; |
| 4136 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4137 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4138 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4139 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4140 | return 0; |
| 4141 | |
| 4142 | if (alc880_is_fixed_pin(pin)) { |
| 4143 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4144 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4145 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4146 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4147 | else |
| 4148 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4149 | /* control HP volume/switch on the output mixer amp */ |
| 4150 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4151 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4152 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4153 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4154 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4155 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4156 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4157 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4158 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4159 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4160 | return err; |
| 4161 | } else if (alc880_is_multi_pin(pin)) { |
| 4162 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4163 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4164 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4165 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4166 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4167 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4168 | return err; |
| 4169 | } |
| 4170 | return 0; |
| 4171 | } |
| 4172 | |
| 4173 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4174 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4175 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4176 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4177 | { |
| 4178 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4179 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4180 | |
| 4181 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4182 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4183 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4184 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4185 | return err; |
| 4186 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4187 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4188 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4189 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4190 | return err; |
| 4191 | return 0; |
| 4192 | } |
| 4193 | |
| 4194 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4195 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4196 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4197 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4198 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4199 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4200 | |
| 4201 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4202 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4203 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4204 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4205 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4206 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4207 | if (err < 0) |
| 4208 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4209 | imux->items[imux->num_items].label = |
| 4210 | auto_pin_cfg_labels[i]; |
| 4211 | imux->items[imux->num_items].index = |
| 4212 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4213 | imux->num_items++; |
| 4214 | } |
| 4215 | } |
| 4216 | return 0; |
| 4217 | } |
| 4218 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4219 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4220 | unsigned int pin_type) |
| 4221 | { |
| 4222 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4223 | pin_type); |
| 4224 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4225 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4226 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4227 | } |
| 4228 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4229 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4230 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4231 | int dac_idx) |
| 4232 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4233 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4234 | /* need the manual connection? */ |
| 4235 | if (alc880_is_multi_pin(nid)) { |
| 4236 | struct alc_spec *spec = codec->spec; |
| 4237 | int idx = alc880_multi_pin_idx(nid); |
| 4238 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4239 | AC_VERB_SET_CONNECT_SEL, |
| 4240 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4241 | } |
| 4242 | } |
| 4243 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4244 | static int get_pin_type(int line_out_type) |
| 4245 | { |
| 4246 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4247 | return PIN_HP; |
| 4248 | else |
| 4249 | return PIN_OUT; |
| 4250 | } |
| 4251 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4252 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4253 | { |
| 4254 | struct alc_spec *spec = codec->spec; |
| 4255 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4256 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4257 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4258 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4259 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4260 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4261 | } |
| 4262 | } |
| 4263 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4264 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4265 | { |
| 4266 | struct alc_spec *spec = codec->spec; |
| 4267 | hda_nid_t pin; |
| 4268 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4269 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4270 | if (pin) /* connect to front */ |
| 4271 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4272 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4273 | if (pin) /* connect to front */ |
| 4274 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4275 | } |
| 4276 | |
| 4277 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4278 | { |
| 4279 | struct alc_spec *spec = codec->spec; |
| 4280 | int i; |
| 4281 | |
| 4282 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4283 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4284 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4285 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4286 | if (nid != ALC880_PIN_CD_NID && |
| 4287 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4288 | snd_hda_codec_write(codec, nid, 0, |
| 4289 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4290 | AMP_OUT_MUTE); |
| 4291 | } |
| 4292 | } |
| 4293 | } |
| 4294 | |
| 4295 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4296 | /* return 1 if successful, 0 if the proper config is not found, |
| 4297 | * or a negative error code |
| 4298 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4299 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4300 | { |
| 4301 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4302 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4303 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4304 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4305 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4306 | alc880_ignore); |
| 4307 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4308 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4309 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4310 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4311 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4312 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4313 | if (err < 0) |
| 4314 | return err; |
| 4315 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4316 | if (err < 0) |
| 4317 | return err; |
| 4318 | err = alc880_auto_create_extra_out(spec, |
| 4319 | spec->autocfg.speaker_pins[0], |
| 4320 | "Speaker"); |
| 4321 | if (err < 0) |
| 4322 | return err; |
| 4323 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4324 | "Headphone"); |
| 4325 | if (err < 0) |
| 4326 | return err; |
| 4327 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4328 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4329 | return err; |
| 4330 | |
| 4331 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4332 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4333 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4334 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4335 | hda_nid_t dig_nid; |
| 4336 | err = snd_hda_get_connections(codec, |
| 4337 | spec->autocfg.dig_out_pins[i], |
| 4338 | &dig_nid, 1); |
| 4339 | if (err < 0) |
| 4340 | continue; |
| 4341 | if (!i) |
| 4342 | spec->multiout.dig_out_nid = dig_nid; |
| 4343 | else { |
| 4344 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4345 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4346 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4347 | break; |
| 4348 | } |
| 4349 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4350 | if (spec->autocfg.dig_in_pin) |
| 4351 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4352 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4353 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4354 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4355 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4356 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4358 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4359 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4360 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4361 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4362 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4363 | return 1; |
| 4364 | } |
| 4365 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4366 | /* additional initialization for auto-configuration model */ |
| 4367 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4368 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4369 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4370 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4371 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4372 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4373 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4374 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4375 | } |
| 4376 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4377 | static void set_capture_mixer(struct alc_spec *spec) |
| 4378 | { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4379 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4380 | { alc_capture_mixer_nosrc1, |
| 4381 | alc_capture_mixer_nosrc2, |
| 4382 | alc_capture_mixer_nosrc3 }, |
| 4383 | { alc_capture_mixer1, |
| 4384 | alc_capture_mixer2, |
| 4385 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4386 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4387 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4388 | int mux; |
| 4389 | if (spec->input_mux && spec->input_mux->num_items > 1) |
| 4390 | mux = 1; |
| 4391 | else |
| 4392 | mux = 0; |
| 4393 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4394 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4395 | } |
| 4396 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4397 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4398 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4399 | |
| 4400 | /* |
| 4401 | * OK, here we have finally the patch for ALC880 |
| 4402 | */ |
| 4403 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4404 | static int patch_alc880(struct hda_codec *codec) |
| 4405 | { |
| 4406 | struct alc_spec *spec; |
| 4407 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4408 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4409 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4410 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4411 | if (spec == NULL) |
| 4412 | return -ENOMEM; |
| 4413 | |
| 4414 | codec->spec = spec; |
| 4415 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4416 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4417 | alc880_models, |
| 4418 | alc880_cfg_tbl); |
| 4419 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 4420 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 4421 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4422 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4423 | } |
| 4424 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4425 | if (board_config == ALC880_AUTO) { |
| 4426 | /* automatic parse from the BIOS config */ |
| 4427 | err = alc880_parse_auto_config(codec); |
| 4428 | if (err < 0) { |
| 4429 | alc_free(codec); |
| 4430 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4431 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4432 | printk(KERN_INFO |
| 4433 | "hda_codec: Cannot set up configuration " |
| 4434 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4435 | board_config = ALC880_3ST; |
| 4436 | } |
| 4437 | } |
| 4438 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4439 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4440 | if (err < 0) { |
| 4441 | alc_free(codec); |
| 4442 | return err; |
| 4443 | } |
| 4444 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4445 | if (board_config != ALC880_AUTO) |
| 4446 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4447 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4448 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4449 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4450 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4451 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4452 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4453 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4454 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4455 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4456 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4457 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4458 | /* get type */ |
| 4459 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4460 | if (wcap != AC_WID_AUD_IN) { |
| 4461 | spec->adc_nids = alc880_adc_nids_alt; |
| 4462 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4463 | } else { |
| 4464 | spec->adc_nids = alc880_adc_nids; |
| 4465 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4466 | } |
| 4467 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4468 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4469 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4470 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4471 | spec->vmaster_nid = 0x0c; |
| 4472 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4473 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4474 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4475 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4476 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4477 | if (!spec->loopback.amplist) |
| 4478 | spec->loopback.amplist = alc880_loopbacks; |
| 4479 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4480 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4481 | |
| 4482 | return 0; |
| 4483 | } |
| 4484 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4485 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4486 | /* |
| 4487 | * ALC260 support |
| 4488 | */ |
| 4489 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4490 | static hda_nid_t alc260_dac_nids[1] = { |
| 4491 | /* front */ |
| 4492 | 0x02, |
| 4493 | }; |
| 4494 | |
| 4495 | static hda_nid_t alc260_adc_nids[1] = { |
| 4496 | /* ADC0 */ |
| 4497 | 0x04, |
| 4498 | }; |
| 4499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4500 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4501 | /* ADC1 */ |
| 4502 | 0x05, |
| 4503 | }; |
| 4504 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4505 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4506 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4507 | */ |
| 4508 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4509 | /* ADC0, ADC1 */ |
| 4510 | 0x04, 0x05 |
| 4511 | }; |
| 4512 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4513 | #define ALC260_DIGOUT_NID 0x03 |
| 4514 | #define ALC260_DIGIN_NID 0x06 |
| 4515 | |
| 4516 | static struct hda_input_mux alc260_capture_source = { |
| 4517 | .num_items = 4, |
| 4518 | .items = { |
| 4519 | { "Mic", 0x0 }, |
| 4520 | { "Front Mic", 0x1 }, |
| 4521 | { "Line", 0x2 }, |
| 4522 | { "CD", 0x4 }, |
| 4523 | }, |
| 4524 | }; |
| 4525 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4526 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4527 | * headphone jack and the internal CD lines since these are the only pins at |
| 4528 | * which audio can appear. For flexibility, also allow the option of |
| 4529 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4530 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4531 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4532 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4533 | { |
| 4534 | .num_items = 3, |
| 4535 | .items = { |
| 4536 | { "Mic/Line", 0x0 }, |
| 4537 | { "CD", 0x4 }, |
| 4538 | { "Headphone", 0x2 }, |
| 4539 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4540 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4541 | { |
| 4542 | .num_items = 4, |
| 4543 | .items = { |
| 4544 | { "Mic/Line", 0x0 }, |
| 4545 | { "CD", 0x4 }, |
| 4546 | { "Headphone", 0x2 }, |
| 4547 | { "Mixer", 0x5 }, |
| 4548 | }, |
| 4549 | }, |
| 4550 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4551 | }; |
| 4552 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4553 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4554 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4555 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4556 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4557 | { |
| 4558 | .num_items = 4, |
| 4559 | .items = { |
| 4560 | { "Mic", 0x0 }, |
| 4561 | { "Line", 0x2 }, |
| 4562 | { "CD", 0x4 }, |
| 4563 | { "Headphone", 0x5 }, |
| 4564 | }, |
| 4565 | }, |
| 4566 | { |
| 4567 | .num_items = 5, |
| 4568 | .items = { |
| 4569 | { "Mic", 0x0 }, |
| 4570 | { "Line", 0x2 }, |
| 4571 | { "CD", 0x4 }, |
| 4572 | { "Headphone", 0x6 }, |
| 4573 | { "Mixer", 0x5 }, |
| 4574 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4575 | }, |
| 4576 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4577 | |
| 4578 | /* Maxdata Favorit 100XS */ |
| 4579 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4580 | { |
| 4581 | .num_items = 2, |
| 4582 | .items = { |
| 4583 | { "Line/Mic", 0x0 }, |
| 4584 | { "CD", 0x4 }, |
| 4585 | }, |
| 4586 | }, |
| 4587 | { |
| 4588 | .num_items = 3, |
| 4589 | .items = { |
| 4590 | { "Line/Mic", 0x0 }, |
| 4591 | { "CD", 0x4 }, |
| 4592 | { "Mixer", 0x5 }, |
| 4593 | }, |
| 4594 | }, |
| 4595 | }; |
| 4596 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4597 | /* |
| 4598 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4599 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4600 | * element which allows changing the channel mode, so the verb list is |
| 4601 | * never used. |
| 4602 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4603 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4604 | { 2, NULL }, |
| 4605 | }; |
| 4606 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4607 | |
| 4608 | /* Mixer combinations |
| 4609 | * |
| 4610 | * basic: base_output + input + pc_beep + capture |
| 4611 | * HP: base_output + input + capture_alt |
| 4612 | * HP_3013: hp_3013 + input + capture |
| 4613 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4614 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4615 | */ |
| 4616 | |
| 4617 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4618 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4619 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4620 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4621 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4622 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4623 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4624 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4625 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4626 | |
| 4627 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4628 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4629 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4630 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4631 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4632 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4633 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4634 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4635 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4636 | { } /* end */ |
| 4637 | }; |
| 4638 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4639 | /* update HP, line and mono out pins according to the master switch */ |
| 4640 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4641 | hda_nid_t hp, hda_nid_t line, |
| 4642 | hda_nid_t mono) |
| 4643 | { |
| 4644 | struct alc_spec *spec = codec->spec; |
| 4645 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4646 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4647 | 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] | 4648 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4649 | 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] | 4650 | val); |
| 4651 | /* mono (speaker) depending on the HP jack sense */ |
| 4652 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4653 | 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] | 4654 | val); |
| 4655 | } |
| 4656 | |
| 4657 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4658 | struct snd_ctl_elem_value *ucontrol) |
| 4659 | { |
| 4660 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4661 | struct alc_spec *spec = codec->spec; |
| 4662 | *ucontrol->value.integer.value = spec->master_sw; |
| 4663 | return 0; |
| 4664 | } |
| 4665 | |
| 4666 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4667 | struct snd_ctl_elem_value *ucontrol) |
| 4668 | { |
| 4669 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4670 | struct alc_spec *spec = codec->spec; |
| 4671 | int val = !!*ucontrol->value.integer.value; |
| 4672 | hda_nid_t hp, line, mono; |
| 4673 | |
| 4674 | if (val == spec->master_sw) |
| 4675 | return 0; |
| 4676 | spec->master_sw = val; |
| 4677 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4678 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4679 | mono = kcontrol->private_value & 0xff; |
| 4680 | alc260_hp_master_update(codec, hp, line, mono); |
| 4681 | return 1; |
| 4682 | } |
| 4683 | |
| 4684 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4685 | { |
| 4686 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4687 | .name = "Master Playback Switch", |
| 4688 | .info = snd_ctl_boolean_mono_info, |
| 4689 | .get = alc260_hp_master_sw_get, |
| 4690 | .put = alc260_hp_master_sw_put, |
| 4691 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4692 | }, |
| 4693 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4694 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4695 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4696 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4697 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4698 | HDA_OUTPUT), |
| 4699 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4700 | { } /* end */ |
| 4701 | }; |
| 4702 | |
| 4703 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4704 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4705 | {}, |
| 4706 | }; |
| 4707 | |
| 4708 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4709 | { |
| 4710 | struct alc_spec *spec = codec->spec; |
| 4711 | unsigned int present; |
| 4712 | |
| 4713 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4714 | AC_VERB_GET_PIN_SENSE, 0); |
| 4715 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4716 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4717 | } |
| 4718 | |
| 4719 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4720 | { |
| 4721 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4722 | alc260_hp_automute(codec); |
| 4723 | } |
| 4724 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4725 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4726 | { |
| 4727 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4728 | .name = "Master Playback Switch", |
| 4729 | .info = snd_ctl_boolean_mono_info, |
| 4730 | .get = alc260_hp_master_sw_get, |
| 4731 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4732 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4733 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4734 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4735 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4736 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4737 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4738 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4739 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4740 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4741 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4742 | { } /* end */ |
| 4743 | }; |
| 4744 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4745 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4746 | .ops = &snd_hda_bind_vol, |
| 4747 | .values = { |
| 4748 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4749 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4750 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4751 | 0 |
| 4752 | }, |
| 4753 | }; |
| 4754 | |
| 4755 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4756 | .ops = &snd_hda_bind_sw, |
| 4757 | .values = { |
| 4758 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4759 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4760 | 0 |
| 4761 | }, |
| 4762 | }; |
| 4763 | |
| 4764 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4765 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4766 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4767 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4768 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4769 | { } /* end */ |
| 4770 | }; |
| 4771 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4772 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4773 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4774 | {}, |
| 4775 | }; |
| 4776 | |
| 4777 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4778 | { |
| 4779 | struct alc_spec *spec = codec->spec; |
| 4780 | unsigned int present; |
| 4781 | |
| 4782 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4783 | AC_VERB_GET_PIN_SENSE, 0); |
| 4784 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4785 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4786 | } |
| 4787 | |
| 4788 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4789 | unsigned int res) |
| 4790 | { |
| 4791 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4792 | alc260_hp_3013_automute(codec); |
| 4793 | } |
| 4794 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4795 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4796 | { |
| 4797 | unsigned int present, bits; |
| 4798 | |
| 4799 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4800 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4801 | |
| 4802 | bits = present ? 0 : PIN_OUT; |
| 4803 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4804 | bits); |
| 4805 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4806 | bits); |
| 4807 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4808 | bits); |
| 4809 | } |
| 4810 | |
| 4811 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4812 | unsigned int res) |
| 4813 | { |
| 4814 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4815 | alc260_hp_3012_automute(codec); |
| 4816 | } |
| 4817 | |
| 4818 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4819 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4820 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4821 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4822 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4823 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4824 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4825 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4826 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4827 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4828 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4829 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4830 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4831 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4832 | { } /* end */ |
| 4833 | }; |
| 4834 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4835 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4836 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4837 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4838 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4839 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4840 | * revisions available in early 2006. Therefore for now allow the |
| 4841 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4842 | * that the lack of mic bias for this NID is intentional we could change the |
| 4843 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4844 | * |
| 4845 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4846 | * don't appear to make the mic bias available from the "line" jack, even |
| 4847 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4848 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4849 | * and the output jack. If this turns out to be the case for all such |
| 4850 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4851 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4852 | * |
| 4853 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4854 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4855 | * controls for such models. On models without a "mono speaker" the control |
| 4856 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4857 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4858 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4859 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4860 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4861 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4862 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4863 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4864 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4865 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4866 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4867 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4868 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4869 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4870 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4871 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4872 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4873 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4874 | { } /* end */ |
| 4875 | }; |
| 4876 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4877 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 4878 | */ |
| 4879 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 4880 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4881 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 4882 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4883 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4884 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4885 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4886 | { } /* end */ |
| 4887 | }; |
| 4888 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4889 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4890 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4891 | */ |
| 4892 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4893 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4894 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4895 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4896 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4897 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4898 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4899 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4900 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4901 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4902 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4903 | { } /* end */ |
| 4904 | }; |
| 4905 | |
| 4906 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4907 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4908 | */ |
| 4909 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4910 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4911 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4914 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4915 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4916 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4917 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4918 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4919 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4920 | { } /* end */ |
| 4921 | }; |
| 4922 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4923 | /* |
| 4924 | * initialization verbs |
| 4925 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4926 | static struct hda_verb alc260_init_verbs[] = { |
| 4927 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4928 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4929 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4930 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4931 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4932 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4933 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4934 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4935 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4936 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4937 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4938 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4939 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4940 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4941 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4942 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4943 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4944 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4945 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4946 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4947 | /* set connection select to line in (default select for this ADC) */ |
| 4948 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4949 | /* mute capture amp left and right */ |
| 4950 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4951 | /* set connection select to line in (default select for this ADC) */ |
| 4952 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4953 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4954 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4955 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4956 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4957 | /* set vol=0 HP mixer amp left and right */ |
| 4958 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4959 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4960 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4961 | /* set vol=0 Mono mixer amp left and right */ |
| 4962 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4963 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4964 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4965 | /* unmute LINE-2 out pin */ |
| 4966 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4967 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4968 | * Line In 2 = 0x03 |
| 4969 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4970 | /* mute analog inputs */ |
| 4971 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4972 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4973 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4974 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4975 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4976 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4977 | /* mute Front out path */ |
| 4978 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4979 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4980 | /* mute Headphone out path */ |
| 4981 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4982 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4983 | /* mute Mono out path */ |
| 4984 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4985 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4986 | { } |
| 4987 | }; |
| 4988 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4989 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4990 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4991 | /* Headphone and output */ |
| 4992 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4993 | /* mono output */ |
| 4994 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4995 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4996 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4997 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4998 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4999 | /* Line In pin widget for input */ |
| 5000 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5001 | /* Line-2 pin widget for output */ |
| 5002 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5003 | /* CD pin widget for input */ |
| 5004 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5005 | /* unmute amp left and right */ |
| 5006 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5007 | /* set connection select to line in (default select for this ADC) */ |
| 5008 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5009 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5010 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5011 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5012 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5013 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5014 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5015 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5016 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5017 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5018 | * Line In 2 = 0x03 |
| 5019 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5020 | /* mute analog inputs */ |
| 5021 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5022 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5023 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5024 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5025 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5026 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5027 | /* Unmute Front out path */ |
| 5028 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5029 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5030 | /* Unmute Headphone out path */ |
| 5031 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5032 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5033 | /* Unmute Mono out path */ |
| 5034 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5035 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5036 | { } |
| 5037 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5038 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5039 | |
| 5040 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5041 | /* Line out and output */ |
| 5042 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5043 | /* mono output */ |
| 5044 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5045 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5046 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5047 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5048 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5049 | /* Line In pin widget for input */ |
| 5050 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5051 | /* Headphone pin widget for output */ |
| 5052 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5053 | /* CD pin widget for input */ |
| 5054 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5055 | /* unmute amp left and right */ |
| 5056 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5057 | /* set connection select to line in (default select for this ADC) */ |
| 5058 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5059 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5060 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5061 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5062 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5063 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5064 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5065 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5066 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5067 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5068 | * Line In 2 = 0x03 |
| 5069 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5070 | /* mute analog inputs */ |
| 5071 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5072 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5073 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5074 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5075 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5076 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5077 | /* Unmute Front out path */ |
| 5078 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5079 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5080 | /* Unmute Headphone out path */ |
| 5081 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5082 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5083 | /* Unmute Mono out path */ |
| 5084 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5085 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5086 | { } |
| 5087 | }; |
| 5088 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5089 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5090 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5091 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5092 | */ |
| 5093 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5094 | /* Disable all GPIOs */ |
| 5095 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5096 | /* Internal speaker is connected to headphone pin */ |
| 5097 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5098 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5099 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5100 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5101 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5102 | /* Ensure all other unused pins are disabled and muted. */ |
| 5103 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5104 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5105 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5106 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5107 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5108 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5109 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5110 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5111 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5112 | /* Disable digital (SPDIF) pins */ |
| 5113 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5114 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5115 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5116 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5117 | * when acting as an output. |
| 5118 | */ |
| 5119 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5120 | |
| 5121 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5122 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5123 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5124 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5126 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5127 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5128 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5129 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5130 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5131 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5132 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5133 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5134 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5135 | * If the pin mode is changed by the user the pin mode control will |
| 5136 | * take care of enabling the pin's input/output buffers as needed. |
| 5137 | * Therefore there's no need to enable the input buffer at this |
| 5138 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5139 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5140 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5141 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5142 | * mixer ctrl) |
| 5143 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5144 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5145 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5146 | /* Mute capture amp left and right */ |
| 5147 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5148 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5149 | * in (on mic1 pin) |
| 5150 | */ |
| 5151 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5152 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5153 | /* Do the same for the second ADC: mute capture input amp and |
| 5154 | * set ADC connection to line in (on mic1 pin) |
| 5155 | */ |
| 5156 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5157 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5158 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5159 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5160 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5161 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5162 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5163 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5164 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5165 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5166 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5167 | {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] | 5168 | |
| 5169 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5170 | }; |
| 5171 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5172 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5173 | * similar laptops (adapted from Fujitsu init verbs). |
| 5174 | */ |
| 5175 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5176 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5177 | * the headphone jack. Turn this on and rely on the standard mute |
| 5178 | * methods whenever the user wants to turn these outputs off. |
| 5179 | */ |
| 5180 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5181 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5182 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5183 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5184 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5185 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5186 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5187 | /* Line In jack is connected to Line1 pin */ |
| 5188 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5189 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5190 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5191 | /* Ensure all other unused pins are disabled and muted. */ |
| 5192 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5193 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5194 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5195 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5196 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5197 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5198 | /* Disable digital (SPDIF) pins */ |
| 5199 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5200 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5201 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5202 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5203 | * bus when acting as outputs. |
| 5204 | */ |
| 5205 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5206 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5207 | |
| 5208 | /* Start with output sum widgets muted and their output gains at min */ |
| 5209 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5210 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5211 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5212 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5213 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5214 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5215 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5216 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5217 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5218 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5219 | /* Unmute Line-out pin widget amp left and right |
| 5220 | * (no equiv mixer ctrl) |
| 5221 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5222 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5223 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5224 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5225 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5226 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5227 | * will take care of enabling the pin's input/output buffers as needed. |
| 5228 | * Therefore there's no need to enable the input buffer at this |
| 5229 | * stage. |
| 5230 | */ |
| 5231 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5232 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5233 | |
| 5234 | /* Mute capture amp left and right */ |
| 5235 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5236 | /* Set ADC connection select to match default mixer setting - mic |
| 5237 | * (on mic1 pin) |
| 5238 | */ |
| 5239 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5240 | |
| 5241 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5242 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5243 | */ |
| 5244 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5245 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5246 | |
| 5247 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5248 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5249 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5250 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5251 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5252 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5253 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5254 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5255 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5256 | |
| 5257 | { } |
| 5258 | }; |
| 5259 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5260 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5261 | * (adapted from Acer init verbs). |
| 5262 | */ |
| 5263 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5264 | /* GPIO 0 enables the output jack. |
| 5265 | * Turn this on and rely on the standard mute |
| 5266 | * methods whenever the user wants to turn these outputs off. |
| 5267 | */ |
| 5268 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5269 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5270 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5271 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5272 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5273 | /* Ensure all other unused pins are disabled and muted. */ |
| 5274 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5275 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5276 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5277 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5278 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5279 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5280 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5281 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5282 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5283 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5284 | /* Disable digital (SPDIF) pins */ |
| 5285 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5286 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5287 | |
| 5288 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5289 | * bus when acting as outputs. |
| 5290 | */ |
| 5291 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5292 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5293 | |
| 5294 | /* Start with output sum widgets muted and their output gains at min */ |
| 5295 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5296 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5297 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5298 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5299 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5300 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5301 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5302 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5303 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5304 | |
| 5305 | /* Unmute Line-out pin widget amp left and right |
| 5306 | * (no equiv mixer ctrl) |
| 5307 | */ |
| 5308 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5309 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5310 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5311 | * will take care of enabling the pin's input/output buffers as needed. |
| 5312 | * Therefore there's no need to enable the input buffer at this |
| 5313 | * stage. |
| 5314 | */ |
| 5315 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5316 | |
| 5317 | /* Mute capture amp left and right */ |
| 5318 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5319 | /* Set ADC connection select to match default mixer setting - mic |
| 5320 | * (on mic1 pin) |
| 5321 | */ |
| 5322 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5323 | |
| 5324 | /* Do similar with the second ADC: mute capture input amp and |
| 5325 | * set ADC connection to mic to match ALSA's default state. |
| 5326 | */ |
| 5327 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5328 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5329 | |
| 5330 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5331 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5334 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5336 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5337 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5338 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5339 | |
| 5340 | { } |
| 5341 | }; |
| 5342 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5343 | static struct hda_verb alc260_will_verbs[] = { |
| 5344 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5345 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5346 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5347 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5348 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5349 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5350 | {} |
| 5351 | }; |
| 5352 | |
| 5353 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5354 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5355 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5356 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5357 | |
| 5358 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5359 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5360 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5361 | |
| 5362 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5363 | {} |
| 5364 | }; |
| 5365 | |
| 5366 | /* toggle speaker-output according to the hp-jack state */ |
| 5367 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5368 | { |
| 5369 | unsigned int present; |
| 5370 | |
| 5371 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5372 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5373 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5374 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5375 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5376 | AC_VERB_SET_GPIO_DATA, 1); |
| 5377 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5378 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5379 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5380 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5381 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5382 | AC_VERB_SET_GPIO_DATA, 0); |
| 5383 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5384 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5385 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5386 | } |
| 5387 | } |
| 5388 | |
| 5389 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5390 | unsigned int res) |
| 5391 | { |
| 5392 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5393 | alc260_replacer_672v_automute(codec); |
| 5394 | } |
| 5395 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5396 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5397 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5398 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5399 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5400 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5401 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5402 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5403 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5404 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5405 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5406 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5407 | {} |
| 5408 | }; |
| 5409 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5410 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5411 | * configuration. |
| 5412 | */ |
| 5413 | #ifdef CONFIG_SND_DEBUG |
| 5414 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5415 | 0x02, |
| 5416 | }; |
| 5417 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5418 | 0x04, 0x05, |
| 5419 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5420 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5421 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5422 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5423 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5424 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5425 | { |
| 5426 | .num_items = 7, |
| 5427 | .items = { |
| 5428 | { "MIC1 pin", 0x0 }, |
| 5429 | { "MIC2 pin", 0x1 }, |
| 5430 | { "LINE1 pin", 0x2 }, |
| 5431 | { "LINE2 pin", 0x3 }, |
| 5432 | { "CD pin", 0x4 }, |
| 5433 | { "LINE-OUT pin", 0x5 }, |
| 5434 | { "HP-OUT pin", 0x6 }, |
| 5435 | }, |
| 5436 | }, |
| 5437 | { |
| 5438 | .num_items = 8, |
| 5439 | .items = { |
| 5440 | { "MIC1 pin", 0x0 }, |
| 5441 | { "MIC2 pin", 0x1 }, |
| 5442 | { "LINE1 pin", 0x2 }, |
| 5443 | { "LINE2 pin", 0x3 }, |
| 5444 | { "CD pin", 0x4 }, |
| 5445 | { "Mixer", 0x5 }, |
| 5446 | { "LINE-OUT pin", 0x6 }, |
| 5447 | { "HP-OUT pin", 0x7 }, |
| 5448 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5449 | }, |
| 5450 | }; |
| 5451 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5452 | /* Output driver widgets */ |
| 5453 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5454 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5455 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5456 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5457 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5458 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5459 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5460 | /* Modes for retasking pin widgets |
| 5461 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5462 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5463 | * mention this restriction. At this stage it's not clear whether |
| 5464 | * this behaviour is intentional or is a hardware bug in chip |
| 5465 | * revisions available at least up until early 2006. Therefore for |
| 5466 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5467 | * choices, but if it turns out that the lack of mic bias for these |
| 5468 | * NIDs is intentional we could change their modes from |
| 5469 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5470 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5471 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5472 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5473 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5474 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5475 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5476 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5477 | |
| 5478 | /* Loopback mixer controls */ |
| 5479 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5480 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5481 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5482 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5483 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5484 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5485 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5486 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5487 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5488 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5489 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5490 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5491 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5492 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5493 | |
| 5494 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5495 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5496 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5497 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5498 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5499 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5500 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5501 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5502 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5503 | */ |
| 5504 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5505 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5506 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5507 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5508 | * this output to turn on an external amplifier. |
| 5509 | */ |
| 5510 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5511 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5512 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5513 | { } /* end */ |
| 5514 | }; |
| 5515 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5516 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5517 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5518 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5519 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5520 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5521 | /* Enable retasking pins as output, initially without power amp */ |
| 5522 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5523 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5524 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5525 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5526 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5527 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5528 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5529 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5530 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5531 | * payload also sets the generation to 0, output to be in "consumer" |
| 5532 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5533 | * control. |
| 5534 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5535 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5536 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5537 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5538 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5539 | * OUT1 sum bus when acting as an output. |
| 5540 | */ |
| 5541 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5542 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5543 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5544 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5545 | |
| 5546 | /* Start with output sum widgets muted and their output gains at min */ |
| 5547 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5548 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5549 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5550 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5551 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5552 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5553 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5554 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5555 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5556 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5557 | /* Unmute retasking pin widget output buffers since the default |
| 5558 | * state appears to be output. As the pin mode is changed by the |
| 5559 | * user the pin mode control will take care of enabling the pin's |
| 5560 | * input/output buffers as needed. |
| 5561 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5562 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5563 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5564 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5565 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5566 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5567 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5568 | /* Also unmute the mono-out pin widget */ |
| 5569 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5570 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5571 | /* Mute capture amp left and right */ |
| 5572 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5573 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5574 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5575 | */ |
| 5576 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5577 | |
| 5578 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5579 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5580 | */ |
| 5581 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5582 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5583 | |
| 5584 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5585 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5586 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5587 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5588 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5589 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5590 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5591 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5592 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5593 | |
| 5594 | { } |
| 5595 | }; |
| 5596 | #endif |
| 5597 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5598 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5599 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5600 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5601 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5602 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5603 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5604 | /* |
| 5605 | * for BIOS auto-configuration |
| 5606 | */ |
| 5607 | |
| 5608 | 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] | 5609 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5610 | { |
| 5611 | hda_nid_t nid_vol; |
| 5612 | unsigned long vol_val, sw_val; |
| 5613 | char name[32]; |
| 5614 | int err; |
| 5615 | |
| 5616 | if (nid >= 0x0f && nid < 0x11) { |
| 5617 | nid_vol = nid - 0x7; |
| 5618 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5619 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5620 | } else if (nid == 0x11) { |
| 5621 | nid_vol = nid - 0x7; |
| 5622 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5623 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5624 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5625 | nid_vol = 0x08; |
| 5626 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5627 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5628 | } else |
| 5629 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5630 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5631 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5632 | /* first control for the volume widget */ |
| 5633 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5634 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5635 | if (err < 0) |
| 5636 | return err; |
| 5637 | *vol_bits |= (1 << nid_vol); |
| 5638 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5639 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5640 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5641 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5642 | return err; |
| 5643 | return 1; |
| 5644 | } |
| 5645 | |
| 5646 | /* add playback controls from the parsed DAC table */ |
| 5647 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5648 | const struct auto_pin_cfg *cfg) |
| 5649 | { |
| 5650 | hda_nid_t nid; |
| 5651 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5652 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5653 | |
| 5654 | spec->multiout.num_dacs = 1; |
| 5655 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5656 | spec->multiout.dac_nids[0] = 0x02; |
| 5657 | |
| 5658 | nid = cfg->line_out_pins[0]; |
| 5659 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5660 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5661 | if (err < 0) |
| 5662 | return err; |
| 5663 | } |
| 5664 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5665 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5666 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5667 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5668 | if (err < 0) |
| 5669 | return err; |
| 5670 | } |
| 5671 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5672 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5673 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5674 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5675 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5676 | if (err < 0) |
| 5677 | return err; |
| 5678 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5679 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5680 | } |
| 5681 | |
| 5682 | /* create playback/capture controls for input pins */ |
| 5683 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5684 | const struct auto_pin_cfg *cfg) |
| 5685 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5686 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5687 | int i, err, idx; |
| 5688 | |
| 5689 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5690 | if (cfg->input_pins[i] >= 0x12) { |
| 5691 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5692 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5693 | auto_pin_cfg_labels[i], idx, |
| 5694 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5695 | if (err < 0) |
| 5696 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5697 | imux->items[imux->num_items].label = |
| 5698 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5699 | imux->items[imux->num_items].index = idx; |
| 5700 | imux->num_items++; |
| 5701 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5702 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5703 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5704 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5705 | auto_pin_cfg_labels[i], idx, |
| 5706 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5707 | if (err < 0) |
| 5708 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5709 | imux->items[imux->num_items].label = |
| 5710 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5711 | imux->items[imux->num_items].index = idx; |
| 5712 | imux->num_items++; |
| 5713 | } |
| 5714 | } |
| 5715 | return 0; |
| 5716 | } |
| 5717 | |
| 5718 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5719 | hda_nid_t nid, int pin_type, |
| 5720 | int sel_idx) |
| 5721 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5722 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5723 | /* need the manual connection? */ |
| 5724 | if (nid >= 0x12) { |
| 5725 | int idx = nid - 0x12; |
| 5726 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5727 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5728 | } |
| 5729 | } |
| 5730 | |
| 5731 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5732 | { |
| 5733 | struct alc_spec *spec = codec->spec; |
| 5734 | hda_nid_t nid; |
| 5735 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5736 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5737 | if (nid) { |
| 5738 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5739 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5740 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5741 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5742 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5743 | if (nid) |
| 5744 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5745 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5746 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5747 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5748 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5749 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5750 | |
| 5751 | #define ALC260_PIN_CD_NID 0x16 |
| 5752 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5753 | { |
| 5754 | struct alc_spec *spec = codec->spec; |
| 5755 | int i; |
| 5756 | |
| 5757 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5758 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5759 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5760 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5761 | if (nid != ALC260_PIN_CD_NID && |
| 5762 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5763 | snd_hda_codec_write(codec, nid, 0, |
| 5764 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5765 | AMP_OUT_MUTE); |
| 5766 | } |
| 5767 | } |
| 5768 | } |
| 5769 | |
| 5770 | /* |
| 5771 | * generic initialization of ADC, input mixers and output mixers |
| 5772 | */ |
| 5773 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5774 | /* |
| 5775 | * Unmute ADC0-1 and set the default input to mic-in |
| 5776 | */ |
| 5777 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5778 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5779 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5780 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5781 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5782 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5783 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5784 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5785 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5786 | */ |
| 5787 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5788 | /* mute analog inputs */ |
| 5789 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5790 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5791 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5792 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5793 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5794 | |
| 5795 | /* |
| 5796 | * Set up output mixers (0x08 - 0x0a) |
| 5797 | */ |
| 5798 | /* set vol=0 to output mixers */ |
| 5799 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5800 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5801 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5802 | /* set up input amps for analog loopback */ |
| 5803 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5804 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5805 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5806 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5807 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5808 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5809 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5810 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5811 | { } |
| 5812 | }; |
| 5813 | |
| 5814 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5815 | { |
| 5816 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5817 | int err; |
| 5818 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5819 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5820 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5821 | alc260_ignore); |
| 5822 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5823 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5824 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5825 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5826 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5827 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5828 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5829 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5830 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5831 | return err; |
| 5832 | |
| 5833 | spec->multiout.max_channels = 2; |
| 5834 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5835 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5836 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5837 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5838 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5839 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5840 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5841 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5842 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5843 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5844 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5845 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 5846 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5847 | return 1; |
| 5848 | } |
| 5849 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5850 | /* additional initialization for auto-configuration model */ |
| 5851 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5852 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5853 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5854 | alc260_auto_init_multi_out(codec); |
| 5855 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5856 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5857 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5858 | } |
| 5859 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5860 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5861 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5862 | { 0x07, HDA_INPUT, 0 }, |
| 5863 | { 0x07, HDA_INPUT, 1 }, |
| 5864 | { 0x07, HDA_INPUT, 2 }, |
| 5865 | { 0x07, HDA_INPUT, 3 }, |
| 5866 | { 0x07, HDA_INPUT, 4 }, |
| 5867 | { } /* end */ |
| 5868 | }; |
| 5869 | #endif |
| 5870 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5871 | /* |
| 5872 | * ALC260 configurations |
| 5873 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5874 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5875 | [ALC260_BASIC] = "basic", |
| 5876 | [ALC260_HP] = "hp", |
| 5877 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5878 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5879 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5880 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5881 | [ALC260_WILL] = "will", |
| 5882 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5883 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5884 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5885 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5886 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5887 | [ALC260_AUTO] = "auto", |
| 5888 | }; |
| 5889 | |
| 5890 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5891 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5892 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5893 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5894 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5895 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5896 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5897 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5898 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5899 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5900 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5901 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5902 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5903 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5904 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5905 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5906 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5907 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5908 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5909 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5910 | {} |
| 5911 | }; |
| 5912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5913 | static struct alc_config_preset alc260_presets[] = { |
| 5914 | [ALC260_BASIC] = { |
| 5915 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5916 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5917 | .init_verbs = { alc260_init_verbs }, |
| 5918 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5919 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5920 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5921 | .adc_nids = alc260_adc_nids, |
| 5922 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5923 | .channel_mode = alc260_modes, |
| 5924 | .input_mux = &alc260_capture_source, |
| 5925 | }, |
| 5926 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5927 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5928 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5929 | .init_verbs = { alc260_init_verbs, |
| 5930 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5931 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5932 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5933 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5934 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5935 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5936 | .channel_mode = alc260_modes, |
| 5937 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5938 | .unsol_event = alc260_hp_unsol_event, |
| 5939 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5940 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5941 | [ALC260_HP_DC7600] = { |
| 5942 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5943 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5944 | .init_verbs = { alc260_init_verbs, |
| 5945 | alc260_hp_dc7600_verbs }, |
| 5946 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5947 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5948 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5949 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5950 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5951 | .channel_mode = alc260_modes, |
| 5952 | .input_mux = &alc260_capture_source, |
| 5953 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5954 | .init_hook = alc260_hp_3012_automute, |
| 5955 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5956 | [ALC260_HP_3013] = { |
| 5957 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5958 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5959 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5960 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5961 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5962 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5963 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5964 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5965 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5966 | .channel_mode = alc260_modes, |
| 5967 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5968 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5969 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5970 | }, |
| 5971 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5972 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5973 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5974 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5975 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5976 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5977 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5978 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5979 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5980 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5981 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5982 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5983 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5984 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5985 | .init_verbs = { alc260_acer_init_verbs }, |
| 5986 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5987 | .dac_nids = alc260_dac_nids, |
| 5988 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5989 | .adc_nids = alc260_dual_adc_nids, |
| 5990 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5991 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5992 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5993 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5994 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5995 | [ALC260_FAVORIT100] = { |
| 5996 | .mixers = { alc260_favorit100_mixer }, |
| 5997 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 5998 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5999 | .dac_nids = alc260_dac_nids, |
| 6000 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6001 | .adc_nids = alc260_dual_adc_nids, |
| 6002 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6003 | .channel_mode = alc260_modes, |
| 6004 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6005 | .input_mux = alc260_favorit100_capture_sources, |
| 6006 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6007 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6008 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6009 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6010 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6011 | .dac_nids = alc260_dac_nids, |
| 6012 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6013 | .adc_nids = alc260_adc_nids, |
| 6014 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6015 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6016 | .channel_mode = alc260_modes, |
| 6017 | .input_mux = &alc260_capture_source, |
| 6018 | }, |
| 6019 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6020 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6021 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6022 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6023 | .dac_nids = alc260_dac_nids, |
| 6024 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6025 | .adc_nids = alc260_adc_nids, |
| 6026 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6027 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6028 | .channel_mode = alc260_modes, |
| 6029 | .input_mux = &alc260_capture_source, |
| 6030 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6031 | .init_hook = alc260_replacer_672v_automute, |
| 6032 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6033 | #ifdef CONFIG_SND_DEBUG |
| 6034 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6035 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6036 | .init_verbs = { alc260_test_init_verbs }, |
| 6037 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6038 | .dac_nids = alc260_test_dac_nids, |
| 6039 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6040 | .adc_nids = alc260_test_adc_nids, |
| 6041 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6042 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6043 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6044 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6045 | }, |
| 6046 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6047 | }; |
| 6048 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6049 | static int patch_alc260(struct hda_codec *codec) |
| 6050 | { |
| 6051 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6052 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6053 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6054 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6055 | if (spec == NULL) |
| 6056 | return -ENOMEM; |
| 6057 | |
| 6058 | codec->spec = spec; |
| 6059 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6060 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6061 | alc260_models, |
| 6062 | alc260_cfg_tbl); |
| 6063 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6064 | snd_printd(KERN_INFO "hda_codec: Unknown model for %s, " |
| 6065 | "trying auto-probe from BIOS...\n", |
| 6066 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6067 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6068 | } |
| 6069 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6070 | if (board_config == ALC260_AUTO) { |
| 6071 | /* automatic parse from the BIOS config */ |
| 6072 | err = alc260_parse_auto_config(codec); |
| 6073 | if (err < 0) { |
| 6074 | alc_free(codec); |
| 6075 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6076 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6077 | printk(KERN_INFO |
| 6078 | "hda_codec: Cannot set up configuration " |
| 6079 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6080 | board_config = ALC260_BASIC; |
| 6081 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6082 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6083 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6084 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6085 | if (err < 0) { |
| 6086 | alc_free(codec); |
| 6087 | return err; |
| 6088 | } |
| 6089 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6090 | if (board_config != ALC260_AUTO) |
| 6091 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6092 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6093 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6094 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6095 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6096 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6097 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6098 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6099 | if (!spec->adc_nids && spec->input_mux) { |
| 6100 | /* check whether NID 0x04 is valid */ |
| 6101 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 6102 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 6103 | /* get type */ |
| 6104 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6105 | spec->adc_nids = alc260_adc_nids_alt; |
| 6106 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6107 | } else { |
| 6108 | spec->adc_nids = alc260_adc_nids; |
| 6109 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6110 | } |
| 6111 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6112 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6113 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6114 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6115 | spec->vmaster_nid = 0x08; |
| 6116 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6117 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6118 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6119 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6120 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6121 | if (!spec->loopback.amplist) |
| 6122 | spec->loopback.amplist = alc260_loopbacks; |
| 6123 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6124 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6125 | |
| 6126 | return 0; |
| 6127 | } |
| 6128 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6129 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6130 | /* |
| 6131 | * ALC882 support |
| 6132 | * |
| 6133 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6134 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6135 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6136 | * 6-channel independent captures. |
| 6137 | * |
| 6138 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6139 | * driver yet). |
| 6140 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6141 | #define ALC882_DIGOUT_NID 0x06 |
| 6142 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6143 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6144 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6145 | { 8, NULL } |
| 6146 | }; |
| 6147 | |
| 6148 | static hda_nid_t alc882_dac_nids[4] = { |
| 6149 | /* front, rear, clfe, rear_surr */ |
| 6150 | 0x02, 0x03, 0x04, 0x05 |
| 6151 | }; |
| 6152 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6153 | /* identical with ALC880 */ |
| 6154 | #define alc882_adc_nids alc880_adc_nids |
| 6155 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6156 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6157 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6158 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 6159 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6160 | /* input MUX */ |
| 6161 | /* FIXME: should be a matrix-type input source selection */ |
| 6162 | |
| 6163 | static struct hda_input_mux alc882_capture_source = { |
| 6164 | .num_items = 4, |
| 6165 | .items = { |
| 6166 | { "Mic", 0x0 }, |
| 6167 | { "Front Mic", 0x1 }, |
| 6168 | { "Line", 0x2 }, |
| 6169 | { "CD", 0x4 }, |
| 6170 | }, |
| 6171 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6172 | |
| 6173 | static struct hda_input_mux mb5_capture_source = { |
| 6174 | .num_items = 3, |
| 6175 | .items = { |
| 6176 | { "Mic", 0x1 }, |
| 6177 | { "Line", 0x2 }, |
| 6178 | { "CD", 0x4 }, |
| 6179 | }, |
| 6180 | }; |
| 6181 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6182 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6183 | * 2ch mode |
| 6184 | */ |
| 6185 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6186 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6187 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6188 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6189 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6190 | { } /* end */ |
| 6191 | }; |
| 6192 | |
| 6193 | /* |
| 6194 | * 6ch mode |
| 6195 | */ |
| 6196 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6197 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6198 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6199 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6200 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6201 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6202 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6203 | { } /* end */ |
| 6204 | }; |
| 6205 | |
| 6206 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6207 | { 2, alc882_3ST_ch2_init }, |
| 6208 | { 6, alc882_3ST_ch6_init }, |
| 6209 | }; |
| 6210 | |
| 6211 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6212 | * 6ch mode |
| 6213 | */ |
| 6214 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6215 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6216 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6217 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6218 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6219 | { } /* end */ |
| 6220 | }; |
| 6221 | |
| 6222 | /* |
| 6223 | * 8ch mode |
| 6224 | */ |
| 6225 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6226 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6227 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6228 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6229 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6230 | { } /* end */ |
| 6231 | }; |
| 6232 | |
| 6233 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6234 | { 6, alc882_sixstack_ch6_init }, |
| 6235 | { 8, alc882_sixstack_ch8_init }, |
| 6236 | }; |
| 6237 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6238 | /* |
| 6239 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 6240 | */ |
| 6241 | |
| 6242 | /* |
| 6243 | * 2ch mode |
| 6244 | */ |
| 6245 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6246 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6247 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6248 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6249 | { } /* end */ |
| 6250 | }; |
| 6251 | |
| 6252 | /* |
| 6253 | * 6ch mode |
| 6254 | */ |
| 6255 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6256 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6257 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6258 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6259 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6260 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6261 | { } /* end */ |
| 6262 | }; |
| 6263 | |
| 6264 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6265 | { 2, alc885_mbp_ch2_init }, |
| 6266 | { 6, alc885_mbp_ch6_init }, |
| 6267 | }; |
| 6268 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame^] | 6269 | /* |
| 6270 | * 2ch |
| 6271 | * Speakers/Woofer/HP = Front |
| 6272 | * LineIn = Input |
| 6273 | */ |
| 6274 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6275 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6276 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6277 | { } /* end */ |
| 6278 | }; |
| 6279 | |
| 6280 | /* |
| 6281 | * 6ch mode |
| 6282 | * Speakers/HP = Front |
| 6283 | * Woofer = LFE |
| 6284 | * LineIn = Surround |
| 6285 | */ |
| 6286 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6287 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6288 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6289 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6290 | { } /* end */ |
| 6291 | }; |
| 6292 | |
| 6293 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6294 | { 2, alc885_mb5_ch2_init }, |
| 6295 | { 6, alc885_mb5_ch6_init }, |
| 6296 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6297 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6298 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6299 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6300 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6301 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6302 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6303 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6304 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6305 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6306 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6307 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6308 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6309 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6310 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6311 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6312 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6313 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6314 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6315 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6316 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6317 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6318 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6319 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6320 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6321 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6322 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6323 | { } /* end */ |
| 6324 | }; |
| 6325 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6326 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6327 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6328 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6329 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6330 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6331 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6332 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6333 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6334 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6335 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6336 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6337 | { } /* end */ |
| 6338 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6339 | |
| 6340 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame^] | 6341 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6342 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6343 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6344 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6345 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 6346 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 6347 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 6348 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6349 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6350 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6351 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6352 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6353 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6354 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6355 | { } /* end */ |
| 6356 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame^] | 6357 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6358 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6359 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6360 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6361 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6362 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6363 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6364 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6365 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6366 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6367 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6368 | { } /* end */ |
| 6369 | }; |
| 6370 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6371 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6372 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6373 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6374 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6375 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6376 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6377 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6378 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6379 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6380 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6381 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6382 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6383 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6384 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6385 | { } /* end */ |
| 6386 | }; |
| 6387 | |
| 6388 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6389 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6390 | */ |
| 6391 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6392 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6393 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6394 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6395 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6396 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6397 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6398 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6399 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6400 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6401 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6402 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6403 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6404 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6405 | { } /* end */ |
| 6406 | }; |
| 6407 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6408 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6409 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6410 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6411 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6412 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6413 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6414 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6415 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6416 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6417 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6418 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6419 | { } /* end */ |
| 6420 | }; |
| 6421 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6422 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6423 | { |
| 6424 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6425 | .name = "Channel Mode", |
| 6426 | .info = alc_ch_mode_info, |
| 6427 | .get = alc_ch_mode_get, |
| 6428 | .put = alc_ch_mode_put, |
| 6429 | }, |
| 6430 | { } /* end */ |
| 6431 | }; |
| 6432 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6433 | static struct hda_verb alc882_init_verbs[] = { |
| 6434 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6435 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6436 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6437 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6438 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6439 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6440 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6441 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6442 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6443 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6444 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6445 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6446 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6447 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6448 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6449 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6450 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6451 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6452 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6453 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6454 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6455 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6456 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6457 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6458 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6459 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6460 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6461 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6462 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6463 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6464 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6465 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6466 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6467 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6468 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6469 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6470 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6471 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6472 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6473 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6474 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6475 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6476 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6477 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6478 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6479 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6480 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6481 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6482 | |
| 6483 | /* FIXME: use matrix-type input source selection */ |
| 6484 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6485 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6486 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6487 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6488 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6489 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6490 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6491 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6492 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6493 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6494 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6495 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6496 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6497 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6498 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6499 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6500 | /* ADC1: mute amp left and right */ |
| 6501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6502 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6503 | /* ADC2: mute amp left and right */ |
| 6504 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6505 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6506 | /* ADC3: mute amp left and right */ |
| 6507 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6508 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6509 | |
| 6510 | { } |
| 6511 | }; |
| 6512 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6513 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6514 | /* change to EAPD mode */ |
| 6515 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6516 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6517 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6518 | }; |
| 6519 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6520 | /* Mac Pro test */ |
| 6521 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6522 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6523 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6524 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6525 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6526 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6527 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6528 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6529 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6530 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6531 | { } /* end */ |
| 6532 | }; |
| 6533 | |
| 6534 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6535 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6536 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6537 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6538 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6539 | /* Front Pin: output 0 (0x0c) */ |
| 6540 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6541 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6542 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6543 | /* Front Mic pin: input vref at 80% */ |
| 6544 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6545 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6546 | /* Speaker: output */ |
| 6547 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6548 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6549 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6550 | /* Headphone output (output 0 - 0x0c) */ |
| 6551 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6552 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6553 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6554 | |
| 6555 | /* FIXME: use matrix-type input source selection */ |
| 6556 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6557 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6558 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6559 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6560 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6561 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6562 | /* Input mixer2 */ |
| 6563 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6564 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6565 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6566 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6567 | /* Input mixer3 */ |
| 6568 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6569 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6570 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6571 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6572 | /* ADC1: mute amp left and right */ |
| 6573 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6574 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6575 | /* ADC2: mute amp left and right */ |
| 6576 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6577 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6578 | /* ADC3: mute amp left and right */ |
| 6579 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6580 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6581 | |
| 6582 | { } |
| 6583 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6584 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6585 | /* Macbook 5,1 */ |
| 6586 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame^] | 6587 | /* DACs */ |
| 6588 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6589 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6590 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6591 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6592 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6593 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6594 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6595 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame^] | 6596 | /* Surround mixer */ |
| 6597 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6598 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6599 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6600 | /* LFE mixer */ |
| 6601 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6602 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6603 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6604 | /* HP mixer */ |
| 6605 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6606 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6607 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6608 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6609 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 6610 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame^] | 6611 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6612 | /* LFE Pin (0x0e) */ |
| 6613 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 6614 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6615 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6616 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6617 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6618 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame^] | 6619 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6620 | /* Front Mic pin: input vref at 80% */ |
| 6621 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6622 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6623 | /* Line In pin */ |
| 6624 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6625 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6626 | |
| 6627 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6628 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6629 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6630 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6631 | { } |
| 6632 | }; |
| 6633 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6634 | /* Macbook Pro rev3 */ |
| 6635 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6636 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6637 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6638 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6639 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6640 | /* Rear mixer */ |
| 6641 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6642 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6643 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6644 | /* Front Pin: output 0 (0x0c) */ |
| 6645 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6646 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6647 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6648 | /* HP Pin: output 0 (0x0d) */ |
| 6649 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6650 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6651 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6652 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6653 | /* Mic (rear) pin: input vref at 80% */ |
| 6654 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6655 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6656 | /* Front Mic pin: input vref at 80% */ |
| 6657 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6658 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6659 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6660 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6661 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6662 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6663 | |
| 6664 | /* FIXME: use matrix-type input source selection */ |
| 6665 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6666 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6667 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6668 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6669 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6670 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6671 | /* Input mixer2 */ |
| 6672 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6673 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6674 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6675 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6676 | /* Input mixer3 */ |
| 6677 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6678 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6679 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6680 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6681 | /* ADC1: mute amp left and right */ |
| 6682 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6683 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6684 | /* ADC2: mute amp left and right */ |
| 6685 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6686 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6687 | /* ADC3: mute amp left and right */ |
| 6688 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6689 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6690 | |
| 6691 | { } |
| 6692 | }; |
| 6693 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6694 | /* iMac 24 mixer. */ |
| 6695 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6696 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6697 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6698 | { } /* end */ |
| 6699 | }; |
| 6700 | |
| 6701 | /* iMac 24 init verbs. */ |
| 6702 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6703 | /* Internal speakers: output 0 (0x0c) */ |
| 6704 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6705 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6706 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6707 | /* Internal speakers: output 0 (0x0c) */ |
| 6708 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6709 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6710 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6711 | /* Headphone: output 0 (0x0c) */ |
| 6712 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6713 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6714 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6715 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6716 | /* Front Mic: input vref at 80% */ |
| 6717 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6718 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6719 | { } |
| 6720 | }; |
| 6721 | |
| 6722 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6723 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6724 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6725 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6726 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6727 | spec->autocfg.hp_pins[0] = 0x14; |
| 6728 | spec->autocfg.speaker_pins[0] = 0x18; |
| 6729 | spec->autocfg.speaker_pins[1] = 0x1a; |
| 6730 | alc_automute_amp(codec); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6731 | } |
| 6732 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6733 | static void alc885_mbp3_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6734 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6735 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6736 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6737 | spec->autocfg.hp_pins[0] = 0x15; |
| 6738 | spec->autocfg.speaker_pins[0] = 0x14; |
| 6739 | alc_automute_amp(codec); |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6740 | } |
| 6741 | |
| 6742 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6743 | static struct hda_verb alc882_targa_verbs[] = { |
| 6744 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6745 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6746 | |
| 6747 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6748 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6749 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6750 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6751 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6752 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6753 | |
| 6754 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6755 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6756 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6757 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6758 | { } /* end */ |
| 6759 | }; |
| 6760 | |
| 6761 | /* toggle speaker-output according to the hp-jack state */ |
| 6762 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6763 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6764 | struct alc_spec *spec = codec->spec; |
| 6765 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6766 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6767 | spec->jack_present ? 1 : 3); |
| 6768 | } |
| 6769 | |
| 6770 | static void alc882_targa_init_hook(struct hda_codec *codec) |
| 6771 | { |
| 6772 | struct alc_spec *spec = codec->spec; |
| 6773 | |
| 6774 | spec->autocfg.hp_pins[0] = 0x14; |
| 6775 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 6776 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6777 | } |
| 6778 | |
| 6779 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6780 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6781 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6782 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6783 | } |
| 6784 | |
| 6785 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6786 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6787 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6788 | |
| 6789 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6790 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6791 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6792 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6793 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6794 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6795 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6796 | |
| 6797 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6798 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6799 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6800 | { } /* end */ |
| 6801 | }; |
| 6802 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6803 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6804 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6805 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6806 | |
| 6807 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6808 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6809 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6810 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6811 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6812 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6813 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6814 | |
| 6815 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6816 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6817 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6818 | { } /* end */ |
| 6819 | }; |
| 6820 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6821 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6822 | { |
| 6823 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6824 | |
| 6825 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6826 | AC_VERB_GET_GPIO_DATA, 0); |
| 6827 | |
| 6828 | if (!muted) |
| 6829 | gpiostate |= (1 << pin); |
| 6830 | else |
| 6831 | gpiostate &= ~(1 << pin); |
| 6832 | |
| 6833 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6834 | AC_VERB_GET_GPIO_MASK, 0); |
| 6835 | gpiomask |= (1 << pin); |
| 6836 | |
| 6837 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6838 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6839 | gpiodir |= (1 << pin); |
| 6840 | |
| 6841 | |
| 6842 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6843 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6844 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6845 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6846 | |
| 6847 | msleep(1); |
| 6848 | |
| 6849 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6850 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6851 | } |
| 6852 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6853 | /* set up GPIO at initialization */ |
| 6854 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6855 | { |
| 6856 | alc882_gpio_mute(codec, 0, 0); |
| 6857 | alc882_gpio_mute(codec, 1, 0); |
| 6858 | } |
| 6859 | |
| 6860 | /* set up GPIO and update auto-muting at initialization */ |
| 6861 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6862 | { |
| 6863 | alc885_macpro_init_hook(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 6864 | alc885_imac24_automute_init_hook(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6865 | } |
| 6866 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6867 | /* |
| 6868 | * generic initialization of ADC, input mixers and output mixers |
| 6869 | */ |
| 6870 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6871 | /* |
| 6872 | * Unmute ADC0-2 and set the default input to mic-in |
| 6873 | */ |
| 6874 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6875 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6876 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6877 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6878 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6879 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6880 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6881 | /* 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] | 6882 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6883 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6884 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6885 | */ |
| 6886 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6887 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6888 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6889 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6890 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6891 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6892 | |
| 6893 | /* |
| 6894 | * Set up output mixers (0x0c - 0x0f) |
| 6895 | */ |
| 6896 | /* set vol=0 to output mixers */ |
| 6897 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6898 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6899 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6900 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6901 | /* set up input amps for analog loopback */ |
| 6902 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6903 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6904 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6905 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6906 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6907 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6908 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6909 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6910 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6911 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6912 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6913 | |
| 6914 | /* FIXME: use matrix-type input source selection */ |
| 6915 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6916 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6917 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6918 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6919 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6920 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6921 | /* Input mixer2 */ |
| 6922 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6923 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6924 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6925 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6926 | /* Input mixer3 */ |
| 6927 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6928 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6929 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6930 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6931 | |
| 6932 | { } |
| 6933 | }; |
| 6934 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6935 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6936 | #define alc882_loopbacks alc880_loopbacks |
| 6937 | #endif |
| 6938 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6939 | /* pcm configuration: identiacal with ALC880 */ |
| 6940 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6941 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6942 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6943 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6944 | |
| 6945 | /* |
| 6946 | * configuration and preset |
| 6947 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6948 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6949 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6950 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6951 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6952 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6953 | [ALC882_TARGA] = "targa", |
| 6954 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6955 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6956 | [ALC885_MACPRO] = "macpro", |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6957 | [ALC885_MB5] = "mb5", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6958 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6959 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6960 | [ALC882_AUTO] = "auto", |
| 6961 | }; |
| 6962 | |
| 6963 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6964 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6965 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6966 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6967 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6968 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6969 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6970 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6971 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6972 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6973 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6974 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6975 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6976 | {} |
| 6977 | }; |
| 6978 | |
| 6979 | static struct alc_config_preset alc882_presets[] = { |
| 6980 | [ALC882_3ST_DIG] = { |
| 6981 | .mixers = { alc882_base_mixer }, |
| 6982 | .init_verbs = { alc882_init_verbs }, |
| 6983 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6984 | .dac_nids = alc882_dac_nids, |
| 6985 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6986 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6987 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6988 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6989 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6990 | .input_mux = &alc882_capture_source, |
| 6991 | }, |
| 6992 | [ALC882_6ST_DIG] = { |
| 6993 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6994 | .init_verbs = { alc882_init_verbs }, |
| 6995 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6996 | .dac_nids = alc882_dac_nids, |
| 6997 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6998 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6999 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 7000 | .channel_mode = alc882_sixstack_modes, |
| 7001 | .input_mux = &alc882_capture_source, |
| 7002 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7003 | [ALC882_ARIMA] = { |
| 7004 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 7005 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 7006 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7007 | .dac_nids = alc882_dac_nids, |
| 7008 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 7009 | .channel_mode = alc882_sixstack_modes, |
| 7010 | .input_mux = &alc882_capture_source, |
| 7011 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7012 | [ALC882_W2JC] = { |
| 7013 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 7014 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 7015 | alc880_gpio1_init_verbs }, |
| 7016 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7017 | .dac_nids = alc882_dac_nids, |
| 7018 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 7019 | .channel_mode = alc880_threestack_modes, |
| 7020 | .need_dac_fix = 1, |
| 7021 | .input_mux = &alc882_capture_source, |
| 7022 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7023 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7024 | [ALC885_MBP3] = { |
| 7025 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 7026 | .init_verbs = { alc885_mbp3_init_verbs, |
| 7027 | alc880_gpio1_init_verbs }, |
| 7028 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7029 | .dac_nids = alc882_dac_nids, |
| 7030 | .channel_mode = alc885_mbp_6ch_modes, |
| 7031 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 7032 | .input_mux = &alc882_capture_source, |
| 7033 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7034 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7035 | .unsol_event = alc_automute_amp_unsol_event, |
| 7036 | .init_hook = alc885_mbp3_init_hook, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7037 | }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7038 | [ALC885_MB5] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame^] | 7039 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7040 | .init_verbs = { alc885_mb5_init_verbs, |
| 7041 | alc880_gpio1_init_verbs }, |
| 7042 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7043 | .dac_nids = alc882_dac_nids, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame^] | 7044 | .channel_mode = alc885_mb5_6ch_modes, |
| 7045 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7046 | .input_mux = &mb5_capture_source, |
| 7047 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7048 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7049 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7050 | [ALC885_MACPRO] = { |
| 7051 | .mixers = { alc882_macpro_mixer }, |
| 7052 | .init_verbs = { alc882_macpro_init_verbs }, |
| 7053 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7054 | .dac_nids = alc882_dac_nids, |
| 7055 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7056 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7057 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7058 | .channel_mode = alc882_ch_modes, |
| 7059 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7060 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7061 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7062 | [ALC885_IMAC24] = { |
| 7063 | .mixers = { alc885_imac24_mixer }, |
| 7064 | .init_verbs = { alc885_imac24_init_verbs }, |
| 7065 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7066 | .dac_nids = alc882_dac_nids, |
| 7067 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7068 | .dig_in_nid = ALC882_DIGIN_NID, |
| 7069 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 7070 | .channel_mode = alc882_ch_modes, |
| 7071 | .input_mux = &alc882_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7072 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7073 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7074 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7075 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7076 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7077 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 7078 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7079 | .dac_nids = alc882_dac_nids, |
| 7080 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7081 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 7082 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7083 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7084 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 7085 | .channel_mode = alc882_3ST_6ch_modes, |
| 7086 | .need_dac_fix = 1, |
| 7087 | .input_mux = &alc882_capture_source, |
| 7088 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7089 | .init_hook = alc882_targa_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7090 | }, |
| 7091 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7092 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7093 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 7094 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7095 | .dac_nids = alc882_dac_nids, |
| 7096 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7097 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 7098 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7099 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7100 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 7101 | .channel_mode = alc882_3ST_6ch_modes, |
| 7102 | .need_dac_fix = 1, |
| 7103 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7104 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7105 | [ALC882_ASUS_A7M] = { |
| 7106 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 7107 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 7108 | alc880_gpio1_init_verbs, |
| 7109 | alc882_asus_a7m_verbs }, |
| 7110 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 7111 | .dac_nids = alc882_dac_nids, |
| 7112 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 7113 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 7114 | .channel_mode = alc880_threestack_modes, |
| 7115 | .need_dac_fix = 1, |
| 7116 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7117 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7118 | }; |
| 7119 | |
| 7120 | |
| 7121 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7122 | * Pin config fixes |
| 7123 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7124 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7125 | PINFIX_ABIT_AW9D_MAX |
| 7126 | }; |
| 7127 | |
| 7128 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 7129 | { 0x15, 0x01080104 }, /* side */ |
| 7130 | { 0x16, 0x01011012 }, /* rear */ |
| 7131 | { 0x17, 0x01016011 }, /* clfe */ |
| 7132 | { } |
| 7133 | }; |
| 7134 | |
| 7135 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 7136 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 7137 | }; |
| 7138 | |
| 7139 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 7140 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 7141 | {} |
| 7142 | }; |
| 7143 | |
| 7144 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7145 | * BIOS auto configuration |
| 7146 | */ |
| 7147 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7148 | hda_nid_t nid, int pin_type, |
| 7149 | int dac_idx) |
| 7150 | { |
| 7151 | /* set as output */ |
| 7152 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7153 | int idx; |
| 7154 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7155 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7156 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7157 | idx = 4; |
| 7158 | else |
| 7159 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7160 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7161 | |
| 7162 | } |
| 7163 | |
| 7164 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 7165 | { |
| 7166 | struct alc_spec *spec = codec->spec; |
| 7167 | int i; |
| 7168 | |
| 7169 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7170 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7171 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7172 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7173 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7174 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7175 | } |
| 7176 | } |
| 7177 | |
| 7178 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 7179 | { |
| 7180 | struct alc_spec *spec = codec->spec; |
| 7181 | hda_nid_t pin; |
| 7182 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7183 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7184 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7185 | /* use dac 0 */ |
| 7186 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7187 | pin = spec->autocfg.speaker_pins[0]; |
| 7188 | if (pin) |
| 7189 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7190 | } |
| 7191 | |
| 7192 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7193 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 7194 | |
| 7195 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 7196 | { |
| 7197 | struct alc_spec *spec = codec->spec; |
| 7198 | int i; |
| 7199 | |
| 7200 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7201 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7202 | if (!nid) |
| 7203 | continue; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 7204 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7205 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 7206 | snd_hda_codec_write(codec, nid, 0, |
| 7207 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7208 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7209 | } |
| 7210 | } |
| 7211 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7212 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 7213 | { |
| 7214 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7215 | int c; |
| 7216 | |
| 7217 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 7218 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 7219 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7220 | unsigned int mux_idx; |
| 7221 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7222 | int conns, mute, idx, item; |
| 7223 | |
| 7224 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 7225 | ARRAY_SIZE(conn_list)); |
| 7226 | if (conns < 0) |
| 7227 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7228 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 7229 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7230 | for (idx = 0; idx < conns; idx++) { |
| 7231 | /* if the current connection is the selected one, |
| 7232 | * unmute it as default - otherwise mute it |
| 7233 | */ |
| 7234 | mute = AMP_IN_MUTE(idx); |
| 7235 | for (item = 0; item < imux->num_items; item++) { |
| 7236 | if (imux->items[item].index == idx) { |
| 7237 | if (spec->cur_mux[c] == item) |
| 7238 | mute = AMP_IN_UNMUTE(idx); |
| 7239 | break; |
| 7240 | } |
| 7241 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7242 | /* check if we have a selector or mixer |
| 7243 | * we could check for the widget type instead, but |
| 7244 | * just check for Amp-In presence (in case of mixer |
| 7245 | * without amp-in there is something wrong, this |
| 7246 | * function shouldn't be used or capsrc nid is wrong) |
| 7247 | */ |
| 7248 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 7249 | snd_hda_codec_write(codec, nid, 0, |
| 7250 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7251 | mute); |
| 7252 | else if (mute != AMP_IN_MUTE(idx)) |
| 7253 | snd_hda_codec_write(codec, nid, 0, |
| 7254 | AC_VERB_SET_CONNECT_SEL, |
| 7255 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7256 | } |
| 7257 | } |
| 7258 | } |
| 7259 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7260 | /* add mic boosts if needed */ |
| 7261 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 7262 | { |
| 7263 | struct alc_spec *spec = codec->spec; |
| 7264 | int err; |
| 7265 | hda_nid_t nid; |
| 7266 | |
| 7267 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7268 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7269 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7270 | "Mic Boost", |
| 7271 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7272 | if (err < 0) |
| 7273 | return err; |
| 7274 | } |
| 7275 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7276 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7277 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7278 | "Front Mic Boost", |
| 7279 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7280 | if (err < 0) |
| 7281 | return err; |
| 7282 | } |
| 7283 | return 0; |
| 7284 | } |
| 7285 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7286 | /* almost identical with ALC880 parser... */ |
| 7287 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7288 | { |
| 7289 | struct alc_spec *spec = codec->spec; |
| 7290 | int err = alc880_parse_auto_config(codec); |
| 7291 | |
| 7292 | if (err < 0) |
| 7293 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7294 | else if (!err) |
| 7295 | return 0; /* no config found */ |
| 7296 | |
| 7297 | err = alc_auto_add_mic_boost(codec); |
| 7298 | if (err < 0) |
| 7299 | return err; |
| 7300 | |
| 7301 | /* hack - override the init verbs */ |
| 7302 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7303 | |
| 7304 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7305 | } |
| 7306 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7307 | /* additional initialization for auto-configuration model */ |
| 7308 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7309 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7310 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7311 | alc882_auto_init_multi_out(codec); |
| 7312 | alc882_auto_init_hp_out(codec); |
| 7313 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7314 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7315 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7316 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7317 | } |
| 7318 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7319 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7320 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7321 | static int patch_alc882(struct hda_codec *codec) |
| 7322 | { |
| 7323 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7324 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7325 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7326 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7327 | if (spec == NULL) |
| 7328 | return -ENOMEM; |
| 7329 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7330 | codec->spec = spec; |
| 7331 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7332 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7333 | alc882_models, |
| 7334 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7335 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7336 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7337 | /* Pick up systems that don't supply PCI SSID */ |
| 7338 | switch (codec->subsystem_id) { |
| 7339 | case 0x106b0c00: /* Mac Pro */ |
| 7340 | board_config = ALC885_MACPRO; |
| 7341 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7342 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7343 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7344 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7345 | board_config = ALC885_IMAC24; |
| 7346 | break; |
Luke Yelavich | 2d46638 | 2009-02-23 13:00:33 +1100 | [diff] [blame] | 7347 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7348 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7349 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7350 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7351 | /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7352 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7353 | board_config = ALC885_MBP3; |
| 7354 | break; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7355 | case 0x106b3f00: /* Macbook 5,1 */ |
Takashi Iwai | 7442f9d | 2009-05-14 18:20:33 +0200 | [diff] [blame] | 7356 | case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense |
| 7357 | * seems not working, so apparently |
| 7358 | * no perfect solution yet |
| 7359 | */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7360 | board_config = ALC885_MB5; |
| 7361 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7362 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7363 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7364 | if (codec->revision_id == 0x100101 || |
| 7365 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7366 | alc_free(codec); |
| 7367 | return patch_alc883(codec); |
| 7368 | } |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7369 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 7370 | "trying auto-probe from BIOS...\n", |
| 7371 | codec->chip_name); |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7372 | board_config = ALC882_AUTO; |
| 7373 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7374 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7375 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7376 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7377 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7378 | if (board_config == ALC882_AUTO) { |
| 7379 | /* automatic parse from the BIOS config */ |
| 7380 | err = alc882_parse_auto_config(codec); |
| 7381 | if (err < 0) { |
| 7382 | alc_free(codec); |
| 7383 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7384 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7385 | printk(KERN_INFO |
| 7386 | "hda_codec: Cannot set up configuration " |
| 7387 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7388 | board_config = ALC882_3ST_DIG; |
| 7389 | } |
| 7390 | } |
| 7391 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7392 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7393 | if (err < 0) { |
| 7394 | alc_free(codec); |
| 7395 | return err; |
| 7396 | } |
| 7397 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7398 | if (board_config != ALC882_AUTO) |
| 7399 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7400 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7401 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7402 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7403 | /* FIXME: setup DAC5 */ |
| 7404 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7405 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7406 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7407 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7408 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7409 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7410 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7411 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7412 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7413 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7414 | /* get type */ |
| 7415 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7416 | if (wcap != AC_WID_AUD_IN) { |
| 7417 | spec->adc_nids = alc882_adc_nids_alt; |
| 7418 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7419 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7420 | } else { |
| 7421 | spec->adc_nids = alc882_adc_nids; |
| 7422 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7423 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7424 | } |
| 7425 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7426 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7427 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7428 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7429 | spec->vmaster_nid = 0x0c; |
| 7430 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7431 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7432 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7433 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7434 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7435 | if (!spec->loopback.amplist) |
| 7436 | spec->loopback.amplist = alc882_loopbacks; |
| 7437 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7438 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7439 | |
| 7440 | return 0; |
| 7441 | } |
| 7442 | |
| 7443 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7444 | * ALC883 support |
| 7445 | * |
| 7446 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7447 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7448 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7449 | * 6-channel independent captures. |
| 7450 | * |
| 7451 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7452 | * driver yet). |
| 7453 | */ |
| 7454 | #define ALC883_DIGOUT_NID 0x06 |
| 7455 | #define ALC883_DIGIN_NID 0x0a |
| 7456 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7457 | #define ALC1200_DIGOUT_NID 0x10 |
| 7458 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7459 | static hda_nid_t alc883_dac_nids[4] = { |
| 7460 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7461 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7462 | }; |
| 7463 | |
| 7464 | static hda_nid_t alc883_adc_nids[2] = { |
| 7465 | /* ADC1-2 */ |
| 7466 | 0x08, 0x09, |
| 7467 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7468 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7469 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7470 | /* ADC1 */ |
| 7471 | 0x08, |
| 7472 | }; |
| 7473 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7474 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7475 | /* ADC2-1 */ |
| 7476 | 0x09, 0x08 |
| 7477 | }; |
| 7478 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7479 | #define alc889_adc_nids alc880_adc_nids |
| 7480 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7481 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7482 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7483 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7484 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7485 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7486 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7487 | /* input MUX */ |
| 7488 | /* FIXME: should be a matrix-type input source selection */ |
| 7489 | |
| 7490 | static struct hda_input_mux alc883_capture_source = { |
| 7491 | .num_items = 4, |
| 7492 | .items = { |
| 7493 | { "Mic", 0x0 }, |
| 7494 | { "Front Mic", 0x1 }, |
| 7495 | { "Line", 0x2 }, |
| 7496 | { "CD", 0x4 }, |
| 7497 | }, |
| 7498 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7499 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7500 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7501 | .num_items = 4, |
| 7502 | .items = { |
| 7503 | { "Mic", 0x1 }, |
| 7504 | { "Front Mic", 0x0 }, |
| 7505 | { "Line", 0x2 }, |
| 7506 | { "CD", 0x4 }, |
| 7507 | }, |
| 7508 | }; |
| 7509 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7510 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7511 | .num_items = 2, |
| 7512 | .items = { |
| 7513 | { "Mic", 0x1 }, |
| 7514 | { "Line", 0x2 }, |
| 7515 | }, |
| 7516 | }; |
| 7517 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7518 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7519 | .num_items = 4, |
| 7520 | .items = { |
| 7521 | { "Mic", 0x0 }, |
| 7522 | { "iMic", 0x1 }, |
| 7523 | { "Line", 0x2 }, |
| 7524 | { "CD", 0x4 }, |
| 7525 | }, |
| 7526 | }; |
| 7527 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7528 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7529 | .num_items = 2, |
| 7530 | .items = { |
| 7531 | { "Mic", 0x0 }, |
| 7532 | { "Int Mic", 0x1 }, |
| 7533 | }, |
| 7534 | }; |
| 7535 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7536 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7537 | .num_items = 3, |
| 7538 | .items = { |
| 7539 | { "Mic", 0x0 }, |
| 7540 | { "Front Mic", 0x1 }, |
| 7541 | { "Line", 0x4 }, |
| 7542 | }, |
| 7543 | }; |
| 7544 | |
| 7545 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7546 | .num_items = 2, |
| 7547 | .items = { |
| 7548 | { "Mic", 0x0 }, |
| 7549 | { "Line", 0x2 }, |
| 7550 | }, |
| 7551 | }; |
| 7552 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7553 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7554 | .num_items = 2, |
| 7555 | .items = { |
| 7556 | { "Mic", 0x0 }, |
| 7557 | /* Front Mic (0x01) unused */ |
| 7558 | { "Line", 0x2 }, |
| 7559 | /* Line 2 (0x03) unused */ |
| 7560 | /* CD (0x04) unsused? */ |
| 7561 | }, |
| 7562 | }; |
| 7563 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7564 | /* |
| 7565 | * 2ch mode |
| 7566 | */ |
| 7567 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7568 | { 2, NULL } |
| 7569 | }; |
| 7570 | |
| 7571 | /* |
| 7572 | * 2ch mode |
| 7573 | */ |
| 7574 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7575 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7576 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7577 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7578 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7579 | { } /* end */ |
| 7580 | }; |
| 7581 | |
| 7582 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7583 | * 4ch mode |
| 7584 | */ |
| 7585 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7586 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7587 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7588 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7589 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7590 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7591 | { } /* end */ |
| 7592 | }; |
| 7593 | |
| 7594 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7595 | * 6ch mode |
| 7596 | */ |
| 7597 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7598 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7599 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7600 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7601 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7602 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7603 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7604 | { } /* end */ |
| 7605 | }; |
| 7606 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7607 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7608 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7609 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7610 | { 6, alc883_3ST_ch6_init }, |
| 7611 | }; |
| 7612 | |
| 7613 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7614 | * 2ch mode |
| 7615 | */ |
| 7616 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7617 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7618 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7619 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7620 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7621 | { } /* end */ |
| 7622 | }; |
| 7623 | |
| 7624 | /* |
| 7625 | * 4ch mode |
| 7626 | */ |
| 7627 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7628 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7629 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7630 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7631 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7632 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7633 | { } /* end */ |
| 7634 | }; |
| 7635 | |
| 7636 | /* |
| 7637 | * 6ch mode |
| 7638 | */ |
| 7639 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7640 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7641 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7642 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7643 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7644 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7645 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7646 | { } /* end */ |
| 7647 | }; |
| 7648 | |
| 7649 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7650 | { 2, alc883_3ST_ch2_intel_init }, |
| 7651 | { 4, alc883_3ST_ch4_intel_init }, |
| 7652 | { 6, alc883_3ST_ch6_intel_init }, |
| 7653 | }; |
| 7654 | |
| 7655 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7656 | * 6ch mode |
| 7657 | */ |
| 7658 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7659 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7660 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7661 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7662 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7663 | { } /* end */ |
| 7664 | }; |
| 7665 | |
| 7666 | /* |
| 7667 | * 8ch mode |
| 7668 | */ |
| 7669 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7670 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7671 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7672 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7673 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7674 | { } /* end */ |
| 7675 | }; |
| 7676 | |
| 7677 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7678 | { 6, alc883_sixstack_ch6_init }, |
| 7679 | { 8, alc883_sixstack_ch8_init }, |
| 7680 | }; |
| 7681 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7682 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7683 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7684 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7685 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7686 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7687 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7688 | { } /* end */ |
| 7689 | }; |
| 7690 | |
| 7691 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7692 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7693 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7694 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7695 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7696 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7697 | { } /* end */ |
| 7698 | }; |
| 7699 | |
| 7700 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7701 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7702 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7703 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7704 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7705 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7706 | { } /* end */ |
| 7707 | }; |
| 7708 | |
| 7709 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7710 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7711 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7712 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7713 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7714 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7715 | { } /* end */ |
| 7716 | }; |
| 7717 | |
| 7718 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7719 | { 2, alc889A_mb31_ch2_init }, |
| 7720 | { 4, alc889A_mb31_ch4_init }, |
| 7721 | { 5, alc889A_mb31_ch5_init }, |
| 7722 | { 6, alc889A_mb31_ch6_init }, |
| 7723 | }; |
| 7724 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7725 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7726 | /* eanable EAPD on medion laptop */ |
| 7727 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7728 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7729 | { } |
| 7730 | }; |
| 7731 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7732 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7733 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7734 | */ |
| 7735 | |
| 7736 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7737 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7738 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7739 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7740 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7741 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7742 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7743 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7744 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7745 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7746 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7747 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7748 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7749 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7750 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7751 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7752 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7753 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7754 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7755 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7756 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7757 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7758 | { } /* end */ |
| 7759 | }; |
| 7760 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7761 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7762 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7763 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7764 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7765 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7766 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7767 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7768 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7769 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7770 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7771 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7772 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7773 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7774 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7775 | { } /* end */ |
| 7776 | }; |
| 7777 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7778 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7779 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7780 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7781 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7782 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7783 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7784 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7785 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7786 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7787 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7788 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7789 | { } /* end */ |
| 7790 | }; |
| 7791 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7792 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7793 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7794 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7795 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7796 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7797 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7798 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7800 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7801 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7802 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7803 | { } /* end */ |
| 7804 | }; |
| 7805 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7806 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7807 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7808 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7809 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7810 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7811 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7812 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7813 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7815 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7816 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7817 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7818 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7819 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7820 | { } /* end */ |
| 7821 | }; |
| 7822 | |
| 7823 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7824 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7825 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7826 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7827 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7828 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7829 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7830 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7831 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7832 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7833 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7834 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7835 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7836 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7838 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7839 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7840 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7841 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7842 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7843 | { } /* end */ |
| 7844 | }; |
| 7845 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7846 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7847 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7848 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7849 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7850 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7851 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7852 | HDA_OUTPUT), |
| 7853 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7854 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7855 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7856 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7857 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7858 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7859 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7860 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7861 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7862 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7863 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7864 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7865 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7866 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7867 | { } /* end */ |
| 7868 | }; |
| 7869 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7870 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7871 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7872 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7873 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7874 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7875 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7876 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7877 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7878 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7879 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7880 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7881 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7882 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7883 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7884 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7885 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7886 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7887 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7888 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7889 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7890 | { } /* end */ |
| 7891 | }; |
| 7892 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7893 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7894 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7895 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7896 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7897 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7898 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7899 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7900 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7901 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7902 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7903 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7904 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7905 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7906 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7907 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7908 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7909 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7910 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7911 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7912 | |
| 7913 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7914 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7915 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7916 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7917 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7918 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7919 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7920 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7921 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7922 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7923 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7924 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7925 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7926 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7927 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7928 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7929 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7930 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7931 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7932 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7933 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7934 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7935 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7936 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7937 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7938 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7939 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7940 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7941 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7942 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7943 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7944 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7945 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7946 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7947 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7948 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7949 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7950 | { } /* end */ |
| 7951 | }; |
| 7952 | |
| 7953 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7954 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7955 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7956 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7957 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7958 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7959 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7960 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7961 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7962 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7963 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7964 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7965 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7966 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7967 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7968 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7969 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7970 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7971 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7972 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7973 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7974 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7975 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7976 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7977 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7978 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7979 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7980 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7981 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7982 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7983 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7984 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7985 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7986 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7987 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7988 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7989 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7990 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7991 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7992 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7993 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7994 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7995 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7996 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7997 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7998 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7999 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8000 | { } /* end */ |
| 8001 | }; |
| 8002 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8003 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8004 | /* Output mixers */ |
| 8005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8006 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8007 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8008 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8009 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8010 | HDA_OUTPUT), |
| 8011 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8012 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8013 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8014 | /* Output switches */ |
| 8015 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8016 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8017 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8018 | /* Boost mixers */ |
| 8019 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8020 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8021 | /* Input mixers */ |
| 8022 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8023 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8024 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8025 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8026 | { } /* end */ |
| 8027 | }; |
| 8028 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8029 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8030 | .ops = &snd_hda_bind_vol, |
| 8031 | .values = { |
| 8032 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8033 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8034 | 0 |
| 8035 | }, |
| 8036 | }; |
| 8037 | |
| 8038 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8039 | .ops = &snd_hda_bind_sw, |
| 8040 | .values = { |
| 8041 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8042 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8043 | 0 |
| 8044 | }, |
| 8045 | }; |
| 8046 | |
| 8047 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8048 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8049 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8050 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8051 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8052 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8053 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8054 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8055 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8056 | { } /* end */ |
| 8057 | }; |
| 8058 | |
| 8059 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8060 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8061 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8062 | { |
| 8063 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8064 | /* .name = "Capture Source", */ |
| 8065 | .name = "Input Source", |
| 8066 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8067 | .info = alc_mux_enum_info, |
| 8068 | .get = alc_mux_enum_get, |
| 8069 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8070 | }, |
| 8071 | { } /* end */ |
| 8072 | }; |
| 8073 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8074 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8075 | { |
| 8076 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8077 | .name = "Channel Mode", |
| 8078 | .info = alc_ch_mode_info, |
| 8079 | .get = alc_ch_mode_get, |
| 8080 | .put = alc_ch_mode_put, |
| 8081 | }, |
| 8082 | { } /* end */ |
| 8083 | }; |
| 8084 | |
| 8085 | static struct hda_verb alc883_init_verbs[] = { |
| 8086 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8087 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8088 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8089 | /* ADC2: mute amp left and right */ |
| 8090 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8091 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8092 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8093 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8094 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8095 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8096 | /* Rear mixer */ |
| 8097 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8098 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8099 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8100 | /* CLFE mixer */ |
| 8101 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8102 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8103 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8104 | /* Side mixer */ |
| 8105 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8106 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8107 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8108 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8109 | /* mute analog input loopbacks */ |
| 8110 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8111 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8115 | |
| 8116 | /* Front Pin: output 0 (0x0c) */ |
| 8117 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8118 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8119 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8120 | /* Rear Pin: output 1 (0x0d) */ |
| 8121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8122 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8123 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8124 | /* CLFE Pin: output 2 (0x0e) */ |
| 8125 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8126 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8127 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8128 | /* Side Pin: output 3 (0x0f) */ |
| 8129 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8130 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8131 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8132 | /* Mic (rear) pin: input vref at 80% */ |
| 8133 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8134 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8135 | /* Front Mic pin: input vref at 80% */ |
| 8136 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8137 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8138 | /* Line In pin: input */ |
| 8139 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8140 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8141 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8142 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8143 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8144 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8145 | /* CD pin widget for input */ |
| 8146 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8147 | |
| 8148 | /* FIXME: use matrix-type input source selection */ |
| 8149 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8150 | /* Input mixer2 */ |
| 8151 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8152 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8153 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8154 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8155 | /* Input mixer3 */ |
| 8156 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8157 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8158 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8159 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8160 | { } |
| 8161 | }; |
| 8162 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8163 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8164 | static void alc883_mitac_init_hook(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8165 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8166 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8167 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8168 | spec->autocfg.hp_pins[0] = 0x15; |
| 8169 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8170 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8171 | alc_automute_amp(codec); |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8172 | } |
| 8173 | |
| 8174 | /* auto-toggle front mic */ |
| 8175 | /* |
| 8176 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8177 | { |
| 8178 | unsigned int present; |
| 8179 | unsigned char bits; |
| 8180 | |
| 8181 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8182 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8183 | bits = present ? HDA_AMP_MUTE : 0; |
| 8184 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8185 | } |
| 8186 | */ |
| 8187 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8188 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8189 | /* HP */ |
| 8190 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8191 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8192 | /* Subwoofer */ |
| 8193 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8194 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8195 | |
| 8196 | /* enable unsolicited event */ |
| 8197 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8198 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8199 | |
| 8200 | { } /* end */ |
| 8201 | }; |
| 8202 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8203 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8204 | /* HP */ |
| 8205 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8206 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8207 | /* Int speaker */ |
| 8208 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8209 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8210 | |
| 8211 | /* enable unsolicited event */ |
| 8212 | {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] | 8213 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8214 | |
| 8215 | { } /* end */ |
| 8216 | }; |
| 8217 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8218 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8219 | /* HP */ |
| 8220 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8221 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8222 | /* Subwoofer */ |
| 8223 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8224 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8225 | |
| 8226 | /* enable unsolicited event */ |
| 8227 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8228 | |
| 8229 | { } /* end */ |
| 8230 | }; |
| 8231 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8232 | static struct hda_verb alc883_tagra_verbs[] = { |
| 8233 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8234 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8235 | |
| 8236 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8237 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8238 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8239 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8240 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8241 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8242 | |
| 8243 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8244 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 8245 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 8246 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8247 | |
| 8248 | { } /* end */ |
| 8249 | }; |
| 8250 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8251 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8252 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8253 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8254 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8255 | { } /* end */ |
| 8256 | }; |
| 8257 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8258 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8259 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8260 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8261 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8262 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8263 | { } /* end */ |
| 8264 | }; |
| 8265 | |
| 8266 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8267 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8268 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8269 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8270 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8271 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8272 | { } /* end */ |
| 8273 | }; |
| 8274 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8275 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8276 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8277 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8278 | |
| 8279 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8280 | |
| 8281 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8282 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8283 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8284 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8285 | { } /* end */ |
| 8286 | }; |
| 8287 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8288 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8289 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8290 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8291 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8292 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8293 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8294 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8295 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8296 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8297 | { } /* end */ |
| 8298 | }; |
| 8299 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8300 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8301 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8302 | { } |
| 8303 | }; |
| 8304 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8305 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8306 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8307 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8308 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8309 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8310 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8311 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8312 | spec->autocfg.speaker_pins[2] = 0x18; |
| 8313 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8314 | } |
| 8315 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8316 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8317 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8318 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8319 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8320 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8321 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8322 | }; |
| 8323 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8324 | /* |
| 8325 | * 2ch mode |
| 8326 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8327 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8328 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8329 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8330 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8331 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8332 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8333 | }; |
| 8334 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8335 | /* |
| 8336 | * 4ch mode |
| 8337 | */ |
| 8338 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8339 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8340 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8341 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8342 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8343 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8344 | { } /* end */ |
| 8345 | }; |
| 8346 | |
| 8347 | /* |
| 8348 | * 6ch mode |
| 8349 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8350 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8351 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8352 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8353 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8354 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8355 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8356 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8357 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8358 | }; |
| 8359 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8360 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8361 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8362 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8363 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8364 | }; |
| 8365 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8366 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8367 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8368 | { |
| 8369 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8370 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8371 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8372 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8373 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8374 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8375 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8376 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8377 | } |
| 8378 | |
| 8379 | /* toggle RCA according to the front-jack state */ |
| 8380 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8381 | { |
| 8382 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8383 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8384 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8385 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8386 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8387 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8388 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8389 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8390 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8391 | unsigned int res) |
| 8392 | { |
| 8393 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8394 | alc888_lenovo_ms7195_front_automute(codec); |
| 8395 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8396 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8397 | } |
| 8398 | |
| 8399 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8400 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8401 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8402 | |
| 8403 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8404 | |
| 8405 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8406 | { } /* end */ |
| 8407 | }; |
| 8408 | |
| 8409 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8410 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8411 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8412 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8413 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8414 | spec->autocfg.hp_pins[0] = 0x14; |
| 8415 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8416 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8417 | } |
| 8418 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8419 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8420 | #define alc883_tagra_init_hook alc882_targa_init_hook |
| 8421 | #define alc883_tagra_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8422 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8423 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8424 | { |
| 8425 | unsigned int present; |
| 8426 | |
| 8427 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8428 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8429 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8430 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8431 | } |
| 8432 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8433 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8434 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8435 | struct alc_spec *spec = codec->spec; |
| 8436 | |
| 8437 | spec->autocfg.hp_pins[0] = 0x15; |
| 8438 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8439 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8440 | alc883_clevo_m720_mic_automute(codec); |
| 8441 | } |
| 8442 | |
| 8443 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8444 | unsigned int res) |
| 8445 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8446 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8447 | case ALC880_MIC_EVENT: |
| 8448 | alc883_clevo_m720_mic_automute(codec); |
| 8449 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8450 | default: |
| 8451 | alc_automute_amp_unsol_event(codec, res); |
| 8452 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8453 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8454 | } |
| 8455 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8456 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8457 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8458 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8459 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8460 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8461 | spec->autocfg.hp_pins[0] = 0x14; |
| 8462 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8463 | alc_automute_amp(codec); |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8464 | } |
| 8465 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8466 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8467 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8468 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8469 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8470 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8471 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8472 | alc_automute_amp(codec); |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8473 | } |
| 8474 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8475 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8476 | { |
| 8477 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8478 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8479 | |
| 8480 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8481 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8482 | bits = present ? HDA_AMP_MUTE : 0; |
| 8483 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8484 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8485 | } |
| 8486 | |
| 8487 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8488 | { |
| 8489 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8490 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8491 | |
| 8492 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8493 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8494 | bits = present ? HDA_AMP_MUTE : 0; |
| 8495 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8496 | HDA_AMP_MUTE, bits); |
| 8497 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8498 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8499 | } |
| 8500 | |
| 8501 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8502 | unsigned int res) |
| 8503 | { |
| 8504 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8505 | alc883_lenovo_101e_all_automute(codec); |
| 8506 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8507 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8508 | } |
| 8509 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8510 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8511 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8512 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8513 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8514 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8515 | spec->autocfg.hp_pins[0] = 0x14; |
| 8516 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8517 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8518 | alc_automute_amp(codec); |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8519 | } |
| 8520 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8521 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8522 | /* HP Pin: output 0 (0x0c) */ |
| 8523 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8524 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8525 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8526 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8527 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8528 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8529 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8530 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8531 | /* eanable EAPD on medion laptop */ |
| 8532 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8533 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8534 | /* enable unsolicited event */ |
| 8535 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8536 | { } |
| 8537 | }; |
| 8538 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8539 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8540 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8541 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8542 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8543 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8544 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8545 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8546 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8547 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8548 | alc_automute_amp(codec); |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8549 | } |
| 8550 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8551 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8552 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8553 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8554 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8555 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8556 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8557 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8558 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8559 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8560 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 8561 | alc_automute_amp(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8562 | } |
| 8563 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8564 | /* |
| 8565 | * generic initialization of ADC, input mixers and output mixers |
| 8566 | */ |
| 8567 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8568 | /* |
| 8569 | * Unmute ADC0-2 and set the default input to mic-in |
| 8570 | */ |
| 8571 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8572 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8573 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8574 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8575 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8576 | /* 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] | 8577 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8578 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8579 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8580 | */ |
| 8581 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8582 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8583 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8584 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8585 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8586 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8587 | |
| 8588 | /* |
| 8589 | * Set up output mixers (0x0c - 0x0f) |
| 8590 | */ |
| 8591 | /* set vol=0 to output mixers */ |
| 8592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8593 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8594 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8595 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8596 | /* set up input amps for analog loopback */ |
| 8597 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8599 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8600 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8601 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8602 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8603 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8604 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8605 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8606 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8607 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8608 | |
| 8609 | /* FIXME: use matrix-type input source selection */ |
| 8610 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8611 | /* Input mixer1 */ |
| 8612 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8613 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8614 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8615 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8616 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8617 | /* Input mixer2 */ |
| 8618 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8619 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8620 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8621 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8622 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8623 | |
| 8624 | { } |
| 8625 | }; |
| 8626 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8627 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8628 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8629 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8630 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8631 | /* enable unsolicited event */ |
| 8632 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8633 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8634 | { } /* end */ |
| 8635 | }; |
| 8636 | |
| 8637 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8638 | { |
| 8639 | unsigned int present; |
| 8640 | |
| 8641 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8642 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8643 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8644 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8645 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8646 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8647 | } |
| 8648 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8649 | static void alc883_M90V_init_hook(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8650 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8651 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8652 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8653 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8654 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8655 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8656 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8657 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8658 | } |
| 8659 | |
| 8660 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8661 | unsigned int res) |
| 8662 | { |
| 8663 | switch (res >> 26) { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8664 | case ALC880_MIC_EVENT: |
| 8665 | alc883_nb_mic_automute(codec); |
| 8666 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8667 | default: |
| 8668 | alc_sku_unsol_event(codec, res); |
| 8669 | break; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8670 | } |
| 8671 | } |
| 8672 | |
| 8673 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8674 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8675 | alc883_M90V_init_hook(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8676 | alc883_nb_mic_automute(codec); |
| 8677 | } |
| 8678 | |
| 8679 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8680 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8681 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8682 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8683 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8684 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8685 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8686 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8687 | /* enable unsolicited event */ |
| 8688 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8689 | { } /* end */ |
| 8690 | }; |
| 8691 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8692 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8693 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8694 | struct alc_spec *spec = codec->spec; |
| 8695 | |
| 8696 | spec->autocfg.hp_pins[0] = 0x14; |
| 8697 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8698 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8699 | } |
| 8700 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8701 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8702 | /* Init rear pin (used as headphone output) */ |
| 8703 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8704 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8705 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8706 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8707 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8708 | /* Init line 2 pin (used as headphone out by default) */ |
| 8709 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8710 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8711 | { } /* end */ |
| 8712 | }; |
| 8713 | |
| 8714 | /* Mute speakers according to the headphone jack state */ |
| 8715 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8716 | { |
| 8717 | unsigned int present; |
| 8718 | |
| 8719 | /* Mute only in 2ch or 4ch mode */ |
| 8720 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8721 | == 0x00) { |
| 8722 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8723 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8724 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8725 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8726 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8727 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8728 | } |
| 8729 | } |
| 8730 | |
| 8731 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8732 | { |
| 8733 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8734 | alc889A_mb31_automute(codec); |
| 8735 | } |
| 8736 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8737 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8738 | #define alc883_loopbacks alc880_loopbacks |
| 8739 | #endif |
| 8740 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8741 | /* pcm configuration: identiacal with ALC880 */ |
| 8742 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8743 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8744 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8745 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8746 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8747 | |
| 8748 | /* |
| 8749 | * configuration and preset |
| 8750 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8751 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8752 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8753 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8754 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8755 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8756 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8757 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8758 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8759 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8760 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8761 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8762 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8763 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8764 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8765 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8766 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8767 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8768 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8769 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8770 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8771 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8772 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8773 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8774 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8775 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8776 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8777 | [ALC889A_MB31] = "mb31", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8778 | [ALC883_AUTO] = "auto", |
| 8779 | }; |
| 8780 | |
| 8781 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8782 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8783 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8784 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8785 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8786 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8787 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8788 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8789 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8790 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8791 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8792 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | b3bdb30 | 2009-02-18 13:16:26 +0100 | [diff] [blame] | 8793 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame] | 8794 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8795 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 8796 | ALC888_ACER_ASPIRE_4930G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8797 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
| 8798 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8799 | /* default Acer -- disabled as it causes more problems. |
| 8800 | * model=auto should work fine now |
| 8801 | */ |
| 8802 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8803 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8804 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8805 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8806 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8807 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8808 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8809 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8810 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8811 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Mackenzie Morgan | 44a678d | 2009-02-10 17:13:43 +0100 | [diff] [blame] | 8812 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8813 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8814 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8815 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8816 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8817 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8818 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8819 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8820 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8821 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8822 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8823 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8824 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8825 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8826 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8827 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8828 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8829 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8830 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8831 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8832 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8833 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8834 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8835 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8836 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8837 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8838 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8839 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8840 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8841 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8842 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8843 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8844 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8845 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8846 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8847 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8848 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8849 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8850 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8851 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8852 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8853 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8854 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8855 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8856 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8857 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8858 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8859 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8860 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8861 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8862 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8863 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8864 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8865 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8866 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8867 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 8868 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8869 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8870 | {} |
| 8871 | }; |
| 8872 | |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8873 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8874 | ALC1200_DIGOUT_NID, 0, |
| 8875 | }; |
| 8876 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 8877 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8878 | ALC883_DIGOUT_NID, 0, |
| 8879 | }; |
| 8880 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8881 | static struct alc_config_preset alc883_presets[] = { |
| 8882 | [ALC883_3ST_2ch_DIG] = { |
| 8883 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8884 | .init_verbs = { alc883_init_verbs }, |
| 8885 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8886 | .dac_nids = alc883_dac_nids, |
| 8887 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8888 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8889 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8890 | .channel_mode = alc883_3ST_2ch_modes, |
| 8891 | .input_mux = &alc883_capture_source, |
| 8892 | }, |
| 8893 | [ALC883_3ST_6ch_DIG] = { |
| 8894 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8895 | .init_verbs = { alc883_init_verbs }, |
| 8896 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8897 | .dac_nids = alc883_dac_nids, |
| 8898 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8899 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8900 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8901 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8902 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8903 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8904 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8905 | [ALC883_3ST_6ch] = { |
| 8906 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8907 | .init_verbs = { alc883_init_verbs }, |
| 8908 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8909 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8910 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8911 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8912 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8913 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8914 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8915 | [ALC883_3ST_6ch_INTEL] = { |
| 8916 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8917 | .init_verbs = { alc883_init_verbs }, |
| 8918 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8919 | .dac_nids = alc883_dac_nids, |
| 8920 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8921 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8922 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8923 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8924 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8925 | .need_dac_fix = 1, |
| 8926 | .input_mux = &alc883_3stack_6ch_intel, |
| 8927 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8928 | [ALC883_6ST_DIG] = { |
| 8929 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8930 | .init_verbs = { alc883_init_verbs }, |
| 8931 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8932 | .dac_nids = alc883_dac_nids, |
| 8933 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8934 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8935 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8936 | .channel_mode = alc883_sixstack_modes, |
| 8937 | .input_mux = &alc883_capture_source, |
| 8938 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8939 | [ALC883_TARGA_DIG] = { |
| 8940 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8941 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8942 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8943 | .dac_nids = alc883_dac_nids, |
| 8944 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8945 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8946 | .channel_mode = alc883_3ST_6ch_modes, |
| 8947 | .need_dac_fix = 1, |
| 8948 | .input_mux = &alc883_capture_source, |
| 8949 | .unsol_event = alc883_tagra_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8950 | .init_hook = alc883_tagra_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8951 | }, |
| 8952 | [ALC883_TARGA_2ch_DIG] = { |
| 8953 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8954 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8955 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8956 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8957 | .adc_nids = alc883_adc_nids_alt, |
| 8958 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8959 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8960 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8961 | .channel_mode = alc883_3ST_2ch_modes, |
| 8962 | .input_mux = &alc883_capture_source, |
| 8963 | .unsol_event = alc883_tagra_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8964 | .init_hook = alc883_tagra_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8965 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8966 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8967 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8968 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8969 | * and the headphone jack. Turn this on and rely on the |
| 8970 | * standard mute methods whenever the user wants to turn |
| 8971 | * these outputs off. |
| 8972 | */ |
| 8973 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8974 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8975 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8976 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8977 | .channel_mode = alc883_3ST_2ch_modes, |
| 8978 | .input_mux = &alc883_capture_source, |
| 8979 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8980 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8981 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8982 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8983 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8984 | .dac_nids = alc883_dac_nids, |
| 8985 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8986 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8987 | .channel_mode = alc883_3ST_2ch_modes, |
| 8988 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8989 | .unsol_event = alc_automute_amp_unsol_event, |
| 8990 | .init_hook = alc883_acer_aspire_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8991 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8992 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8993 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8994 | alc883_chmode_mixer }, |
| 8995 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8996 | alc888_acer_aspire_4930g_verbs }, |
| 8997 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8998 | .dac_nids = alc883_dac_nids, |
| 8999 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9000 | .adc_nids = alc883_adc_nids_rev, |
| 9001 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9002 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9003 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9004 | .channel_mode = alc883_3ST_6ch_modes, |
| 9005 | .need_dac_fix = 1, |
| 9006 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9007 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9008 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9009 | .unsol_event = alc_automute_amp_unsol_event, |
| 9010 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9011 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9012 | [ALC883_MEDION] = { |
| 9013 | .mixers = { alc883_fivestack_mixer, |
| 9014 | alc883_chmode_mixer }, |
| 9015 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9016 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9017 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9018 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9019 | .adc_nids = alc883_adc_nids_alt, |
| 9020 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9021 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9022 | .channel_mode = alc883_sixstack_modes, |
| 9023 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9024 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9025 | [ALC883_MEDION_MD2] = { |
| 9026 | .mixers = { alc883_medion_md2_mixer}, |
| 9027 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9028 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9029 | .dac_nids = alc883_dac_nids, |
| 9030 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9031 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9032 | .channel_mode = alc883_3ST_2ch_modes, |
| 9033 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9034 | .unsol_event = alc_automute_amp_unsol_event, |
| 9035 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9036 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9037 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9038 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9039 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9040 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9041 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9042 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9043 | .channel_mode = alc883_3ST_2ch_modes, |
| 9044 | .input_mux = &alc883_capture_source, |
| 9045 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9046 | [ALC883_CLEVO_M720] = { |
| 9047 | .mixers = { alc883_clevo_m720_mixer }, |
| 9048 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9049 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9050 | .dac_nids = alc883_dac_nids, |
| 9051 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9052 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9053 | .channel_mode = alc883_3ST_2ch_modes, |
| 9054 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9055 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9056 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9057 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9058 | [ALC883_LENOVO_101E_2ch] = { |
| 9059 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9060 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9061 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9062 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9063 | .adc_nids = alc883_adc_nids_alt, |
| 9064 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9065 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9066 | .channel_mode = alc883_3ST_2ch_modes, |
| 9067 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9068 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9069 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9070 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9071 | [ALC883_LENOVO_NB0763] = { |
| 9072 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9073 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9074 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9075 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9076 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9077 | .channel_mode = alc883_3ST_2ch_modes, |
| 9078 | .need_dac_fix = 1, |
| 9079 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9080 | .unsol_event = alc_automute_amp_unsol_event, |
| 9081 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9082 | }, |
| 9083 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9084 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9085 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9086 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9087 | .dac_nids = alc883_dac_nids, |
| 9088 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9089 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9090 | .channel_mode = alc883_3ST_6ch_modes, |
| 9091 | .need_dac_fix = 1, |
| 9092 | .input_mux = &alc883_capture_source, |
| 9093 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9094 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9095 | }, |
| 9096 | [ALC883_HAIER_W66] = { |
| 9097 | .mixers = { alc883_tagra_2ch_mixer}, |
| 9098 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9099 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9100 | .dac_nids = alc883_dac_nids, |
| 9101 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9102 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9103 | .channel_mode = alc883_3ST_2ch_modes, |
| 9104 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9105 | .unsol_event = alc_automute_amp_unsol_event, |
| 9106 | .init_hook = alc883_haier_w66_init_hook, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9107 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9108 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9109 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9110 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9111 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9112 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9113 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9114 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9115 | .need_dac_fix = 1, |
| 9116 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9117 | .unsol_event = alc_automute_amp_unsol_event, |
| 9118 | .init_hook = alc888_3st_hp_init_hook, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9119 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9120 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9121 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9122 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9123 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9124 | .dac_nids = alc883_dac_nids, |
| 9125 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9126 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9127 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9128 | .channel_mode = alc883_sixstack_modes, |
| 9129 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9130 | .unsol_event = alc_automute_amp_unsol_event, |
| 9131 | .init_hook = alc888_6st_dell_init_hook, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9132 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9133 | [ALC883_MITAC] = { |
| 9134 | .mixers = { alc883_mitac_mixer }, |
| 9135 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9136 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9137 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9138 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9139 | .channel_mode = alc883_3ST_2ch_modes, |
| 9140 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9141 | .unsol_event = alc_automute_amp_unsol_event, |
| 9142 | .init_hook = alc883_mitac_init_hook, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9143 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9144 | [ALC883_FUJITSU_PI2515] = { |
| 9145 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9146 | .init_verbs = { alc883_init_verbs, |
| 9147 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9148 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9149 | .dac_nids = alc883_dac_nids, |
| 9150 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9151 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9152 | .channel_mode = alc883_3ST_2ch_modes, |
| 9153 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9154 | .unsol_event = alc_automute_amp_unsol_event, |
| 9155 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9156 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9157 | [ALC888_FUJITSU_XA3530] = { |
| 9158 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9159 | .init_verbs = { alc883_init_verbs, |
| 9160 | alc888_fujitsu_xa3530_verbs }, |
| 9161 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9162 | .dac_nids = alc883_dac_nids, |
| 9163 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9164 | .adc_nids = alc883_adc_nids_rev, |
| 9165 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9166 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9167 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9168 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9169 | .num_mux_defs = |
| 9170 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9171 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9172 | .unsol_event = alc_automute_amp_unsol_event, |
| 9173 | .init_hook = alc888_fujitsu_xa3530_init_hook, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9174 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9175 | [ALC888_LENOVO_SKY] = { |
| 9176 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9177 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9178 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9179 | .dac_nids = alc883_dac_nids, |
| 9180 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9181 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9182 | .channel_mode = alc883_sixstack_modes, |
| 9183 | .need_dac_fix = 1, |
| 9184 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9185 | .unsol_event = alc_automute_amp_unsol_event, |
| 9186 | .init_hook = alc888_lenovo_sky_init_hook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9187 | }, |
| 9188 | [ALC888_ASUS_M90V] = { |
| 9189 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9190 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9191 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9192 | .dac_nids = alc883_dac_nids, |
| 9193 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9194 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9195 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9196 | .channel_mode = alc883_3ST_6ch_modes, |
| 9197 | .need_dac_fix = 1, |
| 9198 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9199 | .unsol_event = alc883_mode2_unsol_event, |
| 9200 | .init_hook = alc883_mode2_inithook, |
| 9201 | }, |
| 9202 | [ALC888_ASUS_EEE1601] = { |
| 9203 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9204 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9205 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9206 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9207 | .dac_nids = alc883_dac_nids, |
| 9208 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9209 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9210 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9211 | .channel_mode = alc883_3ST_2ch_modes, |
| 9212 | .need_dac_fix = 1, |
| 9213 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9214 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9215 | .init_hook = alc883_eee1601_inithook, |
| 9216 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9217 | [ALC1200_ASUS_P5Q] = { |
| 9218 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9219 | .init_verbs = { alc883_init_verbs }, |
| 9220 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9221 | .dac_nids = alc883_dac_nids, |
| 9222 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9223 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9224 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9225 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9226 | .channel_mode = alc883_sixstack_modes, |
| 9227 | .input_mux = &alc883_capture_source, |
| 9228 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9229 | [ALC889A_MB31] = { |
| 9230 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9231 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9232 | alc880_gpio1_init_verbs }, |
| 9233 | .adc_nids = alc883_adc_nids, |
| 9234 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9235 | .dac_nids = alc883_dac_nids, |
| 9236 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9237 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9238 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9239 | .input_mux = &alc889A_mb31_capture_source, |
| 9240 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9241 | .unsol_event = alc889A_mb31_unsol_event, |
| 9242 | .init_hook = alc889A_mb31_automute, |
| 9243 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9244 | }; |
| 9245 | |
| 9246 | |
| 9247 | /* |
| 9248 | * BIOS auto configuration |
| 9249 | */ |
| 9250 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9251 | hda_nid_t nid, int pin_type, |
| 9252 | int dac_idx) |
| 9253 | { |
| 9254 | /* set as output */ |
| 9255 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9256 | int idx; |
| 9257 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9258 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9259 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9260 | idx = 4; |
| 9261 | else |
| 9262 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9263 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9264 | |
| 9265 | } |
| 9266 | |
| 9267 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 9268 | { |
| 9269 | struct alc_spec *spec = codec->spec; |
| 9270 | int i; |
| 9271 | |
| 9272 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9273 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9274 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9275 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9276 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9277 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9278 | } |
| 9279 | } |
| 9280 | |
| 9281 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 9282 | { |
| 9283 | struct alc_spec *spec = codec->spec; |
| 9284 | hda_nid_t pin; |
| 9285 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9286 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9287 | if (pin) /* connect to front */ |
| 9288 | /* use dac 0 */ |
| 9289 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9290 | pin = spec->autocfg.speaker_pins[0]; |
| 9291 | if (pin) |
| 9292 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9293 | } |
| 9294 | |
| 9295 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9296 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9297 | |
| 9298 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9299 | { |
| 9300 | struct alc_spec *spec = codec->spec; |
| 9301 | int i; |
| 9302 | |
| 9303 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9304 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9305 | if (alc883_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 9306 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 9307 | if (nid != ALC883_PIN_CD_NID && |
| 9308 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9309 | snd_hda_codec_write(codec, nid, 0, |
| 9310 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9311 | AMP_OUT_MUTE); |
| 9312 | } |
| 9313 | } |
| 9314 | } |
| 9315 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9316 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9317 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9318 | /* almost identical with ALC880 parser... */ |
| 9319 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9320 | { |
| 9321 | struct alc_spec *spec = codec->spec; |
| 9322 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9323 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9324 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9325 | |
| 9326 | if (err < 0) |
| 9327 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9328 | else if (!err) |
| 9329 | return 0; /* no config found */ |
| 9330 | |
| 9331 | err = alc_auto_add_mic_boost(codec); |
| 9332 | if (err < 0) |
| 9333 | return err; |
| 9334 | |
| 9335 | /* hack - override the init verbs */ |
| 9336 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9337 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9338 | /* setup input_mux for ALC889 */ |
| 9339 | if (codec->vendor_id == 0x10ec0889) { |
| 9340 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9341 | * because it's under 0x18 |
| 9342 | */ |
| 9343 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9344 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9345 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9346 | for (i = 1; i < 3; i++) |
| 9347 | memcpy(&spec->private_imux[i], |
| 9348 | &spec->private_imux[0], |
| 9349 | sizeof(spec->private_imux[0])); |
| 9350 | imux->items[imux->num_items].label = "Int DMic"; |
| 9351 | imux->items[imux->num_items].index = 0x0b; |
| 9352 | imux->num_items++; |
| 9353 | spec->num_mux_defs = 3; |
| 9354 | spec->input_mux = spec->private_imux; |
| 9355 | } |
| 9356 | } |
| 9357 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9358 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9359 | } |
| 9360 | |
| 9361 | /* additional initialization for auto-configuration model */ |
| 9362 | static void alc883_auto_init(struct hda_codec *codec) |
| 9363 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9364 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9365 | alc883_auto_init_multi_out(codec); |
| 9366 | alc883_auto_init_hp_out(codec); |
| 9367 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9368 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9369 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9370 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9371 | } |
| 9372 | |
| 9373 | static int patch_alc883(struct hda_codec *codec) |
| 9374 | { |
| 9375 | struct alc_spec *spec; |
| 9376 | int err, board_config; |
| 9377 | |
| 9378 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9379 | if (spec == NULL) |
| 9380 | return -ENOMEM; |
| 9381 | |
| 9382 | codec->spec = spec; |
| 9383 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9384 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9385 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9386 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9387 | alc883_models, |
| 9388 | alc883_cfg_tbl); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9389 | if (board_config < 0 || board_config >= ALC883_MODEL_LAST) { |
| 9390 | /* Pick up systems that don't supply PCI SSID */ |
| 9391 | switch (codec->subsystem_id) { |
| 9392 | case 0x106b3600: /* Macbook 3.1 */ |
| 9393 | board_config = ALC889A_MB31; |
| 9394 | break; |
| 9395 | default: |
| 9396 | printk(KERN_INFO |
| 9397 | "hda_codec: Unknown model for %s, trying " |
| 9398 | "auto-probe from BIOS...\n", codec->chip_name); |
| 9399 | board_config = ALC883_AUTO; |
| 9400 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9401 | } |
| 9402 | |
| 9403 | if (board_config == ALC883_AUTO) { |
| 9404 | /* automatic parse from the BIOS config */ |
| 9405 | err = alc883_parse_auto_config(codec); |
| 9406 | if (err < 0) { |
| 9407 | alc_free(codec); |
| 9408 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9409 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9410 | printk(KERN_INFO |
| 9411 | "hda_codec: Cannot set up configuration " |
| 9412 | "from BIOS. Using base mode...\n"); |
| 9413 | board_config = ALC883_3ST_2ch_DIG; |
| 9414 | } |
| 9415 | } |
| 9416 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9417 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9418 | if (err < 0) { |
| 9419 | alc_free(codec); |
| 9420 | return err; |
| 9421 | } |
| 9422 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9423 | if (board_config != ALC883_AUTO) |
| 9424 | setup_preset(spec, &alc883_presets[board_config]); |
| 9425 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9426 | switch (codec->vendor_id) { |
| 9427 | case 0x10ec0888: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9428 | if (!spec->num_adc_nids) { |
| 9429 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9430 | spec->adc_nids = alc883_adc_nids; |
| 9431 | } |
| 9432 | if (!spec->capsrc_nids) |
| 9433 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9434 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9435 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9436 | break; |
| 9437 | case 0x10ec0889: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9438 | if (!spec->num_adc_nids) { |
| 9439 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9440 | spec->adc_nids = alc889_adc_nids; |
| 9441 | } |
| 9442 | if (!spec->capsrc_nids) |
| 9443 | spec->capsrc_nids = alc889_capsrc_nids; |
| 9444 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style |
| 9445 | capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9446 | break; |
| 9447 | default: |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9448 | if (!spec->num_adc_nids) { |
| 9449 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9450 | spec->adc_nids = alc883_adc_nids; |
| 9451 | } |
| 9452 | if (!spec->capsrc_nids) |
| 9453 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9454 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9455 | break; |
| 9456 | } |
| 9457 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9458 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9459 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9460 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9461 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9462 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9463 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9464 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9465 | if (!spec->cap_mixer) |
| 9466 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9467 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9468 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9469 | spec->vmaster_nid = 0x0c; |
| 9470 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9471 | codec->patch_ops = alc_patch_ops; |
| 9472 | if (board_config == ALC883_AUTO) |
| 9473 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9474 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9475 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9476 | if (!spec->loopback.amplist) |
| 9477 | spec->loopback.amplist = alc883_loopbacks; |
| 9478 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9479 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9480 | |
| 9481 | return 0; |
| 9482 | } |
| 9483 | |
| 9484 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9485 | * ALC262 support |
| 9486 | */ |
| 9487 | |
| 9488 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9489 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9490 | |
| 9491 | #define alc262_dac_nids alc260_dac_nids |
| 9492 | #define alc262_adc_nids alc882_adc_nids |
| 9493 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9494 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9495 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9496 | |
| 9497 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9498 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9499 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9500 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9501 | /* ADC0 */ |
| 9502 | 0x09 |
| 9503 | }; |
| 9504 | |
| 9505 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9506 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9507 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9508 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9509 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9510 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9511 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9512 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9513 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9514 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9515 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9516 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9517 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9518 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9519 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9520 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9521 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9522 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9523 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9524 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9525 | }; |
| 9526 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9527 | /* update HP, line and mono-out pins according to the master switch */ |
| 9528 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9529 | { |
| 9530 | struct alc_spec *spec = codec->spec; |
| 9531 | int val = spec->master_sw; |
| 9532 | |
| 9533 | /* HP & line-out */ |
| 9534 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9535 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9536 | val ? PIN_HP : 0); |
| 9537 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9538 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9539 | val ? PIN_HP : 0); |
| 9540 | /* mono (speaker) depending on the HP jack sense */ |
| 9541 | val = val && !spec->jack_present; |
| 9542 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9543 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9544 | val ? PIN_OUT : 0); |
| 9545 | } |
| 9546 | |
| 9547 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9548 | { |
| 9549 | struct alc_spec *spec = codec->spec; |
| 9550 | unsigned int presence; |
| 9551 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9552 | AC_VERB_GET_PIN_SENSE, 0); |
| 9553 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9554 | alc262_hp_master_update(codec); |
| 9555 | } |
| 9556 | |
| 9557 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9558 | { |
| 9559 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9560 | return; |
| 9561 | alc262_hp_bpc_automute(codec); |
| 9562 | } |
| 9563 | |
| 9564 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9565 | { |
| 9566 | struct alc_spec *spec = codec->spec; |
| 9567 | unsigned int presence; |
| 9568 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9569 | AC_VERB_GET_PIN_SENSE, 0); |
| 9570 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9571 | alc262_hp_master_update(codec); |
| 9572 | } |
| 9573 | |
| 9574 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9575 | unsigned int res) |
| 9576 | { |
| 9577 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9578 | return; |
| 9579 | alc262_hp_wildwest_automute(codec); |
| 9580 | } |
| 9581 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9582 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9583 | |
| 9584 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9585 | struct snd_ctl_elem_value *ucontrol) |
| 9586 | { |
| 9587 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9588 | struct alc_spec *spec = codec->spec; |
| 9589 | int val = !!*ucontrol->value.integer.value; |
| 9590 | |
| 9591 | if (val == spec->master_sw) |
| 9592 | return 0; |
| 9593 | spec->master_sw = val; |
| 9594 | alc262_hp_master_update(codec); |
| 9595 | return 1; |
| 9596 | } |
| 9597 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9598 | #define ALC262_HP_MASTER_SWITCH \ |
| 9599 | { \ |
| 9600 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9601 | .name = "Master Playback Switch", \ |
| 9602 | .info = snd_ctl_boolean_mono_info, \ |
| 9603 | .get = alc262_hp_master_sw_get, \ |
| 9604 | .put = alc262_hp_master_sw_put, \ |
| 9605 | } |
| 9606 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9607 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9608 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9609 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9610 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9611 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9612 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9613 | HDA_OUTPUT), |
| 9614 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9615 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9616 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9617 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9618 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9619 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9620 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9621 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9622 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9623 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9624 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9625 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9626 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9627 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9628 | { } /* end */ |
| 9629 | }; |
| 9630 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9631 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9632 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9633 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9634 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9635 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9636 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9637 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9638 | HDA_OUTPUT), |
| 9639 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9640 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9641 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9642 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9643 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9644 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9645 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9646 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9647 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9648 | { } /* end */ |
| 9649 | }; |
| 9650 | |
| 9651 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9652 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9653 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9654 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9655 | { } /* end */ |
| 9656 | }; |
| 9657 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9658 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9659 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9660 | { |
| 9661 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9662 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9663 | spec->autocfg.hp_pins[0] = 0x15; |
| 9664 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
| 9665 | alc_automute_amp(codec); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9666 | } |
| 9667 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9668 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9669 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9670 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9671 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9672 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9673 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9674 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9675 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9676 | { } /* end */ |
| 9677 | }; |
| 9678 | |
| 9679 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9680 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9681 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9682 | |
| 9683 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9684 | { } |
| 9685 | }; |
| 9686 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9687 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9688 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9689 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9690 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9691 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9692 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9693 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9694 | { } /* end */ |
| 9695 | }; |
| 9696 | |
| 9697 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9698 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9699 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9700 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9701 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9702 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9703 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9704 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9705 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9706 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9707 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9708 | {} |
| 9709 | }; |
| 9710 | |
| 9711 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9712 | .num_items = 1, |
| 9713 | .items = { |
| 9714 | { "Line", 0x1 }, |
| 9715 | }, |
| 9716 | }; |
| 9717 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9718 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 9719 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 9720 | { |
| 9721 | struct alc_spec *spec = codec->spec; |
| 9722 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9723 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9724 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9725 | unsigned int mute; |
| 9726 | |
| 9727 | /* HP */ |
| 9728 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 9729 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 9730 | HDA_AMP_MUTE, mute); |
| 9731 | /* mute internal speaker per jack sense */ |
| 9732 | if (spec->jack_present) |
| 9733 | mute = HDA_AMP_MUTE; |
| 9734 | if (line_nid) |
| 9735 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 9736 | HDA_AMP_MUTE, mute); |
| 9737 | if (speaker_nid && speaker_nid != line_nid) |
| 9738 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 9739 | HDA_AMP_MUTE, mute); |
| 9740 | } |
| 9741 | |
| 9742 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 9743 | |
| 9744 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9745 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9746 | { |
| 9747 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9748 | struct alc_spec *spec = codec->spec; |
| 9749 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9750 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9751 | if (val == spec->master_sw) |
| 9752 | return 0; |
| 9753 | spec->master_sw = val; |
| 9754 | alc262_hippo_master_update(codec); |
| 9755 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9756 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9757 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9758 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 9759 | { \ |
| 9760 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9761 | .name = "Master Playback Switch", \ |
| 9762 | .info = snd_ctl_boolean_mono_info, \ |
| 9763 | .get = alc262_hippo_master_sw_get, \ |
| 9764 | .put = alc262_hippo_master_sw_put, \ |
| 9765 | } |
| 9766 | |
| 9767 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 9768 | ALC262_HIPPO_MASTER_SWITCH, |
| 9769 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9770 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9771 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9772 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9773 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9774 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9775 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9776 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9777 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9778 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9779 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9780 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9781 | { } /* end */ |
| 9782 | }; |
| 9783 | |
| 9784 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9785 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9786 | ALC262_HIPPO_MASTER_SWITCH, |
| 9787 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9788 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9789 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9790 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9791 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9792 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9793 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9794 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9795 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9796 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9797 | { } /* end */ |
| 9798 | }; |
| 9799 | |
| 9800 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9801 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 9802 | { |
| 9803 | struct alc_spec *spec = codec->spec; |
| 9804 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9805 | unsigned int present; |
| 9806 | |
| 9807 | /* need to execute and sync at first */ |
| 9808 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9809 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 9810 | AC_VERB_GET_PIN_SENSE, 0); |
| 9811 | spec->jack_present = (present & 0x80000000) != 0; |
| 9812 | alc262_hippo_master_update(codec); |
| 9813 | } |
| 9814 | |
| 9815 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9816 | { |
| 9817 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9818 | return; |
| 9819 | alc262_hippo_automute(codec); |
| 9820 | } |
| 9821 | |
| 9822 | static void alc262_hippo_init_hook(struct hda_codec *codec) |
| 9823 | { |
| 9824 | struct alc_spec *spec = codec->spec; |
| 9825 | |
| 9826 | spec->autocfg.hp_pins[0] = 0x15; |
| 9827 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9828 | alc262_hippo_automute(codec); |
| 9829 | } |
| 9830 | |
| 9831 | static void alc262_hippo1_init_hook(struct hda_codec *codec) |
| 9832 | { |
| 9833 | struct alc_spec *spec = codec->spec; |
| 9834 | |
| 9835 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9836 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9837 | alc262_hippo_automute(codec); |
| 9838 | } |
| 9839 | |
| 9840 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9841 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9842 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9843 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9844 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9846 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9847 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9848 | { } /* end */ |
| 9849 | }; |
| 9850 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9851 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9852 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9853 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9854 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9855 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9856 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9857 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9858 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9859 | { } /* end */ |
| 9860 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9861 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9862 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9863 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9864 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9865 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9866 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9867 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9868 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9869 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9870 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9871 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9872 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9873 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9874 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9875 | { } /* end */ |
| 9876 | }; |
| 9877 | |
| 9878 | static struct hda_verb alc262_tyan_verbs[] = { |
| 9879 | /* Headphone automute */ |
| 9880 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9881 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9882 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9883 | |
| 9884 | /* P11 AUX_IN, white 4-pin connector */ |
| 9885 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9886 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 9887 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 9888 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 9889 | |
| 9890 | {} |
| 9891 | }; |
| 9892 | |
| 9893 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9894 | static void alc262_tyan_init_hook(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9895 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9896 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9897 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9898 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9899 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9900 | alc_automute_amp(codec); |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9901 | } |
| 9902 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9903 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9904 | #define alc262_capture_mixer alc882_capture_mixer |
| 9905 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9906 | |
| 9907 | /* |
| 9908 | * generic initialization of ADC, input mixers and output mixers |
| 9909 | */ |
| 9910 | static struct hda_verb alc262_init_verbs[] = { |
| 9911 | /* |
| 9912 | * Unmute ADC0-2 and set the default input to mic-in |
| 9913 | */ |
| 9914 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9915 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9916 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9917 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9918 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9919 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9920 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9921 | /* 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] | 9922 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9923 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9924 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9925 | */ |
| 9926 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9928 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9929 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9930 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9932 | |
| 9933 | /* |
| 9934 | * Set up output mixers (0x0c - 0x0e) |
| 9935 | */ |
| 9936 | /* set vol=0 to output mixers */ |
| 9937 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9938 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9939 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9940 | /* set up input amps for analog loopback */ |
| 9941 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9942 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9943 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9944 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9945 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9946 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9947 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9948 | |
| 9949 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9950 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9951 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9952 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9953 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9954 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9955 | |
| 9956 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9957 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9958 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9959 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9960 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9961 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9962 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9963 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9964 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9965 | /* FIXME: use matrix-type input source selection */ |
| 9966 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9967 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9968 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9969 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9970 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9971 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9972 | /* Input mixer2 */ |
| 9973 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9974 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9975 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9976 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9977 | /* Input mixer3 */ |
| 9978 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9979 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9980 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9981 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9982 | |
| 9983 | { } |
| 9984 | }; |
| 9985 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9986 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9987 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9988 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9989 | { } |
| 9990 | }; |
| 9991 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9992 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9993 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9994 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9995 | {} |
| 9996 | }; |
| 9997 | |
| 9998 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9999 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10000 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10001 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10002 | |
| 10003 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10004 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10005 | {} |
| 10006 | }; |
| 10007 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10008 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10009 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10010 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10011 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10012 | |
| 10013 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10014 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10015 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10016 | }; |
| 10017 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10018 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 10019 | .num_items = 2, |
| 10020 | .items = { |
| 10021 | { "Int DMic", 0x9 }, |
| 10022 | { "Mic", 0x0 }, |
| 10023 | }, |
| 10024 | }; |
| 10025 | |
| 10026 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10027 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10028 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10029 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10030 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10031 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10032 | { } /* end */ |
| 10033 | }; |
| 10034 | |
| 10035 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10036 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10037 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10038 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10039 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10040 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10041 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10042 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10043 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10044 | {} |
| 10045 | }; |
| 10046 | |
| 10047 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 10048 | { |
| 10049 | unsigned int present; |
| 10050 | |
| 10051 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10052 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10053 | snd_hda_codec_write(codec, 0x22, 0, |
| 10054 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 10055 | } |
| 10056 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10057 | |
| 10058 | /* unsolicited event for HP jack sensing */ |
| 10059 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 10060 | unsigned int res) |
| 10061 | { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10062 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10063 | alc262_dmic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10064 | else |
| 10065 | alc_sku_unsol_event(codec, res); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10066 | } |
| 10067 | |
| 10068 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 10069 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10070 | struct alc_spec *spec = codec->spec; |
| 10071 | |
| 10072 | spec->autocfg.hp_pins[0] = 0x15; |
| 10073 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10074 | alc_automute_pin(codec); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10075 | alc262_dmic_automute(codec); |
| 10076 | } |
| 10077 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10078 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10079 | * nec model |
| 10080 | * 0x15 = headphone |
| 10081 | * 0x16 = internal speaker |
| 10082 | * 0x18 = external mic |
| 10083 | */ |
| 10084 | |
| 10085 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10086 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10087 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10088 | |
| 10089 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10090 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10091 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10092 | |
| 10093 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10094 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10095 | { } /* end */ |
| 10096 | }; |
| 10097 | |
| 10098 | static struct hda_verb alc262_nec_verbs[] = { |
| 10099 | /* Unmute Speaker */ |
| 10100 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10101 | |
| 10102 | /* Headphone */ |
| 10103 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10104 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10105 | |
| 10106 | /* External mic to headphone */ |
| 10107 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10108 | /* External mic to speaker */ |
| 10109 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10110 | {} |
| 10111 | }; |
| 10112 | |
| 10113 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10114 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10115 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10116 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10117 | */ |
| 10118 | |
| 10119 | #define ALC_HP_EVENT 0x37 |
| 10120 | |
| 10121 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10122 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10123 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10124 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10125 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10126 | {} |
| 10127 | }; |
| 10128 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10129 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10130 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10131 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10132 | {} |
| 10133 | }; |
| 10134 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10135 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10136 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10137 | .items = { |
| 10138 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10139 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10140 | { "CD", 0x4 }, |
| 10141 | }, |
| 10142 | }; |
| 10143 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10144 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10145 | .num_items = 5, |
| 10146 | .items = { |
| 10147 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10148 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10149 | { "Line", 0x2 }, |
| 10150 | { "CD", 0x4 }, |
| 10151 | { "AUX IN", 0x6 }, |
| 10152 | }, |
| 10153 | }; |
| 10154 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10155 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10156 | .num_items = 4, |
| 10157 | .items = { |
| 10158 | { "Mic", 0x0 }, |
| 10159 | { "Front Mic", 0x2 }, |
| 10160 | { "Line", 0x1 }, |
| 10161 | { "CD", 0x4 }, |
| 10162 | }, |
| 10163 | }; |
| 10164 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10165 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10166 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10167 | { |
| 10168 | struct alc_spec *spec = codec->spec; |
| 10169 | unsigned int mute; |
| 10170 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10171 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10172 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10173 | /* need to execute and sync at first */ |
| 10174 | 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] | 10175 | /* check laptop HP jack */ |
| 10176 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10177 | AC_VERB_GET_PIN_SENSE, 0); |
| 10178 | /* need to execute and sync at first */ |
| 10179 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10180 | /* check docking HP jack */ |
| 10181 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10182 | AC_VERB_GET_PIN_SENSE, 0); |
| 10183 | if (present & AC_PINSENSE_PRESENCE) |
| 10184 | spec->jack_present = 1; |
| 10185 | else |
| 10186 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10187 | spec->sense_updated = 1; |
| 10188 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10189 | /* unmute internal speaker only if both HPs are unplugged and |
| 10190 | * master switch is on |
| 10191 | */ |
| 10192 | if (spec->jack_present) |
| 10193 | mute = HDA_AMP_MUTE; |
| 10194 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10195 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10196 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10197 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10198 | } |
| 10199 | |
| 10200 | /* unsolicited event for HP jack sensing */ |
| 10201 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10202 | unsigned int res) |
| 10203 | { |
| 10204 | if ((res >> 26) != ALC_HP_EVENT) |
| 10205 | return; |
| 10206 | alc262_fujitsu_automute(codec, 1); |
| 10207 | } |
| 10208 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10209 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10210 | { |
| 10211 | alc262_fujitsu_automute(codec, 1); |
| 10212 | } |
| 10213 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10214 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10215 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10216 | .ops = &snd_hda_bind_vol, |
| 10217 | .values = { |
| 10218 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10219 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10220 | 0 |
| 10221 | }, |
| 10222 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10223 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10224 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10225 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10226 | { |
| 10227 | struct alc_spec *spec = codec->spec; |
| 10228 | unsigned int mute; |
| 10229 | |
| 10230 | if (force || !spec->sense_updated) { |
| 10231 | unsigned int present_int_hp; |
| 10232 | /* need to execute and sync at first */ |
| 10233 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10234 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10235 | AC_VERB_GET_PIN_SENSE, 0); |
| 10236 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10237 | spec->sense_updated = 1; |
| 10238 | } |
| 10239 | if (spec->jack_present) { |
| 10240 | /* mute internal speaker */ |
| 10241 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10242 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10243 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10244 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10245 | } else { |
| 10246 | /* unmute internal speaker if necessary */ |
| 10247 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10248 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10249 | HDA_AMP_MUTE, mute); |
| 10250 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10251 | HDA_AMP_MUTE, mute); |
| 10252 | } |
| 10253 | } |
| 10254 | |
| 10255 | /* unsolicited event for HP jack sensing */ |
| 10256 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10257 | unsigned int res) |
| 10258 | { |
| 10259 | if ((res >> 26) != ALC_HP_EVENT) |
| 10260 | return; |
| 10261 | alc262_lenovo_3000_automute(codec, 1); |
| 10262 | } |
| 10263 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10264 | /* bind hp and internal speaker mute (with plug check) */ |
| 10265 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10266 | struct snd_ctl_elem_value *ucontrol) |
| 10267 | { |
| 10268 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10269 | long *valp = ucontrol->value.integer.value; |
| 10270 | int change; |
| 10271 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10272 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10273 | HDA_AMP_MUTE, |
| 10274 | valp ? 0 : HDA_AMP_MUTE); |
| 10275 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10276 | HDA_AMP_MUTE, |
| 10277 | valp ? 0 : HDA_AMP_MUTE); |
| 10278 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10279 | if (change) |
| 10280 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10281 | return change; |
| 10282 | } |
| 10283 | |
| 10284 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10285 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10286 | { |
| 10287 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10288 | .name = "Master Playback Switch", |
| 10289 | .info = snd_hda_mixer_amp_switch_info, |
| 10290 | .get = snd_hda_mixer_amp_switch_get, |
| 10291 | .put = alc262_fujitsu_master_sw_put, |
| 10292 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10293 | }, |
| 10294 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10295 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10296 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10297 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10298 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10299 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10300 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10301 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10302 | { } /* end */ |
| 10303 | }; |
| 10304 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10305 | /* bind hp and internal speaker mute (with plug check) */ |
| 10306 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10307 | struct snd_ctl_elem_value *ucontrol) |
| 10308 | { |
| 10309 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10310 | long *valp = ucontrol->value.integer.value; |
| 10311 | int change; |
| 10312 | |
| 10313 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10314 | HDA_AMP_MUTE, |
| 10315 | valp ? 0 : HDA_AMP_MUTE); |
| 10316 | |
| 10317 | if (change) |
| 10318 | alc262_lenovo_3000_automute(codec, 0); |
| 10319 | return change; |
| 10320 | } |
| 10321 | |
| 10322 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10323 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10324 | { |
| 10325 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10326 | .name = "Master Playback Switch", |
| 10327 | .info = snd_hda_mixer_amp_switch_info, |
| 10328 | .get = snd_hda_mixer_amp_switch_get, |
| 10329 | .put = alc262_lenovo_3000_master_sw_put, |
| 10330 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10331 | }, |
| 10332 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10333 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10334 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10335 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10336 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10337 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10338 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10339 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10340 | { } /* end */ |
| 10341 | }; |
| 10342 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10343 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10344 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10345 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10346 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10347 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10348 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10349 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10350 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10351 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10352 | { } /* end */ |
| 10353 | }; |
| 10354 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10355 | /* additional init verbs for Benq laptops */ |
| 10356 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10357 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10358 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10359 | {} |
| 10360 | }; |
| 10361 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10362 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10363 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10364 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10365 | |
| 10366 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10367 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10368 | {} |
| 10369 | }; |
| 10370 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10371 | /* Samsung Q1 Ultra Vista model setup */ |
| 10372 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10373 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10374 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10375 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10376 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10377 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10378 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10379 | { } /* end */ |
| 10380 | }; |
| 10381 | |
| 10382 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10383 | /* output mixer */ |
| 10384 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10385 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10386 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10387 | /* speaker */ |
| 10388 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10389 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10390 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10391 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10392 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10393 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10394 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10395 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10396 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10397 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10398 | /* internal mic */ |
| 10399 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10400 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10401 | /* ADC, choose mic */ |
| 10402 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10403 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10404 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10405 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10406 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10407 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10408 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10409 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10410 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10411 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10412 | {} |
| 10413 | }; |
| 10414 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10415 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10416 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10417 | { |
| 10418 | struct alc_spec *spec = codec->spec; |
| 10419 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10420 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10421 | mute = 0; |
| 10422 | /* auto-mute only when HP is used as HP */ |
| 10423 | if (!spec->cur_mux[0]) { |
| 10424 | unsigned int present; |
| 10425 | /* need to execute and sync at first */ |
| 10426 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10427 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10428 | AC_VERB_GET_PIN_SENSE, 0); |
| 10429 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10430 | if (spec->jack_present) |
| 10431 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10432 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10433 | /* mute/unmute internal speaker */ |
| 10434 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10435 | HDA_AMP_MUTE, mute); |
| 10436 | /* mute/unmute HP */ |
| 10437 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10438 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10439 | } |
| 10440 | |
| 10441 | /* unsolicited event for HP jack sensing */ |
| 10442 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10443 | unsigned int res) |
| 10444 | { |
| 10445 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10446 | return; |
| 10447 | alc262_ultra_automute(codec); |
| 10448 | } |
| 10449 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10450 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10451 | .num_items = 2, |
| 10452 | .items = { |
| 10453 | { "Mic", 0x1 }, |
| 10454 | { "Headphone", 0x7 }, |
| 10455 | }, |
| 10456 | }; |
| 10457 | |
| 10458 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10459 | struct snd_ctl_elem_value *ucontrol) |
| 10460 | { |
| 10461 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10462 | struct alc_spec *spec = codec->spec; |
| 10463 | int ret; |
| 10464 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10465 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10466 | if (!ret) |
| 10467 | return 0; |
| 10468 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10469 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10470 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10471 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10472 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10473 | return ret; |
| 10474 | } |
| 10475 | |
| 10476 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10477 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10478 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10479 | { |
| 10480 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10481 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10482 | .info = alc_mux_enum_info, |
| 10483 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10484 | .put = alc262_ultra_mux_enum_put, |
| 10485 | }, |
| 10486 | { } /* end */ |
| 10487 | }; |
| 10488 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10489 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10490 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10491 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10492 | { |
| 10493 | hda_nid_t nid; |
| 10494 | int err; |
| 10495 | |
| 10496 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10497 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10498 | spec->multiout.dac_nids[0] = 2; |
| 10499 | |
| 10500 | nid = cfg->line_out_pins[0]; |
| 10501 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10502 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10503 | "Front Playback Volume", |
| 10504 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10505 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10506 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10507 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10508 | "Front Playback Switch", |
| 10509 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10510 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10511 | return err; |
| 10512 | } |
| 10513 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10514 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10515 | if (nid) { |
| 10516 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10517 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10518 | "Speaker Playback Volume", |
| 10519 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10520 | HDA_OUTPUT)); |
| 10521 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10522 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10523 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10524 | "Speaker Playback Switch", |
| 10525 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10526 | HDA_OUTPUT)); |
| 10527 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10528 | return err; |
| 10529 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10530 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10531 | "Speaker Playback Switch", |
| 10532 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10533 | HDA_OUTPUT)); |
| 10534 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10535 | return err; |
| 10536 | } |
| 10537 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10538 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10539 | if (nid) { |
| 10540 | /* spec->multiout.hp_nid = 2; */ |
| 10541 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10542 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10543 | "Headphone Playback Volume", |
| 10544 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10545 | HDA_OUTPUT)); |
| 10546 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10547 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10548 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10549 | "Headphone Playback Switch", |
| 10550 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10551 | HDA_OUTPUT)); |
| 10552 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10553 | return err; |
| 10554 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10555 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10556 | "Headphone Playback Switch", |
| 10557 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10558 | HDA_OUTPUT)); |
| 10559 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10560 | return err; |
| 10561 | } |
| 10562 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10563 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10564 | } |
| 10565 | |
| 10566 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10567 | #define alc262_auto_create_analog_input_ctls \ |
| 10568 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10569 | |
| 10570 | /* |
| 10571 | * generic initialization of ADC, input mixers and output mixers |
| 10572 | */ |
| 10573 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10574 | /* |
| 10575 | * Unmute ADC0-2 and set the default input to mic-in |
| 10576 | */ |
| 10577 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10578 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10579 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10580 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10581 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10582 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10583 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10584 | /* 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] | 10585 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10586 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10587 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10588 | */ |
| 10589 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10590 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10591 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10592 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10593 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10594 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10595 | |
| 10596 | /* |
| 10597 | * Set up output mixers (0x0c - 0x0f) |
| 10598 | */ |
| 10599 | /* set vol=0 to output mixers */ |
| 10600 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10601 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10602 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10603 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10604 | /* set up input amps for analog loopback */ |
| 10605 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10606 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10607 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10608 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10609 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10610 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10611 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10612 | |
| 10613 | /* FIXME: use matrix-type input source selection */ |
| 10614 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10615 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10616 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10617 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10618 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10619 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10620 | /* Input mixer2 */ |
| 10621 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10622 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10623 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10624 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10625 | /* Input mixer3 */ |
| 10626 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10627 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10628 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10629 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10630 | |
| 10631 | { } |
| 10632 | }; |
| 10633 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10634 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10635 | /* |
| 10636 | * Unmute ADC0-2 and set the default input to mic-in |
| 10637 | */ |
| 10638 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10639 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10640 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10641 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10642 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10643 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10644 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10645 | /* 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] | 10646 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10647 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10648 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10649 | */ |
| 10650 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10651 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10652 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10653 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10654 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10655 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10656 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10657 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10658 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10659 | /* |
| 10660 | * Set up output mixers (0x0c - 0x0e) |
| 10661 | */ |
| 10662 | /* set vol=0 to output mixers */ |
| 10663 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10664 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10665 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10666 | |
| 10667 | /* set up input amps for analog loopback */ |
| 10668 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10669 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10670 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10671 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10672 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10673 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10674 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10675 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10676 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10677 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10678 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10679 | |
| 10680 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10681 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10682 | |
| 10683 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10684 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10685 | |
| 10686 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10687 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10688 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10689 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10690 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10691 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10692 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10693 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10694 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10695 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10696 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10697 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10698 | |
| 10699 | |
| 10700 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10701 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 10702 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10703 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10704 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10705 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10706 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10707 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10708 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10709 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10710 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10711 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10712 | /* Input mixer2 */ |
| 10713 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10714 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10715 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10716 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10717 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10718 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10719 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10720 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10721 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10722 | /* Input mixer3 */ |
| 10723 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10724 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10725 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10726 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10727 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10730 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10731 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10732 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10733 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10734 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10735 | { } |
| 10736 | }; |
| 10737 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10738 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10739 | /* |
| 10740 | * Unmute ADC0-2 and set the default input to mic-in |
| 10741 | */ |
| 10742 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10743 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10744 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10745 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10746 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10747 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10748 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10749 | /* 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] | 10750 | * mixer widget |
| 10751 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10752 | * panel mic (mic 2) |
| 10753 | */ |
| 10754 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10755 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10756 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10757 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10758 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10759 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10760 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10761 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10762 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10763 | /* |
| 10764 | * Set up output mixers (0x0c - 0x0e) |
| 10765 | */ |
| 10766 | /* set vol=0 to output mixers */ |
| 10767 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10768 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10769 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10770 | |
| 10771 | /* set up input amps for analog loopback */ |
| 10772 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10773 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10774 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10775 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10776 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10777 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10778 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10779 | |
| 10780 | |
| 10781 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10782 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10783 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10784 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10785 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10786 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10787 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10788 | |
| 10789 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10790 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10791 | |
| 10792 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10793 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10794 | |
| 10795 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10796 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10797 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10798 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10799 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10800 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10801 | |
| 10802 | /* FIXME: use matrix-type input source selection */ |
| 10803 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10804 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10805 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10806 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10807 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10808 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10809 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10810 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10811 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10812 | /* Input mixer2 */ |
| 10813 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10814 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10815 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10816 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10817 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10818 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10819 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10820 | /* Input mixer3 */ |
| 10821 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10822 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10823 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10824 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10825 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10826 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10827 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10828 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10829 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10830 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10831 | { } |
| 10832 | }; |
| 10833 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10834 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10835 | |
| 10836 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10837 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10838 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10839 | |
| 10840 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10841 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10842 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10843 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10844 | |
| 10845 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10846 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10847 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10848 | {} |
| 10849 | }; |
| 10850 | |
| 10851 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10852 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10853 | #define alc262_loopbacks alc880_loopbacks |
| 10854 | #endif |
| 10855 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10856 | /* pcm configuration: identiacal with ALC880 */ |
| 10857 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10858 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10859 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10860 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10861 | |
| 10862 | /* |
| 10863 | * BIOS auto configuration |
| 10864 | */ |
| 10865 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10866 | { |
| 10867 | struct alc_spec *spec = codec->spec; |
| 10868 | int err; |
| 10869 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10870 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10871 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10872 | alc262_ignore); |
| 10873 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10874 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10875 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10876 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10877 | spec->multiout.max_channels = 2; |
| 10878 | spec->no_analog = 1; |
| 10879 | goto dig_only; |
| 10880 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10881 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10882 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10883 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10884 | if (err < 0) |
| 10885 | return err; |
| 10886 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10887 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10888 | return err; |
| 10889 | |
| 10890 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10891 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10892 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10893 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10894 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10895 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10896 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10897 | if (spec->autocfg.dig_in_pin) |
| 10898 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10899 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10900 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10901 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10902 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10903 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10904 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10905 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10906 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10907 | err = alc_auto_add_mic_boost(codec); |
| 10908 | if (err < 0) |
| 10909 | return err; |
| 10910 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 10911 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 10912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10913 | return 1; |
| 10914 | } |
| 10915 | |
| 10916 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10917 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10918 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10919 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10920 | |
| 10921 | |
| 10922 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10923 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10924 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10925 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10926 | alc262_auto_init_multi_out(codec); |
| 10927 | alc262_auto_init_hp_out(codec); |
| 10928 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10929 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10930 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10931 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10932 | } |
| 10933 | |
| 10934 | /* |
| 10935 | * configuration and preset |
| 10936 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10937 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10938 | [ALC262_BASIC] = "basic", |
| 10939 | [ALC262_HIPPO] = "hippo", |
| 10940 | [ALC262_HIPPO_1] = "hippo_1", |
| 10941 | [ALC262_FUJITSU] = "fujitsu", |
| 10942 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10943 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10944 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10945 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10946 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10947 | [ALC262_BENQ_T31] = "benq-t31", |
| 10948 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10949 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10950 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10951 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10952 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10953 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10954 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10955 | [ALC262_AUTO] = "auto", |
| 10956 | }; |
| 10957 | |
| 10958 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10959 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10960 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10961 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 10962 | ALC262_HP_BPC), |
| 10963 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 10964 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 10965 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 10966 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10967 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10968 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10969 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10970 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10971 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10972 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10973 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10974 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10975 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10976 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10977 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10978 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10979 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10980 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10981 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10982 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10983 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 10984 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 10985 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 10986 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10987 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10988 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10989 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10990 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10991 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10992 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10993 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 10994 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 10995 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10996 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10997 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10998 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10999 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11000 | {} |
| 11001 | }; |
| 11002 | |
| 11003 | static struct alc_config_preset alc262_presets[] = { |
| 11004 | [ALC262_BASIC] = { |
| 11005 | .mixers = { alc262_base_mixer }, |
| 11006 | .init_verbs = { alc262_init_verbs }, |
| 11007 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11008 | .dac_nids = alc262_dac_nids, |
| 11009 | .hp_nid = 0x03, |
| 11010 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11011 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11012 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11013 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11014 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11015 | .mixers = { alc262_hippo_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11016 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 11017 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11018 | .dac_nids = alc262_dac_nids, |
| 11019 | .hp_nid = 0x03, |
| 11020 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11021 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11022 | .channel_mode = alc262_modes, |
| 11023 | .input_mux = &alc262_capture_source, |
| 11024 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11025 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11026 | }, |
| 11027 | [ALC262_HIPPO_1] = { |
| 11028 | .mixers = { alc262_hippo1_mixer }, |
| 11029 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11030 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11031 | .dac_nids = alc262_dac_nids, |
| 11032 | .hp_nid = 0x02, |
| 11033 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11034 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11035 | .channel_mode = alc262_modes, |
| 11036 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11037 | .unsol_event = alc262_hippo_unsol_event, |
| 11038 | .init_hook = alc262_hippo1_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11039 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11040 | [ALC262_FUJITSU] = { |
| 11041 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11042 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11043 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11044 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11045 | .dac_nids = alc262_dac_nids, |
| 11046 | .hp_nid = 0x03, |
| 11047 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11048 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11049 | .channel_mode = alc262_modes, |
| 11050 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11051 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11052 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11053 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11054 | [ALC262_HP_BPC] = { |
| 11055 | .mixers = { alc262_HP_BPC_mixer }, |
| 11056 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11057 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11058 | .dac_nids = alc262_dac_nids, |
| 11059 | .hp_nid = 0x03, |
| 11060 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11061 | .channel_mode = alc262_modes, |
| 11062 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11063 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11064 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11065 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11066 | [ALC262_HP_BPC_D7000_WF] = { |
| 11067 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11068 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11069 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11070 | .dac_nids = alc262_dac_nids, |
| 11071 | .hp_nid = 0x03, |
| 11072 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11073 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11074 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11075 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11076 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11077 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11078 | [ALC262_HP_BPC_D7000_WL] = { |
| 11079 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11080 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11081 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11082 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11083 | .dac_nids = alc262_dac_nids, |
| 11084 | .hp_nid = 0x03, |
| 11085 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11086 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11087 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11088 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11089 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11090 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11091 | [ALC262_HP_TC_T5735] = { |
| 11092 | .mixers = { alc262_hp_t5735_mixer }, |
| 11093 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11094 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11095 | .dac_nids = alc262_dac_nids, |
| 11096 | .hp_nid = 0x03, |
| 11097 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11098 | .channel_mode = alc262_modes, |
| 11099 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11100 | .unsol_event = alc_automute_amp_unsol_event, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11101 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11102 | }, |
| 11103 | [ALC262_HP_RP5700] = { |
| 11104 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11105 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11106 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11107 | .dac_nids = alc262_dac_nids, |
| 11108 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11109 | .channel_mode = alc262_modes, |
| 11110 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11111 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11112 | [ALC262_BENQ_ED8] = { |
| 11113 | .mixers = { alc262_base_mixer }, |
| 11114 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11115 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11116 | .dac_nids = alc262_dac_nids, |
| 11117 | .hp_nid = 0x03, |
| 11118 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11119 | .channel_mode = alc262_modes, |
| 11120 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11121 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11122 | [ALC262_SONY_ASSAMD] = { |
| 11123 | .mixers = { alc262_sony_mixer }, |
| 11124 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11125 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11126 | .dac_nids = alc262_dac_nids, |
| 11127 | .hp_nid = 0x02, |
| 11128 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11129 | .channel_mode = alc262_modes, |
| 11130 | .input_mux = &alc262_capture_source, |
| 11131 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11132 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11133 | }, |
| 11134 | [ALC262_BENQ_T31] = { |
| 11135 | .mixers = { alc262_benq_t31_mixer }, |
| 11136 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11137 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11138 | .dac_nids = alc262_dac_nids, |
| 11139 | .hp_nid = 0x03, |
| 11140 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11141 | .channel_mode = alc262_modes, |
| 11142 | .input_mux = &alc262_capture_source, |
| 11143 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11144 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11145 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11146 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11147 | .mixers = { alc262_ultra_mixer }, |
| 11148 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11149 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11150 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11151 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11152 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11153 | .channel_mode = alc262_modes, |
| 11154 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11155 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11156 | .capsrc_nids = alc262_capsrc_nids, |
| 11157 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11158 | .unsol_event = alc262_ultra_unsol_event, |
| 11159 | .init_hook = alc262_ultra_automute, |
| 11160 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11161 | [ALC262_LENOVO_3000] = { |
| 11162 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11163 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11164 | alc262_lenovo_3000_unsol_verbs }, |
| 11165 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11166 | .dac_nids = alc262_dac_nids, |
| 11167 | .hp_nid = 0x03, |
| 11168 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11169 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11170 | .channel_mode = alc262_modes, |
| 11171 | .input_mux = &alc262_fujitsu_capture_source, |
| 11172 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11173 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11174 | [ALC262_NEC] = { |
| 11175 | .mixers = { alc262_nec_mixer }, |
| 11176 | .init_verbs = { alc262_nec_verbs }, |
| 11177 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11178 | .dac_nids = alc262_dac_nids, |
| 11179 | .hp_nid = 0x03, |
| 11180 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11181 | .channel_mode = alc262_modes, |
| 11182 | .input_mux = &alc262_capture_source, |
| 11183 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11184 | [ALC262_TOSHIBA_S06] = { |
| 11185 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11186 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11187 | alc262_eapd_verbs }, |
| 11188 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11189 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11190 | .dac_nids = alc262_dac_nids, |
| 11191 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 11192 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11193 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11194 | .channel_mode = alc262_modes, |
| 11195 | .input_mux = &alc262_dmic_capture_source, |
| 11196 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11197 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11198 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11199 | [ALC262_TOSHIBA_RX1] = { |
| 11200 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11201 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11202 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11203 | .dac_nids = alc262_dac_nids, |
| 11204 | .hp_nid = 0x03, |
| 11205 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11206 | .channel_mode = alc262_modes, |
| 11207 | .input_mux = &alc262_capture_source, |
| 11208 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11209 | .init_hook = alc262_hippo_init_hook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11210 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11211 | [ALC262_TYAN] = { |
| 11212 | .mixers = { alc262_tyan_mixer }, |
| 11213 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11214 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11215 | .dac_nids = alc262_dac_nids, |
| 11216 | .hp_nid = 0x02, |
| 11217 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11218 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11219 | .channel_mode = alc262_modes, |
| 11220 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11221 | .unsol_event = alc_automute_amp_unsol_event, |
| 11222 | .init_hook = alc262_tyan_init_hook, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11223 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11224 | }; |
| 11225 | |
| 11226 | static int patch_alc262(struct hda_codec *codec) |
| 11227 | { |
| 11228 | struct alc_spec *spec; |
| 11229 | int board_config; |
| 11230 | int err; |
| 11231 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11232 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11233 | if (spec == NULL) |
| 11234 | return -ENOMEM; |
| 11235 | |
| 11236 | codec->spec = spec; |
| 11237 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11238 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11239 | * under-run |
| 11240 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11241 | { |
| 11242 | int tmp; |
| 11243 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11244 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11245 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11246 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11247 | } |
| 11248 | #endif |
| 11249 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11250 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11251 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11252 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11253 | alc262_models, |
| 11254 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11255 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11256 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 11257 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 11258 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11259 | board_config = ALC262_AUTO; |
| 11260 | } |
| 11261 | |
| 11262 | if (board_config == ALC262_AUTO) { |
| 11263 | /* automatic parse from the BIOS config */ |
| 11264 | err = alc262_parse_auto_config(codec); |
| 11265 | if (err < 0) { |
| 11266 | alc_free(codec); |
| 11267 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11268 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11269 | printk(KERN_INFO |
| 11270 | "hda_codec: Cannot set up configuration " |
| 11271 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11272 | board_config = ALC262_BASIC; |
| 11273 | } |
| 11274 | } |
| 11275 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11276 | if (!spec->no_analog) { |
| 11277 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11278 | if (err < 0) { |
| 11279 | alc_free(codec); |
| 11280 | return err; |
| 11281 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11282 | } |
| 11283 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11284 | if (board_config != ALC262_AUTO) |
| 11285 | setup_preset(spec, &alc262_presets[board_config]); |
| 11286 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11287 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11288 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11289 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11290 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11291 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11292 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11293 | spec->capture_style = CAPT_MIX; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11294 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11295 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11296 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11297 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11298 | /* get type */ |
| 11299 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11300 | if (wcap != AC_WID_AUD_IN) { |
| 11301 | spec->adc_nids = alc262_adc_nids_alt; |
| 11302 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11303 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11304 | } else { |
| 11305 | spec->adc_nids = alc262_adc_nids; |
| 11306 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11307 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11308 | } |
| 11309 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11310 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11311 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11312 | if (!spec->no_analog) |
| 11313 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11314 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11315 | spec->vmaster_nid = 0x0c; |
| 11316 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11317 | codec->patch_ops = alc_patch_ops; |
| 11318 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11319 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11320 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11321 | if (!spec->loopback.amplist) |
| 11322 | spec->loopback.amplist = alc262_loopbacks; |
| 11323 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11324 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11325 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11326 | return 0; |
| 11327 | } |
| 11328 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11329 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11330 | * ALC268 channel source setting (2 channel) |
| 11331 | */ |
| 11332 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11333 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11334 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11335 | static hda_nid_t alc268_dac_nids[2] = { |
| 11336 | /* front, hp */ |
| 11337 | 0x02, 0x03 |
| 11338 | }; |
| 11339 | |
| 11340 | static hda_nid_t alc268_adc_nids[2] = { |
| 11341 | /* ADC0-1 */ |
| 11342 | 0x08, 0x07 |
| 11343 | }; |
| 11344 | |
| 11345 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11346 | /* ADC0 */ |
| 11347 | 0x08 |
| 11348 | }; |
| 11349 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11350 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11351 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11352 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11353 | /* output mixer control */ |
| 11354 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11355 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11356 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11357 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11358 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11359 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11360 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11361 | { } |
| 11362 | }; |
| 11363 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11364 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11365 | /* output mixer control */ |
| 11366 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11367 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11368 | ALC262_HIPPO_MASTER_SWITCH, |
| 11369 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11370 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11371 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11372 | { } |
| 11373 | }; |
| 11374 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11375 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11376 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11377 | .ops = &snd_hda_bind_sw, |
| 11378 | .values = { |
| 11379 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11380 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11381 | 0 |
| 11382 | }, |
| 11383 | }; |
| 11384 | |
| 11385 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11386 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11387 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11388 | { } |
| 11389 | }; |
| 11390 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11391 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11392 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11393 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11394 | { } |
| 11395 | }; |
| 11396 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11397 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11398 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11399 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11400 | { } /* end */ |
| 11401 | }; |
| 11402 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11403 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11404 | .num_items = 2, |
| 11405 | .items = { |
| 11406 | { "i-Mic", 0x6 }, |
| 11407 | { "E-Mic", 0x0 }, |
| 11408 | }, |
| 11409 | }; |
| 11410 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11411 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11412 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11413 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11414 | .ops = &snd_hda_bind_vol, |
| 11415 | .values = { |
| 11416 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11417 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11418 | 0 |
| 11419 | }, |
| 11420 | }; |
| 11421 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11422 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11423 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11424 | { |
| 11425 | struct alc_spec *spec = codec->spec; |
| 11426 | unsigned int mute; |
| 11427 | |
| 11428 | if (force || !spec->sense_updated) { |
| 11429 | unsigned int present; |
| 11430 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11431 | AC_VERB_GET_PIN_SENSE, 0); |
| 11432 | spec->jack_present = (present & 0x80000000) != 0; |
| 11433 | spec->sense_updated = 1; |
| 11434 | } |
| 11435 | if (spec->jack_present) |
| 11436 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11437 | else /* unmute internal speaker if necessary */ |
| 11438 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11439 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11440 | HDA_AMP_MUTE, mute); |
| 11441 | } |
| 11442 | |
| 11443 | |
| 11444 | /* bind hp and internal speaker mute (with plug check) */ |
| 11445 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11446 | struct snd_ctl_elem_value *ucontrol) |
| 11447 | { |
| 11448 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11449 | long *valp = ucontrol->value.integer.value; |
| 11450 | int change; |
| 11451 | |
| 11452 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11453 | HDA_AMP_MUTE, |
| 11454 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11455 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11456 | HDA_AMP_MUTE, |
| 11457 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11458 | if (change) |
| 11459 | alc268_acer_automute(codec, 0); |
| 11460 | return change; |
| 11461 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11462 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11463 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11464 | /* output mixer control */ |
| 11465 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11466 | { |
| 11467 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11468 | .name = "Master Playback Switch", |
| 11469 | .info = snd_hda_mixer_amp_switch_info, |
| 11470 | .get = snd_hda_mixer_amp_switch_get, |
| 11471 | .put = alc268_acer_master_sw_put, |
| 11472 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11473 | }, |
| 11474 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11475 | { } |
| 11476 | }; |
| 11477 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11478 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11479 | /* output mixer control */ |
| 11480 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11481 | { |
| 11482 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11483 | .name = "Master Playback Switch", |
| 11484 | .info = snd_hda_mixer_amp_switch_info, |
| 11485 | .get = snd_hda_mixer_amp_switch_get, |
| 11486 | .put = alc268_acer_master_sw_put, |
| 11487 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11488 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11489 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11490 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11491 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11492 | { } |
| 11493 | }; |
| 11494 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11495 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11496 | /* output mixer control */ |
| 11497 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11498 | { |
| 11499 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11500 | .name = "Master Playback Switch", |
| 11501 | .info = snd_hda_mixer_amp_switch_info, |
| 11502 | .get = snd_hda_mixer_amp_switch_get, |
| 11503 | .put = alc268_acer_master_sw_put, |
| 11504 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11505 | }, |
| 11506 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11507 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11508 | { } |
| 11509 | }; |
| 11510 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11511 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11512 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11513 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11514 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11515 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11516 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11517 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11518 | { } |
| 11519 | }; |
| 11520 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11521 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11522 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11523 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11524 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11525 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11526 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11527 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11528 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11529 | { } |
| 11530 | }; |
| 11531 | |
| 11532 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11533 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
| 11534 | #define alc268_toshiba_init_hook alc262_hippo_init_hook |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11535 | |
| 11536 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11537 | unsigned int res) |
| 11538 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11539 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11540 | return; |
| 11541 | alc268_acer_automute(codec, 1); |
| 11542 | } |
| 11543 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11544 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11545 | { |
| 11546 | alc268_acer_automute(codec, 1); |
| 11547 | } |
| 11548 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11549 | /* toggle speaker-output according to the hp-jack state */ |
| 11550 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11551 | { |
| 11552 | unsigned int present; |
| 11553 | unsigned char bits; |
| 11554 | |
| 11555 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11556 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11557 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11558 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11559 | AMP_IN_MUTE(0), bits); |
| 11560 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11561 | AMP_IN_MUTE(0), bits); |
| 11562 | } |
| 11563 | |
| 11564 | |
| 11565 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11566 | { |
| 11567 | unsigned int present; |
| 11568 | |
| 11569 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11570 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11571 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11572 | present ? 0x0 : 0x6); |
| 11573 | } |
| 11574 | |
| 11575 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11576 | unsigned int res) |
| 11577 | { |
| 11578 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11579 | alc268_aspire_one_speaker_automute(codec); |
| 11580 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11581 | alc268_acer_mic_automute(codec); |
| 11582 | } |
| 11583 | |
| 11584 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11585 | { |
| 11586 | alc268_aspire_one_speaker_automute(codec); |
| 11587 | alc268_acer_mic_automute(codec); |
| 11588 | } |
| 11589 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11590 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11591 | /* output mixer control */ |
| 11592 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11593 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11594 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11595 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11596 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11597 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11598 | { } |
| 11599 | }; |
| 11600 | |
| 11601 | static struct hda_verb alc268_dell_verbs[] = { |
| 11602 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11603 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11604 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11605 | { } |
| 11606 | }; |
| 11607 | |
| 11608 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11609 | static void alc268_dell_init_hook(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11610 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11611 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11612 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11613 | spec->autocfg.hp_pins[0] = 0x15; |
| 11614 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11615 | alc_automute_pin(codec); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11616 | } |
| 11617 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11618 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11619 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11620 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11621 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11622 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11623 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11624 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11625 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11626 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11627 | { } |
| 11628 | }; |
| 11629 | |
| 11630 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11631 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11632 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11633 | { } |
| 11634 | }; |
| 11635 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11636 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11637 | { |
| 11638 | unsigned int present; |
| 11639 | |
| 11640 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11641 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11642 | snd_hda_codec_write(codec, 0x23, 0, |
| 11643 | AC_VERB_SET_CONNECT_SEL, |
| 11644 | present ? 0x00 : 0x01); |
| 11645 | } |
| 11646 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11647 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11648 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11649 | struct alc_spec *spec = codec->spec; |
| 11650 | |
| 11651 | spec->autocfg.hp_pins[0] = 0x15; |
| 11652 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11653 | alc_automute_pin(codec); |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11654 | alc267_quanta_il1_mic_automute(codec); |
| 11655 | } |
| 11656 | |
| 11657 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11658 | unsigned int res) |
| 11659 | { |
| 11660 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11661 | case ALC880_MIC_EVENT: |
| 11662 | alc267_quanta_il1_mic_automute(codec); |
| 11663 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11664 | default: |
| 11665 | alc_sku_unsol_event(codec, res); |
| 11666 | break; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11667 | } |
| 11668 | } |
| 11669 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11670 | /* |
| 11671 | * generic initialization of ADC, input mixers and output mixers |
| 11672 | */ |
| 11673 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11674 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11675 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11676 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11677 | |
| 11678 | /* |
| 11679 | * Set up output mixers (0x0c - 0x0e) |
| 11680 | */ |
| 11681 | /* set vol=0 to output mixers */ |
| 11682 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11683 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11684 | |
| 11685 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11686 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11687 | |
| 11688 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11689 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11690 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11691 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11692 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11693 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11694 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11695 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11696 | |
| 11697 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11698 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11699 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11700 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11701 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11702 | |
| 11703 | /* set PCBEEP vol = 0, mute connections */ |
| 11704 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11705 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11706 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11707 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11708 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11709 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11710 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11711 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11712 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11713 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11714 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11715 | { } |
| 11716 | }; |
| 11717 | |
| 11718 | /* |
| 11719 | * generic initialization of ADC, input mixers and output mixers |
| 11720 | */ |
| 11721 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11722 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11723 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11724 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11725 | |
| 11726 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11727 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11728 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11729 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11730 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11731 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11732 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11733 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11734 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11735 | |
| 11736 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11737 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11738 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11739 | /* set PCBEEP vol = 0, mute connections */ |
| 11740 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11741 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11742 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11743 | |
| 11744 | { } |
| 11745 | }; |
| 11746 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11747 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11748 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11749 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11750 | { |
| 11751 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11752 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11753 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11754 | */ |
| 11755 | /* .name = "Capture Source", */ |
| 11756 | .name = "Input Source", |
| 11757 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11758 | .info = alc_mux_enum_info, |
| 11759 | .get = alc_mux_enum_get, |
| 11760 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11761 | }, |
| 11762 | { } /* end */ |
| 11763 | }; |
| 11764 | |
| 11765 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11766 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11767 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11768 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11769 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11770 | { |
| 11771 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11772 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11773 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11774 | */ |
| 11775 | /* .name = "Capture Source", */ |
| 11776 | .name = "Input Source", |
| 11777 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11778 | .info = alc_mux_enum_info, |
| 11779 | .get = alc_mux_enum_get, |
| 11780 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11781 | }, |
| 11782 | { } /* end */ |
| 11783 | }; |
| 11784 | |
| 11785 | static struct hda_input_mux alc268_capture_source = { |
| 11786 | .num_items = 4, |
| 11787 | .items = { |
| 11788 | { "Mic", 0x0 }, |
| 11789 | { "Front Mic", 0x1 }, |
| 11790 | { "Line", 0x2 }, |
| 11791 | { "CD", 0x3 }, |
| 11792 | }, |
| 11793 | }; |
| 11794 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11795 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11796 | .num_items = 3, |
| 11797 | .items = { |
| 11798 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11799 | { "Internal Mic", 0x1 }, |
| 11800 | { "Line", 0x2 }, |
| 11801 | }, |
| 11802 | }; |
| 11803 | |
| 11804 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11805 | .num_items = 3, |
| 11806 | .items = { |
| 11807 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11808 | { "Internal Mic", 0x6 }, |
| 11809 | { "Line", 0x2 }, |
| 11810 | }, |
| 11811 | }; |
| 11812 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11813 | #ifdef CONFIG_SND_DEBUG |
| 11814 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11815 | /* Volume widgets */ |
| 11816 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11817 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11818 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11819 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11820 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11821 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11822 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11823 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11824 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11825 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11826 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11827 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11828 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11829 | /* The below appears problematic on some hardwares */ |
| 11830 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11831 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11832 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11833 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11834 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11835 | |
| 11836 | /* Modes for retasking pin widgets */ |
| 11837 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11838 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11839 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11840 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11841 | |
| 11842 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11843 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11844 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11845 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11846 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11847 | |
| 11848 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11849 | * The ALC268 does not have an SPDIF input. |
| 11850 | */ |
| 11851 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11852 | |
| 11853 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11854 | * this output to turn on an external amplifier. |
| 11855 | */ |
| 11856 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11857 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11858 | |
| 11859 | { } /* end */ |
| 11860 | }; |
| 11861 | #endif |
| 11862 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11863 | /* create input playback/capture controls for the given pin */ |
| 11864 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11865 | const char *ctlname, int idx) |
| 11866 | { |
| 11867 | char name[32]; |
| 11868 | int err; |
| 11869 | |
| 11870 | sprintf(name, "%s Playback Volume", ctlname); |
| 11871 | if (nid == 0x14) { |
| 11872 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11873 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11874 | HDA_OUTPUT)); |
| 11875 | if (err < 0) |
| 11876 | return err; |
| 11877 | } else if (nid == 0x15) { |
| 11878 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11879 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11880 | HDA_OUTPUT)); |
| 11881 | if (err < 0) |
| 11882 | return err; |
| 11883 | } else |
| 11884 | return -1; |
| 11885 | sprintf(name, "%s Playback Switch", ctlname); |
| 11886 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11887 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11888 | if (err < 0) |
| 11889 | return err; |
| 11890 | return 0; |
| 11891 | } |
| 11892 | |
| 11893 | /* add playback controls from the parsed DAC table */ |
| 11894 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11895 | const struct auto_pin_cfg *cfg) |
| 11896 | { |
| 11897 | hda_nid_t nid; |
| 11898 | int err; |
| 11899 | |
| 11900 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11901 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11902 | spec->multiout.dac_nids[0] = 2; |
| 11903 | spec->multiout.dac_nids[1] = 3; |
| 11904 | |
| 11905 | nid = cfg->line_out_pins[0]; |
| 11906 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11907 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11908 | |
| 11909 | nid = cfg->speaker_pins[0]; |
| 11910 | if (nid == 0x1d) { |
| 11911 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11912 | "Speaker Playback Volume", |
| 11913 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11914 | if (err < 0) |
| 11915 | return err; |
| 11916 | } |
| 11917 | nid = cfg->hp_pins[0]; |
| 11918 | if (nid) |
| 11919 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11920 | |
| 11921 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11922 | if (nid == 0x16) { |
| 11923 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11924 | "Mono Playback Switch", |
| 11925 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11926 | if (err < 0) |
| 11927 | return err; |
| 11928 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11929 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11930 | } |
| 11931 | |
| 11932 | /* create playback/capture controls for input pins */ |
| 11933 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11934 | const struct auto_pin_cfg *cfg) |
| 11935 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11936 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11937 | int i, idx1; |
| 11938 | |
| 11939 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11940 | switch(cfg->input_pins[i]) { |
| 11941 | case 0x18: |
| 11942 | idx1 = 0; /* Mic 1 */ |
| 11943 | break; |
| 11944 | case 0x19: |
| 11945 | idx1 = 1; /* Mic 2 */ |
| 11946 | break; |
| 11947 | case 0x1a: |
| 11948 | idx1 = 2; /* Line In */ |
| 11949 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11950 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11951 | idx1 = 3; /* CD */ |
| 11952 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11953 | case 0x12: |
| 11954 | case 0x13: |
| 11955 | idx1 = 6; /* digital mics */ |
| 11956 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11957 | default: |
| 11958 | continue; |
| 11959 | } |
| 11960 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11961 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11962 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11963 | } |
| 11964 | return 0; |
| 11965 | } |
| 11966 | |
| 11967 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11968 | { |
| 11969 | struct alc_spec *spec = codec->spec; |
| 11970 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11971 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11972 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11973 | unsigned int dac_vol1, dac_vol2; |
| 11974 | |
| 11975 | if (speaker_nid) { |
| 11976 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11977 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11978 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11979 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11980 | AMP_IN_UNMUTE(1)); |
| 11981 | snd_hda_codec_write(codec, 0x10, 0, |
| 11982 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11983 | AMP_IN_UNMUTE(1)); |
| 11984 | } else { |
| 11985 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11986 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11987 | snd_hda_codec_write(codec, 0x10, 0, |
| 11988 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11989 | } |
| 11990 | |
| 11991 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11992 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11993 | dac_vol2 = AMP_OUT_ZERO; |
| 11994 | else if (line_nid == 0x15) |
| 11995 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11996 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11997 | dac_vol2 = AMP_OUT_ZERO; |
| 11998 | else if (hp_nid == 0x15) |
| 11999 | dac_vol1 = AMP_OUT_ZERO; |
| 12000 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12001 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12002 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12003 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12004 | |
| 12005 | snd_hda_codec_write(codec, 0x02, 0, |
| 12006 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12007 | snd_hda_codec_write(codec, 0x03, 0, |
| 12008 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12009 | } |
| 12010 | |
| 12011 | /* pcm configuration: identiacal with ALC880 */ |
| 12012 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12013 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12014 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12015 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12016 | |
| 12017 | /* |
| 12018 | * BIOS auto configuration |
| 12019 | */ |
| 12020 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12021 | { |
| 12022 | struct alc_spec *spec = codec->spec; |
| 12023 | int err; |
| 12024 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12025 | |
| 12026 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12027 | alc268_ignore); |
| 12028 | if (err < 0) |
| 12029 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12030 | if (!spec->autocfg.line_outs) { |
| 12031 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12032 | spec->multiout.max_channels = 2; |
| 12033 | spec->no_analog = 1; |
| 12034 | goto dig_only; |
| 12035 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12036 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12037 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12038 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12039 | if (err < 0) |
| 12040 | return err; |
| 12041 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12042 | if (err < 0) |
| 12043 | return err; |
| 12044 | |
| 12045 | spec->multiout.max_channels = 2; |
| 12046 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12047 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12048 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12049 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12050 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12051 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12052 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12053 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12054 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12055 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12056 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12057 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12058 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12059 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12060 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12061 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12062 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12063 | err = alc_auto_add_mic_boost(codec); |
| 12064 | if (err < 0) |
| 12065 | return err; |
| 12066 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12067 | return 1; |
| 12068 | } |
| 12069 | |
| 12070 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12071 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12072 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12073 | |
| 12074 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12075 | static void alc268_auto_init(struct hda_codec *codec) |
| 12076 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12077 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12078 | alc268_auto_init_multi_out(codec); |
| 12079 | alc268_auto_init_hp_out(codec); |
| 12080 | alc268_auto_init_mono_speaker_out(codec); |
| 12081 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12082 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12083 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12084 | } |
| 12085 | |
| 12086 | /* |
| 12087 | * configuration and preset |
| 12088 | */ |
| 12089 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12090 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12091 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12092 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12093 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12094 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12095 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12096 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12097 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12098 | #ifdef CONFIG_SND_DEBUG |
| 12099 | [ALC268_TEST] = "test", |
| 12100 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12101 | [ALC268_AUTO] = "auto", |
| 12102 | }; |
| 12103 | |
| 12104 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12105 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12106 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12107 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12108 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12109 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12110 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12111 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12112 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12113 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12114 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Adam Williamson | 8748895 | 2009-05-21 18:32:59 -0400 | [diff] [blame] | 12115 | SND_PCI_QUIRK(0x103c, 0x30f1, "HP TX25xx series", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12116 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12117 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 12118 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 12119 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12120 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12121 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12122 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12123 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12124 | {} |
| 12125 | }; |
| 12126 | |
| 12127 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12128 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12129 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12130 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12131 | alc267_quanta_il1_verbs }, |
| 12132 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12133 | .dac_nids = alc268_dac_nids, |
| 12134 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12135 | .adc_nids = alc268_adc_nids_alt, |
| 12136 | .hp_nid = 0x03, |
| 12137 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12138 | .channel_mode = alc268_modes, |
| 12139 | .input_mux = &alc268_capture_source, |
| 12140 | .unsol_event = alc267_quanta_il1_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12141 | .init_hook = alc267_quanta_il1_init_hook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12142 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12143 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12144 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12145 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12146 | .init_verbs = { alc268_base_init_verbs }, |
| 12147 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12148 | .dac_nids = alc268_dac_nids, |
| 12149 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12150 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12151 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12152 | .hp_nid = 0x03, |
| 12153 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12154 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12155 | .channel_mode = alc268_modes, |
| 12156 | .input_mux = &alc268_capture_source, |
| 12157 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12158 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12159 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12160 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12161 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12162 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12163 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12164 | .dac_nids = alc268_dac_nids, |
| 12165 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12166 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12167 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12168 | .hp_nid = 0x03, |
| 12169 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12170 | .channel_mode = alc268_modes, |
| 12171 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12172 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12173 | .init_hook = alc268_toshiba_init_hook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12174 | }, |
| 12175 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12176 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12177 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12178 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12179 | alc268_acer_verbs }, |
| 12180 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12181 | .dac_nids = alc268_dac_nids, |
| 12182 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12183 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12184 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12185 | .hp_nid = 0x02, |
| 12186 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12187 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12188 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12189 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12190 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12191 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12192 | [ALC268_ACER_DMIC] = { |
| 12193 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12194 | alc268_beep_mixer }, |
| 12195 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12196 | alc268_acer_verbs }, |
| 12197 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12198 | .dac_nids = alc268_dac_nids, |
| 12199 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12200 | .adc_nids = alc268_adc_nids_alt, |
| 12201 | .capsrc_nids = alc268_capsrc_nids, |
| 12202 | .hp_nid = 0x02, |
| 12203 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12204 | .channel_mode = alc268_modes, |
| 12205 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12206 | .unsol_event = alc268_acer_unsol_event, |
| 12207 | .init_hook = alc268_acer_init_hook, |
| 12208 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12209 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12210 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12211 | alc268_beep_mixer, |
| 12212 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12213 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12214 | alc268_acer_aspire_one_verbs }, |
| 12215 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12216 | .dac_nids = alc268_dac_nids, |
| 12217 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12218 | .adc_nids = alc268_adc_nids_alt, |
| 12219 | .capsrc_nids = alc268_capsrc_nids, |
| 12220 | .hp_nid = 0x03, |
| 12221 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12222 | .channel_mode = alc268_modes, |
| 12223 | .input_mux = &alc268_acer_lc_capture_source, |
| 12224 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12225 | .init_hook = alc268_acer_lc_init_hook, |
| 12226 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12227 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12228 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12229 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12230 | alc268_dell_verbs }, |
| 12231 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12232 | .dac_nids = alc268_dac_nids, |
| 12233 | .hp_nid = 0x02, |
| 12234 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12235 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12236 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12237 | .init_hook = alc268_dell_init_hook, |
| 12238 | .input_mux = &alc268_capture_source, |
| 12239 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12240 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12241 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12242 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12243 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12244 | alc268_toshiba_verbs }, |
| 12245 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12246 | .dac_nids = alc268_dac_nids, |
| 12247 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12248 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12249 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12250 | .hp_nid = 0x03, |
| 12251 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12252 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12253 | .channel_mode = alc268_modes, |
| 12254 | .input_mux = &alc268_capture_source, |
| 12255 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12256 | .init_hook = alc268_toshiba_init_hook |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12257 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12258 | #ifdef CONFIG_SND_DEBUG |
| 12259 | [ALC268_TEST] = { |
| 12260 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12261 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12262 | alc268_volume_init_verbs }, |
| 12263 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12264 | .dac_nids = alc268_dac_nids, |
| 12265 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12266 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12267 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12268 | .hp_nid = 0x03, |
| 12269 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12270 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12271 | .channel_mode = alc268_modes, |
| 12272 | .input_mux = &alc268_capture_source, |
| 12273 | }, |
| 12274 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12275 | }; |
| 12276 | |
| 12277 | static int patch_alc268(struct hda_codec *codec) |
| 12278 | { |
| 12279 | struct alc_spec *spec; |
| 12280 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12281 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12282 | |
| 12283 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12284 | if (spec == NULL) |
| 12285 | return -ENOMEM; |
| 12286 | |
| 12287 | codec->spec = spec; |
| 12288 | |
| 12289 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12290 | alc268_models, |
| 12291 | alc268_cfg_tbl); |
| 12292 | |
| 12293 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 12294 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 12295 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12296 | board_config = ALC268_AUTO; |
| 12297 | } |
| 12298 | |
| 12299 | if (board_config == ALC268_AUTO) { |
| 12300 | /* automatic parse from the BIOS config */ |
| 12301 | err = alc268_parse_auto_config(codec); |
| 12302 | if (err < 0) { |
| 12303 | alc_free(codec); |
| 12304 | return err; |
| 12305 | } else if (!err) { |
| 12306 | printk(KERN_INFO |
| 12307 | "hda_codec: Cannot set up configuration " |
| 12308 | "from BIOS. Using base mode...\n"); |
| 12309 | board_config = ALC268_3ST; |
| 12310 | } |
| 12311 | } |
| 12312 | |
| 12313 | if (board_config != ALC268_AUTO) |
| 12314 | setup_preset(spec, &alc268_presets[board_config]); |
| 12315 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12316 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12317 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12318 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12319 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12320 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12321 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12322 | has_beep = 0; |
| 12323 | for (i = 0; i < spec->num_mixers; i++) { |
| 12324 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12325 | has_beep = 1; |
| 12326 | break; |
| 12327 | } |
| 12328 | } |
| 12329 | |
| 12330 | if (has_beep) { |
| 12331 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12332 | if (err < 0) { |
| 12333 | alc_free(codec); |
| 12334 | return err; |
| 12335 | } |
| 12336 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12337 | /* override the amp caps for beep generator */ |
| 12338 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12339 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12340 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12341 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12342 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12343 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12344 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12345 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12346 | /* check whether NID 0x07 is valid */ |
| 12347 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12348 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12349 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12350 | /* get type */ |
| 12351 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12352 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12353 | spec->adc_nids = alc268_adc_nids_alt; |
| 12354 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12355 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12356 | } else { |
| 12357 | spec->adc_nids = alc268_adc_nids; |
| 12358 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12359 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12360 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12361 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12362 | /* set default input source */ |
| 12363 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12364 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12365 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12366 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12367 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12368 | |
| 12369 | spec->vmaster_nid = 0x02; |
| 12370 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12371 | codec->patch_ops = alc_patch_ops; |
| 12372 | if (board_config == ALC268_AUTO) |
| 12373 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12374 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12375 | codec->proc_widget_hook = print_realtek_coef; |
| 12376 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12377 | return 0; |
| 12378 | } |
| 12379 | |
| 12380 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12381 | * ALC269 channel source setting (2 channel) |
| 12382 | */ |
| 12383 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12384 | |
| 12385 | #define alc269_dac_nids alc260_dac_nids |
| 12386 | |
| 12387 | static hda_nid_t alc269_adc_nids[1] = { |
| 12388 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12389 | 0x08, |
| 12390 | }; |
| 12391 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12392 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12393 | 0x23, |
| 12394 | }; |
| 12395 | |
| 12396 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12397 | * not a mux! |
| 12398 | */ |
| 12399 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12400 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12401 | .num_items = 2, |
| 12402 | .items = { |
| 12403 | { "i-Mic", 0x5 }, |
| 12404 | { "e-Mic", 0x0 }, |
| 12405 | }, |
| 12406 | }; |
| 12407 | |
| 12408 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12409 | .num_items = 2, |
| 12410 | .items = { |
| 12411 | { "i-Mic", 0x1 }, |
| 12412 | { "e-Mic", 0x0 }, |
| 12413 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12414 | }; |
| 12415 | |
| 12416 | #define alc269_modes alc260_modes |
| 12417 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12418 | |
| 12419 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12420 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12421 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12422 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12423 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12424 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12425 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12426 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12427 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12428 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12429 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12430 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12431 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12432 | { } /* end */ |
| 12433 | }; |
| 12434 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12435 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12436 | /* output mixer control */ |
| 12437 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12438 | { |
| 12439 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12440 | .name = "Master Playback Switch", |
| 12441 | .info = snd_hda_mixer_amp_switch_info, |
| 12442 | .get = snd_hda_mixer_amp_switch_get, |
| 12443 | .put = alc268_acer_master_sw_put, |
| 12444 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12445 | }, |
| 12446 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12447 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12448 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12449 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12450 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12451 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12452 | { } |
| 12453 | }; |
| 12454 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12455 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12456 | /* output mixer control */ |
| 12457 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12458 | { |
| 12459 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12460 | .name = "Master Playback Switch", |
| 12461 | .info = snd_hda_mixer_amp_switch_info, |
| 12462 | .get = snd_hda_mixer_amp_switch_get, |
| 12463 | .put = alc268_acer_master_sw_put, |
| 12464 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12465 | }, |
| 12466 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12467 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12468 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12469 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12470 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12471 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12472 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12473 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12474 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12475 | { } |
| 12476 | }; |
| 12477 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12478 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12479 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12480 | .ops = &snd_hda_bind_vol, |
| 12481 | .values = { |
| 12482 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12483 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12484 | 0 |
| 12485 | }, |
| 12486 | }; |
| 12487 | |
| 12488 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12489 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12490 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12491 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12492 | { } /* end */ |
| 12493 | }; |
| 12494 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12495 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12496 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12497 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12498 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12499 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12500 | { } /* end */ |
| 12501 | }; |
| 12502 | |
| 12503 | /* FSC amilo */ |
| 12504 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12505 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12506 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12507 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12508 | { } /* end */ |
| 12509 | }; |
| 12510 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12511 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12512 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12513 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12514 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12515 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12516 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12517 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12518 | { } |
| 12519 | }; |
| 12520 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12521 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12522 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12523 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12524 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12525 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12526 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12527 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12528 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12529 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12530 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12531 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12532 | { } |
| 12533 | }; |
| 12534 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12535 | /* toggle speaker-output according to the hp-jack state */ |
| 12536 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12537 | { |
| 12538 | unsigned int present; |
| 12539 | unsigned char bits; |
| 12540 | |
| 12541 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12542 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12543 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12544 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12545 | AMP_IN_MUTE(0), bits); |
| 12546 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12547 | AMP_IN_MUTE(0), bits); |
| 12548 | |
| 12549 | snd_hda_codec_write(codec, 0x20, 0, |
| 12550 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12551 | snd_hda_codec_write(codec, 0x20, 0, |
| 12552 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12553 | |
| 12554 | snd_hda_codec_write(codec, 0x20, 0, |
| 12555 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12556 | snd_hda_codec_write(codec, 0x20, 0, |
| 12557 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12558 | } |
| 12559 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12560 | /* toggle speaker-output according to the hp-jacks state */ |
| 12561 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12562 | { |
| 12563 | unsigned int present; |
| 12564 | unsigned char bits; |
| 12565 | |
| 12566 | /* Check laptop headphone socket */ |
| 12567 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12568 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12569 | |
| 12570 | /* Check port replicator headphone socket */ |
| 12571 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12572 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12573 | |
| 12574 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12575 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12576 | AMP_IN_MUTE(0), bits); |
| 12577 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12578 | AMP_IN_MUTE(0), bits); |
| 12579 | |
| 12580 | snd_hda_codec_write(codec, 0x20, 0, |
| 12581 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12582 | snd_hda_codec_write(codec, 0x20, 0, |
| 12583 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12584 | |
| 12585 | snd_hda_codec_write(codec, 0x20, 0, |
| 12586 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12587 | snd_hda_codec_write(codec, 0x20, 0, |
| 12588 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12589 | } |
| 12590 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12591 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12592 | { |
| 12593 | unsigned int present; |
| 12594 | |
| 12595 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12596 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12597 | snd_hda_codec_write(codec, 0x23, 0, |
| 12598 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12599 | } |
| 12600 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12601 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12602 | { |
| 12603 | unsigned int present_laptop; |
| 12604 | unsigned int present_dock; |
| 12605 | |
| 12606 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12607 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12608 | |
| 12609 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12610 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12611 | |
| 12612 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12613 | if (present_dock) |
| 12614 | snd_hda_codec_write(codec, 0x23, 0, |
| 12615 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12616 | if (present_laptop) |
| 12617 | snd_hda_codec_write(codec, 0x23, 0, |
| 12618 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12619 | if (!present_dock && !present_laptop) |
| 12620 | snd_hda_codec_write(codec, 0x23, 0, |
| 12621 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12622 | } |
| 12623 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12624 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12625 | unsigned int res) |
| 12626 | { |
| 12627 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12628 | alc269_quanta_fl1_speaker_automute(codec); |
| 12629 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12630 | alc269_quanta_fl1_mic_automute(codec); |
| 12631 | } |
| 12632 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12633 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12634 | unsigned int res) |
| 12635 | { |
| 12636 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12637 | alc269_lifebook_speaker_automute(codec); |
| 12638 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12639 | alc269_lifebook_mic_autoswitch(codec); |
| 12640 | } |
| 12641 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12642 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12643 | { |
| 12644 | alc269_quanta_fl1_speaker_automute(codec); |
| 12645 | alc269_quanta_fl1_mic_automute(codec); |
| 12646 | } |
| 12647 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12648 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12649 | { |
| 12650 | alc269_lifebook_speaker_automute(codec); |
| 12651 | alc269_lifebook_mic_autoswitch(codec); |
| 12652 | } |
| 12653 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12654 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12655 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12656 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12657 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12658 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12659 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12660 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12661 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12662 | {} |
| 12663 | }; |
| 12664 | |
| 12665 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12666 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12667 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12668 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12669 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12670 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12671 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12672 | {} |
| 12673 | }; |
| 12674 | |
| 12675 | /* toggle speaker-output according to the hp-jack state */ |
| 12676 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12677 | { |
| 12678 | unsigned int present; |
| 12679 | unsigned char bits; |
| 12680 | |
| 12681 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12682 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12683 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12684 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12685 | AMP_IN_MUTE(0), bits); |
| 12686 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12687 | AMP_IN_MUTE(0), bits); |
| 12688 | } |
| 12689 | |
| 12690 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12691 | { |
| 12692 | unsigned int present; |
| 12693 | |
| 12694 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12695 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12696 | snd_hda_codec_write(codec, 0x23, 0, |
| 12697 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12698 | } |
| 12699 | |
| 12700 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12701 | { |
| 12702 | unsigned int present; |
| 12703 | |
| 12704 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12705 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12706 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12707 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12708 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12709 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12710 | } |
| 12711 | |
| 12712 | /* unsolicited event for HP jack sensing */ |
| 12713 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12714 | unsigned int res) |
| 12715 | { |
| 12716 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12717 | alc269_speaker_automute(codec); |
| 12718 | |
| 12719 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12720 | alc269_eeepc_dmic_automute(codec); |
| 12721 | } |
| 12722 | |
| 12723 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12724 | { |
| 12725 | alc269_speaker_automute(codec); |
| 12726 | alc269_eeepc_dmic_automute(codec); |
| 12727 | } |
| 12728 | |
| 12729 | /* unsolicited event for HP jack sensing */ |
| 12730 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12731 | unsigned int res) |
| 12732 | { |
| 12733 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12734 | alc269_speaker_automute(codec); |
| 12735 | |
| 12736 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12737 | alc269_eeepc_amic_automute(codec); |
| 12738 | } |
| 12739 | |
| 12740 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12741 | { |
| 12742 | alc269_speaker_automute(codec); |
| 12743 | alc269_eeepc_amic_automute(codec); |
| 12744 | } |
| 12745 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12746 | /* |
| 12747 | * generic initialization of ADC, input mixers and output mixers |
| 12748 | */ |
| 12749 | static struct hda_verb alc269_init_verbs[] = { |
| 12750 | /* |
| 12751 | * Unmute ADC0 and set the default input to mic-in |
| 12752 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12753 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12754 | |
| 12755 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12756 | * analog-loopback mixer widget |
| 12757 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12758 | * front panel mic (mic 2) |
| 12759 | */ |
| 12760 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12761 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12762 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12763 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12764 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12765 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12766 | |
| 12767 | /* |
| 12768 | * Set up output mixers (0x0c - 0x0e) |
| 12769 | */ |
| 12770 | /* set vol=0 to output mixers */ |
| 12771 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12772 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12773 | |
| 12774 | /* set up input amps for analog loopback */ |
| 12775 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12776 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12777 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12778 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12779 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12780 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12781 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12782 | |
| 12783 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12784 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12785 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12786 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12787 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12788 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12789 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12790 | |
| 12791 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12792 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12793 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12794 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12795 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12796 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12797 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12798 | |
| 12799 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12800 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12801 | |
| 12802 | /* FIXME: use matrix-type input source selection */ |
| 12803 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12804 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12805 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12806 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12807 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12808 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12809 | |
| 12810 | /* set EAPD */ |
| 12811 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12812 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12813 | { } |
| 12814 | }; |
| 12815 | |
| 12816 | /* add playback controls from the parsed DAC table */ |
| 12817 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12818 | const struct auto_pin_cfg *cfg) |
| 12819 | { |
| 12820 | hda_nid_t nid; |
| 12821 | int err; |
| 12822 | |
| 12823 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12824 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12825 | spec->multiout.dac_nids[0] = 2; |
| 12826 | |
| 12827 | nid = cfg->line_out_pins[0]; |
| 12828 | if (nid) { |
| 12829 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12830 | "Front Playback Volume", |
| 12831 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12832 | if (err < 0) |
| 12833 | return err; |
| 12834 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12835 | "Front Playback Switch", |
| 12836 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12837 | if (err < 0) |
| 12838 | return err; |
| 12839 | } |
| 12840 | |
| 12841 | nid = cfg->speaker_pins[0]; |
| 12842 | if (nid) { |
| 12843 | if (!cfg->line_out_pins[0]) { |
| 12844 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12845 | "Speaker Playback Volume", |
| 12846 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12847 | HDA_OUTPUT)); |
| 12848 | if (err < 0) |
| 12849 | return err; |
| 12850 | } |
| 12851 | if (nid == 0x16) { |
| 12852 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12853 | "Speaker Playback Switch", |
| 12854 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12855 | HDA_OUTPUT)); |
| 12856 | if (err < 0) |
| 12857 | return err; |
| 12858 | } else { |
| 12859 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12860 | "Speaker Playback Switch", |
| 12861 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12862 | HDA_OUTPUT)); |
| 12863 | if (err < 0) |
| 12864 | return err; |
| 12865 | } |
| 12866 | } |
| 12867 | nid = cfg->hp_pins[0]; |
| 12868 | if (nid) { |
| 12869 | /* spec->multiout.hp_nid = 2; */ |
| 12870 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12871 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12872 | "Headphone Playback Volume", |
| 12873 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12874 | HDA_OUTPUT)); |
| 12875 | if (err < 0) |
| 12876 | return err; |
| 12877 | } |
| 12878 | if (nid == 0x16) { |
| 12879 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12880 | "Headphone Playback Switch", |
| 12881 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12882 | HDA_OUTPUT)); |
| 12883 | if (err < 0) |
| 12884 | return err; |
| 12885 | } else { |
| 12886 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12887 | "Headphone Playback Switch", |
| 12888 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12889 | HDA_OUTPUT)); |
| 12890 | if (err < 0) |
| 12891 | return err; |
| 12892 | } |
| 12893 | } |
| 12894 | return 0; |
| 12895 | } |
| 12896 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12897 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12898 | const struct auto_pin_cfg *cfg) |
| 12899 | { |
| 12900 | int err; |
| 12901 | |
| 12902 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12903 | if (err < 0) |
| 12904 | return err; |
| 12905 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12906 | * because it's under 0x18 |
| 12907 | */ |
| 12908 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12909 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12910 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12911 | imux->items[imux->num_items].label = "Int Mic"; |
| 12912 | imux->items[imux->num_items].index = 0x05; |
| 12913 | imux->num_items++; |
| 12914 | } |
| 12915 | return 0; |
| 12916 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12917 | |
| 12918 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12919 | #define alc269_loopbacks alc880_loopbacks |
| 12920 | #endif |
| 12921 | |
| 12922 | /* pcm configuration: identiacal with ALC880 */ |
| 12923 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12924 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12925 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12926 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12927 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 12928 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 12929 | .substreams = 1, |
| 12930 | .channels_min = 2, |
| 12931 | .channels_max = 8, |
| 12932 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12933 | /* NID is set in alc_build_pcms */ |
| 12934 | .ops = { |
| 12935 | .open = alc880_playback_pcm_open, |
| 12936 | .prepare = alc880_playback_pcm_prepare, |
| 12937 | .cleanup = alc880_playback_pcm_cleanup |
| 12938 | }, |
| 12939 | }; |
| 12940 | |
| 12941 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 12942 | .substreams = 1, |
| 12943 | .channels_min = 2, |
| 12944 | .channels_max = 2, |
| 12945 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12946 | /* NID is set in alc_build_pcms */ |
| 12947 | }; |
| 12948 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12949 | /* |
| 12950 | * BIOS auto configuration |
| 12951 | */ |
| 12952 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12953 | { |
| 12954 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 12955 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12956 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12957 | |
| 12958 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12959 | alc269_ignore); |
| 12960 | if (err < 0) |
| 12961 | return err; |
| 12962 | |
| 12963 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12964 | if (err < 0) |
| 12965 | return err; |
| 12966 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12967 | if (err < 0) |
| 12968 | return err; |
| 12969 | |
| 12970 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12971 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12972 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12973 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12974 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12975 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12976 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12977 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12978 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12979 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12980 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12981 | /* set default input source */ |
| 12982 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12983 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12984 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12985 | |
| 12986 | err = alc_auto_add_mic_boost(codec); |
| 12987 | if (err < 0) |
| 12988 | return err; |
| 12989 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12990 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12991 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12992 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12993 | return 1; |
| 12994 | } |
| 12995 | |
| 12996 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12997 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12998 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12999 | |
| 13000 | |
| 13001 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13002 | static void alc269_auto_init(struct hda_codec *codec) |
| 13003 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13004 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13005 | alc269_auto_init_multi_out(codec); |
| 13006 | alc269_auto_init_hp_out(codec); |
| 13007 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13008 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13009 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13010 | } |
| 13011 | |
| 13012 | /* |
| 13013 | * configuration and preset |
| 13014 | */ |
| 13015 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13016 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13017 | [ALC269_QUANTA_FL1] = "quanta", |
| 13018 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13019 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13020 | [ALC269_FUJITSU] = "fujitsu", |
| 13021 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13022 | }; |
| 13023 | |
| 13024 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13025 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13026 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13027 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13028 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13029 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13030 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13031 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13032 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13033 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13034 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13035 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13036 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13037 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13038 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13039 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13040 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13041 | {} |
| 13042 | }; |
| 13043 | |
| 13044 | static struct alc_config_preset alc269_presets[] = { |
| 13045 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13046 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13047 | .init_verbs = { alc269_init_verbs }, |
| 13048 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13049 | .dac_nids = alc269_dac_nids, |
| 13050 | .hp_nid = 0x03, |
| 13051 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13052 | .channel_mode = alc269_modes, |
| 13053 | .input_mux = &alc269_capture_source, |
| 13054 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13055 | [ALC269_QUANTA_FL1] = { |
| 13056 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13057 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13058 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13059 | .dac_nids = alc269_dac_nids, |
| 13060 | .hp_nid = 0x03, |
| 13061 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13062 | .channel_mode = alc269_modes, |
| 13063 | .input_mux = &alc269_capture_source, |
| 13064 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 13065 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13066 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13067 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13068 | .mixers = { alc269_eeepc_mixer }, |
| 13069 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13070 | .init_verbs = { alc269_init_verbs, |
| 13071 | alc269_eeepc_amic_init_verbs }, |
| 13072 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13073 | .dac_nids = alc269_dac_nids, |
| 13074 | .hp_nid = 0x03, |
| 13075 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13076 | .channel_mode = alc269_modes, |
| 13077 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13078 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13079 | .init_hook = alc269_eeepc_amic_inithook, |
| 13080 | }, |
| 13081 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13082 | .mixers = { alc269_eeepc_mixer }, |
| 13083 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13084 | .init_verbs = { alc269_init_verbs, |
| 13085 | alc269_eeepc_dmic_init_verbs }, |
| 13086 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13087 | .dac_nids = alc269_dac_nids, |
| 13088 | .hp_nid = 0x03, |
| 13089 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13090 | .channel_mode = alc269_modes, |
| 13091 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13092 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13093 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13094 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13095 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13096 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13097 | .cap_mixer = alc269_epc_capture_mixer, |
| 13098 | .init_verbs = { alc269_init_verbs, |
| 13099 | alc269_eeepc_dmic_init_verbs }, |
| 13100 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13101 | .dac_nids = alc269_dac_nids, |
| 13102 | .hp_nid = 0x03, |
| 13103 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13104 | .channel_mode = alc269_modes, |
| 13105 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13106 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13107 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13108 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13109 | [ALC269_LIFEBOOK] = { |
| 13110 | .mixers = { alc269_lifebook_mixer }, |
| 13111 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13112 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13113 | .dac_nids = alc269_dac_nids, |
| 13114 | .hp_nid = 0x03, |
| 13115 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13116 | .channel_mode = alc269_modes, |
| 13117 | .input_mux = &alc269_capture_source, |
| 13118 | .unsol_event = alc269_lifebook_unsol_event, |
| 13119 | .init_hook = alc269_lifebook_init_hook, |
| 13120 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13121 | }; |
| 13122 | |
| 13123 | static int patch_alc269(struct hda_codec *codec) |
| 13124 | { |
| 13125 | struct alc_spec *spec; |
| 13126 | int board_config; |
| 13127 | int err; |
| 13128 | |
| 13129 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13130 | if (spec == NULL) |
| 13131 | return -ENOMEM; |
| 13132 | |
| 13133 | codec->spec = spec; |
| 13134 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13135 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13136 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13137 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13138 | alc269_models, |
| 13139 | alc269_cfg_tbl); |
| 13140 | |
| 13141 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 13142 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 13143 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13144 | board_config = ALC269_AUTO; |
| 13145 | } |
| 13146 | |
| 13147 | if (board_config == ALC269_AUTO) { |
| 13148 | /* automatic parse from the BIOS config */ |
| 13149 | err = alc269_parse_auto_config(codec); |
| 13150 | if (err < 0) { |
| 13151 | alc_free(codec); |
| 13152 | return err; |
| 13153 | } else if (!err) { |
| 13154 | printk(KERN_INFO |
| 13155 | "hda_codec: Cannot set up configuration " |
| 13156 | "from BIOS. Using base mode...\n"); |
| 13157 | board_config = ALC269_BASIC; |
| 13158 | } |
| 13159 | } |
| 13160 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13161 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13162 | if (err < 0) { |
| 13163 | alc_free(codec); |
| 13164 | return err; |
| 13165 | } |
| 13166 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13167 | if (board_config != ALC269_AUTO) |
| 13168 | setup_preset(spec, &alc269_presets[board_config]); |
| 13169 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13170 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13171 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13172 | * fix the sample rate of analog I/O to 44.1kHz |
| 13173 | */ |
| 13174 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13175 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13176 | } else { |
| 13177 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13178 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13179 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13180 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13181 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13182 | |
| 13183 | spec->adc_nids = alc269_adc_nids; |
| 13184 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13185 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13186 | if (!spec->cap_mixer) |
| 13187 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13188 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13189 | |
| 13190 | codec->patch_ops = alc_patch_ops; |
| 13191 | if (board_config == ALC269_AUTO) |
| 13192 | spec->init_hook = alc269_auto_init; |
| 13193 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13194 | if (!spec->loopback.amplist) |
| 13195 | spec->loopback.amplist = alc269_loopbacks; |
| 13196 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13197 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13198 | |
| 13199 | return 0; |
| 13200 | } |
| 13201 | |
| 13202 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13203 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13204 | */ |
| 13205 | |
| 13206 | /* |
| 13207 | * set the path ways for 2 channel output |
| 13208 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13209 | */ |
| 13210 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13211 | /* set pin widget 1Ah (line in) for input */ |
| 13212 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13213 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13214 | * the vref |
| 13215 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13216 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13217 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13218 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13219 | #if 0 |
| 13220 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13221 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13222 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13223 | { } /* end */ |
| 13224 | }; |
| 13225 | /* |
| 13226 | * 6ch mode |
| 13227 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13228 | */ |
| 13229 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13230 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13231 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13232 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13233 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13234 | |
| 13235 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13236 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13237 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13238 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13239 | #if 0 |
| 13240 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13241 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13242 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13243 | { } /* end */ |
| 13244 | }; |
| 13245 | |
| 13246 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13247 | { 2, alc861_threestack_ch2_init }, |
| 13248 | { 6, alc861_threestack_ch6_init }, |
| 13249 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13250 | /* Set mic1 as input and unmute the mixer */ |
| 13251 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13252 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13253 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13254 | { } /* end */ |
| 13255 | }; |
| 13256 | /* Set mic1 as output and mute mixer */ |
| 13257 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13258 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13259 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13260 | { } /* end */ |
| 13261 | }; |
| 13262 | |
| 13263 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13264 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13265 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13266 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13267 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13268 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13269 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13270 | /* set pin widget 1Ah (line in) for input */ |
| 13271 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13272 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13273 | * the vref |
| 13274 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13275 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13276 | |
| 13277 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13278 | #if 0 |
| 13279 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13280 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13281 | #endif |
| 13282 | { } /* end */ |
| 13283 | }; |
| 13284 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13285 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13286 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13287 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13288 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13289 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13290 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13291 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13292 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13293 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13294 | |
| 13295 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13296 | #if 0 |
| 13297 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13298 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13299 | #endif |
| 13300 | { } /* end */ |
| 13301 | }; |
| 13302 | |
| 13303 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13304 | { 2, alc861_asus_ch2_init }, |
| 13305 | { 6, alc861_asus_ch6_init }, |
| 13306 | }; |
| 13307 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13308 | /* patch-ALC861 */ |
| 13309 | |
| 13310 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13311 | /* output mixer control */ |
| 13312 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13313 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13314 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13315 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13316 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13317 | |
| 13318 | /*Input mixer control */ |
| 13319 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13320 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13321 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13322 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13323 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13324 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13325 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13326 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13327 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13328 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13329 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13330 | { } /* end */ |
| 13331 | }; |
| 13332 | |
| 13333 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13334 | /* output mixer control */ |
| 13335 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13336 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13337 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13338 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13339 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13340 | |
| 13341 | /* Input mixer control */ |
| 13342 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13343 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13344 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13345 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13346 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13347 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13348 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13349 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13350 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13351 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13352 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13353 | { |
| 13354 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13355 | .name = "Channel Mode", |
| 13356 | .info = alc_ch_mode_info, |
| 13357 | .get = alc_ch_mode_get, |
| 13358 | .put = alc_ch_mode_put, |
| 13359 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13360 | }, |
| 13361 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13362 | }; |
| 13363 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13364 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13365 | /* output mixer control */ |
| 13366 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13367 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13368 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13369 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13370 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13371 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13372 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13373 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13374 | /* output mixer control */ |
| 13375 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13376 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13377 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13378 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13379 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13380 | |
| 13381 | /* Input mixer control */ |
| 13382 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13383 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13384 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13385 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13386 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13387 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13388 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13389 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13390 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13391 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13392 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13393 | { |
| 13394 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13395 | .name = "Channel Mode", |
| 13396 | .info = alc_ch_mode_info, |
| 13397 | .get = alc_ch_mode_get, |
| 13398 | .put = alc_ch_mode_put, |
| 13399 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13400 | }, |
| 13401 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13402 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13403 | |
| 13404 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13405 | /* output mixer control */ |
| 13406 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13407 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13408 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13409 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13410 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13411 | |
| 13412 | /* Input mixer control */ |
| 13413 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13414 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13415 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13416 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13417 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13418 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13419 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13420 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13421 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13422 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13423 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13424 | { |
| 13425 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13426 | .name = "Channel Mode", |
| 13427 | .info = alc_ch_mode_info, |
| 13428 | .get = alc_ch_mode_get, |
| 13429 | .put = alc_ch_mode_put, |
| 13430 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13431 | }, |
| 13432 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13433 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13434 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13435 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13436 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13437 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13438 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13439 | { } |
| 13440 | }; |
| 13441 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13442 | /* |
| 13443 | * generic initialization of ADC, input mixers and output mixers |
| 13444 | */ |
| 13445 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13446 | /* |
| 13447 | * Unmute ADC0 and set the default input to mic-in |
| 13448 | */ |
| 13449 | /* port-A for surround (rear panel) */ |
| 13450 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13451 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13452 | /* port-B for mic-in (rear panel) with vref */ |
| 13453 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13454 | /* port-C for line-in (rear panel) */ |
| 13455 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13456 | /* port-D for Front */ |
| 13457 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13458 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13459 | /* port-E for HP out (front panel) */ |
| 13460 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13461 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13462 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13463 | /* port-F for mic-in (front panel) with vref */ |
| 13464 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13465 | /* port-G for CLFE (rear panel) */ |
| 13466 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13467 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13468 | /* port-H for side (rear panel) */ |
| 13469 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13470 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13471 | /* CD-in */ |
| 13472 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13473 | /* route front mic to ADC1*/ |
| 13474 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13475 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13476 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13477 | /* Unmute DAC0~3 & spdif out*/ |
| 13478 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13479 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13480 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13481 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13482 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13483 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13484 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13485 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13486 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13487 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13488 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13489 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13490 | /* Unmute Stereo Mixer 15 */ |
| 13491 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13492 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13493 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13494 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13495 | |
| 13496 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13497 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13498 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13499 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13500 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13501 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13502 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13503 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13504 | /* hp used DAC 3 (Front) */ |
| 13505 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13506 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13507 | |
| 13508 | { } |
| 13509 | }; |
| 13510 | |
| 13511 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13512 | /* |
| 13513 | * Unmute ADC0 and set the default input to mic-in |
| 13514 | */ |
| 13515 | /* port-A for surround (rear panel) */ |
| 13516 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13517 | /* port-B for mic-in (rear panel) with vref */ |
| 13518 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13519 | /* port-C for line-in (rear panel) */ |
| 13520 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13521 | /* port-D for Front */ |
| 13522 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13523 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13524 | /* port-E for HP out (front panel) */ |
| 13525 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13526 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13527 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13528 | /* port-F for mic-in (front panel) with vref */ |
| 13529 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13530 | /* port-G for CLFE (rear panel) */ |
| 13531 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13532 | /* port-H for side (rear panel) */ |
| 13533 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13534 | /* CD-in */ |
| 13535 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13536 | /* route front mic to ADC1*/ |
| 13537 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13538 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13539 | /* Unmute DAC0~3 & spdif out*/ |
| 13540 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13541 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13542 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13543 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13544 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13545 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13546 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13547 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13548 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13549 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13550 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13551 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13552 | /* Unmute Stereo Mixer 15 */ |
| 13553 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13554 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13555 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13556 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13557 | |
| 13558 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13559 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13560 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13561 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13562 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13563 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13564 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13565 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13566 | /* hp used DAC 3 (Front) */ |
| 13567 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13568 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13569 | { } |
| 13570 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13571 | |
| 13572 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13573 | /* |
| 13574 | * Unmute ADC0 and set the default input to mic-in |
| 13575 | */ |
| 13576 | /* port-A for surround (rear panel) */ |
| 13577 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13578 | /* port-B for mic-in (rear panel) with vref */ |
| 13579 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13580 | /* port-C for line-in (rear panel) */ |
| 13581 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13582 | /* port-D for Front */ |
| 13583 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13584 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13585 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13586 | /* this has to be set to VREF80 */ |
| 13587 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13588 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13589 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13590 | /* port-F for mic-in (front panel) with vref */ |
| 13591 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13592 | /* port-G for CLFE (rear panel) */ |
| 13593 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13594 | /* port-H for side (rear panel) */ |
| 13595 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13596 | /* CD-in */ |
| 13597 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13598 | /* route front mic to ADC1*/ |
| 13599 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13600 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13601 | /* Unmute DAC0~3 & spdif out*/ |
| 13602 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13603 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13604 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13605 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13606 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13607 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13608 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13609 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13610 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13611 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13612 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13613 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13614 | /* Unmute Stereo Mixer 15 */ |
| 13615 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13616 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13617 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13618 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13619 | |
| 13620 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13621 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13622 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13623 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13624 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13625 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13626 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13627 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13628 | /* hp used DAC 3 (Front) */ |
| 13629 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13630 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13631 | { } |
| 13632 | }; |
| 13633 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13634 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13635 | /* |
| 13636 | * Unmute ADC0 and set the default input to mic-in |
| 13637 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13638 | /* port-A for surround (rear panel) |
| 13639 | * according to codec#0 this is the HP jack |
| 13640 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13641 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13642 | /* route front PCM to HP */ |
| 13643 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13644 | /* port-B for mic-in (rear panel) with vref */ |
| 13645 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13646 | /* port-C for line-in (rear panel) */ |
| 13647 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13648 | /* port-D for Front */ |
| 13649 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13650 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13651 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13652 | /* this has to be set to VREF80 */ |
| 13653 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13654 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13655 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13656 | /* port-F for mic-in (front panel) with vref */ |
| 13657 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13658 | /* port-G for CLFE (rear panel) */ |
| 13659 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13660 | /* port-H for side (rear panel) */ |
| 13661 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13662 | /* CD-in */ |
| 13663 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13664 | /* route front mic to ADC1*/ |
| 13665 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13666 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13667 | /* Unmute DAC0~3 & spdif out*/ |
| 13668 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13669 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13670 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13671 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13672 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13673 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13674 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13675 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13676 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13677 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13678 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13679 | /* Unmute Stereo Mixer 15 */ |
| 13680 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13681 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13682 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13683 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13684 | |
| 13685 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13686 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13687 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13688 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13689 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13690 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13691 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13692 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13693 | /* hp used DAC 3 (Front) */ |
| 13694 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13695 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13696 | { } |
| 13697 | }; |
| 13698 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13699 | /* additional init verbs for ASUS laptops */ |
| 13700 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13701 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13702 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13703 | { } |
| 13704 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13705 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13706 | /* |
| 13707 | * generic initialization of ADC, input mixers and output mixers |
| 13708 | */ |
| 13709 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13710 | /* |
| 13711 | * Unmute ADC0 and set the default input to mic-in |
| 13712 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13713 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13714 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13715 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13716 | /* Unmute DAC0~3 & spdif out*/ |
| 13717 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13718 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13719 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13720 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13721 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13722 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13723 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13724 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13725 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13726 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13727 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13728 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13729 | /* Unmute Stereo Mixer 15 */ |
| 13730 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13731 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13732 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13733 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13734 | |
| 13735 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13736 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13737 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13738 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13739 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13740 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13741 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13742 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13743 | |
| 13744 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13745 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13746 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13747 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13748 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13749 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13750 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13751 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13752 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13753 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13754 | |
| 13755 | { } |
| 13756 | }; |
| 13757 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13758 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13759 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13760 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13761 | { } |
| 13762 | }; |
| 13763 | |
| 13764 | /* toggle speaker-output according to the hp-jack state */ |
| 13765 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13766 | { |
| 13767 | unsigned int present; |
| 13768 | |
| 13769 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13770 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13771 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13772 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13773 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13774 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13775 | } |
| 13776 | |
| 13777 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13778 | unsigned int res) |
| 13779 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13780 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13781 | alc861_toshiba_automute(codec); |
| 13782 | } |
| 13783 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13784 | /* pcm configuration: identiacal with ALC880 */ |
| 13785 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13786 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13787 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13788 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13789 | |
| 13790 | |
| 13791 | #define ALC861_DIGOUT_NID 0x07 |
| 13792 | |
| 13793 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13794 | { 8, NULL } |
| 13795 | }; |
| 13796 | |
| 13797 | static hda_nid_t alc861_dac_nids[4] = { |
| 13798 | /* front, surround, clfe, side */ |
| 13799 | 0x03, 0x06, 0x05, 0x04 |
| 13800 | }; |
| 13801 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13802 | static hda_nid_t alc660_dac_nids[3] = { |
| 13803 | /* front, clfe, surround */ |
| 13804 | 0x03, 0x05, 0x06 |
| 13805 | }; |
| 13806 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13807 | static hda_nid_t alc861_adc_nids[1] = { |
| 13808 | /* ADC0-2 */ |
| 13809 | 0x08, |
| 13810 | }; |
| 13811 | |
| 13812 | static struct hda_input_mux alc861_capture_source = { |
| 13813 | .num_items = 5, |
| 13814 | .items = { |
| 13815 | { "Mic", 0x0 }, |
| 13816 | { "Front Mic", 0x3 }, |
| 13817 | { "Line", 0x1 }, |
| 13818 | { "CD", 0x4 }, |
| 13819 | { "Mixer", 0x5 }, |
| 13820 | }, |
| 13821 | }; |
| 13822 | |
| 13823 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13824 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13825 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13826 | { |
| 13827 | int i; |
| 13828 | hda_nid_t nid; |
| 13829 | |
| 13830 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13831 | for (i = 0; i < cfg->line_outs; i++) { |
| 13832 | nid = cfg->line_out_pins[i]; |
| 13833 | if (nid) { |
| 13834 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13835 | continue; |
| 13836 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13837 | } |
| 13838 | } |
| 13839 | spec->multiout.num_dacs = cfg->line_outs; |
| 13840 | return 0; |
| 13841 | } |
| 13842 | |
| 13843 | /* add playback controls from the parsed DAC table */ |
| 13844 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13845 | const struct auto_pin_cfg *cfg) |
| 13846 | { |
| 13847 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13848 | static const char *chname[4] = { |
| 13849 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13850 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13851 | hda_nid_t nid; |
| 13852 | int i, idx, err; |
| 13853 | |
| 13854 | for (i = 0; i < cfg->line_outs; i++) { |
| 13855 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13856 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13857 | continue; |
| 13858 | if (nid == 0x05) { |
| 13859 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13860 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13861 | "Center Playback Switch", |
| 13862 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13863 | HDA_OUTPUT)); |
| 13864 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13865 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13866 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13867 | "LFE Playback Switch", |
| 13868 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13869 | HDA_OUTPUT)); |
| 13870 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13871 | return err; |
| 13872 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13873 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13874 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13875 | if (nid == alc861_dac_nids[idx]) |
| 13876 | break; |
| 13877 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13878 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13879 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13880 | HDA_OUTPUT)); |
| 13881 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13882 | return err; |
| 13883 | } |
| 13884 | } |
| 13885 | return 0; |
| 13886 | } |
| 13887 | |
| 13888 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13889 | { |
| 13890 | int err; |
| 13891 | hda_nid_t nid; |
| 13892 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13893 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13894 | return 0; |
| 13895 | |
| 13896 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13897 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13898 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13899 | "Headphone Playback Switch", |
| 13900 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13901 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13902 | return err; |
| 13903 | spec->multiout.hp_nid = nid; |
| 13904 | } |
| 13905 | return 0; |
| 13906 | } |
| 13907 | |
| 13908 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13909 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13910 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13911 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13912 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13913 | int i, err, idx, idx1; |
| 13914 | |
| 13915 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13916 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13917 | case 0x0c: |
| 13918 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13919 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13920 | break; |
| 13921 | case 0x0f: |
| 13922 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13923 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13924 | break; |
| 13925 | case 0x0d: |
| 13926 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13927 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13928 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13929 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13930 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13931 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13932 | break; |
| 13933 | case 0x11: |
| 13934 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13935 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13936 | break; |
| 13937 | default: |
| 13938 | continue; |
| 13939 | } |
| 13940 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13941 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13942 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13943 | if (err < 0) |
| 13944 | return err; |
| 13945 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13946 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13947 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13948 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13949 | } |
| 13950 | return 0; |
| 13951 | } |
| 13952 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13953 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13954 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13955 | int pin_type, int dac_idx) |
| 13956 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13957 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13958 | pin_type); |
| 13959 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13960 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13961 | } |
| 13962 | |
| 13963 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13964 | { |
| 13965 | struct alc_spec *spec = codec->spec; |
| 13966 | int i; |
| 13967 | |
| 13968 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13969 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13970 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13971 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13972 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13973 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13974 | } |
| 13975 | } |
| 13976 | |
| 13977 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13978 | { |
| 13979 | struct alc_spec *spec = codec->spec; |
| 13980 | hda_nid_t pin; |
| 13981 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13982 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13983 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13984 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13985 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13986 | pin = spec->autocfg.speaker_pins[0]; |
| 13987 | if (pin) |
| 13988 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13989 | } |
| 13990 | |
| 13991 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13992 | { |
| 13993 | struct alc_spec *spec = codec->spec; |
| 13994 | int i; |
| 13995 | |
| 13996 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13997 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 13998 | if (nid >= 0x0c && nid <= 0x11) |
| 13999 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14000 | } |
| 14001 | } |
| 14002 | |
| 14003 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14004 | /* return 1 if successful, 0 if the proper config is not found, |
| 14005 | * or a negative error code |
| 14006 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14007 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14008 | { |
| 14009 | struct alc_spec *spec = codec->spec; |
| 14010 | int err; |
| 14011 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14012 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14013 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14014 | alc861_ignore); |
| 14015 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14016 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14017 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14018 | return 0; /* can't find valid BIOS pin config */ |
| 14019 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14020 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14021 | if (err < 0) |
| 14022 | return err; |
| 14023 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14024 | if (err < 0) |
| 14025 | return err; |
| 14026 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 14027 | if (err < 0) |
| 14028 | return err; |
| 14029 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14030 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14031 | return err; |
| 14032 | |
| 14033 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14034 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14035 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14036 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14037 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14038 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14039 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14040 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14041 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14042 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14043 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14044 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14045 | |
| 14046 | spec->adc_nids = alc861_adc_nids; |
| 14047 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14048 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14049 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14050 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14051 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14052 | return 1; |
| 14053 | } |
| 14054 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14055 | /* additional initialization for auto-configuration model */ |
| 14056 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14057 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14058 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14059 | alc861_auto_init_multi_out(codec); |
| 14060 | alc861_auto_init_hp_out(codec); |
| 14061 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14062 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14063 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14064 | } |
| 14065 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14066 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14067 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14068 | { 0x15, HDA_INPUT, 0 }, |
| 14069 | { 0x15, HDA_INPUT, 1 }, |
| 14070 | { 0x15, HDA_INPUT, 2 }, |
| 14071 | { 0x15, HDA_INPUT, 3 }, |
| 14072 | { } /* end */ |
| 14073 | }; |
| 14074 | #endif |
| 14075 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14076 | |
| 14077 | /* |
| 14078 | * configuration and preset |
| 14079 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14080 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14081 | [ALC861_3ST] = "3stack", |
| 14082 | [ALC660_3ST] = "3stack-660", |
| 14083 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14084 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14085 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14086 | [ALC861_TOSHIBA] = "toshiba", |
| 14087 | [ALC861_ASUS] = "asus", |
| 14088 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14089 | [ALC861_AUTO] = "auto", |
| 14090 | }; |
| 14091 | |
| 14092 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14093 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14094 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14095 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14096 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14097 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14098 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14099 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14100 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14101 | * Any other models that need this preset? |
| 14102 | */ |
| 14103 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14104 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14105 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14106 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14107 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14108 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14109 | /* FIXME: the below seems conflict */ |
| 14110 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14111 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14112 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14113 | {} |
| 14114 | }; |
| 14115 | |
| 14116 | static struct alc_config_preset alc861_presets[] = { |
| 14117 | [ALC861_3ST] = { |
| 14118 | .mixers = { alc861_3ST_mixer }, |
| 14119 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14120 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14121 | .dac_nids = alc861_dac_nids, |
| 14122 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14123 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14124 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14125 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14126 | .adc_nids = alc861_adc_nids, |
| 14127 | .input_mux = &alc861_capture_source, |
| 14128 | }, |
| 14129 | [ALC861_3ST_DIG] = { |
| 14130 | .mixers = { alc861_base_mixer }, |
| 14131 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14132 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14133 | .dac_nids = alc861_dac_nids, |
| 14134 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14135 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14136 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14137 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14138 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14139 | .adc_nids = alc861_adc_nids, |
| 14140 | .input_mux = &alc861_capture_source, |
| 14141 | }, |
| 14142 | [ALC861_6ST_DIG] = { |
| 14143 | .mixers = { alc861_base_mixer }, |
| 14144 | .init_verbs = { alc861_base_init_verbs }, |
| 14145 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14146 | .dac_nids = alc861_dac_nids, |
| 14147 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14148 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14149 | .channel_mode = alc861_8ch_modes, |
| 14150 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14151 | .adc_nids = alc861_adc_nids, |
| 14152 | .input_mux = &alc861_capture_source, |
| 14153 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14154 | [ALC660_3ST] = { |
| 14155 | .mixers = { alc861_3ST_mixer }, |
| 14156 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14157 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14158 | .dac_nids = alc660_dac_nids, |
| 14159 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14160 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14161 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14162 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14163 | .adc_nids = alc861_adc_nids, |
| 14164 | .input_mux = &alc861_capture_source, |
| 14165 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14166 | [ALC861_UNIWILL_M31] = { |
| 14167 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14168 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14169 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14170 | .dac_nids = alc861_dac_nids, |
| 14171 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14172 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14173 | .channel_mode = alc861_uniwill_m31_modes, |
| 14174 | .need_dac_fix = 1, |
| 14175 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14176 | .adc_nids = alc861_adc_nids, |
| 14177 | .input_mux = &alc861_capture_source, |
| 14178 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14179 | [ALC861_TOSHIBA] = { |
| 14180 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14181 | .init_verbs = { alc861_base_init_verbs, |
| 14182 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14183 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14184 | .dac_nids = alc861_dac_nids, |
| 14185 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14186 | .channel_mode = alc883_3ST_2ch_modes, |
| 14187 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14188 | .adc_nids = alc861_adc_nids, |
| 14189 | .input_mux = &alc861_capture_source, |
| 14190 | .unsol_event = alc861_toshiba_unsol_event, |
| 14191 | .init_hook = alc861_toshiba_automute, |
| 14192 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14193 | [ALC861_ASUS] = { |
| 14194 | .mixers = { alc861_asus_mixer }, |
| 14195 | .init_verbs = { alc861_asus_init_verbs }, |
| 14196 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14197 | .dac_nids = alc861_dac_nids, |
| 14198 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14199 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14200 | .channel_mode = alc861_asus_modes, |
| 14201 | .need_dac_fix = 1, |
| 14202 | .hp_nid = 0x06, |
| 14203 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14204 | .adc_nids = alc861_adc_nids, |
| 14205 | .input_mux = &alc861_capture_source, |
| 14206 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14207 | [ALC861_ASUS_LAPTOP] = { |
| 14208 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14209 | .init_verbs = { alc861_asus_init_verbs, |
| 14210 | alc861_asus_laptop_init_verbs }, |
| 14211 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14212 | .dac_nids = alc861_dac_nids, |
| 14213 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14214 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14215 | .channel_mode = alc883_3ST_2ch_modes, |
| 14216 | .need_dac_fix = 1, |
| 14217 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14218 | .adc_nids = alc861_adc_nids, |
| 14219 | .input_mux = &alc861_capture_source, |
| 14220 | }, |
| 14221 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14222 | |
| 14223 | |
| 14224 | static int patch_alc861(struct hda_codec *codec) |
| 14225 | { |
| 14226 | struct alc_spec *spec; |
| 14227 | int board_config; |
| 14228 | int err; |
| 14229 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14230 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14231 | if (spec == NULL) |
| 14232 | return -ENOMEM; |
| 14233 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14234 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14235 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14236 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14237 | alc861_models, |
| 14238 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14239 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14240 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 14241 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 14242 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14243 | board_config = ALC861_AUTO; |
| 14244 | } |
| 14245 | |
| 14246 | if (board_config == ALC861_AUTO) { |
| 14247 | /* automatic parse from the BIOS config */ |
| 14248 | err = alc861_parse_auto_config(codec); |
| 14249 | if (err < 0) { |
| 14250 | alc_free(codec); |
| 14251 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14252 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14253 | printk(KERN_INFO |
| 14254 | "hda_codec: Cannot set up configuration " |
| 14255 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14256 | board_config = ALC861_3ST_DIG; |
| 14257 | } |
| 14258 | } |
| 14259 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14260 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14261 | if (err < 0) { |
| 14262 | alc_free(codec); |
| 14263 | return err; |
| 14264 | } |
| 14265 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14266 | if (board_config != ALC861_AUTO) |
| 14267 | setup_preset(spec, &alc861_presets[board_config]); |
| 14268 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14269 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14270 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14271 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14272 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14273 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14274 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14275 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14276 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14277 | spec->vmaster_nid = 0x03; |
| 14278 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14279 | codec->patch_ops = alc_patch_ops; |
| 14280 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14281 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14282 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14283 | if (!spec->loopback.amplist) |
| 14284 | spec->loopback.amplist = alc861_loopbacks; |
| 14285 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14286 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14287 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14288 | return 0; |
| 14289 | } |
| 14290 | |
| 14291 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14292 | * ALC861-VD support |
| 14293 | * |
| 14294 | * Based on ALC882 |
| 14295 | * |
| 14296 | * In addition, an independent DAC |
| 14297 | */ |
| 14298 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14299 | |
| 14300 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14301 | /* front, surr, clfe, side surr */ |
| 14302 | 0x02, 0x03, 0x04, 0x05 |
| 14303 | }; |
| 14304 | |
| 14305 | /* dac_nids for ALC660vd are in a different order - according to |
| 14306 | * Realtek's driver. |
| 14307 | * This should probably tesult in a different mixer for 6stack models |
| 14308 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14309 | * - and it is the same as in 861vd. |
| 14310 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14311 | */ |
| 14312 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14313 | /* front, rear, clfe, rear_surr */ |
| 14314 | 0x02, 0x04, 0x03 |
| 14315 | }; |
| 14316 | |
| 14317 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14318 | /* ADC0 */ |
| 14319 | 0x09, |
| 14320 | }; |
| 14321 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14322 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14323 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14324 | /* input MUX */ |
| 14325 | /* FIXME: should be a matrix-type input source selection */ |
| 14326 | static struct hda_input_mux alc861vd_capture_source = { |
| 14327 | .num_items = 4, |
| 14328 | .items = { |
| 14329 | { "Mic", 0x0 }, |
| 14330 | { "Front Mic", 0x1 }, |
| 14331 | { "Line", 0x2 }, |
| 14332 | { "CD", 0x4 }, |
| 14333 | }, |
| 14334 | }; |
| 14335 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14336 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14337 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14338 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14339 | { "Ext Mic", 0x0 }, |
| 14340 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14341 | }, |
| 14342 | }; |
| 14343 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14344 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14345 | .num_items = 2, |
| 14346 | .items = { |
| 14347 | { "Front Mic", 0x0 }, |
| 14348 | { "ATAPI Mic", 0x1 }, |
| 14349 | }, |
| 14350 | }; |
| 14351 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14352 | /* |
| 14353 | * 2ch mode |
| 14354 | */ |
| 14355 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14356 | { 2, NULL } |
| 14357 | }; |
| 14358 | |
| 14359 | /* |
| 14360 | * 6ch mode |
| 14361 | */ |
| 14362 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14363 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14364 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14365 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14366 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14367 | { } /* end */ |
| 14368 | }; |
| 14369 | |
| 14370 | /* |
| 14371 | * 8ch mode |
| 14372 | */ |
| 14373 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14374 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14375 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14376 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14377 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14378 | { } /* end */ |
| 14379 | }; |
| 14380 | |
| 14381 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14382 | { 6, alc861vd_6stack_ch6_init }, |
| 14383 | { 8, alc861vd_6stack_ch8_init }, |
| 14384 | }; |
| 14385 | |
| 14386 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14387 | { |
| 14388 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14389 | .name = "Channel Mode", |
| 14390 | .info = alc_ch_mode_info, |
| 14391 | .get = alc_ch_mode_get, |
| 14392 | .put = alc_ch_mode_put, |
| 14393 | }, |
| 14394 | { } /* end */ |
| 14395 | }; |
| 14396 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14397 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14398 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14399 | */ |
| 14400 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14401 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14402 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14403 | |
| 14404 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14405 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14406 | |
| 14407 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14408 | HDA_OUTPUT), |
| 14409 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14410 | HDA_OUTPUT), |
| 14411 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14412 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14413 | |
| 14414 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14415 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14416 | |
| 14417 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14418 | |
| 14419 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14420 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14421 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14422 | |
| 14423 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14424 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14425 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14426 | |
| 14427 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14428 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14429 | |
| 14430 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14431 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14432 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14433 | { } /* end */ |
| 14434 | }; |
| 14435 | |
| 14436 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14437 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14438 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14439 | |
| 14440 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14441 | |
| 14442 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14443 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14444 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14445 | |
| 14446 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14447 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14448 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14449 | |
| 14450 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14451 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14452 | |
| 14453 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14454 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14455 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14456 | { } /* end */ |
| 14457 | }; |
| 14458 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14459 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14460 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14461 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14462 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14463 | |
| 14464 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14465 | |
| 14466 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14468 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14469 | |
| 14470 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14471 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14472 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14473 | |
| 14474 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14475 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14476 | |
| 14477 | { } /* end */ |
| 14478 | }; |
| 14479 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14480 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14481 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14482 | */ |
| 14483 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14484 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14485 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14486 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14487 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14488 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14489 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14490 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14491 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14492 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14493 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14494 | { } /* end */ |
| 14495 | }; |
| 14496 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14497 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14498 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14499 | */ |
| 14500 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14501 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14502 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14503 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14504 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14505 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14506 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14507 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14508 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14509 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14510 | { } /* end */ |
| 14511 | }; |
| 14512 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14513 | /* |
| 14514 | * generic initialization of ADC, input mixers and output mixers |
| 14515 | */ |
| 14516 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14517 | /* |
| 14518 | * Unmute ADC0 and set the default input to mic-in |
| 14519 | */ |
| 14520 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14521 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14522 | |
| 14523 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14524 | * the analog-loopback mixer widget |
| 14525 | */ |
| 14526 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14527 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14528 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14529 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14530 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14531 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14532 | |
| 14533 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14534 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14535 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14536 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14537 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14538 | |
| 14539 | /* |
| 14540 | * Set up output mixers (0x02 - 0x05) |
| 14541 | */ |
| 14542 | /* set vol=0 to output mixers */ |
| 14543 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14544 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14545 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14546 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14547 | |
| 14548 | /* set up input amps for analog loopback */ |
| 14549 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14550 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14551 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14552 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14553 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14554 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14555 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14556 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14557 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14558 | |
| 14559 | { } |
| 14560 | }; |
| 14561 | |
| 14562 | /* |
| 14563 | * 3-stack pin configuration: |
| 14564 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14565 | */ |
| 14566 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14567 | /* |
| 14568 | * Set pin mode and muting |
| 14569 | */ |
| 14570 | /* set front pin widgets 0x14 for output */ |
| 14571 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14572 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14573 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14574 | |
| 14575 | /* Mic (rear) pin: input vref at 80% */ |
| 14576 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14577 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14578 | /* Front Mic pin: input vref at 80% */ |
| 14579 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14580 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14581 | /* Line In pin: input */ |
| 14582 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14583 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14584 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14585 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14586 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14587 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14588 | /* CD pin widget for input */ |
| 14589 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14590 | |
| 14591 | { } |
| 14592 | }; |
| 14593 | |
| 14594 | /* |
| 14595 | * 6-stack pin configuration: |
| 14596 | */ |
| 14597 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14598 | /* |
| 14599 | * Set pin mode and muting |
| 14600 | */ |
| 14601 | /* set front pin widgets 0x14 for output */ |
| 14602 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14603 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14604 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14605 | |
| 14606 | /* Rear Pin: output 1 (0x0d) */ |
| 14607 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14608 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14609 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14610 | /* CLFE Pin: output 2 (0x0e) */ |
| 14611 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14612 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14613 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14614 | /* Side Pin: output 3 (0x0f) */ |
| 14615 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14616 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14617 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14618 | |
| 14619 | /* Mic (rear) pin: input vref at 80% */ |
| 14620 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14621 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14622 | /* Front Mic pin: input vref at 80% */ |
| 14623 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14624 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14625 | /* Line In pin: input */ |
| 14626 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14627 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14628 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14629 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14630 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14631 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14632 | /* CD pin widget for input */ |
| 14633 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14634 | |
| 14635 | { } |
| 14636 | }; |
| 14637 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14638 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14639 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14640 | { } |
| 14641 | }; |
| 14642 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14643 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14644 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14645 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14646 | { } |
| 14647 | }; |
| 14648 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14649 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14650 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14651 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14652 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14653 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14654 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14655 | {} |
| 14656 | }; |
| 14657 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14658 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14659 | { |
| 14660 | unsigned int present; |
| 14661 | unsigned char bits; |
| 14662 | |
| 14663 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14664 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14665 | bits = present ? HDA_AMP_MUTE : 0; |
| 14666 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14667 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14668 | } |
| 14669 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14670 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14671 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14672 | struct alc_spec *spec = codec->spec; |
| 14673 | |
| 14674 | spec->autocfg.hp_pins[0] = 0x1b; |
| 14675 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14676 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14677 | alc861vd_lenovo_mic_automute(codec); |
| 14678 | } |
| 14679 | |
| 14680 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14681 | unsigned int res) |
| 14682 | { |
| 14683 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14684 | case ALC880_MIC_EVENT: |
| 14685 | alc861vd_lenovo_mic_automute(codec); |
| 14686 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14687 | default: |
| 14688 | alc_automute_amp_unsol_event(codec, res); |
| 14689 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14690 | } |
| 14691 | } |
| 14692 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14693 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14694 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14695 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14696 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14697 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14698 | |
| 14699 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14700 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14701 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14702 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14703 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14704 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14705 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14706 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14707 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14708 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14709 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14710 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14711 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14712 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14713 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14714 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14715 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14716 | |
| 14717 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14718 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14719 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14720 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14721 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14722 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14723 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14724 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14725 | |
| 14726 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14727 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14730 | |
| 14731 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14732 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14733 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14734 | |
| 14735 | { } /* end */ |
| 14736 | }; |
| 14737 | |
| 14738 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14739 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14740 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14741 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14742 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14743 | spec->autocfg.hp_pins[0] = 0x15; |
| 14744 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14745 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14746 | } |
| 14747 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14748 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14749 | #define alc861vd_loopbacks alc880_loopbacks |
| 14750 | #endif |
| 14751 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14752 | /* pcm configuration: identiacal with ALC880 */ |
| 14753 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14754 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14755 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14756 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14757 | |
| 14758 | /* |
| 14759 | * configuration and preset |
| 14760 | */ |
| 14761 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14762 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14763 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14764 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14765 | [ALC861VD_3ST] = "3stack", |
| 14766 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14767 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14768 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14769 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14770 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14771 | [ALC861VD_AUTO] = "auto", |
| 14772 | }; |
| 14773 | |
| 14774 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14775 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14776 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14777 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14778 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14779 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14780 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14781 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14782 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14783 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14784 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14785 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14786 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14787 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 14788 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14789 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14790 | {} |
| 14791 | }; |
| 14792 | |
| 14793 | static struct alc_config_preset alc861vd_presets[] = { |
| 14794 | [ALC660VD_3ST] = { |
| 14795 | .mixers = { alc861vd_3st_mixer }, |
| 14796 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14797 | alc861vd_3stack_init_verbs }, |
| 14798 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14799 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14800 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14801 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14802 | .input_mux = &alc861vd_capture_source, |
| 14803 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14804 | [ALC660VD_3ST_DIG] = { |
| 14805 | .mixers = { alc861vd_3st_mixer }, |
| 14806 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14807 | alc861vd_3stack_init_verbs }, |
| 14808 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14809 | .dac_nids = alc660vd_dac_nids, |
| 14810 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14811 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14812 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14813 | .input_mux = &alc861vd_capture_source, |
| 14814 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14815 | [ALC861VD_3ST] = { |
| 14816 | .mixers = { alc861vd_3st_mixer }, |
| 14817 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14818 | alc861vd_3stack_init_verbs }, |
| 14819 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14820 | .dac_nids = alc861vd_dac_nids, |
| 14821 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14822 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14823 | .input_mux = &alc861vd_capture_source, |
| 14824 | }, |
| 14825 | [ALC861VD_3ST_DIG] = { |
| 14826 | .mixers = { alc861vd_3st_mixer }, |
| 14827 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14828 | alc861vd_3stack_init_verbs }, |
| 14829 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14830 | .dac_nids = alc861vd_dac_nids, |
| 14831 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14832 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14833 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14834 | .input_mux = &alc861vd_capture_source, |
| 14835 | }, |
| 14836 | [ALC861VD_6ST_DIG] = { |
| 14837 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14838 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14839 | alc861vd_6stack_init_verbs }, |
| 14840 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14841 | .dac_nids = alc861vd_dac_nids, |
| 14842 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14843 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14844 | .channel_mode = alc861vd_6stack_modes, |
| 14845 | .input_mux = &alc861vd_capture_source, |
| 14846 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14847 | [ALC861VD_LENOVO] = { |
| 14848 | .mixers = { alc861vd_lenovo_mixer }, |
| 14849 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14850 | alc861vd_3stack_init_verbs, |
| 14851 | alc861vd_eapd_verbs, |
| 14852 | alc861vd_lenovo_unsol_verbs }, |
| 14853 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14854 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14855 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14856 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14857 | .input_mux = &alc861vd_capture_source, |
| 14858 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14859 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14860 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14861 | [ALC861VD_DALLAS] = { |
| 14862 | .mixers = { alc861vd_dallas_mixer }, |
| 14863 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14864 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14865 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14866 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14867 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14868 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14869 | .unsol_event = alc_automute_amp_unsol_event, |
| 14870 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14871 | }, |
| 14872 | [ALC861VD_HP] = { |
| 14873 | .mixers = { alc861vd_hp_mixer }, |
| 14874 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14875 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14876 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14877 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14878 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14879 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14880 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14881 | .unsol_event = alc_automute_amp_unsol_event, |
| 14882 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14883 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14884 | [ALC660VD_ASUS_V1S] = { |
| 14885 | .mixers = { alc861vd_lenovo_mixer }, |
| 14886 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14887 | alc861vd_3stack_init_verbs, |
| 14888 | alc861vd_eapd_verbs, |
| 14889 | alc861vd_lenovo_unsol_verbs }, |
| 14890 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14891 | .dac_nids = alc660vd_dac_nids, |
| 14892 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14893 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14894 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14895 | .input_mux = &alc861vd_capture_source, |
| 14896 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14897 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14898 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14899 | }; |
| 14900 | |
| 14901 | /* |
| 14902 | * BIOS auto configuration |
| 14903 | */ |
| 14904 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14905 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14906 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14907 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14908 | } |
| 14909 | |
| 14910 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14911 | { |
| 14912 | struct alc_spec *spec = codec->spec; |
| 14913 | int i; |
| 14914 | |
| 14915 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14916 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14917 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14918 | if (nid) |
| 14919 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14920 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14921 | } |
| 14922 | } |
| 14923 | |
| 14924 | |
| 14925 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14926 | { |
| 14927 | struct alc_spec *spec = codec->spec; |
| 14928 | hda_nid_t pin; |
| 14929 | |
| 14930 | pin = spec->autocfg.hp_pins[0]; |
| 14931 | if (pin) /* connect to front and use dac 0 */ |
| 14932 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14933 | pin = spec->autocfg.speaker_pins[0]; |
| 14934 | if (pin) |
| 14935 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14936 | } |
| 14937 | |
| 14938 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14939 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14940 | |
| 14941 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14942 | { |
| 14943 | struct alc_spec *spec = codec->spec; |
| 14944 | int i; |
| 14945 | |
| 14946 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14947 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14948 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14949 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 14950 | if (nid != ALC861VD_PIN_CD_NID && |
| 14951 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14952 | snd_hda_codec_write(codec, nid, 0, |
| 14953 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14954 | AMP_OUT_MUTE); |
| 14955 | } |
| 14956 | } |
| 14957 | } |
| 14958 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14959 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14960 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14961 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14962 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14963 | |
| 14964 | /* add playback controls from the parsed DAC table */ |
| 14965 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14966 | * different NIDs for mute/unmute switch and volume control */ |
| 14967 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14968 | const struct auto_pin_cfg *cfg) |
| 14969 | { |
| 14970 | char name[32]; |
| 14971 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14972 | hda_nid_t nid_v, nid_s; |
| 14973 | int i, err; |
| 14974 | |
| 14975 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14976 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14977 | continue; |
| 14978 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14979 | alc880_dac_to_idx( |
| 14980 | spec->multiout.dac_nids[i])); |
| 14981 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14982 | alc880_dac_to_idx( |
| 14983 | spec->multiout.dac_nids[i])); |
| 14984 | |
| 14985 | if (i == 2) { |
| 14986 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14987 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14988 | "Center Playback Volume", |
| 14989 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14990 | HDA_OUTPUT)); |
| 14991 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14992 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14993 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14994 | "LFE Playback Volume", |
| 14995 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14996 | HDA_OUTPUT)); |
| 14997 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14998 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14999 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15000 | "Center Playback Switch", |
| 15001 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15002 | HDA_INPUT)); |
| 15003 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15004 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15005 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15006 | "LFE Playback Switch", |
| 15007 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15008 | HDA_INPUT)); |
| 15009 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15010 | return err; |
| 15011 | } else { |
| 15012 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15013 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15014 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15015 | HDA_OUTPUT)); |
| 15016 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15017 | return err; |
| 15018 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15019 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15020 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15021 | HDA_INPUT)); |
| 15022 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15023 | return err; |
| 15024 | } |
| 15025 | } |
| 15026 | return 0; |
| 15027 | } |
| 15028 | |
| 15029 | /* add playback controls for speaker and HP outputs */ |
| 15030 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15031 | * different NIDs for mute/unmute switch and volume control */ |
| 15032 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15033 | hda_nid_t pin, const char *pfx) |
| 15034 | { |
| 15035 | hda_nid_t nid_v, nid_s; |
| 15036 | int err; |
| 15037 | char name[32]; |
| 15038 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15039 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15040 | return 0; |
| 15041 | |
| 15042 | if (alc880_is_fixed_pin(pin)) { |
| 15043 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15044 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15045 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15046 | spec->multiout.hp_nid = nid_v; |
| 15047 | else |
| 15048 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15049 | /* control HP volume/switch on the output mixer amp */ |
| 15050 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15051 | alc880_fixed_pin_idx(pin)); |
| 15052 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15053 | alc880_fixed_pin_idx(pin)); |
| 15054 | |
| 15055 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15056 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15057 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15058 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15059 | return err; |
| 15060 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15061 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15062 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15063 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15064 | return err; |
| 15065 | } else if (alc880_is_multi_pin(pin)) { |
| 15066 | /* set manual connection */ |
| 15067 | /* we have only a switch on HP-out PIN */ |
| 15068 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15069 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15070 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15071 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15072 | return err; |
| 15073 | } |
| 15074 | return 0; |
| 15075 | } |
| 15076 | |
| 15077 | /* parse the BIOS configuration and set up the alc_spec |
| 15078 | * return 1 if successful, 0 if the proper config is not found, |
| 15079 | * or a negative error code |
| 15080 | * Based on ALC880 version - had to change it to override |
| 15081 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15082 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15083 | { |
| 15084 | struct alc_spec *spec = codec->spec; |
| 15085 | int err; |
| 15086 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15087 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15088 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15089 | alc861vd_ignore); |
| 15090 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15091 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15092 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15093 | return 0; /* can't find valid BIOS pin config */ |
| 15094 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15095 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15096 | if (err < 0) |
| 15097 | return err; |
| 15098 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15099 | if (err < 0) |
| 15100 | return err; |
| 15101 | err = alc861vd_auto_create_extra_out(spec, |
| 15102 | spec->autocfg.speaker_pins[0], |
| 15103 | "Speaker"); |
| 15104 | if (err < 0) |
| 15105 | return err; |
| 15106 | err = alc861vd_auto_create_extra_out(spec, |
| 15107 | spec->autocfg.hp_pins[0], |
| 15108 | "Headphone"); |
| 15109 | if (err < 0) |
| 15110 | return err; |
| 15111 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15112 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15113 | return err; |
| 15114 | |
| 15115 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15116 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15117 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15118 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15119 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15120 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15121 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15122 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15123 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15124 | |
| 15125 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15126 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15127 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15128 | err = alc_auto_add_mic_boost(codec); |
| 15129 | if (err < 0) |
| 15130 | return err; |
| 15131 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15132 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15133 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15134 | return 1; |
| 15135 | } |
| 15136 | |
| 15137 | /* additional initialization for auto-configuration model */ |
| 15138 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15139 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15140 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15141 | alc861vd_auto_init_multi_out(codec); |
| 15142 | alc861vd_auto_init_hp_out(codec); |
| 15143 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15144 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15145 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15146 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15147 | } |
| 15148 | |
| 15149 | static int patch_alc861vd(struct hda_codec *codec) |
| 15150 | { |
| 15151 | struct alc_spec *spec; |
| 15152 | int err, board_config; |
| 15153 | |
| 15154 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15155 | if (spec == NULL) |
| 15156 | return -ENOMEM; |
| 15157 | |
| 15158 | codec->spec = spec; |
| 15159 | |
| 15160 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15161 | alc861vd_models, |
| 15162 | alc861vd_cfg_tbl); |
| 15163 | |
| 15164 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 15165 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 15166 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15167 | board_config = ALC861VD_AUTO; |
| 15168 | } |
| 15169 | |
| 15170 | if (board_config == ALC861VD_AUTO) { |
| 15171 | /* automatic parse from the BIOS config */ |
| 15172 | err = alc861vd_parse_auto_config(codec); |
| 15173 | if (err < 0) { |
| 15174 | alc_free(codec); |
| 15175 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15176 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15177 | printk(KERN_INFO |
| 15178 | "hda_codec: Cannot set up configuration " |
| 15179 | "from BIOS. Using base mode...\n"); |
| 15180 | board_config = ALC861VD_3ST; |
| 15181 | } |
| 15182 | } |
| 15183 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15184 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15185 | if (err < 0) { |
| 15186 | alc_free(codec); |
| 15187 | return err; |
| 15188 | } |
| 15189 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15190 | if (board_config != ALC861VD_AUTO) |
| 15191 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15192 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15193 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15194 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15195 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15196 | } |
| 15197 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15198 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15199 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15200 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15201 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15202 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15203 | |
| 15204 | spec->adc_nids = alc861vd_adc_nids; |
| 15205 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15206 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15207 | spec->capture_style = CAPT_MIX; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15208 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15209 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15210 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15211 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15212 | spec->vmaster_nid = 0x02; |
| 15213 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15214 | codec->patch_ops = alc_patch_ops; |
| 15215 | |
| 15216 | if (board_config == ALC861VD_AUTO) |
| 15217 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15218 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15219 | if (!spec->loopback.amplist) |
| 15220 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15221 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15222 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15223 | |
| 15224 | return 0; |
| 15225 | } |
| 15226 | |
| 15227 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15228 | * ALC662 support |
| 15229 | * |
| 15230 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15231 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15232 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15233 | * 6-channel independent captures. |
| 15234 | * |
| 15235 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15236 | * driver yet). |
| 15237 | */ |
| 15238 | #define ALC662_DIGOUT_NID 0x06 |
| 15239 | #define ALC662_DIGIN_NID 0x0a |
| 15240 | |
| 15241 | static hda_nid_t alc662_dac_nids[4] = { |
| 15242 | /* front, rear, clfe, rear_surr */ |
| 15243 | 0x02, 0x03, 0x04 |
| 15244 | }; |
| 15245 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15246 | static hda_nid_t alc272_dac_nids[2] = { |
| 15247 | 0x02, 0x03 |
| 15248 | }; |
| 15249 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15250 | static hda_nid_t alc662_adc_nids[1] = { |
| 15251 | /* ADC1-2 */ |
| 15252 | 0x09, |
| 15253 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15254 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15255 | static hda_nid_t alc272_adc_nids[1] = { |
| 15256 | /* ADC1-2 */ |
| 15257 | 0x08, |
| 15258 | }; |
| 15259 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15260 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15261 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15262 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15263 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15264 | /* input MUX */ |
| 15265 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15266 | static struct hda_input_mux alc662_capture_source = { |
| 15267 | .num_items = 4, |
| 15268 | .items = { |
| 15269 | { "Mic", 0x0 }, |
| 15270 | { "Front Mic", 0x1 }, |
| 15271 | { "Line", 0x2 }, |
| 15272 | { "CD", 0x4 }, |
| 15273 | }, |
| 15274 | }; |
| 15275 | |
| 15276 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15277 | .num_items = 2, |
| 15278 | .items = { |
| 15279 | { "Mic", 0x1 }, |
| 15280 | { "Line", 0x2 }, |
| 15281 | }, |
| 15282 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15283 | |
| 15284 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15285 | .num_items = 2, |
| 15286 | .items = { |
| 15287 | { "i-Mic", 0x1 }, |
| 15288 | { "e-Mic", 0x0 }, |
| 15289 | }, |
| 15290 | }; |
| 15291 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15292 | static struct hda_input_mux alc663_capture_source = { |
| 15293 | .num_items = 3, |
| 15294 | .items = { |
| 15295 | { "Mic", 0x0 }, |
| 15296 | { "Front Mic", 0x1 }, |
| 15297 | { "Line", 0x2 }, |
| 15298 | }, |
| 15299 | }; |
| 15300 | |
| 15301 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15302 | .num_items = 2, |
| 15303 | .items = { |
| 15304 | { "Ext-Mic", 0x0 }, |
| 15305 | { "D-Mic", 0x9 }, |
| 15306 | }, |
| 15307 | }; |
| 15308 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15309 | #if 1 /* set to 0 for testing other input sources below */ |
| 15310 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15311 | .num_items = 2, |
| 15312 | .items = { |
| 15313 | { "Autoselect Mic", 0x0 }, |
| 15314 | { "Internal Mic", 0x1 }, |
| 15315 | }, |
| 15316 | }; |
| 15317 | #else |
| 15318 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15319 | .num_items = 16, |
| 15320 | .items = { |
| 15321 | { "Autoselect Mic", 0x0 }, |
| 15322 | { "Internal Mic", 0x1 }, |
| 15323 | { "In-0x02", 0x2 }, |
| 15324 | { "In-0x03", 0x3 }, |
| 15325 | { "In-0x04", 0x4 }, |
| 15326 | { "In-0x05", 0x5 }, |
| 15327 | { "In-0x06", 0x6 }, |
| 15328 | { "In-0x07", 0x7 }, |
| 15329 | { "In-0x08", 0x8 }, |
| 15330 | { "In-0x09", 0x9 }, |
| 15331 | { "In-0x0a", 0x0a }, |
| 15332 | { "In-0x0b", 0x0b }, |
| 15333 | { "In-0x0c", 0x0c }, |
| 15334 | { "In-0x0d", 0x0d }, |
| 15335 | { "In-0x0e", 0x0e }, |
| 15336 | { "In-0x0f", 0x0f }, |
| 15337 | }, |
| 15338 | }; |
| 15339 | #endif |
| 15340 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15341 | /* |
| 15342 | * 2ch mode |
| 15343 | */ |
| 15344 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15345 | { 2, NULL } |
| 15346 | }; |
| 15347 | |
| 15348 | /* |
| 15349 | * 2ch mode |
| 15350 | */ |
| 15351 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15352 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15353 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15354 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15355 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15356 | { } /* end */ |
| 15357 | }; |
| 15358 | |
| 15359 | /* |
| 15360 | * 6ch mode |
| 15361 | */ |
| 15362 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15363 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15364 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15365 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15366 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15367 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15368 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15369 | { } /* end */ |
| 15370 | }; |
| 15371 | |
| 15372 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15373 | { 2, alc662_3ST_ch2_init }, |
| 15374 | { 6, alc662_3ST_ch6_init }, |
| 15375 | }; |
| 15376 | |
| 15377 | /* |
| 15378 | * 2ch mode |
| 15379 | */ |
| 15380 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15381 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15382 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15383 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15384 | { } /* end */ |
| 15385 | }; |
| 15386 | |
| 15387 | /* |
| 15388 | * 6ch mode |
| 15389 | */ |
| 15390 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15391 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15392 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15393 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15394 | { } /* end */ |
| 15395 | }; |
| 15396 | |
| 15397 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15398 | { 2, alc662_sixstack_ch6_init }, |
| 15399 | { 6, alc662_sixstack_ch8_init }, |
| 15400 | }; |
| 15401 | |
| 15402 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15403 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15404 | */ |
| 15405 | |
| 15406 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15407 | /* output mixer control */ |
| 15408 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15409 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15410 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15411 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15412 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15413 | 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] | 15414 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15415 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15416 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15417 | |
| 15418 | /*Input mixer control */ |
| 15419 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15420 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15421 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15422 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15423 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15424 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15425 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15426 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15427 | { } /* end */ |
| 15428 | }; |
| 15429 | |
| 15430 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15431 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15432 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15433 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15434 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15435 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15436 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15437 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15438 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15439 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15440 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15441 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15442 | { } /* end */ |
| 15443 | }; |
| 15444 | |
| 15445 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15446 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15447 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15448 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15449 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15450 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15451 | 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] | 15452 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15453 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15454 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15455 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15456 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15457 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15458 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15459 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15460 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15461 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15462 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15463 | { } /* end */ |
| 15464 | }; |
| 15465 | |
| 15466 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15467 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15468 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15469 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15470 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15471 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15472 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15473 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15474 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15475 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15476 | { } /* end */ |
| 15477 | }; |
| 15478 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15479 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15480 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15481 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15482 | |
| 15483 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15484 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15485 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15486 | |
| 15487 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15488 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15489 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15490 | { } /* end */ |
| 15491 | }; |
| 15492 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15493 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15494 | ALC262_HIPPO_MASTER_SWITCH, |
| 15495 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15496 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15497 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15498 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15499 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15500 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15501 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15502 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15503 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15504 | { } /* end */ |
| 15505 | }; |
| 15506 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15507 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15508 | .ops = &snd_hda_bind_vol, |
| 15509 | .values = { |
| 15510 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15511 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15512 | 0 |
| 15513 | }, |
| 15514 | }; |
| 15515 | |
| 15516 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15517 | .ops = &snd_hda_bind_sw, |
| 15518 | .values = { |
| 15519 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15520 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15521 | 0 |
| 15522 | }, |
| 15523 | }; |
| 15524 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15525 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15526 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15527 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15528 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15529 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15530 | { } /* end */ |
| 15531 | }; |
| 15532 | |
| 15533 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15534 | .ops = &snd_hda_bind_sw, |
| 15535 | .values = { |
| 15536 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15537 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15538 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15539 | 0 |
| 15540 | }, |
| 15541 | }; |
| 15542 | |
| 15543 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15544 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15545 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15546 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15547 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15548 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15549 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15550 | |
| 15551 | { } /* end */ |
| 15552 | }; |
| 15553 | |
| 15554 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15555 | .ops = &snd_hda_bind_sw, |
| 15556 | .values = { |
| 15557 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15558 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15559 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15560 | 0 |
| 15561 | }, |
| 15562 | }; |
| 15563 | |
| 15564 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15565 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15566 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15567 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15568 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15569 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15570 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15571 | { } /* end */ |
| 15572 | }; |
| 15573 | |
| 15574 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15575 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15576 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15577 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15580 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15581 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15582 | { } /* end */ |
| 15583 | }; |
| 15584 | |
| 15585 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15586 | .ops = &snd_hda_bind_vol, |
| 15587 | .values = { |
| 15588 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15589 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15590 | 0 |
| 15591 | }, |
| 15592 | }; |
| 15593 | |
| 15594 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15595 | .ops = &snd_hda_bind_sw, |
| 15596 | .values = { |
| 15597 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15598 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15599 | 0 |
| 15600 | }, |
| 15601 | }; |
| 15602 | |
| 15603 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15604 | HDA_BIND_VOL("Master Playback Volume", |
| 15605 | &alc663_asus_two_bind_master_vol), |
| 15606 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15607 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15608 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15609 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15610 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15611 | { } /* end */ |
| 15612 | }; |
| 15613 | |
| 15614 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15615 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15616 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15617 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15618 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15619 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15620 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15621 | { } /* end */ |
| 15622 | }; |
| 15623 | |
| 15624 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15625 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15626 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15627 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15628 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15629 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15630 | |
| 15631 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15632 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15633 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15634 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15635 | { } /* end */ |
| 15636 | }; |
| 15637 | |
| 15638 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15639 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15640 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15641 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15642 | |
| 15643 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15644 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15645 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15646 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15647 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15648 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15649 | { } /* end */ |
| 15650 | }; |
| 15651 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15652 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15653 | { |
| 15654 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15655 | .name = "Channel Mode", |
| 15656 | .info = alc_ch_mode_info, |
| 15657 | .get = alc_ch_mode_get, |
| 15658 | .put = alc_ch_mode_put, |
| 15659 | }, |
| 15660 | { } /* end */ |
| 15661 | }; |
| 15662 | |
| 15663 | static struct hda_verb alc662_init_verbs[] = { |
| 15664 | /* ADC: mute amp left and right */ |
| 15665 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15666 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15667 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15668 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15669 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15670 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15671 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15672 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15673 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15674 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15675 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15676 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15677 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15678 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15679 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15680 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15681 | |
| 15682 | /* Front Pin: output 0 (0x0c) */ |
| 15683 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15684 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15685 | |
| 15686 | /* Rear Pin: output 1 (0x0d) */ |
| 15687 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15688 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15689 | |
| 15690 | /* CLFE Pin: output 2 (0x0e) */ |
| 15691 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15692 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15693 | |
| 15694 | /* Mic (rear) pin: input vref at 80% */ |
| 15695 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15696 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15697 | /* Front Mic pin: input vref at 80% */ |
| 15698 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15699 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15700 | /* Line In pin: input */ |
| 15701 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15702 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15703 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15704 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15705 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15706 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15707 | /* CD pin widget for input */ |
| 15708 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15709 | |
| 15710 | /* FIXME: use matrix-type input source selection */ |
| 15711 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15712 | /* Input mixer */ |
| 15713 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15714 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15715 | |
| 15716 | /* always trun on EAPD */ |
| 15717 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15718 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15719 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15720 | { } |
| 15721 | }; |
| 15722 | |
| 15723 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15724 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15725 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15726 | {} |
| 15727 | }; |
| 15728 | |
| 15729 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15730 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15731 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15732 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15733 | }; |
| 15734 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15735 | /* Set Unsolicited Event*/ |
| 15736 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15737 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15738 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15739 | {} |
| 15740 | }; |
| 15741 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15742 | /* |
| 15743 | * generic initialization of ADC, input mixers and output mixers |
| 15744 | */ |
| 15745 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15746 | /* |
| 15747 | * Unmute ADC and set the default input to mic-in |
| 15748 | */ |
| 15749 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15750 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15751 | |
| 15752 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15753 | * mixer widget |
| 15754 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15755 | * panel mic (mic 2) |
| 15756 | */ |
| 15757 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15758 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15759 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15760 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15761 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15762 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15763 | |
| 15764 | /* |
| 15765 | * Set up output mixers (0x0c - 0x0f) |
| 15766 | */ |
| 15767 | /* set vol=0 to output mixers */ |
| 15768 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15769 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15770 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15771 | |
| 15772 | /* set up input amps for analog loopback */ |
| 15773 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15774 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15775 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15776 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15777 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15778 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15779 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15780 | |
| 15781 | |
| 15782 | /* FIXME: use matrix-type input source selection */ |
| 15783 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15784 | /* Input mixer */ |
| 15785 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15786 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15787 | { } |
| 15788 | }; |
| 15789 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15790 | /* additional verbs for ALC663 */ |
| 15791 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15792 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15793 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15794 | { } |
| 15795 | }; |
| 15796 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15797 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15798 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15799 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15800 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15801 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15802 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15803 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15804 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15805 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15806 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15807 | {} |
| 15808 | }; |
| 15809 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15810 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15811 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15812 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15813 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15814 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15815 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15816 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15817 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15818 | {} |
| 15819 | }; |
| 15820 | |
| 15821 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15822 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15823 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15824 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15825 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15826 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15827 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15828 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15829 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15830 | {} |
| 15831 | }; |
| 15832 | |
| 15833 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15834 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15835 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15836 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15837 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15838 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15839 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15840 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15841 | {} |
| 15842 | }; |
| 15843 | |
| 15844 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15845 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15846 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15847 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15848 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15849 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15850 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15851 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15852 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15853 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15854 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15855 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15856 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15857 | {} |
| 15858 | }; |
| 15859 | |
| 15860 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15861 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15862 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15863 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15864 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15865 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15866 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15867 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15868 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15869 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15870 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15871 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15872 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15873 | {} |
| 15874 | }; |
| 15875 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15876 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15877 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15878 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15879 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15880 | |
| 15881 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15882 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15883 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15884 | |
| 15885 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15886 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15887 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15888 | {} |
| 15889 | }; |
| 15890 | |
| 15891 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15892 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15893 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15894 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15895 | |
| 15896 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15897 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15898 | {} |
| 15899 | }; |
| 15900 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15901 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15902 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15903 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15904 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15905 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15906 | {} |
| 15907 | }; |
| 15908 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15909 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 15910 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15911 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15912 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15913 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15914 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15915 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15916 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15917 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15918 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 15919 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15920 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15921 | {} |
| 15922 | }; |
| 15923 | |
| 15924 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 15925 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15926 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15928 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15929 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15930 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15931 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15932 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15933 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 15934 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15935 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15936 | {} |
| 15937 | }; |
| 15938 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15939 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15940 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15941 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15942 | { } /* end */ |
| 15943 | }; |
| 15944 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15945 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 15946 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 15947 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 15948 | { } /* end */ |
| 15949 | }; |
| 15950 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15951 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15952 | { |
| 15953 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15954 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15955 | |
| 15956 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15957 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15958 | bits = present ? HDA_AMP_MUTE : 0; |
| 15959 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15960 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15961 | } |
| 15962 | |
| 15963 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15964 | { |
| 15965 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15966 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15967 | |
| 15968 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15969 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15970 | bits = present ? HDA_AMP_MUTE : 0; |
| 15971 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15972 | HDA_AMP_MUTE, bits); |
| 15973 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15974 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15975 | } |
| 15976 | |
| 15977 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15978 | unsigned int res) |
| 15979 | { |
| 15980 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15981 | alc662_lenovo_101e_all_automute(codec); |
| 15982 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15983 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15984 | } |
| 15985 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15986 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15987 | { |
| 15988 | unsigned int present; |
| 15989 | |
| 15990 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15991 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15992 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15993 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15994 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15995 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15996 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15997 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15998 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15999 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16000 | } |
| 16001 | |
| 16002 | /* unsolicited event for HP jack sensing */ |
| 16003 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16004 | unsigned int res) |
| 16005 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16006 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 16007 | alc662_eeepc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16008 | else |
| 16009 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16010 | } |
| 16011 | |
| 16012 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16013 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16014 | alc262_hippo1_init_hook(codec); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16015 | alc662_eeepc_mic_automute(codec); |
| 16016 | } |
| 16017 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16018 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 16019 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16020 | struct alc_spec *spec = codec->spec; |
| 16021 | |
| 16022 | spec->autocfg.hp_pins[0] = 0x14; |
| 16023 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 16024 | alc262_hippo_master_update(codec); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16025 | } |
| 16026 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16027 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16028 | { |
| 16029 | unsigned int present; |
| 16030 | unsigned char bits; |
| 16031 | |
| 16032 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16033 | AC_VERB_GET_PIN_SENSE, 0) |
| 16034 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16035 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16036 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16037 | AMP_IN_MUTE(0), bits); |
| 16038 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16039 | AMP_IN_MUTE(0), bits); |
| 16040 | } |
| 16041 | |
| 16042 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16043 | { |
| 16044 | unsigned int present; |
| 16045 | unsigned char bits; |
| 16046 | |
| 16047 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16048 | AC_VERB_GET_PIN_SENSE, 0) |
| 16049 | & AC_PINSENSE_PRESENCE; |
| 16050 | bits = present ? HDA_AMP_MUTE : 0; |
| 16051 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16052 | AMP_IN_MUTE(0), bits); |
| 16053 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16054 | AMP_IN_MUTE(0), bits); |
| 16055 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16056 | AMP_IN_MUTE(0), bits); |
| 16057 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16058 | AMP_IN_MUTE(0), bits); |
| 16059 | } |
| 16060 | |
| 16061 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16062 | { |
| 16063 | unsigned int present; |
| 16064 | unsigned char bits; |
| 16065 | |
| 16066 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16067 | AC_VERB_GET_PIN_SENSE, 0) |
| 16068 | & AC_PINSENSE_PRESENCE; |
| 16069 | bits = present ? HDA_AMP_MUTE : 0; |
| 16070 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16071 | AMP_IN_MUTE(0), bits); |
| 16072 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16073 | AMP_IN_MUTE(0), bits); |
| 16074 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16075 | AMP_IN_MUTE(0), bits); |
| 16076 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16077 | AMP_IN_MUTE(0), bits); |
| 16078 | } |
| 16079 | |
| 16080 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16081 | { |
| 16082 | unsigned int present; |
| 16083 | unsigned char bits; |
| 16084 | |
| 16085 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16086 | AC_VERB_GET_PIN_SENSE, 0) |
| 16087 | & AC_PINSENSE_PRESENCE; |
| 16088 | bits = present ? 0 : PIN_OUT; |
| 16089 | snd_hda_codec_write(codec, 0x14, 0, |
| 16090 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16091 | } |
| 16092 | |
| 16093 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16094 | { |
| 16095 | unsigned int present1, present2; |
| 16096 | |
| 16097 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16098 | AC_VERB_GET_PIN_SENSE, 0) |
| 16099 | & AC_PINSENSE_PRESENCE; |
| 16100 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16101 | AC_VERB_GET_PIN_SENSE, 0) |
| 16102 | & AC_PINSENSE_PRESENCE; |
| 16103 | |
| 16104 | if (present1 || present2) { |
| 16105 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16106 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16107 | } else { |
| 16108 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16109 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16110 | } |
| 16111 | } |
| 16112 | |
| 16113 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16114 | { |
| 16115 | unsigned int present1, present2; |
| 16116 | |
| 16117 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16118 | AC_VERB_GET_PIN_SENSE, 0) |
| 16119 | & AC_PINSENSE_PRESENCE; |
| 16120 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16121 | AC_VERB_GET_PIN_SENSE, 0) |
| 16122 | & AC_PINSENSE_PRESENCE; |
| 16123 | |
| 16124 | if (present1 || present2) { |
| 16125 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16126 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16127 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16128 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16129 | } else { |
| 16130 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16131 | AMP_IN_MUTE(0), 0); |
| 16132 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16133 | AMP_IN_MUTE(0), 0); |
| 16134 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16135 | } |
| 16136 | |
| 16137 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16138 | { |
| 16139 | unsigned int present; |
| 16140 | |
| 16141 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16142 | AC_VERB_GET_PIN_SENSE, 0) |
| 16143 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16144 | 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] | 16145 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16146 | 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] | 16147 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16148 | 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] | 16149 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16150 | 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] | 16151 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16152 | } |
| 16153 | |
| 16154 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16155 | unsigned int res) |
| 16156 | { |
| 16157 | switch (res >> 26) { |
| 16158 | case ALC880_HP_EVENT: |
| 16159 | alc663_m51va_speaker_automute(codec); |
| 16160 | break; |
| 16161 | case ALC880_MIC_EVENT: |
| 16162 | alc663_m51va_mic_automute(codec); |
| 16163 | break; |
| 16164 | } |
| 16165 | } |
| 16166 | |
| 16167 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16168 | { |
| 16169 | alc663_m51va_speaker_automute(codec); |
| 16170 | alc663_m51va_mic_automute(codec); |
| 16171 | } |
| 16172 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16173 | /* ***************** Mode1 ******************************/ |
| 16174 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16175 | unsigned int res) |
| 16176 | { |
| 16177 | switch (res >> 26) { |
| 16178 | case ALC880_HP_EVENT: |
| 16179 | alc663_m51va_speaker_automute(codec); |
| 16180 | break; |
| 16181 | case ALC880_MIC_EVENT: |
| 16182 | alc662_eeepc_mic_automute(codec); |
| 16183 | break; |
| 16184 | } |
| 16185 | } |
| 16186 | |
| 16187 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16188 | { |
| 16189 | alc663_m51va_speaker_automute(codec); |
| 16190 | alc662_eeepc_mic_automute(codec); |
| 16191 | } |
| 16192 | /* ***************** Mode2 ******************************/ |
| 16193 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16194 | unsigned int res) |
| 16195 | { |
| 16196 | switch (res >> 26) { |
| 16197 | case ALC880_HP_EVENT: |
| 16198 | alc662_f5z_speaker_automute(codec); |
| 16199 | break; |
| 16200 | case ALC880_MIC_EVENT: |
| 16201 | alc662_eeepc_mic_automute(codec); |
| 16202 | break; |
| 16203 | } |
| 16204 | } |
| 16205 | |
| 16206 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16207 | { |
| 16208 | alc662_f5z_speaker_automute(codec); |
| 16209 | alc662_eeepc_mic_automute(codec); |
| 16210 | } |
| 16211 | /* ***************** Mode3 ******************************/ |
| 16212 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16213 | unsigned int res) |
| 16214 | { |
| 16215 | switch (res >> 26) { |
| 16216 | case ALC880_HP_EVENT: |
| 16217 | alc663_two_hp_m1_speaker_automute(codec); |
| 16218 | break; |
| 16219 | case ALC880_MIC_EVENT: |
| 16220 | alc662_eeepc_mic_automute(codec); |
| 16221 | break; |
| 16222 | } |
| 16223 | } |
| 16224 | |
| 16225 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16226 | { |
| 16227 | alc663_two_hp_m1_speaker_automute(codec); |
| 16228 | alc662_eeepc_mic_automute(codec); |
| 16229 | } |
| 16230 | /* ***************** Mode4 ******************************/ |
| 16231 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16232 | unsigned int res) |
| 16233 | { |
| 16234 | switch (res >> 26) { |
| 16235 | case ALC880_HP_EVENT: |
| 16236 | alc663_21jd_two_speaker_automute(codec); |
| 16237 | break; |
| 16238 | case ALC880_MIC_EVENT: |
| 16239 | alc662_eeepc_mic_automute(codec); |
| 16240 | break; |
| 16241 | } |
| 16242 | } |
| 16243 | |
| 16244 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16245 | { |
| 16246 | alc663_21jd_two_speaker_automute(codec); |
| 16247 | alc662_eeepc_mic_automute(codec); |
| 16248 | } |
| 16249 | /* ***************** Mode5 ******************************/ |
| 16250 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16251 | unsigned int res) |
| 16252 | { |
| 16253 | switch (res >> 26) { |
| 16254 | case ALC880_HP_EVENT: |
| 16255 | alc663_15jd_two_speaker_automute(codec); |
| 16256 | break; |
| 16257 | case ALC880_MIC_EVENT: |
| 16258 | alc662_eeepc_mic_automute(codec); |
| 16259 | break; |
| 16260 | } |
| 16261 | } |
| 16262 | |
| 16263 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16264 | { |
| 16265 | alc663_15jd_two_speaker_automute(codec); |
| 16266 | alc662_eeepc_mic_automute(codec); |
| 16267 | } |
| 16268 | /* ***************** Mode6 ******************************/ |
| 16269 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16270 | unsigned int res) |
| 16271 | { |
| 16272 | switch (res >> 26) { |
| 16273 | case ALC880_HP_EVENT: |
| 16274 | alc663_two_hp_m2_speaker_automute(codec); |
| 16275 | break; |
| 16276 | case ALC880_MIC_EVENT: |
| 16277 | alc662_eeepc_mic_automute(codec); |
| 16278 | break; |
| 16279 | } |
| 16280 | } |
| 16281 | |
| 16282 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16283 | { |
| 16284 | alc663_two_hp_m2_speaker_automute(codec); |
| 16285 | alc662_eeepc_mic_automute(codec); |
| 16286 | } |
| 16287 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16288 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16289 | { |
| 16290 | unsigned int present; |
| 16291 | unsigned char bits; |
| 16292 | |
| 16293 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16294 | AC_VERB_GET_PIN_SENSE, 0) |
| 16295 | & AC_PINSENSE_PRESENCE; |
| 16296 | bits = present ? HDA_AMP_MUTE : 0; |
| 16297 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16298 | HDA_AMP_MUTE, bits); |
| 16299 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16300 | HDA_AMP_MUTE, bits); |
| 16301 | } |
| 16302 | |
| 16303 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16304 | { |
| 16305 | unsigned int present; |
| 16306 | unsigned char bits; |
| 16307 | |
| 16308 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16309 | AC_VERB_GET_PIN_SENSE, 0) |
| 16310 | & AC_PINSENSE_PRESENCE; |
| 16311 | bits = present ? HDA_AMP_MUTE : 0; |
| 16312 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16313 | HDA_AMP_MUTE, bits); |
| 16314 | } |
| 16315 | |
| 16316 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16317 | unsigned int res) |
| 16318 | { |
| 16319 | switch (res >> 26) { |
| 16320 | case ALC880_HP_EVENT: |
| 16321 | alc663_g71v_hp_automute(codec); |
| 16322 | break; |
| 16323 | case ALC880_FRONT_EVENT: |
| 16324 | alc663_g71v_front_automute(codec); |
| 16325 | break; |
| 16326 | case ALC880_MIC_EVENT: |
| 16327 | alc662_eeepc_mic_automute(codec); |
| 16328 | break; |
| 16329 | } |
| 16330 | } |
| 16331 | |
| 16332 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16333 | { |
| 16334 | alc663_g71v_front_automute(codec); |
| 16335 | alc663_g71v_hp_automute(codec); |
| 16336 | alc662_eeepc_mic_automute(codec); |
| 16337 | } |
| 16338 | |
| 16339 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16340 | unsigned int res) |
| 16341 | { |
| 16342 | switch (res >> 26) { |
| 16343 | case ALC880_HP_EVENT: |
| 16344 | alc663_m51va_speaker_automute(codec); |
| 16345 | break; |
| 16346 | case ALC880_MIC_EVENT: |
| 16347 | alc662_eeepc_mic_automute(codec); |
| 16348 | break; |
| 16349 | } |
| 16350 | } |
| 16351 | |
| 16352 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16353 | { |
| 16354 | alc663_m51va_speaker_automute(codec); |
| 16355 | alc662_eeepc_mic_automute(codec); |
| 16356 | } |
| 16357 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16358 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16359 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16360 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16361 | |
| 16362 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16363 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16364 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16365 | |
| 16366 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16367 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16368 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16369 | { } /* end */ |
| 16370 | }; |
| 16371 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16372 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16373 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16374 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16375 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16376 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16377 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16378 | |
| 16379 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16380 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16381 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16382 | |
| 16383 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16384 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16385 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16386 | { } /* end */ |
| 16387 | }; |
| 16388 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16389 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16390 | #define alc662_loopbacks alc880_loopbacks |
| 16391 | #endif |
| 16392 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16393 | |
| 16394 | /* pcm configuration: identiacal with ALC880 */ |
| 16395 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16396 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16397 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16398 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16399 | |
| 16400 | /* |
| 16401 | * configuration and preset |
| 16402 | */ |
| 16403 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16404 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16405 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16406 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16407 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16408 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16409 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16410 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16411 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16412 | [ALC663_ASUS_M51VA] = "m51va", |
| 16413 | [ALC663_ASUS_G71V] = "g71v", |
| 16414 | [ALC663_ASUS_H13] = "h13", |
| 16415 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16416 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16417 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16418 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16419 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16420 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16421 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16422 | [ALC272_DELL] = "dell", |
| 16423 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16424 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16425 | [ALC662_AUTO] = "auto", |
| 16426 | }; |
| 16427 | |
| 16428 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16429 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16430 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16431 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16432 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16433 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16434 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16435 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16436 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16437 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16438 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16439 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16440 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16441 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16442 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16443 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16444 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16445 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16446 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16447 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16448 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16449 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16450 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16451 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16452 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16453 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16454 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16455 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16456 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16457 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16458 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16459 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16460 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16461 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16462 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16463 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16464 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16465 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16466 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16467 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16468 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16469 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16470 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16471 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16472 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16473 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16474 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16475 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16476 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16477 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16478 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16479 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16480 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16481 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16482 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16483 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16484 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16485 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16486 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16487 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16488 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16489 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16490 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16491 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16492 | {} |
| 16493 | }; |
| 16494 | |
| 16495 | static struct alc_config_preset alc662_presets[] = { |
| 16496 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16497 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16498 | .init_verbs = { alc662_init_verbs }, |
| 16499 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16500 | .dac_nids = alc662_dac_nids, |
| 16501 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16502 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16503 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16504 | .channel_mode = alc662_3ST_2ch_modes, |
| 16505 | .input_mux = &alc662_capture_source, |
| 16506 | }, |
| 16507 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16508 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16509 | .init_verbs = { alc662_init_verbs }, |
| 16510 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16511 | .dac_nids = alc662_dac_nids, |
| 16512 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16513 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16514 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16515 | .channel_mode = alc662_3ST_6ch_modes, |
| 16516 | .need_dac_fix = 1, |
| 16517 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16518 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16519 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16520 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16521 | .init_verbs = { alc662_init_verbs }, |
| 16522 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16523 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16524 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16525 | .channel_mode = alc662_3ST_6ch_modes, |
| 16526 | .need_dac_fix = 1, |
| 16527 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16528 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16529 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16530 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16531 | .init_verbs = { alc662_init_verbs }, |
| 16532 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16533 | .dac_nids = alc662_dac_nids, |
| 16534 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16535 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16536 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16537 | .channel_mode = alc662_5stack_modes, |
| 16538 | .input_mux = &alc662_capture_source, |
| 16539 | }, |
| 16540 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16541 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16542 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16543 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16544 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16545 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16546 | .channel_mode = alc662_3ST_2ch_modes, |
| 16547 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16548 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16549 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16550 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16551 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16552 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16553 | .init_verbs = { alc662_init_verbs, |
| 16554 | alc662_eeepc_sue_init_verbs }, |
| 16555 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16556 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16557 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16558 | .channel_mode = alc662_3ST_2ch_modes, |
| 16559 | .input_mux = &alc662_eeepc_capture_source, |
| 16560 | .unsol_event = alc662_eeepc_unsol_event, |
| 16561 | .init_hook = alc662_eeepc_inithook, |
| 16562 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16563 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16564 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16565 | alc662_chmode_mixer }, |
| 16566 | .init_verbs = { alc662_init_verbs, |
| 16567 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16568 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16569 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16570 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16571 | .channel_mode = alc662_3ST_6ch_modes, |
| 16572 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16573 | .unsol_event = alc662_eeepc_unsol_event, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16574 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16575 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16576 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16577 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16578 | .init_verbs = { alc662_init_verbs, |
| 16579 | alc662_ecs_init_verbs }, |
| 16580 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16581 | .dac_nids = alc662_dac_nids, |
| 16582 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16583 | .channel_mode = alc662_3ST_2ch_modes, |
| 16584 | .input_mux = &alc662_eeepc_capture_source, |
| 16585 | .unsol_event = alc662_eeepc_unsol_event, |
| 16586 | .init_hook = alc662_eeepc_inithook, |
| 16587 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16588 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16589 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16590 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16591 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16592 | .dac_nids = alc662_dac_nids, |
| 16593 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16594 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16595 | .channel_mode = alc662_3ST_2ch_modes, |
| 16596 | .input_mux = &alc663_m51va_capture_source, |
| 16597 | .unsol_event = alc663_m51va_unsol_event, |
| 16598 | .init_hook = alc663_m51va_inithook, |
| 16599 | }, |
| 16600 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16601 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16602 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16603 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16604 | .dac_nids = alc662_dac_nids, |
| 16605 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16606 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16607 | .channel_mode = alc662_3ST_2ch_modes, |
| 16608 | .input_mux = &alc662_eeepc_capture_source, |
| 16609 | .unsol_event = alc663_g71v_unsol_event, |
| 16610 | .init_hook = alc663_g71v_inithook, |
| 16611 | }, |
| 16612 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16613 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16614 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16615 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16616 | .dac_nids = alc662_dac_nids, |
| 16617 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16618 | .channel_mode = alc662_3ST_2ch_modes, |
| 16619 | .input_mux = &alc663_m51va_capture_source, |
| 16620 | .unsol_event = alc663_m51va_unsol_event, |
| 16621 | .init_hook = alc663_m51va_inithook, |
| 16622 | }, |
| 16623 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16624 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16625 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16626 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16627 | .dac_nids = alc662_dac_nids, |
| 16628 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16629 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16630 | .channel_mode = alc662_3ST_6ch_modes, |
| 16631 | .input_mux = &alc663_capture_source, |
| 16632 | .unsol_event = alc663_g50v_unsol_event, |
| 16633 | .init_hook = alc663_g50v_inithook, |
| 16634 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16635 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16636 | .mixers = { alc663_m51va_mixer }, |
| 16637 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16638 | .init_verbs = { alc662_init_verbs, |
| 16639 | alc663_21jd_amic_init_verbs }, |
| 16640 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16641 | .hp_nid = 0x03, |
| 16642 | .dac_nids = alc662_dac_nids, |
| 16643 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16644 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16645 | .channel_mode = alc662_3ST_2ch_modes, |
| 16646 | .input_mux = &alc662_eeepc_capture_source, |
| 16647 | .unsol_event = alc663_mode1_unsol_event, |
| 16648 | .init_hook = alc663_mode1_inithook, |
| 16649 | }, |
| 16650 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16651 | .mixers = { alc662_1bjd_mixer }, |
| 16652 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16653 | .init_verbs = { alc662_init_verbs, |
| 16654 | alc662_1bjd_amic_init_verbs }, |
| 16655 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16656 | .dac_nids = alc662_dac_nids, |
| 16657 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16658 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16659 | .channel_mode = alc662_3ST_2ch_modes, |
| 16660 | .input_mux = &alc662_eeepc_capture_source, |
| 16661 | .unsol_event = alc662_mode2_unsol_event, |
| 16662 | .init_hook = alc662_mode2_inithook, |
| 16663 | }, |
| 16664 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16665 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16666 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16667 | .init_verbs = { alc662_init_verbs, |
| 16668 | alc663_two_hp_amic_m1_init_verbs }, |
| 16669 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16670 | .hp_nid = 0x03, |
| 16671 | .dac_nids = alc662_dac_nids, |
| 16672 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16673 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16674 | .channel_mode = alc662_3ST_2ch_modes, |
| 16675 | .input_mux = &alc662_eeepc_capture_source, |
| 16676 | .unsol_event = alc663_mode3_unsol_event, |
| 16677 | .init_hook = alc663_mode3_inithook, |
| 16678 | }, |
| 16679 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16680 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16681 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16682 | .init_verbs = { alc662_init_verbs, |
| 16683 | alc663_21jd_amic_init_verbs}, |
| 16684 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16685 | .hp_nid = 0x03, |
| 16686 | .dac_nids = alc662_dac_nids, |
| 16687 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16688 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16689 | .channel_mode = alc662_3ST_2ch_modes, |
| 16690 | .input_mux = &alc662_eeepc_capture_source, |
| 16691 | .unsol_event = alc663_mode4_unsol_event, |
| 16692 | .init_hook = alc663_mode4_inithook, |
| 16693 | }, |
| 16694 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16695 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16696 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16697 | .init_verbs = { alc662_init_verbs, |
| 16698 | alc663_15jd_amic_init_verbs }, |
| 16699 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16700 | .hp_nid = 0x03, |
| 16701 | .dac_nids = alc662_dac_nids, |
| 16702 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16703 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16704 | .channel_mode = alc662_3ST_2ch_modes, |
| 16705 | .input_mux = &alc662_eeepc_capture_source, |
| 16706 | .unsol_event = alc663_mode5_unsol_event, |
| 16707 | .init_hook = alc663_mode5_inithook, |
| 16708 | }, |
| 16709 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16710 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16711 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16712 | .init_verbs = { alc662_init_verbs, |
| 16713 | alc663_two_hp_amic_m2_init_verbs }, |
| 16714 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16715 | .hp_nid = 0x03, |
| 16716 | .dac_nids = alc662_dac_nids, |
| 16717 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16718 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16719 | .channel_mode = alc662_3ST_2ch_modes, |
| 16720 | .input_mux = &alc662_eeepc_capture_source, |
| 16721 | .unsol_event = alc663_mode6_unsol_event, |
| 16722 | .init_hook = alc663_mode6_inithook, |
| 16723 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16724 | [ALC272_DELL] = { |
| 16725 | .mixers = { alc663_m51va_mixer }, |
| 16726 | .cap_mixer = alc272_auto_capture_mixer, |
| 16727 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 16728 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16729 | .dac_nids = alc662_dac_nids, |
| 16730 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16731 | .adc_nids = alc272_adc_nids, |
| 16732 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 16733 | .capsrc_nids = alc272_capsrc_nids, |
| 16734 | .channel_mode = alc662_3ST_2ch_modes, |
| 16735 | .input_mux = &alc663_m51va_capture_source, |
| 16736 | .unsol_event = alc663_m51va_unsol_event, |
| 16737 | .init_hook = alc663_m51va_inithook, |
| 16738 | }, |
| 16739 | [ALC272_DELL_ZM1] = { |
| 16740 | .mixers = { alc663_m51va_mixer }, |
| 16741 | .cap_mixer = alc662_auto_capture_mixer, |
| 16742 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 16743 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16744 | .dac_nids = alc662_dac_nids, |
| 16745 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16746 | .adc_nids = alc662_adc_nids, |
| 16747 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 16748 | .capsrc_nids = alc662_capsrc_nids, |
| 16749 | .channel_mode = alc662_3ST_2ch_modes, |
| 16750 | .input_mux = &alc663_m51va_capture_source, |
| 16751 | .unsol_event = alc663_m51va_unsol_event, |
| 16752 | .init_hook = alc663_m51va_inithook, |
| 16753 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16754 | [ALC272_SAMSUNG_NC10] = { |
| 16755 | .mixers = { alc272_nc10_mixer }, |
| 16756 | .init_verbs = { alc662_init_verbs, |
| 16757 | alc663_21jd_amic_init_verbs }, |
| 16758 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16759 | .dac_nids = alc272_dac_nids, |
| 16760 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16761 | .channel_mode = alc662_3ST_2ch_modes, |
| 16762 | .input_mux = &alc272_nc10_capture_source, |
| 16763 | .unsol_event = alc663_mode4_unsol_event, |
| 16764 | .init_hook = alc663_mode4_inithook, |
| 16765 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16766 | }; |
| 16767 | |
| 16768 | |
| 16769 | /* |
| 16770 | * BIOS auto configuration |
| 16771 | */ |
| 16772 | |
| 16773 | /* add playback controls from the parsed DAC table */ |
| 16774 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16775 | const struct auto_pin_cfg *cfg) |
| 16776 | { |
| 16777 | char name[32]; |
| 16778 | static const char *chname[4] = { |
| 16779 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16780 | }; |
| 16781 | hda_nid_t nid; |
| 16782 | int i, err; |
| 16783 | |
| 16784 | for (i = 0; i < cfg->line_outs; i++) { |
| 16785 | if (!spec->multiout.dac_nids[i]) |
| 16786 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16787 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16788 | if (i == 2) { |
| 16789 | /* Center/LFE */ |
| 16790 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16791 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16792 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16793 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16794 | if (err < 0) |
| 16795 | return err; |
| 16796 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16797 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16798 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16799 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16800 | if (err < 0) |
| 16801 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16802 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16803 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16804 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16805 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16806 | if (err < 0) |
| 16807 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16808 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16809 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16810 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16811 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16812 | if (err < 0) |
| 16813 | return err; |
| 16814 | } else { |
| 16815 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16816 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16817 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16818 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16819 | if (err < 0) |
| 16820 | return err; |
| 16821 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16822 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16823 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16824 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16825 | if (err < 0) |
| 16826 | return err; |
| 16827 | } |
| 16828 | } |
| 16829 | return 0; |
| 16830 | } |
| 16831 | |
| 16832 | /* add playback controls for speaker and HP outputs */ |
| 16833 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16834 | const char *pfx) |
| 16835 | { |
| 16836 | hda_nid_t nid; |
| 16837 | int err; |
| 16838 | char name[32]; |
| 16839 | |
| 16840 | if (!pin) |
| 16841 | return 0; |
| 16842 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16843 | if (pin == 0x17) { |
| 16844 | /* ALC663 has a mono output pin on 0x17 */ |
| 16845 | sprintf(name, "%s Playback Switch", pfx); |
| 16846 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16847 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16848 | return err; |
| 16849 | } |
| 16850 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16851 | if (alc880_is_fixed_pin(pin)) { |
| 16852 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 16853 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16854 | /* specify the DAC as the extra output */ |
| 16855 | if (!spec->multiout.hp_nid) |
| 16856 | spec->multiout.hp_nid = nid; |
| 16857 | else |
| 16858 | spec->multiout.extra_out_nid[0] = nid; |
| 16859 | /* control HP volume/switch on the output mixer amp */ |
| 16860 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16861 | sprintf(name, "%s Playback Volume", pfx); |
| 16862 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16863 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16864 | if (err < 0) |
| 16865 | return err; |
| 16866 | sprintf(name, "%s Playback Switch", pfx); |
| 16867 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16868 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16869 | if (err < 0) |
| 16870 | return err; |
| 16871 | } else if (alc880_is_multi_pin(pin)) { |
| 16872 | /* set manual connection */ |
| 16873 | /* we have only a switch on HP-out PIN */ |
| 16874 | sprintf(name, "%s Playback Switch", pfx); |
| 16875 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16876 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16877 | if (err < 0) |
| 16878 | return err; |
| 16879 | } |
| 16880 | return 0; |
| 16881 | } |
| 16882 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16883 | /* return the index of the src widget from the connection list of the nid. |
| 16884 | * return -1 if not found |
| 16885 | */ |
| 16886 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 16887 | hda_nid_t src) |
| 16888 | { |
| 16889 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 16890 | int i, conns; |
| 16891 | |
| 16892 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 16893 | ARRAY_SIZE(conn_list)); |
| 16894 | if (conns < 0) |
| 16895 | return -1; |
| 16896 | for (i = 0; i < conns; i++) |
| 16897 | if (conn_list[i] == src) |
| 16898 | return i; |
| 16899 | return -1; |
| 16900 | } |
| 16901 | |
| 16902 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 16903 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 16904 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16905 | return (pincap & AC_PINCAP_IN) != 0; |
| 16906 | } |
| 16907 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16908 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16909 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16910 | const struct auto_pin_cfg *cfg) |
| 16911 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16912 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16913 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16914 | int i, err, idx; |
| 16915 | |
| 16916 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16917 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 16918 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 16919 | cfg->input_pins[i]); |
| 16920 | if (idx >= 0) { |
| 16921 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16922 | auto_pin_cfg_labels[i], |
| 16923 | idx, 0x0b); |
| 16924 | if (err < 0) |
| 16925 | return err; |
| 16926 | } |
| 16927 | idx = alc662_input_pin_idx(codec, 0x22, |
| 16928 | cfg->input_pins[i]); |
| 16929 | if (idx >= 0) { |
| 16930 | imux->items[imux->num_items].label = |
| 16931 | auto_pin_cfg_labels[i]; |
| 16932 | imux->items[imux->num_items].index = idx; |
| 16933 | imux->num_items++; |
| 16934 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16935 | } |
| 16936 | } |
| 16937 | return 0; |
| 16938 | } |
| 16939 | |
| 16940 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16941 | hda_nid_t nid, int pin_type, |
| 16942 | int dac_idx) |
| 16943 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16944 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16945 | /* need the manual connection? */ |
| 16946 | if (alc880_is_multi_pin(nid)) { |
| 16947 | struct alc_spec *spec = codec->spec; |
| 16948 | int idx = alc880_multi_pin_idx(nid); |
| 16949 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16950 | AC_VERB_SET_CONNECT_SEL, |
| 16951 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16952 | } |
| 16953 | } |
| 16954 | |
| 16955 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16956 | { |
| 16957 | struct alc_spec *spec = codec->spec; |
| 16958 | int i; |
| 16959 | |
| 16960 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16961 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16962 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16963 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16964 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16965 | i); |
| 16966 | } |
| 16967 | } |
| 16968 | |
| 16969 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16970 | { |
| 16971 | struct alc_spec *spec = codec->spec; |
| 16972 | hda_nid_t pin; |
| 16973 | |
| 16974 | pin = spec->autocfg.hp_pins[0]; |
| 16975 | if (pin) /* connect to front */ |
| 16976 | /* use dac 0 */ |
| 16977 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16978 | pin = spec->autocfg.speaker_pins[0]; |
| 16979 | if (pin) |
| 16980 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16981 | } |
| 16982 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16983 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16984 | |
| 16985 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16986 | { |
| 16987 | struct alc_spec *spec = codec->spec; |
| 16988 | int i; |
| 16989 | |
| 16990 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16991 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16992 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16993 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 16994 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16995 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16996 | snd_hda_codec_write(codec, nid, 0, |
| 16997 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16998 | AMP_OUT_MUTE); |
| 16999 | } |
| 17000 | } |
| 17001 | } |
| 17002 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17003 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17004 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17005 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17006 | { |
| 17007 | struct alc_spec *spec = codec->spec; |
| 17008 | int err; |
| 17009 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17010 | |
| 17011 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17012 | alc662_ignore); |
| 17013 | if (err < 0) |
| 17014 | return err; |
| 17015 | if (!spec->autocfg.line_outs) |
| 17016 | return 0; /* can't find valid BIOS pin config */ |
| 17017 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17018 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17019 | if (err < 0) |
| 17020 | return err; |
| 17021 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17022 | if (err < 0) |
| 17023 | return err; |
| 17024 | err = alc662_auto_create_extra_out(spec, |
| 17025 | spec->autocfg.speaker_pins[0], |
| 17026 | "Speaker"); |
| 17027 | if (err < 0) |
| 17028 | return err; |
| 17029 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17030 | "Headphone"); |
| 17031 | if (err < 0) |
| 17032 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17033 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17034 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17035 | return err; |
| 17036 | |
| 17037 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17038 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17039 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17040 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17041 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17042 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17043 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17044 | |
| 17045 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17046 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17047 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17048 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17049 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17050 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17051 | |
| 17052 | err = alc_auto_add_mic_boost(codec); |
| 17053 | if (err < 0) |
| 17054 | return err; |
| 17055 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17056 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17057 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17058 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17059 | } |
| 17060 | |
| 17061 | /* additional initialization for auto-configuration model */ |
| 17062 | static void alc662_auto_init(struct hda_codec *codec) |
| 17063 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17064 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17065 | alc662_auto_init_multi_out(codec); |
| 17066 | alc662_auto_init_hp_out(codec); |
| 17067 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17068 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17069 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17070 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17071 | } |
| 17072 | |
| 17073 | static int patch_alc662(struct hda_codec *codec) |
| 17074 | { |
| 17075 | struct alc_spec *spec; |
| 17076 | int err, board_config; |
| 17077 | |
| 17078 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17079 | if (!spec) |
| 17080 | return -ENOMEM; |
| 17081 | |
| 17082 | codec->spec = spec; |
| 17083 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17084 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17085 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17086 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17087 | alc662_models, |
| 17088 | alc662_cfg_tbl); |
| 17089 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 17090 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 17091 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17092 | board_config = ALC662_AUTO; |
| 17093 | } |
| 17094 | |
| 17095 | if (board_config == ALC662_AUTO) { |
| 17096 | /* automatic parse from the BIOS config */ |
| 17097 | err = alc662_parse_auto_config(codec); |
| 17098 | if (err < 0) { |
| 17099 | alc_free(codec); |
| 17100 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17101 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17102 | printk(KERN_INFO |
| 17103 | "hda_codec: Cannot set up configuration " |
| 17104 | "from BIOS. Using base mode...\n"); |
| 17105 | board_config = ALC662_3ST_2ch_DIG; |
| 17106 | } |
| 17107 | } |
| 17108 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17109 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17110 | if (err < 0) { |
| 17111 | alc_free(codec); |
| 17112 | return err; |
| 17113 | } |
| 17114 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17115 | if (board_config != ALC662_AUTO) |
| 17116 | setup_preset(spec, &alc662_presets[board_config]); |
| 17117 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17118 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17119 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17120 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17121 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17122 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17123 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17124 | spec->adc_nids = alc662_adc_nids; |
| 17125 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17126 | spec->capsrc_nids = alc662_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17127 | spec->capture_style = CAPT_MIX; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17128 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17129 | if (!spec->cap_mixer) |
| 17130 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17131 | if (codec->vendor_id == 0x10ec0662) |
| 17132 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17133 | else |
| 17134 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17135 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17136 | spec->vmaster_nid = 0x02; |
| 17137 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17138 | codec->patch_ops = alc_patch_ops; |
| 17139 | if (board_config == ALC662_AUTO) |
| 17140 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17141 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17142 | if (!spec->loopback.amplist) |
| 17143 | spec->loopback.amplist = alc662_loopbacks; |
| 17144 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17145 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17146 | |
| 17147 | return 0; |
| 17148 | } |
| 17149 | |
| 17150 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17151 | * patch entries |
| 17152 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17153 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17154 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17155 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17156 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17157 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17158 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17159 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17160 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17161 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17162 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17163 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17164 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17165 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 17166 | .patch = patch_alc883 }, |
| 17167 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17168 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17169 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17170 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17171 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 17172 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17173 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 17174 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17175 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 17176 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17177 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 17178 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17179 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 17180 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 17181 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17182 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17183 | {} /* terminator */ |
| 17184 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17185 | |
| 17186 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17187 | |
| 17188 | MODULE_LICENSE("GPL"); |
| 17189 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17190 | |
| 17191 | static struct hda_codec_preset_list realtek_list = { |
| 17192 | .preset = snd_hda_preset_realtek, |
| 17193 | .owner = THIS_MODULE, |
| 17194 | }; |
| 17195 | |
| 17196 | static int __init patch_realtek_init(void) |
| 17197 | { |
| 17198 | return snd_hda_add_codec_preset(&realtek_list); |
| 17199 | } |
| 17200 | |
| 17201 | static void __exit patch_realtek_exit(void) |
| 17202 | { |
| 17203 | snd_hda_delete_codec_preset(&realtek_list); |
| 17204 | } |
| 17205 | |
| 17206 | module_init(patch_realtek_init) |
| 17207 | module_exit(patch_realtek_exit) |