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 | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 191 | ALC662_AUTO, |
| 192 | ALC662_MODEL_LAST, |
| 193 | }; |
| 194 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 195 | /* ALC882 models */ |
| 196 | enum { |
| 197 | ALC882_3ST_DIG, |
| 198 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 199 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 200 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 201 | ALC882_TARGA, |
| 202 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 203 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 204 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 205 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 206 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 207 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 208 | ALC882_MODEL_LAST, |
| 209 | }; |
| 210 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 211 | /* ALC883 models */ |
| 212 | enum { |
| 213 | ALC883_3ST_2ch_DIG, |
| 214 | ALC883_3ST_6ch_DIG, |
| 215 | ALC883_3ST_6ch, |
| 216 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 217 | ALC883_TARGA_DIG, |
| 218 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 219 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 220 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 221 | ALC888_ACER_ASPIRE_4930G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 222 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 223 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 224 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 225 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 226 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 227 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 228 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 229 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 230 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 231 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 232 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 233 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 234 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 235 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 236 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 237 | ALC888_ASUS_M90V, |
| 238 | ALC888_ASUS_EEE1601, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 239 | ALC1200_ASUS_P5Q, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 240 | ALC883_AUTO, |
| 241 | ALC883_MODEL_LAST, |
| 242 | }; |
| 243 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 244 | /* styles of capture selection */ |
| 245 | enum { |
| 246 | CAPT_MUX = 0, /* only mux based */ |
| 247 | CAPT_MIX, /* only mixer based */ |
| 248 | CAPT_1MUX_MIX, /* first mux and other mixers */ |
| 249 | }; |
| 250 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 251 | /* for GPIO Poll */ |
| 252 | #define GPIO_MASK 0x03 |
| 253 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | struct alc_spec { |
| 255 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 256 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 258 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 259 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 261 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 262 | * don't forget NULL |
| 263 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 264 | */ |
| 265 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 267 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | struct hda_pcm_stream *stream_analog_playback; |
| 269 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 270 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 271 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 273 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | struct hda_pcm_stream *stream_digital_playback; |
| 275 | struct hda_pcm_stream *stream_digital_capture; |
| 276 | |
| 277 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 278 | struct hda_multi_out multiout; /* playback set-up |
| 279 | * max_channels, dacs must be set |
| 280 | * dig_out_nid and hp_nid are optional |
| 281 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 282 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 283 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 284 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | |
| 286 | /* capture */ |
| 287 | unsigned int num_adc_nids; |
| 288 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 289 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 290 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 291 | int capture_style; /* capture style (CAPT_*) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | |
| 293 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 294 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | const struct hda_input_mux *input_mux; |
| 296 | unsigned int cur_mux[3]; |
| 297 | |
| 298 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 299 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 301 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | |
| 303 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 304 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 305 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 306 | /* dynamic controls, init_verbs and input_mux */ |
| 307 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 308 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 309 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 310 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 311 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 312 | /* hooks */ |
| 313 | void (*init_hook)(struct hda_codec *codec); |
| 314 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 315 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 316 | /* for pin sensing */ |
| 317 | unsigned int sense_updated: 1; |
| 318 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 319 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 320 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 321 | /* other flags */ |
| 322 | unsigned int no_analog :1; /* digital I/O only */ |
| 323 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 324 | /* for virtual master */ |
| 325 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 326 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 327 | struct hda_loopback_check loopback; |
| 328 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 329 | |
| 330 | /* for PLL fix */ |
| 331 | hda_nid_t pll_nid; |
| 332 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 333 | }; |
| 334 | |
| 335 | /* |
| 336 | * configuration template - to be copied to the spec instance |
| 337 | */ |
| 338 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 339 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 340 | * with spec |
| 341 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 342 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 343 | const struct hda_verb *init_verbs[5]; |
| 344 | unsigned int num_dacs; |
| 345 | hda_nid_t *dac_nids; |
| 346 | hda_nid_t dig_out_nid; /* optional */ |
| 347 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 348 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 349 | unsigned int num_adc_nids; |
| 350 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 351 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 352 | hda_nid_t dig_in_nid; |
| 353 | unsigned int num_channel_mode; |
| 354 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 355 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 356 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 357 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 358 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 359 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 360 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 361 | struct hda_amp_list *loopbacks; |
| 362 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | }; |
| 364 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | |
| 366 | /* |
| 367 | * input MUX handling |
| 368 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 369 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 370 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | { |
| 372 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 373 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 374 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 375 | if (mux_idx >= spec->num_mux_defs) |
| 376 | mux_idx = 0; |
| 377 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | } |
| 379 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 380 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 381 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 382 | { |
| 383 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 384 | struct alc_spec *spec = codec->spec; |
| 385 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 386 | |
| 387 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 388 | return 0; |
| 389 | } |
| 390 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 391 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 392 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 | { |
| 394 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 395 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 396 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 398 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 399 | hda_nid_t nid = spec->capsrc_nids ? |
| 400 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 402 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 403 | imux = &spec->input_mux[mux_idx]; |
| 404 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 405 | if (spec->capture_style && |
| 406 | !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 407 | /* Matrix-mixer style (e.g. ALC882) */ |
| 408 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 409 | unsigned int i, idx; |
| 410 | |
| 411 | idx = ucontrol->value.enumerated.item[0]; |
| 412 | if (idx >= imux->num_items) |
| 413 | idx = imux->num_items - 1; |
| 414 | if (*cur_val == idx) |
| 415 | return 0; |
| 416 | for (i = 0; i < imux->num_items; i++) { |
| 417 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 418 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 419 | imux->items[i].index, |
| 420 | HDA_AMP_MUTE, v); |
| 421 | } |
| 422 | *cur_val = idx; |
| 423 | return 1; |
| 424 | } else { |
| 425 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 426 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 427 | &spec->cur_mux[adc_idx]); |
| 428 | } |
| 429 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 430 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | /* |
| 432 | * channel mode setting |
| 433 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 434 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 435 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | { |
| 437 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 438 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 439 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 440 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | } |
| 442 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 443 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 444 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | { |
| 446 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 447 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 448 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 449 | spec->num_channel_mode, |
| 450 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | } |
| 452 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 453 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 454 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | { |
| 456 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 457 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 458 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 459 | spec->num_channel_mode, |
| 460 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 461 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 462 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 463 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | } |
| 465 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 467 | * 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] | 468 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 469 | * being part of a format specifier. Maximum allowed length of a value is |
| 470 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 471 | * |
| 472 | * Note: some retasking pin complexes seem to ignore requests for input |
| 473 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 474 | * are requested. Therefore order this list so that this behaviour will not |
| 475 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 476 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 477 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 478 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 479 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 480 | "Mic 50pc bias", "Mic 80pc bias", |
| 481 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 482 | }; |
| 483 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 484 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 485 | }; |
| 486 | /* 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] | 487 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 488 | * addition, "input" pins may or may not process the mic bias option |
| 489 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 490 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 491 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 492 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 493 | #define ALC_PIN_DIR_IN 0x00 |
| 494 | #define ALC_PIN_DIR_OUT 0x01 |
| 495 | #define ALC_PIN_DIR_INOUT 0x02 |
| 496 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 497 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 498 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 499 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 500 | * For each direction the minimum and maximum values are given. |
| 501 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 502 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 503 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 504 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 505 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 506 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 507 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 508 | }; |
| 509 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 510 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 511 | #define alc_pin_mode_n_items(_dir) \ |
| 512 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 513 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 514 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 515 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 516 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 517 | unsigned int item_num = uinfo->value.enumerated.item; |
| 518 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 519 | |
| 520 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 521 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 522 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 523 | |
| 524 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 525 | item_num = alc_pin_mode_min(dir); |
| 526 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 527 | return 0; |
| 528 | } |
| 529 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 530 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 531 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 532 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 533 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 534 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 535 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 536 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 537 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 538 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 539 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 540 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 541 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 542 | /* Find enumerated value for current pinctl setting */ |
| 543 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 544 | 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] | 545 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 546 | *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] | 547 | return 0; |
| 548 | } |
| 549 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 550 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 551 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | { |
| 553 | signed int change; |
| 554 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 555 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 556 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 557 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 558 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 559 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 560 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 561 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 562 | 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] | 563 | val = alc_pin_mode_min(dir); |
| 564 | |
| 565 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 566 | if (change) { |
| 567 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 568 | snd_hda_codec_write_cache(codec, nid, 0, |
| 569 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 570 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 571 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 572 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 573 | * for the requested pin mode. Enum values of 2 or less are |
| 574 | * input modes. |
| 575 | * |
| 576 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 577 | * reduces noise slightly (particularly on input) so we'll |
| 578 | * do it. However, having both input and output buffers |
| 579 | * enabled simultaneously doesn't seem to be problematic if |
| 580 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 581 | */ |
| 582 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 583 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 584 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 585 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 586 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 587 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 588 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 589 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 590 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 591 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 592 | } |
| 593 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 594 | return change; |
| 595 | } |
| 596 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 597 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 598 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 599 | .info = alc_pin_mode_info, \ |
| 600 | .get = alc_pin_mode_get, \ |
| 601 | .put = alc_pin_mode_put, \ |
| 602 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 603 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 604 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 605 | * together using a mask with more than one bit set. This control is |
| 606 | * currently used only by the ALC260 test model. At this stage they are not |
| 607 | * needed for any "production" models. |
| 608 | */ |
| 609 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 610 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 611 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 612 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 613 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 614 | { |
| 615 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 616 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 617 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 618 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 619 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 620 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 621 | |
| 622 | *valp = (val & mask) != 0; |
| 623 | return 0; |
| 624 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 625 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 626 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 627 | { |
| 628 | signed int change; |
| 629 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 630 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 631 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 632 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 633 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 634 | AC_VERB_GET_GPIO_DATA, |
| 635 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 636 | |
| 637 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 638 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 639 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 640 | gpio_data &= ~mask; |
| 641 | else |
| 642 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 643 | snd_hda_codec_write_cache(codec, nid, 0, |
| 644 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 645 | |
| 646 | return change; |
| 647 | } |
| 648 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 649 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 650 | .info = alc_gpio_data_info, \ |
| 651 | .get = alc_gpio_data_get, \ |
| 652 | .put = alc_gpio_data_put, \ |
| 653 | .private_value = nid | (mask<<16) } |
| 654 | #endif /* CONFIG_SND_DEBUG */ |
| 655 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 656 | /* A switch control to allow the enabling of the digital IO pins on the |
| 657 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 658 | * to provide something in the test model allowing digital outputs to be |
| 659 | * identified if present. If models are found which can utilise these |
| 660 | * outputs a more complete mixer control can be devised for those models if |
| 661 | * necessary. |
| 662 | */ |
| 663 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 664 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 665 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 666 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 667 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 668 | { |
| 669 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 670 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 671 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 672 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 673 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 674 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 675 | |
| 676 | *valp = (val & mask) != 0; |
| 677 | return 0; |
| 678 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 679 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 680 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 681 | { |
| 682 | signed int change; |
| 683 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 684 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 685 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 686 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 687 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 688 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 689 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 690 | |
| 691 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 692 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 693 | if (val==0) |
| 694 | ctrl_data &= ~mask; |
| 695 | else |
| 696 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 697 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 698 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 699 | |
| 700 | return change; |
| 701 | } |
| 702 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 703 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 704 | .info = alc_spdif_ctrl_info, \ |
| 705 | .get = alc_spdif_ctrl_get, \ |
| 706 | .put = alc_spdif_ctrl_put, \ |
| 707 | .private_value = nid | (mask<<16) } |
| 708 | #endif /* CONFIG_SND_DEBUG */ |
| 709 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 710 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 711 | * Again, this is only used in the ALC26x test models to help identify when |
| 712 | * the EAPD line must be asserted for features to work. |
| 713 | */ |
| 714 | #ifdef CONFIG_SND_DEBUG |
| 715 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 716 | |
| 717 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 718 | struct snd_ctl_elem_value *ucontrol) |
| 719 | { |
| 720 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 721 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 722 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 723 | long *valp = ucontrol->value.integer.value; |
| 724 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 725 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 726 | |
| 727 | *valp = (val & mask) != 0; |
| 728 | return 0; |
| 729 | } |
| 730 | |
| 731 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 732 | struct snd_ctl_elem_value *ucontrol) |
| 733 | { |
| 734 | int change; |
| 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 val = *ucontrol->value.integer.value; |
| 739 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 740 | AC_VERB_GET_EAPD_BTLENABLE, |
| 741 | 0x00); |
| 742 | |
| 743 | /* Set/unset the masked control bit(s) as needed */ |
| 744 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 745 | if (!val) |
| 746 | ctrl_data &= ~mask; |
| 747 | else |
| 748 | ctrl_data |= mask; |
| 749 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 750 | ctrl_data); |
| 751 | |
| 752 | return change; |
| 753 | } |
| 754 | |
| 755 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 756 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 757 | .info = alc_eapd_ctrl_info, \ |
| 758 | .get = alc_eapd_ctrl_get, \ |
| 759 | .put = alc_eapd_ctrl_put, \ |
| 760 | .private_value = nid | (mask<<16) } |
| 761 | #endif /* CONFIG_SND_DEBUG */ |
| 762 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 763 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 764 | * set up the input pin config (depending on the given auto-pin type) |
| 765 | */ |
| 766 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 767 | int auto_pin_type) |
| 768 | { |
| 769 | unsigned int val = PIN_IN; |
| 770 | |
| 771 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 772 | unsigned int pincap; |
| 773 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 774 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 775 | if (pincap & AC_PINCAP_VREF_80) |
| 776 | val = PIN_VREF80; |
| 777 | } |
| 778 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 779 | } |
| 780 | |
| 781 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 782 | */ |
| 783 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 784 | { |
| 785 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 786 | return; |
| 787 | spec->mixers[spec->num_mixers++] = mix; |
| 788 | } |
| 789 | |
| 790 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 791 | { |
| 792 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 793 | return; |
| 794 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 795 | } |
| 796 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 797 | #ifdef CONFIG_PROC_FS |
| 798 | /* |
| 799 | * hook for proc |
| 800 | */ |
| 801 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 802 | struct hda_codec *codec, hda_nid_t nid) |
| 803 | { |
| 804 | int coeff; |
| 805 | |
| 806 | if (nid != 0x20) |
| 807 | return; |
| 808 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 809 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 810 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 811 | AC_VERB_GET_COEF_INDEX, 0); |
| 812 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 813 | } |
| 814 | #else |
| 815 | #define print_realtek_coef NULL |
| 816 | #endif |
| 817 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 818 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 819 | * set up from the preset table |
| 820 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 821 | static void setup_preset(struct alc_spec *spec, |
| 822 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 823 | { |
| 824 | int i; |
| 825 | |
| 826 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 827 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 828 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 829 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 830 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 831 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 832 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 833 | spec->channel_mode = preset->channel_mode; |
| 834 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 835 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 836 | |
| 837 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 838 | |
| 839 | spec->multiout.num_dacs = preset->num_dacs; |
| 840 | spec->multiout.dac_nids = preset->dac_nids; |
| 841 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 842 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 843 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 844 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 845 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 846 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 847 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 848 | spec->input_mux = preset->input_mux; |
| 849 | |
| 850 | spec->num_adc_nids = preset->num_adc_nids; |
| 851 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 852 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 853 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 854 | |
| 855 | spec->unsol_event = preset->unsol_event; |
| 856 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 857 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 858 | spec->loopback.amplist = preset->loopbacks; |
| 859 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 860 | } |
| 861 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 862 | /* Enable GPIO mask and set output */ |
| 863 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 864 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 865 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 866 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 867 | { } |
| 868 | }; |
| 869 | |
| 870 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 871 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 872 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 873 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 874 | { } |
| 875 | }; |
| 876 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 877 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 878 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 879 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 880 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 881 | { } |
| 882 | }; |
| 883 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 884 | /* |
| 885 | * Fix hardware PLL issue |
| 886 | * On some codecs, the analog PLL gating control must be off while |
| 887 | * the default value is 1. |
| 888 | */ |
| 889 | static void alc_fix_pll(struct hda_codec *codec) |
| 890 | { |
| 891 | struct alc_spec *spec = codec->spec; |
| 892 | unsigned int val; |
| 893 | |
| 894 | if (!spec->pll_nid) |
| 895 | return; |
| 896 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 897 | spec->pll_coef_idx); |
| 898 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 899 | AC_VERB_GET_PROC_COEF, 0); |
| 900 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 901 | spec->pll_coef_idx); |
| 902 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 903 | val & ~(1 << spec->pll_coef_bit)); |
| 904 | } |
| 905 | |
| 906 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 907 | unsigned int coef_idx, unsigned int coef_bit) |
| 908 | { |
| 909 | struct alc_spec *spec = codec->spec; |
| 910 | spec->pll_nid = nid; |
| 911 | spec->pll_coef_idx = coef_idx; |
| 912 | spec->pll_coef_bit = coef_bit; |
| 913 | alc_fix_pll(codec); |
| 914 | } |
| 915 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 916 | static void alc_sku_automute(struct hda_codec *codec) |
| 917 | { |
| 918 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 919 | unsigned int present; |
| 920 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 921 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 922 | |
| 923 | /* need to execute and sync at first */ |
| 924 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 925 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 926 | AC_VERB_GET_PIN_SENSE, 0); |
| 927 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 928 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 929 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 930 | } |
| 931 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 932 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 933 | static void alc_mic_automute(struct hda_codec *codec) |
| 934 | { |
| 935 | struct alc_spec *spec = codec->spec; |
| 936 | unsigned int present; |
| 937 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 938 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 939 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 940 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 941 | |
| 942 | capsrc_idx_mic = mic_nid - 0x18; |
| 943 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 944 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 945 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 946 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 947 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 948 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 949 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 950 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 951 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 952 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 953 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 954 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 955 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 956 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 957 | /* unsolicited event for HP jack sensing */ |
| 958 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 959 | { |
| 960 | if (codec->vendor_id == 0x10ec0880) |
| 961 | res >>= 28; |
| 962 | else |
| 963 | res >>= 26; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 964 | if (res == ALC880_HP_EVENT) |
| 965 | alc_sku_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 966 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 967 | if (res == ALC880_MIC_EVENT) |
| 968 | alc_mic_automute(codec); |
| 969 | } |
| 970 | |
| 971 | static void alc_inithook(struct hda_codec *codec) |
| 972 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 973 | alc_sku_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 974 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 975 | } |
| 976 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 977 | /* additional initialization for ALC888 variants */ |
| 978 | static void alc888_coef_init(struct hda_codec *codec) |
| 979 | { |
| 980 | unsigned int tmp; |
| 981 | |
| 982 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 983 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 984 | 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] | 985 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 986 | /* alc888S-VC */ |
| 987 | snd_hda_codec_read(codec, 0x20, 0, |
| 988 | AC_VERB_SET_PROC_COEF, 0x830); |
| 989 | else |
| 990 | /* alc888-VB */ |
| 991 | snd_hda_codec_read(codec, 0x20, 0, |
| 992 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 993 | } |
| 994 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 995 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 996 | * 31 ~ 16 : Manufacture ID |
| 997 | * 15 ~ 8 : SKU ID |
| 998 | * 7 ~ 0 : Assembly ID |
| 999 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1000 | */ |
| 1001 | static void alc_subsystem_id(struct hda_codec *codec, |
| 1002 | unsigned int porta, unsigned int porte, |
| 1003 | unsigned int portd) |
| 1004 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1005 | unsigned int ass, tmp, i; |
| 1006 | unsigned nid; |
| 1007 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1008 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1009 | ass = codec->subsystem_id & 0xffff; |
| 1010 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1011 | goto do_sku; |
| 1012 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1013 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1014 | * 31~30 : port conetcivity |
| 1015 | * 29~21 : reserve |
| 1016 | * 20 : PCBEEP input |
| 1017 | * 19~16 : Check sum (15:1) |
| 1018 | * 15~1 : Custom |
| 1019 | * 0 : override |
| 1020 | */ |
| 1021 | nid = 0x1d; |
| 1022 | if (codec->vendor_id == 0x10ec0260) |
| 1023 | nid = 0x17; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1024 | ass = snd_hda_codec_get_pincfg(codec, nid); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1025 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1026 | return; |
| 1027 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1028 | return; |
| 1029 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1030 | /* check sum */ |
| 1031 | tmp = 0; |
| 1032 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1033 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1034 | tmp++; |
| 1035 | } |
| 1036 | if (((ass >> 16) & 0xf) != tmp) |
| 1037 | return; |
| 1038 | do_sku: |
| 1039 | /* |
| 1040 | * 0 : override |
| 1041 | * 1 : Swap Jack |
| 1042 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1043 | * 3~5 : External Amplifier control |
| 1044 | * 7~6 : Reserved |
| 1045 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1046 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1047 | switch (tmp) { |
| 1048 | case 1: |
| 1049 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1050 | break; |
| 1051 | case 3: |
| 1052 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1053 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1054 | case 7: |
| 1055 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1056 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1057 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1058 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1059 | case 0x10ec0260: |
| 1060 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1061 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1062 | snd_hda_codec_write(codec, 0x10, 0, |
| 1063 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1064 | break; |
| 1065 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1066 | case 0x10ec0267: |
| 1067 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1068 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1069 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1070 | case 0x10ec0660: |
| 1071 | case 0x10ec0662: |
| 1072 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1073 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1074 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1075 | snd_hda_codec_write(codec, 0x14, 0, |
| 1076 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1077 | snd_hda_codec_write(codec, 0x15, 0, |
| 1078 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1079 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1080 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1081 | switch (codec->vendor_id) { |
| 1082 | case 0x10ec0260: |
| 1083 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1084 | AC_VERB_SET_COEF_INDEX, 7); |
| 1085 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1086 | AC_VERB_GET_PROC_COEF, 0); |
| 1087 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1088 | AC_VERB_SET_COEF_INDEX, 7); |
| 1089 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1090 | AC_VERB_SET_PROC_COEF, |
| 1091 | tmp | 0x2010); |
| 1092 | break; |
| 1093 | case 0x10ec0262: |
| 1094 | case 0x10ec0880: |
| 1095 | case 0x10ec0882: |
| 1096 | case 0x10ec0883: |
| 1097 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1098 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1099 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1100 | snd_hda_codec_write(codec, 0x20, 0, |
| 1101 | AC_VERB_SET_COEF_INDEX, 7); |
| 1102 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1103 | AC_VERB_GET_PROC_COEF, 0); |
| 1104 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1105 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1106 | snd_hda_codec_write(codec, 0x20, 0, |
| 1107 | AC_VERB_SET_PROC_COEF, |
| 1108 | tmp | 0x2010); |
| 1109 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1110 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 1111 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1112 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1113 | case 0x10ec0267: |
| 1114 | case 0x10ec0268: |
| 1115 | snd_hda_codec_write(codec, 0x20, 0, |
| 1116 | AC_VERB_SET_COEF_INDEX, 7); |
| 1117 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1118 | AC_VERB_GET_PROC_COEF, 0); |
| 1119 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1120 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1121 | snd_hda_codec_write(codec, 0x20, 0, |
| 1122 | AC_VERB_SET_PROC_COEF, |
| 1123 | tmp | 0x3000); |
| 1124 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1125 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1126 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1127 | break; |
| 1128 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1129 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1130 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1131 | * when the external headphone out jack is plugged" |
| 1132 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1133 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1134 | return; |
| 1135 | /* |
| 1136 | * 10~8 : Jack location |
| 1137 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1138 | * 14~13: Resvered |
| 1139 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1140 | * when the external headphone out jack is plugged" |
| 1141 | */ |
| 1142 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1143 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1144 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1145 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1146 | else |
| 1147 | return; |
| 1148 | } |
| 1149 | |
| 1150 | if (!spec->autocfg.hp_pins[0]) { |
| 1151 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1152 | if (tmp == 0) |
| 1153 | spec->autocfg.hp_pins[0] = porta; |
| 1154 | else if (tmp == 1) |
| 1155 | spec->autocfg.hp_pins[0] = porte; |
| 1156 | else if (tmp == 2) |
| 1157 | spec->autocfg.hp_pins[0] = portd; |
| 1158 | else |
| 1159 | return; |
| 1160 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1161 | if (spec->autocfg.hp_pins[0]) |
| 1162 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1163 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1164 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1165 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1166 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1167 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
| 1168 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) |
| 1169 | snd_hda_codec_write(codec, |
| 1170 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, |
| 1171 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1172 | AC_USRSP_EN | ALC880_MIC_EVENT); |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1173 | #endif /* disabled */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1174 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1175 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1176 | } |
| 1177 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1178 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1179 | * Fix-up pin default configurations |
| 1180 | */ |
| 1181 | |
| 1182 | struct alc_pincfg { |
| 1183 | hda_nid_t nid; |
| 1184 | u32 val; |
| 1185 | }; |
| 1186 | |
| 1187 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1188 | const struct snd_pci_quirk *quirk, |
| 1189 | const struct alc_pincfg **pinfix) |
| 1190 | { |
| 1191 | const struct alc_pincfg *cfg; |
| 1192 | |
| 1193 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1194 | if (!quirk) |
| 1195 | return; |
| 1196 | |
| 1197 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1198 | for (; cfg->nid; cfg++) |
| 1199 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1200 | } |
| 1201 | |
| 1202 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1203 | * ALC888 |
| 1204 | */ |
| 1205 | |
| 1206 | /* |
| 1207 | * 2ch mode |
| 1208 | */ |
| 1209 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1210 | /* Mic-in jack as mic in */ |
| 1211 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1212 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1213 | /* Line-in jack as Line in */ |
| 1214 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1215 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1216 | /* Line-Out as Front */ |
| 1217 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1218 | { } /* end */ |
| 1219 | }; |
| 1220 | |
| 1221 | /* |
| 1222 | * 4ch mode |
| 1223 | */ |
| 1224 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1225 | /* Mic-in jack as mic in */ |
| 1226 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1227 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1228 | /* Line-in jack as Surround */ |
| 1229 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1230 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1231 | /* Line-Out as Front */ |
| 1232 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1233 | { } /* end */ |
| 1234 | }; |
| 1235 | |
| 1236 | /* |
| 1237 | * 6ch mode |
| 1238 | */ |
| 1239 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1240 | /* Mic-in jack as CLFE */ |
| 1241 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1242 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1243 | /* Line-in jack as Surround */ |
| 1244 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1245 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1246 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1247 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1248 | { } /* end */ |
| 1249 | }; |
| 1250 | |
| 1251 | /* |
| 1252 | * 8ch mode |
| 1253 | */ |
| 1254 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1255 | /* Mic-in jack as CLFE */ |
| 1256 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1257 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1258 | /* Line-in jack as Surround */ |
| 1259 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1260 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1261 | /* Line-Out as Side */ |
| 1262 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1263 | { } /* end */ |
| 1264 | }; |
| 1265 | |
| 1266 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1267 | { 2, alc888_4ST_ch2_intel_init }, |
| 1268 | { 4, alc888_4ST_ch4_intel_init }, |
| 1269 | { 6, alc888_4ST_ch6_intel_init }, |
| 1270 | { 8, alc888_4ST_ch8_intel_init }, |
| 1271 | }; |
| 1272 | |
| 1273 | /* |
| 1274 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1275 | */ |
| 1276 | |
| 1277 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1278 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1279 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1280 | /* Connect Internal HP to Front */ |
| 1281 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1282 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1283 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1284 | /* Connect Bass HP to Front */ |
| 1285 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1286 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1287 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1288 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1289 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1290 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1291 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1292 | /* Connect Mic jack to CLFE */ |
| 1293 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1294 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1295 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1296 | /* Connect Line-in jack to Surround */ |
| 1297 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1298 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1299 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1300 | /* Connect HP out jack to Front */ |
| 1301 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1302 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1303 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1304 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1305 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1306 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1307 | {} |
| 1308 | }; |
| 1309 | |
| 1310 | static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec) |
| 1311 | { |
| 1312 | unsigned int present; |
| 1313 | unsigned int bits; |
| 1314 | /* Line out presence */ |
| 1315 | present = snd_hda_codec_read(codec, 0x17, 0, |
| 1316 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1317 | /* HP out presence */ |
| 1318 | present = present || snd_hda_codec_read(codec, 0x1b, 0, |
| 1319 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1320 | bits = present ? HDA_AMP_MUTE : 0; |
| 1321 | /* Toggle internal speakers muting */ |
| 1322 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1323 | HDA_AMP_MUTE, bits); |
| 1324 | /* Toggle internal bass muting */ |
| 1325 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1326 | HDA_AMP_MUTE, bits); |
| 1327 | } |
| 1328 | |
| 1329 | static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec, |
| 1330 | unsigned int res) |
| 1331 | { |
| 1332 | if (res >> 26 == ALC880_HP_EVENT) |
| 1333 | alc888_fujitsu_xa3530_automute(codec); |
| 1334 | } |
| 1335 | |
| 1336 | |
| 1337 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1338 | * ALC888 Acer Aspire 4930G model |
| 1339 | */ |
| 1340 | |
| 1341 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1342 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1343 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1344 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1345 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1346 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1347 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1348 | /* Connect Internal HP to front */ |
| 1349 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1350 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1351 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1352 | /* Connect HP out to front */ |
| 1353 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1354 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1355 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1356 | { } |
| 1357 | }; |
| 1358 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1359 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1360 | /* Front mic only available on one ADC */ |
| 1361 | { |
| 1362 | .num_items = 4, |
| 1363 | .items = { |
| 1364 | { "Mic", 0x0 }, |
| 1365 | { "Line", 0x2 }, |
| 1366 | { "CD", 0x4 }, |
| 1367 | { "Front Mic", 0xb }, |
| 1368 | }, |
| 1369 | }, |
| 1370 | { |
| 1371 | .num_items = 3, |
| 1372 | .items = { |
| 1373 | { "Mic", 0x0 }, |
| 1374 | { "Line", 0x2 }, |
| 1375 | { "CD", 0x4 }, |
| 1376 | }, |
| 1377 | } |
| 1378 | }; |
| 1379 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1380 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1381 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1382 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1383 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1384 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1385 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1386 | HDA_OUTPUT), |
| 1387 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1388 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1389 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1390 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1391 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1392 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1393 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1394 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1395 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1396 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1397 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1398 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1399 | { } /* end */ |
| 1400 | }; |
| 1401 | |
| 1402 | static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec) |
| 1403 | { |
| 1404 | unsigned int present; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1405 | unsigned int bits; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1406 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 1407 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1408 | bits = present ? HDA_AMP_MUTE : 0; |
| 1409 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1410 | HDA_AMP_MUTE, bits); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1411 | } |
| 1412 | |
| 1413 | static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, |
| 1414 | unsigned int res) |
| 1415 | { |
| 1416 | if (res >> 26 == ALC880_HP_EVENT) |
| 1417 | alc888_acer_aspire_4930g_automute(codec); |
| 1418 | } |
| 1419 | |
| 1420 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1421 | * ALC880 3-stack model |
| 1422 | * |
| 1423 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1424 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1425 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1426 | */ |
| 1427 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1428 | static hda_nid_t alc880_dac_nids[4] = { |
| 1429 | /* front, rear, clfe, rear_surr */ |
| 1430 | 0x02, 0x05, 0x04, 0x03 |
| 1431 | }; |
| 1432 | |
| 1433 | static hda_nid_t alc880_adc_nids[3] = { |
| 1434 | /* ADC0-2 */ |
| 1435 | 0x07, 0x08, 0x09, |
| 1436 | }; |
| 1437 | |
| 1438 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1439 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1440 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1441 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1442 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1443 | /* ADC1-2 */ |
| 1444 | 0x08, 0x09, |
| 1445 | }; |
| 1446 | |
| 1447 | #define ALC880_DIGOUT_NID 0x06 |
| 1448 | #define ALC880_DIGIN_NID 0x0a |
| 1449 | |
| 1450 | static struct hda_input_mux alc880_capture_source = { |
| 1451 | .num_items = 4, |
| 1452 | .items = { |
| 1453 | { "Mic", 0x0 }, |
| 1454 | { "Front Mic", 0x3 }, |
| 1455 | { "Line", 0x2 }, |
| 1456 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1457 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1458 | }; |
| 1459 | |
| 1460 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1461 | /* 2ch mode */ |
| 1462 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1463 | /* set line-in to input, mute it */ |
| 1464 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1465 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1466 | /* set mic-in to input vref 80%, mute it */ |
| 1467 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1468 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1469 | { } /* end */ |
| 1470 | }; |
| 1471 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1472 | /* 6ch mode */ |
| 1473 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1474 | /* set line-in to output, unmute it */ |
| 1475 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1476 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1477 | /* set mic-in to output, unmute it */ |
| 1478 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1479 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1480 | { } /* end */ |
| 1481 | }; |
| 1482 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1483 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1484 | { 2, alc880_threestack_ch2_init }, |
| 1485 | { 6, alc880_threestack_ch6_init }, |
| 1486 | }; |
| 1487 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1488 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1489 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1490 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1491 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1492 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1493 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1494 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1495 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1496 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1497 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1498 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1499 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1500 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1503 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1504 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1505 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1506 | { |
| 1507 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1508 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1509 | .info = alc_ch_mode_info, |
| 1510 | .get = alc_ch_mode_get, |
| 1511 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1512 | }, |
| 1513 | { } /* end */ |
| 1514 | }; |
| 1515 | |
| 1516 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1517 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1518 | struct snd_ctl_elem_info *uinfo) |
| 1519 | { |
| 1520 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1521 | struct alc_spec *spec = codec->spec; |
| 1522 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1523 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1524 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1525 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1526 | HDA_INPUT); |
| 1527 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1528 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1529 | return err; |
| 1530 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1531 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1532 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1533 | unsigned int size, unsigned int __user *tlv) |
| 1534 | { |
| 1535 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1536 | struct alc_spec *spec = codec->spec; |
| 1537 | int err; |
| 1538 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1539 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1540 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1541 | HDA_INPUT); |
| 1542 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1543 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1544 | return err; |
| 1545 | } |
| 1546 | |
| 1547 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1548 | struct snd_ctl_elem_value *ucontrol); |
| 1549 | |
| 1550 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1551 | struct snd_ctl_elem_value *ucontrol, |
| 1552 | getput_call_t func) |
| 1553 | { |
| 1554 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1555 | struct alc_spec *spec = codec->spec; |
| 1556 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1557 | int err; |
| 1558 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1559 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1560 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1561 | 3, 0, HDA_INPUT); |
| 1562 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1563 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1564 | return err; |
| 1565 | } |
| 1566 | |
| 1567 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1568 | struct snd_ctl_elem_value *ucontrol) |
| 1569 | { |
| 1570 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1571 | snd_hda_mixer_amp_volume_get); |
| 1572 | } |
| 1573 | |
| 1574 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1575 | struct snd_ctl_elem_value *ucontrol) |
| 1576 | { |
| 1577 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1578 | snd_hda_mixer_amp_volume_put); |
| 1579 | } |
| 1580 | |
| 1581 | /* capture mixer elements */ |
| 1582 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1583 | |
| 1584 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1585 | struct snd_ctl_elem_value *ucontrol) |
| 1586 | { |
| 1587 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1588 | snd_hda_mixer_amp_switch_get); |
| 1589 | } |
| 1590 | |
| 1591 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1592 | struct snd_ctl_elem_value *ucontrol) |
| 1593 | { |
| 1594 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1595 | snd_hda_mixer_amp_switch_put); |
| 1596 | } |
| 1597 | |
| 1598 | #define DEFINE_CAPMIX(num) \ |
| 1599 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1600 | { \ |
| 1601 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1602 | .name = "Capture Switch", \ |
| 1603 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1604 | .count = num, \ |
| 1605 | .info = alc_cap_sw_info, \ |
| 1606 | .get = alc_cap_sw_get, \ |
| 1607 | .put = alc_cap_sw_put, \ |
| 1608 | }, \ |
| 1609 | { \ |
| 1610 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1611 | .name = "Capture Volume", \ |
| 1612 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1613 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1614 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1615 | .count = num, \ |
| 1616 | .info = alc_cap_vol_info, \ |
| 1617 | .get = alc_cap_vol_get, \ |
| 1618 | .put = alc_cap_vol_put, \ |
| 1619 | .tlv = { .c = alc_cap_vol_tlv }, \ |
| 1620 | }, \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1621 | { \ |
| 1622 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1623 | /* .name = "Capture Source", */ \ |
| 1624 | .name = "Input Source", \ |
| 1625 | .count = num, \ |
| 1626 | .info = alc_mux_enum_info, \ |
| 1627 | .get = alc_mux_enum_get, \ |
| 1628 | .put = alc_mux_enum_put, \ |
| 1629 | }, \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1630 | { } /* end */ \ |
| 1631 | } |
| 1632 | |
| 1633 | /* up to three ADCs */ |
| 1634 | DEFINE_CAPMIX(1); |
| 1635 | DEFINE_CAPMIX(2); |
| 1636 | DEFINE_CAPMIX(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1637 | |
| 1638 | |
| 1639 | /* |
| 1640 | * ALC880 5-stack model |
| 1641 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1642 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1643 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1644 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1645 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1646 | */ |
| 1647 | |
| 1648 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1649 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1650 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1651 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1652 | { } /* end */ |
| 1653 | }; |
| 1654 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1655 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1656 | /* 6ch mode */ |
| 1657 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1658 | /* set line-in to input, mute it */ |
| 1659 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1660 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1661 | { } /* end */ |
| 1662 | }; |
| 1663 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1664 | /* 8ch mode */ |
| 1665 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1666 | /* set line-in to output, unmute it */ |
| 1667 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1668 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1669 | { } /* end */ |
| 1670 | }; |
| 1671 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1672 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1673 | { 6, alc880_fivestack_ch6_init }, |
| 1674 | { 8, alc880_fivestack_ch8_init }, |
| 1675 | }; |
| 1676 | |
| 1677 | |
| 1678 | /* |
| 1679 | * ALC880 6-stack model |
| 1680 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1681 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1682 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1683 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1684 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1685 | */ |
| 1686 | |
| 1687 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1688 | /* front, rear, clfe, rear_surr */ |
| 1689 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1690 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1691 | |
| 1692 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1693 | .num_items = 4, |
| 1694 | .items = { |
| 1695 | { "Mic", 0x0 }, |
| 1696 | { "Front Mic", 0x1 }, |
| 1697 | { "Line", 0x2 }, |
| 1698 | { "CD", 0x4 }, |
| 1699 | }, |
| 1700 | }; |
| 1701 | |
| 1702 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1703 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1704 | { 8, NULL }, |
| 1705 | }; |
| 1706 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1707 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1708 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1709 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1710 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1711 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1712 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1713 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1714 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1715 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1716 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1717 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1718 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1719 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1720 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1721 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1722 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1724 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1725 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1726 | { |
| 1727 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1728 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1729 | .info = alc_ch_mode_info, |
| 1730 | .get = alc_ch_mode_get, |
| 1731 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1732 | }, |
| 1733 | { } /* end */ |
| 1734 | }; |
| 1735 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1736 | |
| 1737 | /* |
| 1738 | * ALC880 W810 model |
| 1739 | * |
| 1740 | * W810 has rear IO for: |
| 1741 | * Front (DAC 02) |
| 1742 | * Surround (DAC 03) |
| 1743 | * Center/LFE (DAC 04) |
| 1744 | * Digital out (06) |
| 1745 | * |
| 1746 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1747 | * 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] | 1748 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1749 | * There is a variable resistor to control the speaker or headphone |
| 1750 | * volume. This is a hardware-only device without a software API. |
| 1751 | * |
| 1752 | * Plugging headphones in will disable the internal speakers. This is |
| 1753 | * implemented in hardware, not via the driver using jack sense. In |
| 1754 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1755 | * disable both the speakers and headphones. |
| 1756 | * |
| 1757 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1758 | * These may not do anything useful with this driver yet, because I |
| 1759 | * haven't setup any initialization verbs for these yet... |
| 1760 | */ |
| 1761 | |
| 1762 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1763 | /* front, rear/surround, clfe */ |
| 1764 | 0x02, 0x03, 0x04 |
| 1765 | }; |
| 1766 | |
| 1767 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1768 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1769 | { 6, NULL } |
| 1770 | }; |
| 1771 | |
| 1772 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1773 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1774 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1775 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1776 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1777 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1778 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1779 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1780 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1781 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1782 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1783 | { } /* end */ |
| 1784 | }; |
| 1785 | |
| 1786 | |
| 1787 | /* |
| 1788 | * Z710V model |
| 1789 | * |
| 1790 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1791 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1792 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1793 | */ |
| 1794 | |
| 1795 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1796 | 0x02 |
| 1797 | }; |
| 1798 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1799 | |
| 1800 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1801 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1802 | { 2, NULL } |
| 1803 | }; |
| 1804 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1805 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1806 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1807 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1808 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1809 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1810 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1811 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1812 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1813 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1814 | { } /* end */ |
| 1815 | }; |
| 1816 | |
| 1817 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1818 | /* |
| 1819 | * ALC880 F1734 model |
| 1820 | * |
| 1821 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1822 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1823 | */ |
| 1824 | |
| 1825 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1826 | 0x03 |
| 1827 | }; |
| 1828 | #define ALC880_F1734_HP_DAC 0x02 |
| 1829 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1830 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1831 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1832 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1833 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1834 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1835 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1836 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1838 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1839 | { } /* end */ |
| 1840 | }; |
| 1841 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1842 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1843 | .num_items = 2, |
| 1844 | .items = { |
| 1845 | { "Mic", 0x1 }, |
| 1846 | { "CD", 0x4 }, |
| 1847 | }, |
| 1848 | }; |
| 1849 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1850 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1851 | /* |
| 1852 | * ALC880 ASUS model |
| 1853 | * |
| 1854 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1855 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1856 | * Mic = 0x18, Line = 0x1a |
| 1857 | */ |
| 1858 | |
| 1859 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1860 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1861 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1862 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1863 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1864 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1865 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1866 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1867 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1868 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1869 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1870 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1871 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1872 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1873 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1874 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1875 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1876 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1877 | { |
| 1878 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1879 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1880 | .info = alc_ch_mode_info, |
| 1881 | .get = alc_ch_mode_get, |
| 1882 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1883 | }, |
| 1884 | { } /* end */ |
| 1885 | }; |
| 1886 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1887 | /* |
| 1888 | * ALC880 ASUS W1V model |
| 1889 | * |
| 1890 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1891 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1892 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1893 | */ |
| 1894 | |
| 1895 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1896 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1897 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1898 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1899 | { } /* end */ |
| 1900 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1901 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1902 | /* TCL S700 */ |
| 1903 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1904 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1905 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1906 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1907 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1908 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1909 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1910 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1911 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1912 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1913 | { } /* end */ |
| 1914 | }; |
| 1915 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1916 | /* Uniwill */ |
| 1917 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1918 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1919 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1920 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1921 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1922 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1923 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1924 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1925 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1926 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1927 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1928 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1929 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1930 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1931 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1932 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1933 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1934 | { |
| 1935 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1936 | .name = "Channel Mode", |
| 1937 | .info = alc_ch_mode_info, |
| 1938 | .get = alc_ch_mode_get, |
| 1939 | .put = alc_ch_mode_put, |
| 1940 | }, |
| 1941 | { } /* end */ |
| 1942 | }; |
| 1943 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1944 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1945 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1946 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1947 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1948 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1949 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1950 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1951 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1952 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1953 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1954 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1955 | { } /* end */ |
| 1956 | }; |
| 1957 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1958 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1959 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1960 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1961 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1962 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1963 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1964 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1965 | { } /* end */ |
| 1966 | }; |
| 1967 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1968 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1969 | * virtual master controls |
| 1970 | */ |
| 1971 | |
| 1972 | /* |
| 1973 | * slave controls for virtual master |
| 1974 | */ |
| 1975 | static const char *alc_slave_vols[] = { |
| 1976 | "Front Playback Volume", |
| 1977 | "Surround Playback Volume", |
| 1978 | "Center Playback Volume", |
| 1979 | "LFE Playback Volume", |
| 1980 | "Side Playback Volume", |
| 1981 | "Headphone Playback Volume", |
| 1982 | "Speaker Playback Volume", |
| 1983 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1984 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 1985 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1986 | NULL, |
| 1987 | }; |
| 1988 | |
| 1989 | static const char *alc_slave_sws[] = { |
| 1990 | "Front Playback Switch", |
| 1991 | "Surround Playback Switch", |
| 1992 | "Center Playback Switch", |
| 1993 | "LFE Playback Switch", |
| 1994 | "Side Playback Switch", |
| 1995 | "Headphone Playback Switch", |
| 1996 | "Speaker Playback Switch", |
| 1997 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1998 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1999 | NULL, |
| 2000 | }; |
| 2001 | |
| 2002 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2003 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2004 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2005 | |
| 2006 | static void alc_free_kctls(struct hda_codec *codec); |
| 2007 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2008 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2009 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2010 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2011 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2012 | { } /* end */ |
| 2013 | }; |
| 2014 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2015 | static int alc_build_controls(struct hda_codec *codec) |
| 2016 | { |
| 2017 | struct alc_spec *spec = codec->spec; |
| 2018 | int err; |
| 2019 | int i; |
| 2020 | |
| 2021 | for (i = 0; i < spec->num_mixers; i++) { |
| 2022 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2023 | if (err < 0) |
| 2024 | return err; |
| 2025 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2026 | if (spec->cap_mixer) { |
| 2027 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2028 | if (err < 0) |
| 2029 | return err; |
| 2030 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2031 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2032 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2033 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2034 | if (err < 0) |
| 2035 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2036 | if (!spec->no_analog) { |
| 2037 | err = snd_hda_create_spdif_share_sw(codec, |
| 2038 | &spec->multiout); |
| 2039 | if (err < 0) |
| 2040 | return err; |
| 2041 | spec->multiout.share_spdif = 1; |
| 2042 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2043 | } |
| 2044 | if (spec->dig_in_nid) { |
| 2045 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2046 | if (err < 0) |
| 2047 | return err; |
| 2048 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2049 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2050 | /* create beep controls if needed */ |
| 2051 | if (spec->beep_amp) { |
| 2052 | struct snd_kcontrol_new *knew; |
| 2053 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2054 | struct snd_kcontrol *kctl; |
| 2055 | kctl = snd_ctl_new1(knew, codec); |
| 2056 | if (!kctl) |
| 2057 | return -ENOMEM; |
| 2058 | kctl->private_value = spec->beep_amp; |
| 2059 | err = snd_hda_ctl_add(codec, kctl); |
| 2060 | if (err < 0) |
| 2061 | return err; |
| 2062 | } |
| 2063 | } |
| 2064 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2065 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2066 | if (!spec->no_analog && |
| 2067 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2068 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2069 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2070 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2071 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2072 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2073 | if (err < 0) |
| 2074 | return err; |
| 2075 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2076 | if (!spec->no_analog && |
| 2077 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2078 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2079 | NULL, alc_slave_sws); |
| 2080 | if (err < 0) |
| 2081 | return err; |
| 2082 | } |
| 2083 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2084 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2085 | return 0; |
| 2086 | } |
| 2087 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2088 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2089 | /* |
| 2090 | * initialize the codec volumes, etc |
| 2091 | */ |
| 2092 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2093 | /* |
| 2094 | * generic initialization of ADC, input mixers and output mixers |
| 2095 | */ |
| 2096 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2097 | /* |
| 2098 | * Unmute ADC0-2 and set the default input to mic-in |
| 2099 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2100 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2101 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2102 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2103 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2104 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2105 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2106 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2107 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2108 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2109 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2110 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2111 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2112 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2118 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2119 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2120 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2121 | /* |
| 2122 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2123 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2124 | /* set vol=0 to output mixers */ |
| 2125 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2126 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2127 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2128 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2129 | /* set up input amps for analog loopback */ |
| 2130 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2131 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2132 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2133 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2134 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2135 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2136 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2137 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2138 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2139 | |
| 2140 | { } |
| 2141 | }; |
| 2142 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2143 | /* |
| 2144 | * 3-stack pin configuration: |
| 2145 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2146 | */ |
| 2147 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2148 | /* |
| 2149 | * preset connection lists of input pins |
| 2150 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2151 | */ |
| 2152 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2153 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2154 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2155 | |
| 2156 | /* |
| 2157 | * Set pin mode and muting |
| 2158 | */ |
| 2159 | /* set front pin widgets 0x14 for output */ |
| 2160 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2161 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2162 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2163 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2164 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2165 | /* Mic2 (as headphone out) for HP output */ |
| 2166 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2167 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2168 | /* Line In pin widget for input */ |
| 2169 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2170 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2171 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2172 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2173 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2174 | /* CD pin widget for input */ |
| 2175 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2176 | |
| 2177 | { } |
| 2178 | }; |
| 2179 | |
| 2180 | /* |
| 2181 | * 5-stack pin configuration: |
| 2182 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2183 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2184 | */ |
| 2185 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2186 | /* |
| 2187 | * preset connection lists of input pins |
| 2188 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2189 | */ |
| 2190 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2191 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2192 | |
| 2193 | /* |
| 2194 | * Set pin mode and muting |
| 2195 | */ |
| 2196 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2197 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2198 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2199 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2200 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2201 | /* unmute pins for output (no gain on this amp) */ |
| 2202 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2203 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2204 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2205 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2206 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2207 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2208 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2209 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2210 | /* Mic2 (as headphone out) for HP output */ |
| 2211 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2212 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2213 | /* Line In pin widget for input */ |
| 2214 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2215 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2216 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2217 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2218 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2219 | /* CD pin widget for input */ |
| 2220 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2221 | |
| 2222 | { } |
| 2223 | }; |
| 2224 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2225 | /* |
| 2226 | * W810 pin configuration: |
| 2227 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2228 | */ |
| 2229 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2230 | /* hphone/speaker input selector: front DAC */ |
| 2231 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2232 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2233 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2234 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2236 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2237 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2238 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2239 | |
| 2240 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2241 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2242 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2243 | { } |
| 2244 | }; |
| 2245 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2246 | /* |
| 2247 | * Z71V pin configuration: |
| 2248 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2249 | */ |
| 2250 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2251 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2252 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2253 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2254 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2255 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2256 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2257 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2258 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2259 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2260 | |
| 2261 | { } |
| 2262 | }; |
| 2263 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2264 | /* |
| 2265 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2266 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2267 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2268 | */ |
| 2269 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2270 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2271 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2272 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2273 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2274 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2275 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2276 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2277 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2278 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2279 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2280 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2281 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2282 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2283 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2284 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2285 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2286 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2287 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2288 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2289 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2290 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2291 | { } |
| 2292 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2293 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2294 | /* |
| 2295 | * Uniwill pin configuration: |
| 2296 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2297 | * line = 0x1a |
| 2298 | */ |
| 2299 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2300 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2301 | |
| 2302 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2303 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2304 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2305 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2306 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2307 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2308 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2309 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2310 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2311 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2312 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2313 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2314 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2315 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2316 | |
| 2317 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2318 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2319 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2320 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2321 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2322 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2323 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2324 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2325 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2326 | |
| 2327 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2328 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2329 | |
| 2330 | { } |
| 2331 | }; |
| 2332 | |
| 2333 | /* |
| 2334 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2335 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2336 | */ |
| 2337 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2338 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2339 | |
| 2340 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2341 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2342 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2343 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2344 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2345 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2346 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2347 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2348 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2349 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2350 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2351 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2352 | |
| 2353 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2354 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2355 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2356 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2357 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2358 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2359 | |
| 2360 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2361 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2362 | |
| 2363 | { } |
| 2364 | }; |
| 2365 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2366 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2367 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2368 | { } |
| 2369 | }; |
| 2370 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2371 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2372 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2373 | { |
| 2374 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2375 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2376 | |
| 2377 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2378 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2379 | bits = present ? HDA_AMP_MUTE : 0; |
| 2380 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 2381 | HDA_AMP_MUTE, bits); |
| 2382 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 2383 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2384 | } |
| 2385 | |
| 2386 | /* auto-toggle front mic */ |
| 2387 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2388 | { |
| 2389 | unsigned int present; |
| 2390 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2391 | |
| 2392 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2393 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2394 | bits = present ? HDA_AMP_MUTE : 0; |
| 2395 | 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] | 2396 | } |
| 2397 | |
| 2398 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 2399 | { |
| 2400 | alc880_uniwill_hp_automute(codec); |
| 2401 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2402 | } |
| 2403 | |
| 2404 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2405 | unsigned int res) |
| 2406 | { |
| 2407 | /* Looks like the unsol event is incompatible with the standard |
| 2408 | * definition. 4bit tag is placed at 28 bit! |
| 2409 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2410 | switch (res >> 28) { |
| 2411 | case ALC880_HP_EVENT: |
| 2412 | alc880_uniwill_hp_automute(codec); |
| 2413 | break; |
| 2414 | case ALC880_MIC_EVENT: |
| 2415 | alc880_uniwill_mic_automute(codec); |
| 2416 | break; |
| 2417 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2418 | } |
| 2419 | |
| 2420 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 2421 | { |
| 2422 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2423 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2424 | |
| 2425 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2426 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2427 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 2428 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2429 | } |
| 2430 | |
| 2431 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2432 | { |
| 2433 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2434 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2435 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2436 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2437 | present &= HDA_AMP_VOLMASK; |
| 2438 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2439 | HDA_AMP_VOLMASK, present); |
| 2440 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2441 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2442 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2443 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2444 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2445 | unsigned int res) |
| 2446 | { |
| 2447 | /* Looks like the unsol event is incompatible with the standard |
| 2448 | * definition. 4bit tag is placed at 28 bit! |
| 2449 | */ |
| 2450 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2451 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2452 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2453 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2454 | } |
| 2455 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2456 | /* |
| 2457 | * F1734 pin configuration: |
| 2458 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2459 | */ |
| 2460 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2461 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2462 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2463 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2464 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2465 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2466 | |
| 2467 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2468 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2469 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2470 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2471 | |
| 2472 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2473 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2474 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2475 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2476 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2477 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2478 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2479 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2480 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2481 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2482 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2483 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2484 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2485 | { } |
| 2486 | }; |
| 2487 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2488 | /* |
| 2489 | * ASUS pin configuration: |
| 2490 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2491 | */ |
| 2492 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2493 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2494 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2495 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2496 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2497 | |
| 2498 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2499 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2500 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2501 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2502 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2503 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2504 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2506 | |
| 2507 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2509 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2510 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2511 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2512 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2513 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2514 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2515 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2516 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2517 | { } |
| 2518 | }; |
| 2519 | |
| 2520 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2521 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2522 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2523 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2524 | /* Clevo m520g init */ |
| 2525 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2526 | /* headphone output */ |
| 2527 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2528 | /* line-out */ |
| 2529 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2530 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2531 | /* Line-in */ |
| 2532 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2533 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2534 | /* CD */ |
| 2535 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2536 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2537 | /* Mic1 (rear panel) */ |
| 2538 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2539 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2540 | /* Mic2 (front panel) */ |
| 2541 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2542 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2543 | /* headphone */ |
| 2544 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2545 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2546 | /* change to EAPD mode */ |
| 2547 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2548 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2549 | |
| 2550 | { } |
| 2551 | }; |
| 2552 | |
| 2553 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2554 | /* change to EAPD mode */ |
| 2555 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2556 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2557 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2558 | /* Headphone output */ |
| 2559 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2560 | /* Front output*/ |
| 2561 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2562 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2563 | |
| 2564 | /* Line In pin widget for input */ |
| 2565 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2566 | /* CD pin widget for input */ |
| 2567 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2568 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2569 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2570 | |
| 2571 | /* change to EAPD mode */ |
| 2572 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2573 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2574 | |
| 2575 | { } |
| 2576 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2577 | |
| 2578 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2579 | * LG m1 express dual |
| 2580 | * |
| 2581 | * Pin assignment: |
| 2582 | * Rear Line-In/Out (blue): 0x14 |
| 2583 | * Build-in Mic-In: 0x15 |
| 2584 | * Speaker-out: 0x17 |
| 2585 | * HP-Out (green): 0x1b |
| 2586 | * Mic-In/Out (red): 0x19 |
| 2587 | * SPDIF-Out: 0x1e |
| 2588 | */ |
| 2589 | |
| 2590 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2591 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2592 | 0x05, 0x02, 0x03 |
| 2593 | }; |
| 2594 | |
| 2595 | /* seems analog CD is not working */ |
| 2596 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2597 | .num_items = 3, |
| 2598 | .items = { |
| 2599 | { "Mic", 0x1 }, |
| 2600 | { "Line", 0x5 }, |
| 2601 | { "Internal Mic", 0x6 }, |
| 2602 | }, |
| 2603 | }; |
| 2604 | |
| 2605 | /* 2,4,6 channel modes */ |
| 2606 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2607 | /* set line-in and mic-in to input */ |
| 2608 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2609 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2610 | { } |
| 2611 | }; |
| 2612 | |
| 2613 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2614 | /* set line-in to out and mic-in to input */ |
| 2615 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2616 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2617 | { } |
| 2618 | }; |
| 2619 | |
| 2620 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2621 | /* set line-in and mic-in to output */ |
| 2622 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2623 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2624 | { } |
| 2625 | }; |
| 2626 | |
| 2627 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2628 | { 2, alc880_lg_ch2_init }, |
| 2629 | { 4, alc880_lg_ch4_init }, |
| 2630 | { 6, alc880_lg_ch6_init }, |
| 2631 | }; |
| 2632 | |
| 2633 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2634 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2635 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2636 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2637 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2638 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2639 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2640 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2641 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2642 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2643 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2644 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2645 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2646 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2647 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2648 | { |
| 2649 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2650 | .name = "Channel Mode", |
| 2651 | .info = alc_ch_mode_info, |
| 2652 | .get = alc_ch_mode_get, |
| 2653 | .put = alc_ch_mode_put, |
| 2654 | }, |
| 2655 | { } /* end */ |
| 2656 | }; |
| 2657 | |
| 2658 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2659 | /* set capture source to mic-in */ |
| 2660 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2661 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2662 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2663 | /* mute all amp mixer inputs */ |
| 2664 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2665 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2666 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2667 | /* line-in to input */ |
| 2668 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2669 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2670 | /* built-in mic */ |
| 2671 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2672 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2673 | /* speaker-out */ |
| 2674 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2675 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2676 | /* mic-in to input */ |
| 2677 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2678 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2679 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2680 | /* HP-out */ |
| 2681 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2682 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2683 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2684 | /* jack sense */ |
| 2685 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2686 | { } |
| 2687 | }; |
| 2688 | |
| 2689 | /* toggle speaker-output according to the hp-jack state */ |
| 2690 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2691 | { |
| 2692 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2693 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2694 | |
| 2695 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2696 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2697 | bits = present ? HDA_AMP_MUTE : 0; |
| 2698 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2699 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2700 | } |
| 2701 | |
| 2702 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2703 | { |
| 2704 | /* Looks like the unsol event is incompatible with the standard |
| 2705 | * definition. 4bit tag is placed at 28 bit! |
| 2706 | */ |
| 2707 | if ((res >> 28) == 0x01) |
| 2708 | alc880_lg_automute(codec); |
| 2709 | } |
| 2710 | |
| 2711 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2712 | * LG LW20 |
| 2713 | * |
| 2714 | * Pin assignment: |
| 2715 | * Speaker-out: 0x14 |
| 2716 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2717 | * Built-in Mic-In: 0x19 |
| 2718 | * Line-In: 0x1b |
| 2719 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2720 | * SPDIF-Out: 0x1e |
| 2721 | */ |
| 2722 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2723 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2724 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2725 | .items = { |
| 2726 | { "Mic", 0x0 }, |
| 2727 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2728 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2729 | }, |
| 2730 | }; |
| 2731 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2732 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2733 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2734 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2735 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2736 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2737 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2738 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2739 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2740 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2741 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2742 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2743 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2744 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2745 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2746 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2747 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2748 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2749 | { |
| 2750 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2751 | .name = "Channel Mode", |
| 2752 | .info = alc_ch_mode_info, |
| 2753 | .get = alc_ch_mode_get, |
| 2754 | .put = alc_ch_mode_put, |
| 2755 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2756 | { } /* end */ |
| 2757 | }; |
| 2758 | |
| 2759 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2760 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2761 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2762 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2763 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2764 | /* set capture source to mic-in */ |
| 2765 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2766 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2767 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2768 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2769 | /* speaker-out */ |
| 2770 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2771 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2772 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2773 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2774 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2775 | /* mic-in to input */ |
| 2776 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2777 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2778 | /* built-in mic */ |
| 2779 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2780 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2781 | /* jack sense */ |
| 2782 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2783 | { } |
| 2784 | }; |
| 2785 | |
| 2786 | /* toggle speaker-output according to the hp-jack state */ |
| 2787 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2788 | { |
| 2789 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2790 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2791 | |
| 2792 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2793 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2794 | bits = present ? HDA_AMP_MUTE : 0; |
| 2795 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2796 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2797 | } |
| 2798 | |
| 2799 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2800 | { |
| 2801 | /* Looks like the unsol event is incompatible with the standard |
| 2802 | * definition. 4bit tag is placed at 28 bit! |
| 2803 | */ |
| 2804 | if ((res >> 28) == 0x01) |
| 2805 | alc880_lg_lw_automute(codec); |
| 2806 | } |
| 2807 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2808 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2809 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2810 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2811 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2812 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2813 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2814 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2815 | { } /* end */ |
| 2816 | }; |
| 2817 | |
| 2818 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2819 | .num_items = 2, |
| 2820 | .items = { |
| 2821 | { "Mic", 0x0 }, |
| 2822 | { "Internal Mic", 0x1 }, |
| 2823 | }, |
| 2824 | }; |
| 2825 | |
| 2826 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2827 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2828 | |
| 2829 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2830 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2831 | |
| 2832 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2833 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2834 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2835 | /* Mic2 (as headphone out) for HP output */ |
| 2836 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2837 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2838 | /* Internal Speaker */ |
| 2839 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2840 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2841 | |
| 2842 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2843 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2844 | |
| 2845 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2846 | { } |
| 2847 | }; |
| 2848 | |
| 2849 | /* toggle speaker-output according to the hp-jack state */ |
| 2850 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2851 | { |
| 2852 | unsigned int present; |
| 2853 | unsigned char bits; |
| 2854 | |
| 2855 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2856 | AC_VERB_GET_PIN_SENSE, 0) |
| 2857 | & AC_PINSENSE_PRESENCE; |
| 2858 | bits = present ? HDA_AMP_MUTE : 0; |
| 2859 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2860 | HDA_AMP_MUTE, bits); |
| 2861 | if (present) |
| 2862 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2863 | else |
| 2864 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2865 | } |
| 2866 | |
| 2867 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2868 | unsigned int res) |
| 2869 | { |
| 2870 | /* Looks like the unsol event is incompatible with the standard |
| 2871 | * definition. 4bit tag is placed at 28 bit! |
| 2872 | */ |
| 2873 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2874 | alc880_medion_rim_automute(codec); |
| 2875 | } |
| 2876 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2877 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2878 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2879 | { 0x0b, HDA_INPUT, 0 }, |
| 2880 | { 0x0b, HDA_INPUT, 1 }, |
| 2881 | { 0x0b, HDA_INPUT, 2 }, |
| 2882 | { 0x0b, HDA_INPUT, 3 }, |
| 2883 | { 0x0b, HDA_INPUT, 4 }, |
| 2884 | { } /* end */ |
| 2885 | }; |
| 2886 | |
| 2887 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2888 | { 0x0b, HDA_INPUT, 1 }, |
| 2889 | { 0x0b, HDA_INPUT, 6 }, |
| 2890 | { 0x0b, HDA_INPUT, 7 }, |
| 2891 | { } /* end */ |
| 2892 | }; |
| 2893 | #endif |
| 2894 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2895 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2896 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2897 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2898 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2899 | static int alc_init(struct hda_codec *codec) |
| 2900 | { |
| 2901 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2902 | unsigned int i; |
| 2903 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2904 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2905 | if (codec->vendor_id == 0x10ec0888) |
| 2906 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2907 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2908 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2909 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2910 | |
| 2911 | if (spec->init_hook) |
| 2912 | spec->init_hook(codec); |
| 2913 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2914 | return 0; |
| 2915 | } |
| 2916 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2917 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2918 | { |
| 2919 | struct alc_spec *spec = codec->spec; |
| 2920 | |
| 2921 | if (spec->unsol_event) |
| 2922 | spec->unsol_event(codec, res); |
| 2923 | } |
| 2924 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2925 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2926 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2927 | { |
| 2928 | struct alc_spec *spec = codec->spec; |
| 2929 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2930 | } |
| 2931 | #endif |
| 2932 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2933 | /* |
| 2934 | * Analog playback callbacks |
| 2935 | */ |
| 2936 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2937 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2938 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2939 | { |
| 2940 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2941 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2942 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2943 | } |
| 2944 | |
| 2945 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2946 | struct hda_codec *codec, |
| 2947 | unsigned int stream_tag, |
| 2948 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2949 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2950 | { |
| 2951 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2952 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2953 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2954 | } |
| 2955 | |
| 2956 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2957 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2958 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2959 | { |
| 2960 | struct alc_spec *spec = codec->spec; |
| 2961 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2962 | } |
| 2963 | |
| 2964 | /* |
| 2965 | * Digital out |
| 2966 | */ |
| 2967 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2968 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2969 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2970 | { |
| 2971 | struct alc_spec *spec = codec->spec; |
| 2972 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2973 | } |
| 2974 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2975 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2976 | struct hda_codec *codec, |
| 2977 | unsigned int stream_tag, |
| 2978 | unsigned int format, |
| 2979 | struct snd_pcm_substream *substream) |
| 2980 | { |
| 2981 | struct alc_spec *spec = codec->spec; |
| 2982 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2983 | stream_tag, format, substream); |
| 2984 | } |
| 2985 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 2986 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2987 | struct hda_codec *codec, |
| 2988 | struct snd_pcm_substream *substream) |
| 2989 | { |
| 2990 | struct alc_spec *spec = codec->spec; |
| 2991 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 2992 | } |
| 2993 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2994 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2995 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2996 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2997 | { |
| 2998 | struct alc_spec *spec = codec->spec; |
| 2999 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3000 | } |
| 3001 | |
| 3002 | /* |
| 3003 | * Analog capture |
| 3004 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3005 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3006 | struct hda_codec *codec, |
| 3007 | unsigned int stream_tag, |
| 3008 | unsigned int format, |
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; |
| 3012 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3013 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3014 | stream_tag, 0, format); |
| 3015 | return 0; |
| 3016 | } |
| 3017 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3018 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3019 | struct hda_codec *codec, |
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; |
| 3023 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3024 | snd_hda_codec_cleanup_stream(codec, |
| 3025 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3026 | return 0; |
| 3027 | } |
| 3028 | |
| 3029 | |
| 3030 | /* |
| 3031 | */ |
| 3032 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3033 | .substreams = 1, |
| 3034 | .channels_min = 2, |
| 3035 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3036 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3037 | .ops = { |
| 3038 | .open = alc880_playback_pcm_open, |
| 3039 | .prepare = alc880_playback_pcm_prepare, |
| 3040 | .cleanup = alc880_playback_pcm_cleanup |
| 3041 | }, |
| 3042 | }; |
| 3043 | |
| 3044 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3045 | .substreams = 1, |
| 3046 | .channels_min = 2, |
| 3047 | .channels_max = 2, |
| 3048 | /* NID is set in alc_build_pcms */ |
| 3049 | }; |
| 3050 | |
| 3051 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3052 | .substreams = 1, |
| 3053 | .channels_min = 2, |
| 3054 | .channels_max = 2, |
| 3055 | /* NID is set in alc_build_pcms */ |
| 3056 | }; |
| 3057 | |
| 3058 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3059 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3060 | .channels_min = 2, |
| 3061 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3062 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3063 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3064 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3065 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3066 | }, |
| 3067 | }; |
| 3068 | |
| 3069 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3070 | .substreams = 1, |
| 3071 | .channels_min = 2, |
| 3072 | .channels_max = 2, |
| 3073 | /* NID is set in alc_build_pcms */ |
| 3074 | .ops = { |
| 3075 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3076 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3077 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3078 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3079 | }, |
| 3080 | }; |
| 3081 | |
| 3082 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3083 | .substreams = 1, |
| 3084 | .channels_min = 2, |
| 3085 | .channels_max = 2, |
| 3086 | /* NID is set in alc_build_pcms */ |
| 3087 | }; |
| 3088 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3089 | /* 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] | 3090 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3091 | .substreams = 0, |
| 3092 | .channels_min = 0, |
| 3093 | .channels_max = 0, |
| 3094 | }; |
| 3095 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3096 | static int alc_build_pcms(struct hda_codec *codec) |
| 3097 | { |
| 3098 | struct alc_spec *spec = codec->spec; |
| 3099 | struct hda_pcm *info = spec->pcm_rec; |
| 3100 | int i; |
| 3101 | |
| 3102 | codec->num_pcms = 1; |
| 3103 | codec->pcm_info = info; |
| 3104 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3105 | if (spec->no_analog) |
| 3106 | goto skip_analog; |
| 3107 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3108 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3109 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3110 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3111 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3112 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3113 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3114 | } |
| 3115 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3116 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3117 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3118 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3119 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3120 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3121 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3122 | if (spec->channel_mode) { |
| 3123 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3124 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3125 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3126 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3127 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3128 | } |
| 3129 | } |
| 3130 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3131 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3132 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3133 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3134 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3135 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3136 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3137 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3138 | if (spec->dig_out_type) |
| 3139 | info->pcm_type = spec->dig_out_type; |
| 3140 | else |
| 3141 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3142 | if (spec->multiout.dig_out_nid && |
| 3143 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3144 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3145 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3146 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3147 | if (spec->dig_in_nid && |
| 3148 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3149 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3150 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3151 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3152 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3153 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3154 | } |
| 3155 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3156 | if (spec->no_analog) |
| 3157 | return 0; |
| 3158 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3159 | /* If the use of more than one ADC is requested for the current |
| 3160 | * model, configure a second analog capture-only PCM. |
| 3161 | */ |
| 3162 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3163 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3164 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3165 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3166 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3167 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3168 | if (spec->alt_dac_nid) { |
| 3169 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3170 | *spec->stream_analog_alt_playback; |
| 3171 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3172 | spec->alt_dac_nid; |
| 3173 | } else { |
| 3174 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3175 | alc_pcm_null_stream; |
| 3176 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3177 | } |
| 3178 | if (spec->num_adc_nids > 1) { |
| 3179 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3180 | *spec->stream_analog_alt_capture; |
| 3181 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3182 | spec->adc_nids[1]; |
| 3183 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3184 | spec->num_adc_nids - 1; |
| 3185 | } else { |
| 3186 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3187 | alc_pcm_null_stream; |
| 3188 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3189 | } |
| 3190 | } |
| 3191 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3192 | return 0; |
| 3193 | } |
| 3194 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3195 | static void alc_free_kctls(struct hda_codec *codec) |
| 3196 | { |
| 3197 | struct alc_spec *spec = codec->spec; |
| 3198 | |
| 3199 | if (spec->kctls.list) { |
| 3200 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3201 | int i; |
| 3202 | for (i = 0; i < spec->kctls.used; i++) |
| 3203 | kfree(kctl[i].name); |
| 3204 | } |
| 3205 | snd_array_free(&spec->kctls); |
| 3206 | } |
| 3207 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3208 | static void alc_free(struct hda_codec *codec) |
| 3209 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3210 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3211 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3212 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3213 | return; |
| 3214 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3215 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3216 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3217 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3218 | } |
| 3219 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3220 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3221 | static int alc_resume(struct hda_codec *codec) |
| 3222 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3223 | codec->patch_ops.init(codec); |
| 3224 | snd_hda_codec_resume_amp(codec); |
| 3225 | snd_hda_codec_resume_cache(codec); |
| 3226 | return 0; |
| 3227 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3228 | #endif |
| 3229 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3230 | /* |
| 3231 | */ |
| 3232 | static struct hda_codec_ops alc_patch_ops = { |
| 3233 | .build_controls = alc_build_controls, |
| 3234 | .build_pcms = alc_build_pcms, |
| 3235 | .init = alc_init, |
| 3236 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3237 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3238 | #ifdef SND_HDA_NEEDS_RESUME |
| 3239 | .resume = alc_resume, |
| 3240 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3241 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3242 | .check_power_status = alc_check_power_status, |
| 3243 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3244 | }; |
| 3245 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3246 | |
| 3247 | /* |
| 3248 | * Test configuration for debugging |
| 3249 | * |
| 3250 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3251 | * enum controls. |
| 3252 | */ |
| 3253 | #ifdef CONFIG_SND_DEBUG |
| 3254 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3255 | 0x02, 0x03, 0x04, 0x05 |
| 3256 | }; |
| 3257 | |
| 3258 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3259 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3260 | .items = { |
| 3261 | { "In-1", 0x0 }, |
| 3262 | { "In-2", 0x1 }, |
| 3263 | { "In-3", 0x2 }, |
| 3264 | { "In-4", 0x3 }, |
| 3265 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3266 | { "Front", 0x5 }, |
| 3267 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3268 | }, |
| 3269 | }; |
| 3270 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3271 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3272 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3273 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3274 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3275 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3276 | }; |
| 3277 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3278 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3279 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3280 | { |
| 3281 | static char *texts[] = { |
| 3282 | "N/A", "Line Out", "HP Out", |
| 3283 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3284 | }; |
| 3285 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3286 | uinfo->count = 1; |
| 3287 | uinfo->value.enumerated.items = 8; |
| 3288 | if (uinfo->value.enumerated.item >= 8) |
| 3289 | uinfo->value.enumerated.item = 7; |
| 3290 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3291 | return 0; |
| 3292 | } |
| 3293 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3294 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3295 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3296 | { |
| 3297 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3298 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3299 | unsigned int pin_ctl, item = 0; |
| 3300 | |
| 3301 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3302 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3303 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3304 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3305 | item = 2; |
| 3306 | else |
| 3307 | item = 1; |
| 3308 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3309 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3310 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3311 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3312 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3313 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3314 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3315 | } |
| 3316 | } |
| 3317 | ucontrol->value.enumerated.item[0] = item; |
| 3318 | return 0; |
| 3319 | } |
| 3320 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3321 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3322 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3323 | { |
| 3324 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3325 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3326 | static unsigned int ctls[] = { |
| 3327 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3328 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3329 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3330 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3331 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3332 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3333 | }; |
| 3334 | unsigned int old_ctl, new_ctl; |
| 3335 | |
| 3336 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3337 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3338 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3339 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3340 | int val; |
| 3341 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3342 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3343 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3344 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3345 | HDA_AMP_MUTE : 0; |
| 3346 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3347 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3348 | return 1; |
| 3349 | } |
| 3350 | return 0; |
| 3351 | } |
| 3352 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3353 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3354 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3355 | { |
| 3356 | static char *texts[] = { |
| 3357 | "Front", "Surround", "CLFE", "Side" |
| 3358 | }; |
| 3359 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3360 | uinfo->count = 1; |
| 3361 | uinfo->value.enumerated.items = 4; |
| 3362 | if (uinfo->value.enumerated.item >= 4) |
| 3363 | uinfo->value.enumerated.item = 3; |
| 3364 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3365 | return 0; |
| 3366 | } |
| 3367 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3368 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3369 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3370 | { |
| 3371 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3372 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3373 | unsigned int sel; |
| 3374 | |
| 3375 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3376 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3377 | return 0; |
| 3378 | } |
| 3379 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3380 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3381 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3382 | { |
| 3383 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3384 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3385 | unsigned int sel; |
| 3386 | |
| 3387 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3388 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3389 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3390 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3391 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3392 | return 1; |
| 3393 | } |
| 3394 | return 0; |
| 3395 | } |
| 3396 | |
| 3397 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3398 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3399 | .name = xname, \ |
| 3400 | .info = alc_test_pin_ctl_info, \ |
| 3401 | .get = alc_test_pin_ctl_get, \ |
| 3402 | .put = alc_test_pin_ctl_put, \ |
| 3403 | .private_value = nid \ |
| 3404 | } |
| 3405 | |
| 3406 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3407 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3408 | .name = xname, \ |
| 3409 | .info = alc_test_pin_src_info, \ |
| 3410 | .get = alc_test_pin_src_get, \ |
| 3411 | .put = alc_test_pin_src_put, \ |
| 3412 | .private_value = nid \ |
| 3413 | } |
| 3414 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3415 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3416 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3417 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3418 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3419 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3420 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3421 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3422 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3423 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3424 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3425 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3426 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3427 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3428 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3429 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3430 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3431 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3432 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3433 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3434 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3435 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3436 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3437 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3438 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3439 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3440 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3441 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3442 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3443 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3444 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3445 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3446 | { |
| 3447 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3448 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3449 | .info = alc_ch_mode_info, |
| 3450 | .get = alc_ch_mode_get, |
| 3451 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3452 | }, |
| 3453 | { } /* end */ |
| 3454 | }; |
| 3455 | |
| 3456 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3457 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3458 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3459 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3460 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3461 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3462 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3463 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3464 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3465 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3466 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3467 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3468 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3469 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3470 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3471 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3472 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3473 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3474 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3475 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3476 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3477 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3478 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3479 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3480 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3481 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3482 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3483 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3484 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3485 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3486 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3487 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3488 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3489 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3490 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3491 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3492 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3493 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3494 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3495 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3496 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3497 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3498 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3499 | /* Analog input/passthru */ |
| 3500 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3501 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3502 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3503 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3504 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3505 | { } |
| 3506 | }; |
| 3507 | #endif |
| 3508 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3509 | /* |
| 3510 | */ |
| 3511 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3512 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3513 | [ALC880_3ST] = "3stack", |
| 3514 | [ALC880_TCL_S700] = "tcl", |
| 3515 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3516 | [ALC880_CLEVO] = "clevo", |
| 3517 | [ALC880_5ST] = "5stack", |
| 3518 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3519 | [ALC880_W810] = "w810", |
| 3520 | [ALC880_Z71V] = "z71v", |
| 3521 | [ALC880_6ST] = "6stack", |
| 3522 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3523 | [ALC880_ASUS] = "asus", |
| 3524 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3525 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3526 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3527 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3528 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3529 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3530 | [ALC880_F1734] = "F1734", |
| 3531 | [ALC880_LG] = "lg", |
| 3532 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3533 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3534 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3535 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3536 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3537 | [ALC880_AUTO] = "auto", |
| 3538 | }; |
| 3539 | |
| 3540 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3541 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3542 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3543 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3544 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3545 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3546 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3547 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3548 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3549 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3550 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3551 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3552 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3553 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3554 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3555 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3556 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3557 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3558 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3559 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3560 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3561 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3562 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3563 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3564 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3565 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3566 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3567 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3568 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3569 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3570 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3571 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3572 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3573 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3574 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3575 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3576 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3577 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3578 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3579 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3580 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3581 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3582 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3583 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3584 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3585 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3586 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3587 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3588 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3589 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3590 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3591 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3592 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3593 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3594 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3595 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3596 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3597 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3598 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3599 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3600 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3601 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3602 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3603 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3604 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3605 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3606 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3607 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3608 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3609 | /* default Intel */ |
| 3610 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3611 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3612 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3613 | {} |
| 3614 | }; |
| 3615 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3616 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3617 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3618 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3619 | static struct alc_config_preset alc880_presets[] = { |
| 3620 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3621 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3622 | .init_verbs = { alc880_volume_init_verbs, |
| 3623 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3624 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3625 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3626 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3627 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3628 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3629 | .input_mux = &alc880_capture_source, |
| 3630 | }, |
| 3631 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3632 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3633 | .init_verbs = { alc880_volume_init_verbs, |
| 3634 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3635 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3636 | .dac_nids = alc880_dac_nids, |
| 3637 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3638 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3639 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3640 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3641 | .input_mux = &alc880_capture_source, |
| 3642 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3643 | [ALC880_TCL_S700] = { |
| 3644 | .mixers = { alc880_tcl_s700_mixer }, |
| 3645 | .init_verbs = { alc880_volume_init_verbs, |
| 3646 | alc880_pin_tcl_S700_init_verbs, |
| 3647 | alc880_gpio2_init_verbs }, |
| 3648 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3649 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3650 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3651 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3652 | .hp_nid = 0x03, |
| 3653 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3654 | .channel_mode = alc880_2_jack_modes, |
| 3655 | .input_mux = &alc880_capture_source, |
| 3656 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3657 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3658 | .mixers = { alc880_three_stack_mixer, |
| 3659 | alc880_five_stack_mixer}, |
| 3660 | .init_verbs = { alc880_volume_init_verbs, |
| 3661 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3662 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3663 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3664 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3665 | .channel_mode = alc880_fivestack_modes, |
| 3666 | .input_mux = &alc880_capture_source, |
| 3667 | }, |
| 3668 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3669 | .mixers = { alc880_three_stack_mixer, |
| 3670 | alc880_five_stack_mixer }, |
| 3671 | .init_verbs = { alc880_volume_init_verbs, |
| 3672 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3673 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3674 | .dac_nids = alc880_dac_nids, |
| 3675 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3676 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3677 | .channel_mode = alc880_fivestack_modes, |
| 3678 | .input_mux = &alc880_capture_source, |
| 3679 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3680 | [ALC880_6ST] = { |
| 3681 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3682 | .init_verbs = { alc880_volume_init_verbs, |
| 3683 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3684 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3685 | .dac_nids = alc880_6st_dac_nids, |
| 3686 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3687 | .channel_mode = alc880_sixstack_modes, |
| 3688 | .input_mux = &alc880_6stack_capture_source, |
| 3689 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3690 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3691 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3692 | .init_verbs = { alc880_volume_init_verbs, |
| 3693 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3694 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3695 | .dac_nids = alc880_6st_dac_nids, |
| 3696 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3697 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3698 | .channel_mode = alc880_sixstack_modes, |
| 3699 | .input_mux = &alc880_6stack_capture_source, |
| 3700 | }, |
| 3701 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3702 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3703 | .init_verbs = { alc880_volume_init_verbs, |
| 3704 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3705 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3706 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3707 | .dac_nids = alc880_w810_dac_nids, |
| 3708 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3709 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3710 | .channel_mode = alc880_w810_modes, |
| 3711 | .input_mux = &alc880_capture_source, |
| 3712 | }, |
| 3713 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3714 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3715 | .init_verbs = { alc880_volume_init_verbs, |
| 3716 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3717 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3718 | .dac_nids = alc880_z71v_dac_nids, |
| 3719 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3720 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3721 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3722 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3723 | .input_mux = &alc880_capture_source, |
| 3724 | }, |
| 3725 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3726 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3727 | .init_verbs = { alc880_volume_init_verbs, |
| 3728 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3729 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3730 | .dac_nids = alc880_f1734_dac_nids, |
| 3731 | .hp_nid = 0x02, |
| 3732 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3733 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3734 | .input_mux = &alc880_f1734_capture_source, |
| 3735 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3736 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3737 | }, |
| 3738 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3739 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3740 | .init_verbs = { alc880_volume_init_verbs, |
| 3741 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3742 | alc880_gpio1_init_verbs }, |
| 3743 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3744 | .dac_nids = alc880_asus_dac_nids, |
| 3745 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3746 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3747 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3748 | .input_mux = &alc880_capture_source, |
| 3749 | }, |
| 3750 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3751 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3752 | .init_verbs = { alc880_volume_init_verbs, |
| 3753 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3754 | alc880_gpio1_init_verbs }, |
| 3755 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3756 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3757 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3758 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3759 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3760 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3761 | .input_mux = &alc880_capture_source, |
| 3762 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3763 | [ALC880_ASUS_DIG2] = { |
| 3764 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3765 | .init_verbs = { alc880_volume_init_verbs, |
| 3766 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3767 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3768 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3769 | .dac_nids = alc880_asus_dac_nids, |
| 3770 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3771 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3772 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3773 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3774 | .input_mux = &alc880_capture_source, |
| 3775 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3776 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3777 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3778 | .init_verbs = { alc880_volume_init_verbs, |
| 3779 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3780 | alc880_gpio1_init_verbs }, |
| 3781 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3782 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3783 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3784 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3785 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3786 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3787 | .input_mux = &alc880_capture_source, |
| 3788 | }, |
| 3789 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3790 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3791 | .init_verbs = { alc880_volume_init_verbs, |
| 3792 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3793 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3794 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3795 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3796 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3797 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3798 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3799 | .input_mux = &alc880_capture_source, |
| 3800 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3801 | [ALC880_UNIWILL] = { |
| 3802 | .mixers = { alc880_uniwill_mixer }, |
| 3803 | .init_verbs = { alc880_volume_init_verbs, |
| 3804 | alc880_uniwill_init_verbs }, |
| 3805 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3806 | .dac_nids = alc880_asus_dac_nids, |
| 3807 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3808 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3809 | .channel_mode = alc880_threestack_modes, |
| 3810 | .need_dac_fix = 1, |
| 3811 | .input_mux = &alc880_capture_source, |
| 3812 | .unsol_event = alc880_uniwill_unsol_event, |
| 3813 | .init_hook = alc880_uniwill_automute, |
| 3814 | }, |
| 3815 | [ALC880_UNIWILL_P53] = { |
| 3816 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3817 | .init_verbs = { alc880_volume_init_verbs, |
| 3818 | alc880_uniwill_p53_init_verbs }, |
| 3819 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3820 | .dac_nids = alc880_asus_dac_nids, |
| 3821 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3822 | .channel_mode = alc880_threestack_modes, |
| 3823 | .input_mux = &alc880_capture_source, |
| 3824 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3825 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3826 | }, |
| 3827 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3828 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3829 | .init_verbs = { alc880_volume_init_verbs, |
| 3830 | alc880_uniwill_p53_init_verbs, |
| 3831 | alc880_beep_init_verbs }, |
| 3832 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3833 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3834 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3835 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3836 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3837 | .input_mux = &alc880_capture_source, |
| 3838 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3839 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3840 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3841 | [ALC880_CLEVO] = { |
| 3842 | .mixers = { alc880_three_stack_mixer }, |
| 3843 | .init_verbs = { alc880_volume_init_verbs, |
| 3844 | alc880_pin_clevo_init_verbs }, |
| 3845 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3846 | .dac_nids = alc880_dac_nids, |
| 3847 | .hp_nid = 0x03, |
| 3848 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3849 | .channel_mode = alc880_threestack_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 | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3853 | [ALC880_LG] = { |
| 3854 | .mixers = { alc880_lg_mixer }, |
| 3855 | .init_verbs = { alc880_volume_init_verbs, |
| 3856 | alc880_lg_init_verbs }, |
| 3857 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3858 | .dac_nids = alc880_lg_dac_nids, |
| 3859 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3860 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3861 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3862 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3863 | .input_mux = &alc880_lg_capture_source, |
| 3864 | .unsol_event = alc880_lg_unsol_event, |
| 3865 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3866 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3867 | .loopbacks = alc880_lg_loopbacks, |
| 3868 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3869 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3870 | [ALC880_LG_LW] = { |
| 3871 | .mixers = { alc880_lg_lw_mixer }, |
| 3872 | .init_verbs = { alc880_volume_init_verbs, |
| 3873 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3874 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3875 | .dac_nids = alc880_dac_nids, |
| 3876 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3877 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3878 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3879 | .input_mux = &alc880_lg_lw_capture_source, |
| 3880 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3881 | .init_hook = alc880_lg_lw_automute, |
| 3882 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3883 | [ALC880_MEDION_RIM] = { |
| 3884 | .mixers = { alc880_medion_rim_mixer }, |
| 3885 | .init_verbs = { alc880_volume_init_verbs, |
| 3886 | alc880_medion_rim_init_verbs, |
| 3887 | alc_gpio2_init_verbs }, |
| 3888 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3889 | .dac_nids = alc880_dac_nids, |
| 3890 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3891 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3892 | .channel_mode = alc880_2_jack_modes, |
| 3893 | .input_mux = &alc880_medion_rim_capture_source, |
| 3894 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3895 | .init_hook = alc880_medion_rim_automute, |
| 3896 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3897 | #ifdef CONFIG_SND_DEBUG |
| 3898 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3899 | .mixers = { alc880_test_mixer }, |
| 3900 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3901 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3902 | .dac_nids = alc880_test_dac_nids, |
| 3903 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3904 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3905 | .channel_mode = alc880_test_modes, |
| 3906 | .input_mux = &alc880_test_capture_source, |
| 3907 | }, |
| 3908 | #endif |
| 3909 | }; |
| 3910 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3911 | /* |
| 3912 | * Automatic parse of I/O pins from the BIOS configuration |
| 3913 | */ |
| 3914 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3915 | enum { |
| 3916 | ALC_CTL_WIDGET_VOL, |
| 3917 | ALC_CTL_WIDGET_MUTE, |
| 3918 | ALC_CTL_BIND_MUTE, |
| 3919 | }; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3920 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3921 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3922 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3923 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3924 | }; |
| 3925 | |
| 3926 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3927 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3928 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3929 | { |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3930 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3931 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3932 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 3933 | knew = snd_array_new(&spec->kctls); |
| 3934 | if (!knew) |
| 3935 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3936 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3937 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3938 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3939 | return -ENOMEM; |
| 3940 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3941 | return 0; |
| 3942 | } |
| 3943 | |
| 3944 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3945 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3946 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3947 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3948 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3949 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3950 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3951 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3952 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3953 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3954 | #define ALC880_PIN_CD_NID 0x1c |
| 3955 | |
| 3956 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3957 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3958 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3959 | { |
| 3960 | hda_nid_t nid; |
| 3961 | int assigned[4]; |
| 3962 | int i, j; |
| 3963 | |
| 3964 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3965 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3966 | |
| 3967 | /* check the pins hardwired to audio widget */ |
| 3968 | for (i = 0; i < cfg->line_outs; i++) { |
| 3969 | nid = cfg->line_out_pins[i]; |
| 3970 | if (alc880_is_fixed_pin(nid)) { |
| 3971 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3972 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3973 | assigned[idx] = 1; |
| 3974 | } |
| 3975 | } |
| 3976 | /* left pins can be connect to any audio widget */ |
| 3977 | for (i = 0; i < cfg->line_outs; i++) { |
| 3978 | nid = cfg->line_out_pins[i]; |
| 3979 | if (alc880_is_fixed_pin(nid)) |
| 3980 | continue; |
| 3981 | /* search for an empty channel */ |
| 3982 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3983 | if (!assigned[j]) { |
| 3984 | spec->multiout.dac_nids[i] = |
| 3985 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3986 | assigned[j] = 1; |
| 3987 | break; |
| 3988 | } |
| 3989 | } |
| 3990 | } |
| 3991 | spec->multiout.num_dacs = cfg->line_outs; |
| 3992 | return 0; |
| 3993 | } |
| 3994 | |
| 3995 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3996 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3997 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3998 | { |
| 3999 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4000 | static const char *chname[4] = { |
| 4001 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4002 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4003 | hda_nid_t nid; |
| 4004 | int i, err; |
| 4005 | |
| 4006 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4007 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4008 | continue; |
| 4009 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4010 | if (i == 2) { |
| 4011 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4012 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4013 | "Center Playback Volume", |
| 4014 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4015 | HDA_OUTPUT)); |
| 4016 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4017 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4018 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4019 | "LFE Playback Volume", |
| 4020 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4021 | HDA_OUTPUT)); |
| 4022 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4023 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4024 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4025 | "Center Playback Switch", |
| 4026 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4027 | HDA_INPUT)); |
| 4028 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4029 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4030 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4031 | "LFE Playback Switch", |
| 4032 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4033 | HDA_INPUT)); |
| 4034 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4035 | return err; |
| 4036 | } else { |
| 4037 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4038 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4039 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4040 | HDA_OUTPUT)); |
| 4041 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4042 | return err; |
| 4043 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4044 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4045 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4046 | HDA_INPUT)); |
| 4047 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4048 | return err; |
| 4049 | } |
| 4050 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4051 | return 0; |
| 4052 | } |
| 4053 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4054 | /* add playback controls for speaker and HP outputs */ |
| 4055 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4056 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4057 | { |
| 4058 | hda_nid_t nid; |
| 4059 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4060 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4061 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4062 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4063 | return 0; |
| 4064 | |
| 4065 | if (alc880_is_fixed_pin(pin)) { |
| 4066 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4067 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4068 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4069 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4070 | else |
| 4071 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4072 | /* control HP volume/switch on the output mixer amp */ |
| 4073 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4074 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4075 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4076 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4077 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4078 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4079 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4080 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4081 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4082 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4083 | return err; |
| 4084 | } else if (alc880_is_multi_pin(pin)) { |
| 4085 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4086 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4087 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4088 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4089 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4090 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4091 | return err; |
| 4092 | } |
| 4093 | return 0; |
| 4094 | } |
| 4095 | |
| 4096 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4097 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4098 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4099 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4100 | { |
| 4101 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4102 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4103 | |
| 4104 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4105 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4106 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4107 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4108 | return err; |
| 4109 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4110 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4111 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4112 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4113 | return err; |
| 4114 | return 0; |
| 4115 | } |
| 4116 | |
| 4117 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4118 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4119 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4120 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4121 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4122 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4123 | |
| 4124 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4125 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4126 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4127 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4128 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4129 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4130 | if (err < 0) |
| 4131 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4132 | imux->items[imux->num_items].label = |
| 4133 | auto_pin_cfg_labels[i]; |
| 4134 | imux->items[imux->num_items].index = |
| 4135 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4136 | imux->num_items++; |
| 4137 | } |
| 4138 | } |
| 4139 | return 0; |
| 4140 | } |
| 4141 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4142 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4143 | unsigned int pin_type) |
| 4144 | { |
| 4145 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4146 | pin_type); |
| 4147 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4148 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4149 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4150 | } |
| 4151 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4152 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4153 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4154 | int dac_idx) |
| 4155 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4156 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4157 | /* need the manual connection? */ |
| 4158 | if (alc880_is_multi_pin(nid)) { |
| 4159 | struct alc_spec *spec = codec->spec; |
| 4160 | int idx = alc880_multi_pin_idx(nid); |
| 4161 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4162 | AC_VERB_SET_CONNECT_SEL, |
| 4163 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4164 | } |
| 4165 | } |
| 4166 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4167 | static int get_pin_type(int line_out_type) |
| 4168 | { |
| 4169 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4170 | return PIN_HP; |
| 4171 | else |
| 4172 | return PIN_OUT; |
| 4173 | } |
| 4174 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4175 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4176 | { |
| 4177 | struct alc_spec *spec = codec->spec; |
| 4178 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4179 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4180 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4181 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4182 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4183 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4184 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4185 | } |
| 4186 | } |
| 4187 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4188 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4189 | { |
| 4190 | struct alc_spec *spec = codec->spec; |
| 4191 | hda_nid_t pin; |
| 4192 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4193 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4194 | if (pin) /* connect to front */ |
| 4195 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4196 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4197 | if (pin) /* connect to front */ |
| 4198 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4199 | } |
| 4200 | |
| 4201 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4202 | { |
| 4203 | struct alc_spec *spec = codec->spec; |
| 4204 | int i; |
| 4205 | |
| 4206 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4207 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4208 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4209 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4210 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4211 | snd_hda_codec_write(codec, nid, 0, |
| 4212 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4213 | AMP_OUT_MUTE); |
| 4214 | } |
| 4215 | } |
| 4216 | } |
| 4217 | |
| 4218 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4219 | /* return 1 if successful, 0 if the proper config is not found, |
| 4220 | * or a negative error code |
| 4221 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4222 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4223 | { |
| 4224 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4225 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4226 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4227 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4228 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4229 | alc880_ignore); |
| 4230 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4231 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4232 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4233 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4234 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4235 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4236 | if (err < 0) |
| 4237 | return err; |
| 4238 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4239 | if (err < 0) |
| 4240 | return err; |
| 4241 | err = alc880_auto_create_extra_out(spec, |
| 4242 | spec->autocfg.speaker_pins[0], |
| 4243 | "Speaker"); |
| 4244 | if (err < 0) |
| 4245 | return err; |
| 4246 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4247 | "Headphone"); |
| 4248 | if (err < 0) |
| 4249 | return err; |
| 4250 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4251 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4252 | return err; |
| 4253 | |
| 4254 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4255 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4256 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4257 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4258 | hda_nid_t dig_nid; |
| 4259 | err = snd_hda_get_connections(codec, |
| 4260 | spec->autocfg.dig_out_pins[i], |
| 4261 | &dig_nid, 1); |
| 4262 | if (err < 0) |
| 4263 | continue; |
| 4264 | if (!i) |
| 4265 | spec->multiout.dig_out_nid = dig_nid; |
| 4266 | else { |
| 4267 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4268 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4269 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4270 | break; |
| 4271 | } |
| 4272 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4273 | if (spec->autocfg.dig_in_pin) |
| 4274 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4275 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4276 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4277 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4278 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4279 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4280 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4281 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4282 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4283 | |
| 4284 | return 1; |
| 4285 | } |
| 4286 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4287 | /* additional initialization for auto-configuration model */ |
| 4288 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4289 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4290 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4291 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4292 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4293 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4294 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4295 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4296 | } |
| 4297 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4298 | static void set_capture_mixer(struct alc_spec *spec) |
| 4299 | { |
| 4300 | static struct snd_kcontrol_new *caps[3] = { |
| 4301 | alc_capture_mixer1, |
| 4302 | alc_capture_mixer2, |
| 4303 | alc_capture_mixer3, |
| 4304 | }; |
Takashi Iwai | 30d72e9 | 2008-11-27 15:25:34 +0100 | [diff] [blame] | 4305 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4306 | spec->cap_mixer = caps[spec->num_adc_nids - 1]; |
| 4307 | } |
| 4308 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4309 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4310 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4311 | |
| 4312 | /* |
| 4313 | * OK, here we have finally the patch for ALC880 |
| 4314 | */ |
| 4315 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4316 | static int patch_alc880(struct hda_codec *codec) |
| 4317 | { |
| 4318 | struct alc_spec *spec; |
| 4319 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4320 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4321 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4322 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4323 | if (spec == NULL) |
| 4324 | return -ENOMEM; |
| 4325 | |
| 4326 | codec->spec = spec; |
| 4327 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4328 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4329 | alc880_models, |
| 4330 | alc880_cfg_tbl); |
| 4331 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4332 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 4333 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4334 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4335 | } |
| 4336 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4337 | if (board_config == ALC880_AUTO) { |
| 4338 | /* automatic parse from the BIOS config */ |
| 4339 | err = alc880_parse_auto_config(codec); |
| 4340 | if (err < 0) { |
| 4341 | alc_free(codec); |
| 4342 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4343 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4344 | printk(KERN_INFO |
| 4345 | "hda_codec: Cannot set up configuration " |
| 4346 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4347 | board_config = ALC880_3ST; |
| 4348 | } |
| 4349 | } |
| 4350 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4351 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4352 | if (err < 0) { |
| 4353 | alc_free(codec); |
| 4354 | return err; |
| 4355 | } |
| 4356 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4357 | if (board_config != ALC880_AUTO) |
| 4358 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4359 | |
| 4360 | spec->stream_name_analog = "ALC880 Analog"; |
| 4361 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4362 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4363 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4364 | |
| 4365 | spec->stream_name_digital = "ALC880 Digital"; |
| 4366 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4367 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4368 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4369 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4370 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4371 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4372 | /* get type */ |
| 4373 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4374 | if (wcap != AC_WID_AUD_IN) { |
| 4375 | spec->adc_nids = alc880_adc_nids_alt; |
| 4376 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4377 | } else { |
| 4378 | spec->adc_nids = alc880_adc_nids; |
| 4379 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4380 | } |
| 4381 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4382 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4383 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4384 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4385 | spec->vmaster_nid = 0x0c; |
| 4386 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4387 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4388 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4389 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4390 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4391 | if (!spec->loopback.amplist) |
| 4392 | spec->loopback.amplist = alc880_loopbacks; |
| 4393 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4394 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4395 | |
| 4396 | return 0; |
| 4397 | } |
| 4398 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4399 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4400 | /* |
| 4401 | * ALC260 support |
| 4402 | */ |
| 4403 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4404 | static hda_nid_t alc260_dac_nids[1] = { |
| 4405 | /* front */ |
| 4406 | 0x02, |
| 4407 | }; |
| 4408 | |
| 4409 | static hda_nid_t alc260_adc_nids[1] = { |
| 4410 | /* ADC0 */ |
| 4411 | 0x04, |
| 4412 | }; |
| 4413 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4414 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4415 | /* ADC1 */ |
| 4416 | 0x05, |
| 4417 | }; |
| 4418 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4419 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4420 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4421 | */ |
| 4422 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4423 | /* ADC0, ADC1 */ |
| 4424 | 0x04, 0x05 |
| 4425 | }; |
| 4426 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4427 | #define ALC260_DIGOUT_NID 0x03 |
| 4428 | #define ALC260_DIGIN_NID 0x06 |
| 4429 | |
| 4430 | static struct hda_input_mux alc260_capture_source = { |
| 4431 | .num_items = 4, |
| 4432 | .items = { |
| 4433 | { "Mic", 0x0 }, |
| 4434 | { "Front Mic", 0x1 }, |
| 4435 | { "Line", 0x2 }, |
| 4436 | { "CD", 0x4 }, |
| 4437 | }, |
| 4438 | }; |
| 4439 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4440 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4441 | * headphone jack and the internal CD lines since these are the only pins at |
| 4442 | * which audio can appear. For flexibility, also allow the option of |
| 4443 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4444 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4445 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4446 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4447 | { |
| 4448 | .num_items = 3, |
| 4449 | .items = { |
| 4450 | { "Mic/Line", 0x0 }, |
| 4451 | { "CD", 0x4 }, |
| 4452 | { "Headphone", 0x2 }, |
| 4453 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4454 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4455 | { |
| 4456 | .num_items = 4, |
| 4457 | .items = { |
| 4458 | { "Mic/Line", 0x0 }, |
| 4459 | { "CD", 0x4 }, |
| 4460 | { "Headphone", 0x2 }, |
| 4461 | { "Mixer", 0x5 }, |
| 4462 | }, |
| 4463 | }, |
| 4464 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4465 | }; |
| 4466 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4467 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4468 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4469 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4470 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4471 | { |
| 4472 | .num_items = 4, |
| 4473 | .items = { |
| 4474 | { "Mic", 0x0 }, |
| 4475 | { "Line", 0x2 }, |
| 4476 | { "CD", 0x4 }, |
| 4477 | { "Headphone", 0x5 }, |
| 4478 | }, |
| 4479 | }, |
| 4480 | { |
| 4481 | .num_items = 5, |
| 4482 | .items = { |
| 4483 | { "Mic", 0x0 }, |
| 4484 | { "Line", 0x2 }, |
| 4485 | { "CD", 0x4 }, |
| 4486 | { "Headphone", 0x6 }, |
| 4487 | { "Mixer", 0x5 }, |
| 4488 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4489 | }, |
| 4490 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4491 | |
| 4492 | /* Maxdata Favorit 100XS */ |
| 4493 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4494 | { |
| 4495 | .num_items = 2, |
| 4496 | .items = { |
| 4497 | { "Line/Mic", 0x0 }, |
| 4498 | { "CD", 0x4 }, |
| 4499 | }, |
| 4500 | }, |
| 4501 | { |
| 4502 | .num_items = 3, |
| 4503 | .items = { |
| 4504 | { "Line/Mic", 0x0 }, |
| 4505 | { "CD", 0x4 }, |
| 4506 | { "Mixer", 0x5 }, |
| 4507 | }, |
| 4508 | }, |
| 4509 | }; |
| 4510 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4511 | /* |
| 4512 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4513 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4514 | * element which allows changing the channel mode, so the verb list is |
| 4515 | * never used. |
| 4516 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4517 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4518 | { 2, NULL }, |
| 4519 | }; |
| 4520 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4521 | |
| 4522 | /* Mixer combinations |
| 4523 | * |
| 4524 | * basic: base_output + input + pc_beep + capture |
| 4525 | * HP: base_output + input + capture_alt |
| 4526 | * HP_3013: hp_3013 + input + capture |
| 4527 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4528 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4529 | */ |
| 4530 | |
| 4531 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4532 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4533 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4534 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4535 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4536 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4537 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4538 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4539 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4540 | |
| 4541 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4542 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4543 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4544 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4545 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4546 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4547 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4548 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4549 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4550 | { } /* end */ |
| 4551 | }; |
| 4552 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4553 | /* update HP, line and mono out pins according to the master switch */ |
| 4554 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4555 | hda_nid_t hp, hda_nid_t line, |
| 4556 | hda_nid_t mono) |
| 4557 | { |
| 4558 | struct alc_spec *spec = codec->spec; |
| 4559 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4560 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4561 | 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] | 4562 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4563 | 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] | 4564 | val); |
| 4565 | /* mono (speaker) depending on the HP jack sense */ |
| 4566 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4567 | 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] | 4568 | val); |
| 4569 | } |
| 4570 | |
| 4571 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4572 | struct snd_ctl_elem_value *ucontrol) |
| 4573 | { |
| 4574 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4575 | struct alc_spec *spec = codec->spec; |
| 4576 | *ucontrol->value.integer.value = spec->master_sw; |
| 4577 | return 0; |
| 4578 | } |
| 4579 | |
| 4580 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4581 | struct snd_ctl_elem_value *ucontrol) |
| 4582 | { |
| 4583 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4584 | struct alc_spec *spec = codec->spec; |
| 4585 | int val = !!*ucontrol->value.integer.value; |
| 4586 | hda_nid_t hp, line, mono; |
| 4587 | |
| 4588 | if (val == spec->master_sw) |
| 4589 | return 0; |
| 4590 | spec->master_sw = val; |
| 4591 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4592 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4593 | mono = kcontrol->private_value & 0xff; |
| 4594 | alc260_hp_master_update(codec, hp, line, mono); |
| 4595 | return 1; |
| 4596 | } |
| 4597 | |
| 4598 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4599 | { |
| 4600 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4601 | .name = "Master Playback Switch", |
| 4602 | .info = snd_ctl_boolean_mono_info, |
| 4603 | .get = alc260_hp_master_sw_get, |
| 4604 | .put = alc260_hp_master_sw_put, |
| 4605 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4606 | }, |
| 4607 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4608 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4609 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4610 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4611 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4612 | HDA_OUTPUT), |
| 4613 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4614 | { } /* end */ |
| 4615 | }; |
| 4616 | |
| 4617 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4618 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4619 | {}, |
| 4620 | }; |
| 4621 | |
| 4622 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4623 | { |
| 4624 | struct alc_spec *spec = codec->spec; |
| 4625 | unsigned int present; |
| 4626 | |
| 4627 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4628 | AC_VERB_GET_PIN_SENSE, 0); |
| 4629 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4630 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4631 | } |
| 4632 | |
| 4633 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4634 | { |
| 4635 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4636 | alc260_hp_automute(codec); |
| 4637 | } |
| 4638 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4639 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4640 | { |
| 4641 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4642 | .name = "Master Playback Switch", |
| 4643 | .info = snd_ctl_boolean_mono_info, |
| 4644 | .get = alc260_hp_master_sw_get, |
| 4645 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4646 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4647 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4649 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4650 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4651 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4652 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4653 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4654 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4655 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4656 | { } /* end */ |
| 4657 | }; |
| 4658 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4659 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4660 | .ops = &snd_hda_bind_vol, |
| 4661 | .values = { |
| 4662 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4663 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4664 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4665 | 0 |
| 4666 | }, |
| 4667 | }; |
| 4668 | |
| 4669 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4670 | .ops = &snd_hda_bind_sw, |
| 4671 | .values = { |
| 4672 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4673 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4674 | 0 |
| 4675 | }, |
| 4676 | }; |
| 4677 | |
| 4678 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4679 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4680 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4681 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4682 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4683 | { } /* end */ |
| 4684 | }; |
| 4685 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4686 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4687 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4688 | {}, |
| 4689 | }; |
| 4690 | |
| 4691 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4692 | { |
| 4693 | struct alc_spec *spec = codec->spec; |
| 4694 | unsigned int present; |
| 4695 | |
| 4696 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4697 | AC_VERB_GET_PIN_SENSE, 0); |
| 4698 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4699 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4700 | } |
| 4701 | |
| 4702 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4703 | unsigned int res) |
| 4704 | { |
| 4705 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4706 | alc260_hp_3013_automute(codec); |
| 4707 | } |
| 4708 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4709 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4710 | { |
| 4711 | unsigned int present, bits; |
| 4712 | |
| 4713 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4714 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4715 | |
| 4716 | bits = present ? 0 : PIN_OUT; |
| 4717 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4718 | bits); |
| 4719 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4720 | bits); |
| 4721 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4722 | bits); |
| 4723 | } |
| 4724 | |
| 4725 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4726 | unsigned int res) |
| 4727 | { |
| 4728 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4729 | alc260_hp_3012_automute(codec); |
| 4730 | } |
| 4731 | |
| 4732 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4733 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4734 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4735 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4736 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4737 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4738 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4739 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4740 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4741 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4742 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4743 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4744 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4745 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4746 | { } /* end */ |
| 4747 | }; |
| 4748 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4749 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4750 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4751 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4752 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4753 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4754 | * revisions available in early 2006. Therefore for now allow the |
| 4755 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4756 | * that the lack of mic bias for this NID is intentional we could change the |
| 4757 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4758 | * |
| 4759 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4760 | * don't appear to make the mic bias available from the "line" jack, even |
| 4761 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4762 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4763 | * and the output jack. If this turns out to be the case for all such |
| 4764 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4765 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4766 | * |
| 4767 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4768 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4769 | * controls for such models. On models without a "mono speaker" the control |
| 4770 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4771 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4772 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4773 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4774 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4775 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4776 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4777 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4778 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4779 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4780 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4781 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4782 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4783 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4784 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4785 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4786 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4787 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4788 | { } /* end */ |
| 4789 | }; |
| 4790 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4791 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 4792 | */ |
| 4793 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 4794 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4795 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 4796 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4797 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4798 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4799 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4800 | { } /* end */ |
| 4801 | }; |
| 4802 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4803 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4804 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4805 | */ |
| 4806 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4807 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4808 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4809 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4810 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4811 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4812 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4813 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4814 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4815 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4816 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4817 | { } /* end */ |
| 4818 | }; |
| 4819 | |
| 4820 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4821 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4822 | */ |
| 4823 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4824 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4825 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4826 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4827 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4828 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4829 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4830 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4831 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4832 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4833 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4834 | { } /* end */ |
| 4835 | }; |
| 4836 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4837 | /* |
| 4838 | * initialization verbs |
| 4839 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4840 | static struct hda_verb alc260_init_verbs[] = { |
| 4841 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4842 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4843 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4844 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4845 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4846 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4847 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4848 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4849 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4850 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4851 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4852 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4853 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4854 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4855 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4856 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4857 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4858 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4859 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4860 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4861 | /* set connection select to line in (default select for this ADC) */ |
| 4862 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4863 | /* mute capture amp left and right */ |
| 4864 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4865 | /* set connection select to line in (default select for this ADC) */ |
| 4866 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4867 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4868 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4869 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4870 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4871 | /* set vol=0 HP mixer amp left and right */ |
| 4872 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4873 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4874 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4875 | /* set vol=0 Mono mixer amp left and right */ |
| 4876 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4877 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4878 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4879 | /* unmute LINE-2 out pin */ |
| 4880 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4881 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4882 | * Line In 2 = 0x03 |
| 4883 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4884 | /* mute analog inputs */ |
| 4885 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4886 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4887 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4888 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4889 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4890 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4891 | /* mute Front out path */ |
| 4892 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4893 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4894 | /* mute Headphone out path */ |
| 4895 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4896 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4897 | /* mute Mono out path */ |
| 4898 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4899 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4900 | { } |
| 4901 | }; |
| 4902 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4903 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4904 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4905 | /* Headphone and output */ |
| 4906 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4907 | /* mono output */ |
| 4908 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4909 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4910 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4911 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4912 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4913 | /* Line In pin widget for input */ |
| 4914 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4915 | /* Line-2 pin widget for output */ |
| 4916 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4917 | /* CD pin widget for input */ |
| 4918 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4919 | /* unmute amp left and right */ |
| 4920 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4921 | /* set connection select to line in (default select for this ADC) */ |
| 4922 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4923 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4924 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4925 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4926 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4927 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4928 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4929 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4930 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4931 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4932 | * Line In 2 = 0x03 |
| 4933 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4934 | /* mute analog inputs */ |
| 4935 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4936 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4937 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4938 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4939 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4940 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4941 | /* Unmute Front out path */ |
| 4942 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4943 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4944 | /* Unmute Headphone out path */ |
| 4945 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4946 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4947 | /* Unmute Mono out path */ |
| 4948 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4949 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4950 | { } |
| 4951 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4952 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4953 | |
| 4954 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4955 | /* Line out and output */ |
| 4956 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4957 | /* mono output */ |
| 4958 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4959 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4960 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4961 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4962 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4963 | /* Line In pin widget for input */ |
| 4964 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4965 | /* Headphone pin widget for output */ |
| 4966 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4967 | /* CD pin widget for input */ |
| 4968 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4969 | /* unmute amp left and right */ |
| 4970 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4971 | /* set connection select to line in (default select for this ADC) */ |
| 4972 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4973 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4974 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4975 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4976 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4977 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4978 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4979 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4980 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4981 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4982 | * Line In 2 = 0x03 |
| 4983 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4984 | /* mute analog inputs */ |
| 4985 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4986 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4987 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4988 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4989 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4990 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4991 | /* Unmute Front out path */ |
| 4992 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4993 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4994 | /* Unmute Headphone out path */ |
| 4995 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4996 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4997 | /* Unmute Mono out path */ |
| 4998 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4999 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5000 | { } |
| 5001 | }; |
| 5002 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5003 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5004 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5005 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5006 | */ |
| 5007 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5008 | /* Disable all GPIOs */ |
| 5009 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5010 | /* Internal speaker is connected to headphone pin */ |
| 5011 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5012 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5013 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5014 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5015 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5016 | /* Ensure all other unused pins are disabled and muted. */ |
| 5017 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5018 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5019 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5020 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5021 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5022 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5023 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5024 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5025 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5026 | /* Disable digital (SPDIF) pins */ |
| 5027 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5028 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5029 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5030 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5031 | * when acting as an output. |
| 5032 | */ |
| 5033 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5034 | |
| 5035 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5036 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5037 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5038 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5039 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5040 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5041 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5042 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5043 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5044 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5045 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5046 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5047 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5048 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5049 | * If the pin mode is changed by the user the pin mode control will |
| 5050 | * take care of enabling the pin's input/output buffers as needed. |
| 5051 | * Therefore there's no need to enable the input buffer at this |
| 5052 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5053 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5054 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5055 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5056 | * mixer ctrl) |
| 5057 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5058 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5059 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5060 | /* Mute capture amp left and right */ |
| 5061 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5062 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5063 | * in (on mic1 pin) |
| 5064 | */ |
| 5065 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5066 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5067 | /* Do the same for the second ADC: mute capture input amp and |
| 5068 | * set ADC connection to line in (on mic1 pin) |
| 5069 | */ |
| 5070 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5071 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5072 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5073 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5074 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5075 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5076 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5077 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5078 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5079 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5080 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5081 | {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] | 5082 | |
| 5083 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5084 | }; |
| 5085 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5086 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5087 | * similar laptops (adapted from Fujitsu init verbs). |
| 5088 | */ |
| 5089 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5090 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5091 | * the headphone jack. Turn this on and rely on the standard mute |
| 5092 | * methods whenever the user wants to turn these outputs off. |
| 5093 | */ |
| 5094 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5095 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5096 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5097 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5098 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5099 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5100 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5101 | /* Line In jack is connected to Line1 pin */ |
| 5102 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5103 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5104 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5105 | /* Ensure all other unused pins are disabled and muted. */ |
| 5106 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5107 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5108 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5109 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5110 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5111 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5112 | /* Disable digital (SPDIF) pins */ |
| 5113 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5114 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5115 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5116 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5117 | * bus when acting as outputs. |
| 5118 | */ |
| 5119 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5120 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5121 | |
| 5122 | /* Start with output sum widgets muted and their output gains at min */ |
| 5123 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5124 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5125 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5126 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5127 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5128 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5129 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5130 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5131 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5132 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5133 | /* Unmute Line-out pin widget amp left and right |
| 5134 | * (no equiv mixer ctrl) |
| 5135 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5136 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5137 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5138 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5139 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5140 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5141 | * will take care of enabling the pin's input/output buffers as needed. |
| 5142 | * Therefore there's no need to enable the input buffer at this |
| 5143 | * stage. |
| 5144 | */ |
| 5145 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5146 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5147 | |
| 5148 | /* Mute capture amp left and right */ |
| 5149 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5150 | /* Set ADC connection select to match default mixer setting - mic |
| 5151 | * (on mic1 pin) |
| 5152 | */ |
| 5153 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5154 | |
| 5155 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5156 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5157 | */ |
| 5158 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5159 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5160 | |
| 5161 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5162 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5163 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5164 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5165 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5166 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5167 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5168 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5169 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5170 | |
| 5171 | { } |
| 5172 | }; |
| 5173 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5174 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5175 | * (adapted from Acer init verbs). |
| 5176 | */ |
| 5177 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5178 | /* GPIO 0 enables the output jack. |
| 5179 | * Turn this on and rely on the standard mute |
| 5180 | * methods whenever the user wants to turn these outputs off. |
| 5181 | */ |
| 5182 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5183 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5184 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5185 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5186 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5187 | /* Ensure all other unused pins are disabled and muted. */ |
| 5188 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5189 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5190 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5191 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5192 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5193 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5194 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5195 | {0x14, 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 | |
| 5202 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 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 | |
| 5219 | /* Unmute Line-out pin widget amp left and right |
| 5220 | * (no equiv mixer ctrl) |
| 5221 | */ |
| 5222 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5223 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5224 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5225 | * will take care of enabling the pin's input/output buffers as needed. |
| 5226 | * Therefore there's no need to enable the input buffer at this |
| 5227 | * stage. |
| 5228 | */ |
| 5229 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5230 | |
| 5231 | /* Mute capture amp left and right */ |
| 5232 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5233 | /* Set ADC connection select to match default mixer setting - mic |
| 5234 | * (on mic1 pin) |
| 5235 | */ |
| 5236 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5237 | |
| 5238 | /* Do similar with the second ADC: mute capture input amp and |
| 5239 | * set ADC connection to mic to match ALSA's default state. |
| 5240 | */ |
| 5241 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5242 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5243 | |
| 5244 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5245 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5246 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5247 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5248 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5249 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5250 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5251 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5252 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5253 | |
| 5254 | { } |
| 5255 | }; |
| 5256 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5257 | static struct hda_verb alc260_will_verbs[] = { |
| 5258 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5259 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5260 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5261 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5262 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5263 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5264 | {} |
| 5265 | }; |
| 5266 | |
| 5267 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5268 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5269 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5270 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5271 | |
| 5272 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5273 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5274 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5275 | |
| 5276 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5277 | {} |
| 5278 | }; |
| 5279 | |
| 5280 | /* toggle speaker-output according to the hp-jack state */ |
| 5281 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5282 | { |
| 5283 | unsigned int present; |
| 5284 | |
| 5285 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5286 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5287 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5288 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5289 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5290 | AC_VERB_SET_GPIO_DATA, 1); |
| 5291 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5292 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5293 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5294 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5295 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5296 | AC_VERB_SET_GPIO_DATA, 0); |
| 5297 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5298 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5299 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5300 | } |
| 5301 | } |
| 5302 | |
| 5303 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5304 | unsigned int res) |
| 5305 | { |
| 5306 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5307 | alc260_replacer_672v_automute(codec); |
| 5308 | } |
| 5309 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5310 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5311 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5312 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5313 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5314 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5315 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5316 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5317 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5318 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5319 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5320 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5321 | {} |
| 5322 | }; |
| 5323 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5324 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5325 | * configuration. |
| 5326 | */ |
| 5327 | #ifdef CONFIG_SND_DEBUG |
| 5328 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5329 | 0x02, |
| 5330 | }; |
| 5331 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5332 | 0x04, 0x05, |
| 5333 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5334 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5335 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5336 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5337 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5338 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5339 | { |
| 5340 | .num_items = 7, |
| 5341 | .items = { |
| 5342 | { "MIC1 pin", 0x0 }, |
| 5343 | { "MIC2 pin", 0x1 }, |
| 5344 | { "LINE1 pin", 0x2 }, |
| 5345 | { "LINE2 pin", 0x3 }, |
| 5346 | { "CD pin", 0x4 }, |
| 5347 | { "LINE-OUT pin", 0x5 }, |
| 5348 | { "HP-OUT pin", 0x6 }, |
| 5349 | }, |
| 5350 | }, |
| 5351 | { |
| 5352 | .num_items = 8, |
| 5353 | .items = { |
| 5354 | { "MIC1 pin", 0x0 }, |
| 5355 | { "MIC2 pin", 0x1 }, |
| 5356 | { "LINE1 pin", 0x2 }, |
| 5357 | { "LINE2 pin", 0x3 }, |
| 5358 | { "CD pin", 0x4 }, |
| 5359 | { "Mixer", 0x5 }, |
| 5360 | { "LINE-OUT pin", 0x6 }, |
| 5361 | { "HP-OUT pin", 0x7 }, |
| 5362 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5363 | }, |
| 5364 | }; |
| 5365 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5366 | /* Output driver widgets */ |
| 5367 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5368 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5369 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5370 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5371 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5372 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5373 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5374 | /* Modes for retasking pin widgets |
| 5375 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5376 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5377 | * mention this restriction. At this stage it's not clear whether |
| 5378 | * this behaviour is intentional or is a hardware bug in chip |
| 5379 | * revisions available at least up until early 2006. Therefore for |
| 5380 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5381 | * choices, but if it turns out that the lack of mic bias for these |
| 5382 | * NIDs is intentional we could change their modes from |
| 5383 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5384 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5385 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5386 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5387 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5388 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5389 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5390 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5391 | |
| 5392 | /* Loopback mixer controls */ |
| 5393 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5394 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5395 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5396 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5397 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5398 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5399 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5400 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5401 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5402 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5403 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5404 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5405 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5406 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5407 | |
| 5408 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5409 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5410 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5411 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5412 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5413 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5414 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5415 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5416 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5417 | */ |
| 5418 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5419 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5420 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5421 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5422 | * this output to turn on an external amplifier. |
| 5423 | */ |
| 5424 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5425 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5426 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5427 | { } /* end */ |
| 5428 | }; |
| 5429 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5430 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5431 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5432 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5433 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5434 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5435 | /* Enable retasking pins as output, initially without power amp */ |
| 5436 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5437 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5438 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5439 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5440 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5441 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5442 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5443 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5444 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5445 | * payload also sets the generation to 0, output to be in "consumer" |
| 5446 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5447 | * control. |
| 5448 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5449 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5450 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5451 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5452 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5453 | * OUT1 sum bus when acting as an output. |
| 5454 | */ |
| 5455 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5456 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5457 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5458 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5459 | |
| 5460 | /* Start with output sum widgets muted and their output gains at min */ |
| 5461 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5462 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5463 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5464 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5465 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5466 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5467 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5468 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5469 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5470 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5471 | /* Unmute retasking pin widget output buffers since the default |
| 5472 | * state appears to be output. As the pin mode is changed by the |
| 5473 | * user the pin mode control will take care of enabling the pin's |
| 5474 | * input/output buffers as needed. |
| 5475 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5476 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5477 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5478 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5479 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5480 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5481 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5482 | /* Also unmute the mono-out pin widget */ |
| 5483 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5484 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5485 | /* Mute capture amp left and right */ |
| 5486 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5487 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5488 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5489 | */ |
| 5490 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5491 | |
| 5492 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5493 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5494 | */ |
| 5495 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5496 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5497 | |
| 5498 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5499 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5500 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5502 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5505 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5506 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5507 | |
| 5508 | { } |
| 5509 | }; |
| 5510 | #endif |
| 5511 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5512 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5513 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5514 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5515 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5516 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5517 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5518 | /* |
| 5519 | * for BIOS auto-configuration |
| 5520 | */ |
| 5521 | |
| 5522 | 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] | 5523 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5524 | { |
| 5525 | hda_nid_t nid_vol; |
| 5526 | unsigned long vol_val, sw_val; |
| 5527 | char name[32]; |
| 5528 | int err; |
| 5529 | |
| 5530 | if (nid >= 0x0f && nid < 0x11) { |
| 5531 | nid_vol = nid - 0x7; |
| 5532 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5533 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5534 | } else if (nid == 0x11) { |
| 5535 | nid_vol = nid - 0x7; |
| 5536 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5537 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5538 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5539 | nid_vol = 0x08; |
| 5540 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5541 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5542 | } else |
| 5543 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5544 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5545 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5546 | /* first control for the volume widget */ |
| 5547 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5548 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5549 | if (err < 0) |
| 5550 | return err; |
| 5551 | *vol_bits |= (1 << nid_vol); |
| 5552 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5553 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5554 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5555 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5556 | return err; |
| 5557 | return 1; |
| 5558 | } |
| 5559 | |
| 5560 | /* add playback controls from the parsed DAC table */ |
| 5561 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5562 | const struct auto_pin_cfg *cfg) |
| 5563 | { |
| 5564 | hda_nid_t nid; |
| 5565 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5566 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5567 | |
| 5568 | spec->multiout.num_dacs = 1; |
| 5569 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5570 | spec->multiout.dac_nids[0] = 0x02; |
| 5571 | |
| 5572 | nid = cfg->line_out_pins[0]; |
| 5573 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5574 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5575 | if (err < 0) |
| 5576 | return err; |
| 5577 | } |
| 5578 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5579 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5580 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5581 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5582 | if (err < 0) |
| 5583 | return err; |
| 5584 | } |
| 5585 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5586 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5587 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5588 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5589 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5590 | if (err < 0) |
| 5591 | return err; |
| 5592 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5593 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5594 | } |
| 5595 | |
| 5596 | /* create playback/capture controls for input pins */ |
| 5597 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5598 | const struct auto_pin_cfg *cfg) |
| 5599 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5600 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5601 | int i, err, idx; |
| 5602 | |
| 5603 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5604 | if (cfg->input_pins[i] >= 0x12) { |
| 5605 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5606 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5607 | auto_pin_cfg_labels[i], idx, |
| 5608 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5609 | if (err < 0) |
| 5610 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5611 | imux->items[imux->num_items].label = |
| 5612 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5613 | imux->items[imux->num_items].index = idx; |
| 5614 | imux->num_items++; |
| 5615 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5616 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5617 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5618 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5619 | auto_pin_cfg_labels[i], idx, |
| 5620 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5621 | if (err < 0) |
| 5622 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5623 | imux->items[imux->num_items].label = |
| 5624 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5625 | imux->items[imux->num_items].index = idx; |
| 5626 | imux->num_items++; |
| 5627 | } |
| 5628 | } |
| 5629 | return 0; |
| 5630 | } |
| 5631 | |
| 5632 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5633 | hda_nid_t nid, int pin_type, |
| 5634 | int sel_idx) |
| 5635 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5636 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5637 | /* need the manual connection? */ |
| 5638 | if (nid >= 0x12) { |
| 5639 | int idx = nid - 0x12; |
| 5640 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5641 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5642 | } |
| 5643 | } |
| 5644 | |
| 5645 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5646 | { |
| 5647 | struct alc_spec *spec = codec->spec; |
| 5648 | hda_nid_t nid; |
| 5649 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5650 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5651 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5652 | if (nid) { |
| 5653 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5654 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5655 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5656 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5657 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5658 | if (nid) |
| 5659 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5660 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5661 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5662 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5663 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5664 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5665 | |
| 5666 | #define ALC260_PIN_CD_NID 0x16 |
| 5667 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5668 | { |
| 5669 | struct alc_spec *spec = codec->spec; |
| 5670 | int i; |
| 5671 | |
| 5672 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5673 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5674 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5675 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5676 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5677 | snd_hda_codec_write(codec, nid, 0, |
| 5678 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5679 | AMP_OUT_MUTE); |
| 5680 | } |
| 5681 | } |
| 5682 | } |
| 5683 | |
| 5684 | /* |
| 5685 | * generic initialization of ADC, input mixers and output mixers |
| 5686 | */ |
| 5687 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5688 | /* |
| 5689 | * Unmute ADC0-1 and set the default input to mic-in |
| 5690 | */ |
| 5691 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5692 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5693 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5694 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5695 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5696 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5697 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5698 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5699 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5700 | */ |
| 5701 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5702 | /* mute analog inputs */ |
| 5703 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5704 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5705 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5706 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5707 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5708 | |
| 5709 | /* |
| 5710 | * Set up output mixers (0x08 - 0x0a) |
| 5711 | */ |
| 5712 | /* set vol=0 to output mixers */ |
| 5713 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5714 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5715 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5716 | /* set up input amps for analog loopback */ |
| 5717 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5718 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5719 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5720 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5721 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5722 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5723 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5724 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5725 | { } |
| 5726 | }; |
| 5727 | |
| 5728 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5729 | { |
| 5730 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5731 | int err; |
| 5732 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5733 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5734 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5735 | alc260_ignore); |
| 5736 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5737 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5738 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5739 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5740 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5741 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5742 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5743 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5744 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5745 | return err; |
| 5746 | |
| 5747 | spec->multiout.max_channels = 2; |
| 5748 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5749 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5750 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5751 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5752 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5753 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5754 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5755 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5756 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5757 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5758 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5759 | return 1; |
| 5760 | } |
| 5761 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5762 | /* additional initialization for auto-configuration model */ |
| 5763 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5764 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5765 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5766 | alc260_auto_init_multi_out(codec); |
| 5767 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5768 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5769 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5770 | } |
| 5771 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5772 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5773 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5774 | { 0x07, HDA_INPUT, 0 }, |
| 5775 | { 0x07, HDA_INPUT, 1 }, |
| 5776 | { 0x07, HDA_INPUT, 2 }, |
| 5777 | { 0x07, HDA_INPUT, 3 }, |
| 5778 | { 0x07, HDA_INPUT, 4 }, |
| 5779 | { } /* end */ |
| 5780 | }; |
| 5781 | #endif |
| 5782 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5783 | /* |
| 5784 | * ALC260 configurations |
| 5785 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5786 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5787 | [ALC260_BASIC] = "basic", |
| 5788 | [ALC260_HP] = "hp", |
| 5789 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5790 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5791 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5792 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5793 | [ALC260_WILL] = "will", |
| 5794 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5795 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5796 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5797 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5798 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5799 | [ALC260_AUTO] = "auto", |
| 5800 | }; |
| 5801 | |
| 5802 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5803 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5804 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5805 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5806 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5807 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5808 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5809 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5810 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5811 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5812 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5813 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5814 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5815 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5816 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5817 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5818 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5819 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5820 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5821 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5822 | {} |
| 5823 | }; |
| 5824 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5825 | static struct alc_config_preset alc260_presets[] = { |
| 5826 | [ALC260_BASIC] = { |
| 5827 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5828 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5829 | .init_verbs = { alc260_init_verbs }, |
| 5830 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5831 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5832 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5833 | .adc_nids = alc260_adc_nids, |
| 5834 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5835 | .channel_mode = alc260_modes, |
| 5836 | .input_mux = &alc260_capture_source, |
| 5837 | }, |
| 5838 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5839 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5840 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5841 | .init_verbs = { alc260_init_verbs, |
| 5842 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5843 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5844 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5845 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5846 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5847 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5848 | .channel_mode = alc260_modes, |
| 5849 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5850 | .unsol_event = alc260_hp_unsol_event, |
| 5851 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5852 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5853 | [ALC260_HP_DC7600] = { |
| 5854 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5855 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5856 | .init_verbs = { alc260_init_verbs, |
| 5857 | alc260_hp_dc7600_verbs }, |
| 5858 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5859 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5860 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5861 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5862 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5863 | .channel_mode = alc260_modes, |
| 5864 | .input_mux = &alc260_capture_source, |
| 5865 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5866 | .init_hook = alc260_hp_3012_automute, |
| 5867 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5868 | [ALC260_HP_3013] = { |
| 5869 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5870 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5871 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5872 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5873 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5874 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5875 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5876 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5877 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5878 | .channel_mode = alc260_modes, |
| 5879 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5880 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5881 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5882 | }, |
| 5883 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5884 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5885 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5886 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5887 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5888 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5889 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5890 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5891 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5892 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5893 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5894 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5895 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5896 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5897 | .init_verbs = { alc260_acer_init_verbs }, |
| 5898 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5899 | .dac_nids = alc260_dac_nids, |
| 5900 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5901 | .adc_nids = alc260_dual_adc_nids, |
| 5902 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5903 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5904 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5905 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5906 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5907 | [ALC260_FAVORIT100] = { |
| 5908 | .mixers = { alc260_favorit100_mixer }, |
| 5909 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 5910 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5911 | .dac_nids = alc260_dac_nids, |
| 5912 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5913 | .adc_nids = alc260_dual_adc_nids, |
| 5914 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5915 | .channel_mode = alc260_modes, |
| 5916 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 5917 | .input_mux = alc260_favorit100_capture_sources, |
| 5918 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5919 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5920 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5921 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5922 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5923 | .dac_nids = alc260_dac_nids, |
| 5924 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5925 | .adc_nids = alc260_adc_nids, |
| 5926 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5927 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5928 | .channel_mode = alc260_modes, |
| 5929 | .input_mux = &alc260_capture_source, |
| 5930 | }, |
| 5931 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5932 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5933 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5934 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5935 | .dac_nids = alc260_dac_nids, |
| 5936 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5937 | .adc_nids = alc260_adc_nids, |
| 5938 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5939 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5940 | .channel_mode = alc260_modes, |
| 5941 | .input_mux = &alc260_capture_source, |
| 5942 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5943 | .init_hook = alc260_replacer_672v_automute, |
| 5944 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5945 | #ifdef CONFIG_SND_DEBUG |
| 5946 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5947 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5948 | .init_verbs = { alc260_test_init_verbs }, |
| 5949 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5950 | .dac_nids = alc260_test_dac_nids, |
| 5951 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5952 | .adc_nids = alc260_test_adc_nids, |
| 5953 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5954 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5955 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5956 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5957 | }, |
| 5958 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5959 | }; |
| 5960 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5961 | static int patch_alc260(struct hda_codec *codec) |
| 5962 | { |
| 5963 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5964 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5965 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5966 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5967 | if (spec == NULL) |
| 5968 | return -ENOMEM; |
| 5969 | |
| 5970 | codec->spec = spec; |
| 5971 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5972 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5973 | alc260_models, |
| 5974 | alc260_cfg_tbl); |
| 5975 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5976 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5977 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5978 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5979 | } |
| 5980 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5981 | if (board_config == ALC260_AUTO) { |
| 5982 | /* automatic parse from the BIOS config */ |
| 5983 | err = alc260_parse_auto_config(codec); |
| 5984 | if (err < 0) { |
| 5985 | alc_free(codec); |
| 5986 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5987 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5988 | printk(KERN_INFO |
| 5989 | "hda_codec: Cannot set up configuration " |
| 5990 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5991 | board_config = ALC260_BASIC; |
| 5992 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5993 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5994 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5995 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5996 | if (err < 0) { |
| 5997 | alc_free(codec); |
| 5998 | return err; |
| 5999 | } |
| 6000 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6001 | if (board_config != ALC260_AUTO) |
| 6002 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6003 | |
| 6004 | spec->stream_name_analog = "ALC260 Analog"; |
| 6005 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6006 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6007 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6008 | spec->stream_name_digital = "ALC260 Digital"; |
| 6009 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6010 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6011 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6012 | if (!spec->adc_nids && spec->input_mux) { |
| 6013 | /* check whether NID 0x04 is valid */ |
| 6014 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 6015 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 6016 | /* get type */ |
| 6017 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6018 | spec->adc_nids = alc260_adc_nids_alt; |
| 6019 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6020 | } else { |
| 6021 | spec->adc_nids = alc260_adc_nids; |
| 6022 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6023 | } |
| 6024 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6025 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6026 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6027 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6028 | spec->vmaster_nid = 0x08; |
| 6029 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6030 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6031 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6032 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6033 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6034 | if (!spec->loopback.amplist) |
| 6035 | spec->loopback.amplist = alc260_loopbacks; |
| 6036 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6037 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6038 | |
| 6039 | return 0; |
| 6040 | } |
| 6041 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6042 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6043 | /* |
| 6044 | * ALC882 support |
| 6045 | * |
| 6046 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6047 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6048 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6049 | * 6-channel independent captures. |
| 6050 | * |
| 6051 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6052 | * driver yet). |
| 6053 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6054 | #define ALC882_DIGOUT_NID 0x06 |
| 6055 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6056 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6057 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6058 | { 8, NULL } |
| 6059 | }; |
| 6060 | |
| 6061 | static hda_nid_t alc882_dac_nids[4] = { |
| 6062 | /* front, rear, clfe, rear_surr */ |
| 6063 | 0x02, 0x03, 0x04, 0x05 |
| 6064 | }; |
| 6065 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6066 | /* identical with ALC880 */ |
| 6067 | #define alc882_adc_nids alc880_adc_nids |
| 6068 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6069 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6070 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6071 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 6072 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6073 | /* input MUX */ |
| 6074 | /* FIXME: should be a matrix-type input source selection */ |
| 6075 | |
| 6076 | static struct hda_input_mux alc882_capture_source = { |
| 6077 | .num_items = 4, |
| 6078 | .items = { |
| 6079 | { "Mic", 0x0 }, |
| 6080 | { "Front Mic", 0x1 }, |
| 6081 | { "Line", 0x2 }, |
| 6082 | { "CD", 0x4 }, |
| 6083 | }, |
| 6084 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6085 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6086 | * 2ch mode |
| 6087 | */ |
| 6088 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6089 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6090 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6091 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6092 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6093 | { } /* end */ |
| 6094 | }; |
| 6095 | |
| 6096 | /* |
| 6097 | * 6ch mode |
| 6098 | */ |
| 6099 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6100 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6101 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6102 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6103 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6104 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6105 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6106 | { } /* end */ |
| 6107 | }; |
| 6108 | |
| 6109 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6110 | { 2, alc882_3ST_ch2_init }, |
| 6111 | { 6, alc882_3ST_ch6_init }, |
| 6112 | }; |
| 6113 | |
| 6114 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6115 | * 6ch mode |
| 6116 | */ |
| 6117 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6118 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6119 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6120 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6121 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6122 | { } /* end */ |
| 6123 | }; |
| 6124 | |
| 6125 | /* |
| 6126 | * 8ch mode |
| 6127 | */ |
| 6128 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6129 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6130 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6131 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6132 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6133 | { } /* end */ |
| 6134 | }; |
| 6135 | |
| 6136 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6137 | { 6, alc882_sixstack_ch6_init }, |
| 6138 | { 8, alc882_sixstack_ch8_init }, |
| 6139 | }; |
| 6140 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6141 | /* |
| 6142 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 6143 | */ |
| 6144 | |
| 6145 | /* |
| 6146 | * 2ch mode |
| 6147 | */ |
| 6148 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6149 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6150 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6151 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6152 | { } /* end */ |
| 6153 | }; |
| 6154 | |
| 6155 | /* |
| 6156 | * 6ch mode |
| 6157 | */ |
| 6158 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6159 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6160 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6161 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6162 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6163 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6164 | { } /* end */ |
| 6165 | }; |
| 6166 | |
| 6167 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6168 | { 2, alc885_mbp_ch2_init }, |
| 6169 | { 6, alc885_mbp_ch6_init }, |
| 6170 | }; |
| 6171 | |
| 6172 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6173 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6174 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6175 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6176 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6177 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6178 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6179 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6180 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6181 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6182 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6183 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6184 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6185 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6186 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6187 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6188 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6189 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6190 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6191 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6193 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6194 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6195 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6196 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6197 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6198 | { } /* end */ |
| 6199 | }; |
| 6200 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6201 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6202 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6203 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6204 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6205 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6206 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6207 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6208 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6209 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6210 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6211 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6212 | { } /* end */ |
| 6213 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6214 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6215 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6216 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6217 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6218 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6219 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6220 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6221 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6222 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6223 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6224 | { } /* end */ |
| 6225 | }; |
| 6226 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6227 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6228 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6229 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6230 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6231 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6232 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6233 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6234 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6235 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6236 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6237 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6238 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6239 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6240 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6241 | { } /* end */ |
| 6242 | }; |
| 6243 | |
| 6244 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6245 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6246 | */ |
| 6247 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6248 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6249 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6250 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6251 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6252 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6253 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6254 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6255 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6256 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6257 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6258 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6259 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6260 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6261 | { } /* end */ |
| 6262 | }; |
| 6263 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6264 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6265 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6266 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6267 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6268 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6269 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6270 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6271 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6272 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6273 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6274 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6275 | { } /* end */ |
| 6276 | }; |
| 6277 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6278 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6279 | { |
| 6280 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6281 | .name = "Channel Mode", |
| 6282 | .info = alc_ch_mode_info, |
| 6283 | .get = alc_ch_mode_get, |
| 6284 | .put = alc_ch_mode_put, |
| 6285 | }, |
| 6286 | { } /* end */ |
| 6287 | }; |
| 6288 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6289 | static struct hda_verb alc882_init_verbs[] = { |
| 6290 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6291 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6292 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6293 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6294 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6296 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6297 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6298 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6299 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6300 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6301 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6302 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6303 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6304 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6305 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6306 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6307 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6308 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6309 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6310 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6311 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6312 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6313 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6314 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6315 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6316 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6317 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6318 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6319 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6320 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6321 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6322 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6323 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6324 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6325 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6326 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6327 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6328 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6329 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6330 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6331 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6332 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6333 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6334 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6335 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6336 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6337 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6338 | |
| 6339 | /* FIXME: use matrix-type input source selection */ |
| 6340 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6341 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6342 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6343 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6344 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6345 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6346 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6347 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6348 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6349 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6350 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6351 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6352 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6353 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6354 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6355 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6356 | /* ADC1: mute amp left and right */ |
| 6357 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6358 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6359 | /* ADC2: mute amp left and right */ |
| 6360 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6361 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6362 | /* ADC3: mute amp left and right */ |
| 6363 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6364 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6365 | |
| 6366 | { } |
| 6367 | }; |
| 6368 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6369 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6370 | /* change to EAPD mode */ |
| 6371 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6372 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6373 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6374 | }; |
| 6375 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6376 | /* Mac Pro test */ |
| 6377 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6378 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6379 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6380 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6381 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6382 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6383 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6384 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6385 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6386 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6387 | { } /* end */ |
| 6388 | }; |
| 6389 | |
| 6390 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6391 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6392 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6393 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6394 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6395 | /* Front Pin: output 0 (0x0c) */ |
| 6396 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6397 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6398 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6399 | /* Front Mic pin: input vref at 80% */ |
| 6400 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6401 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6402 | /* Speaker: output */ |
| 6403 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6404 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6405 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6406 | /* Headphone output (output 0 - 0x0c) */ |
| 6407 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6408 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6409 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6410 | |
| 6411 | /* FIXME: use matrix-type input source selection */ |
| 6412 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6413 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6414 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6415 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6416 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6417 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6418 | /* Input mixer2 */ |
| 6419 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6420 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6421 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6422 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6423 | /* Input mixer3 */ |
| 6424 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6425 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6426 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6427 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6428 | /* ADC1: mute amp left and right */ |
| 6429 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6430 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6431 | /* ADC2: mute amp left and right */ |
| 6432 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6433 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6434 | /* ADC3: mute amp left and right */ |
| 6435 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6436 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6437 | |
| 6438 | { } |
| 6439 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6440 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6441 | /* Macbook Pro rev3 */ |
| 6442 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6443 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6444 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6445 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6446 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6447 | /* Rear mixer */ |
| 6448 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6449 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6450 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6451 | /* Front Pin: output 0 (0x0c) */ |
| 6452 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6453 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6454 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6455 | /* HP Pin: output 0 (0x0d) */ |
| 6456 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6457 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6458 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6459 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6460 | /* Mic (rear) pin: input vref at 80% */ |
| 6461 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6462 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6463 | /* Front Mic pin: input vref at 80% */ |
| 6464 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6465 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6466 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6467 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6468 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6469 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6470 | |
| 6471 | /* FIXME: use matrix-type input source selection */ |
| 6472 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6473 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6474 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6475 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6476 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6477 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6478 | /* Input mixer2 */ |
| 6479 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6480 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6481 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6482 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6483 | /* Input mixer3 */ |
| 6484 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6485 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6486 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6487 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6488 | /* ADC1: mute amp left and right */ |
| 6489 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6490 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6491 | /* ADC2: mute amp left and right */ |
| 6492 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6493 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6494 | /* ADC3: mute amp left and right */ |
| 6495 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6496 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6497 | |
| 6498 | { } |
| 6499 | }; |
| 6500 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6501 | /* iMac 24 mixer. */ |
| 6502 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6503 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6504 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6505 | { } /* end */ |
| 6506 | }; |
| 6507 | |
| 6508 | /* iMac 24 init verbs. */ |
| 6509 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6510 | /* Internal speakers: output 0 (0x0c) */ |
| 6511 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6512 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6513 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6514 | /* Internal speakers: output 0 (0x0c) */ |
| 6515 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6516 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6517 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6518 | /* Headphone: output 0 (0x0c) */ |
| 6519 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6520 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6521 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6522 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6523 | /* Front Mic: input vref at 80% */ |
| 6524 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6525 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6526 | { } |
| 6527 | }; |
| 6528 | |
| 6529 | /* Toggle speaker-output according to the hp-jack state */ |
| 6530 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 6531 | { |
| 6532 | unsigned int present; |
| 6533 | |
| 6534 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6535 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6536 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 6537 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6538 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 6539 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6540 | } |
| 6541 | |
| 6542 | /* Processes unsolicited events. */ |
| 6543 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6544 | unsigned int res) |
| 6545 | { |
| 6546 | /* Headphone insertion or removal. */ |
| 6547 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6548 | alc885_imac24_automute(codec); |
| 6549 | } |
| 6550 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6551 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6552 | { |
| 6553 | unsigned int present; |
| 6554 | |
| 6555 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6556 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6557 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6558 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6559 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6560 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6561 | |
| 6562 | } |
| 6563 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6564 | unsigned int res) |
| 6565 | { |
| 6566 | /* Headphone insertion or removal. */ |
| 6567 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6568 | alc885_mbp3_automute(codec); |
| 6569 | } |
| 6570 | |
| 6571 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6572 | static struct hda_verb alc882_targa_verbs[] = { |
| 6573 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6574 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6575 | |
| 6576 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6577 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6578 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6579 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6580 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6581 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6582 | |
| 6583 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6584 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6585 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6586 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6587 | { } /* end */ |
| 6588 | }; |
| 6589 | |
| 6590 | /* toggle speaker-output according to the hp-jack state */ |
| 6591 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6592 | { |
| 6593 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6594 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6595 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6596 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6597 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6598 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6599 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6600 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6601 | } |
| 6602 | |
| 6603 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6604 | { |
| 6605 | /* Looks like the unsol event is incompatible with the standard |
| 6606 | * definition. 4bit tag is placed at 26 bit! |
| 6607 | */ |
| 6608 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6609 | alc882_targa_automute(codec); |
| 6610 | } |
| 6611 | } |
| 6612 | |
| 6613 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6614 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6615 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6616 | |
| 6617 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6618 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6619 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6620 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6621 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6622 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6623 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6624 | |
| 6625 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6626 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6627 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6628 | { } /* end */ |
| 6629 | }; |
| 6630 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6631 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6632 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6633 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6634 | |
| 6635 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6636 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6637 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6638 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6639 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6640 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6641 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6642 | |
| 6643 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6644 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6645 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6646 | { } /* end */ |
| 6647 | }; |
| 6648 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6649 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6650 | { |
| 6651 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6652 | |
| 6653 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6654 | AC_VERB_GET_GPIO_DATA, 0); |
| 6655 | |
| 6656 | if (!muted) |
| 6657 | gpiostate |= (1 << pin); |
| 6658 | else |
| 6659 | gpiostate &= ~(1 << pin); |
| 6660 | |
| 6661 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6662 | AC_VERB_GET_GPIO_MASK, 0); |
| 6663 | gpiomask |= (1 << pin); |
| 6664 | |
| 6665 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6666 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6667 | gpiodir |= (1 << pin); |
| 6668 | |
| 6669 | |
| 6670 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6671 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6672 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6673 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6674 | |
| 6675 | msleep(1); |
| 6676 | |
| 6677 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6678 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6679 | } |
| 6680 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6681 | /* set up GPIO at initialization */ |
| 6682 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6683 | { |
| 6684 | alc882_gpio_mute(codec, 0, 0); |
| 6685 | alc882_gpio_mute(codec, 1, 0); |
| 6686 | } |
| 6687 | |
| 6688 | /* set up GPIO and update auto-muting at initialization */ |
| 6689 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6690 | { |
| 6691 | alc885_macpro_init_hook(codec); |
| 6692 | alc885_imac24_automute(codec); |
| 6693 | } |
| 6694 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6695 | /* |
| 6696 | * generic initialization of ADC, input mixers and output mixers |
| 6697 | */ |
| 6698 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6699 | /* |
| 6700 | * Unmute ADC0-2 and set the default input to mic-in |
| 6701 | */ |
| 6702 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6703 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6704 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6705 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6706 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6707 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6708 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6709 | /* 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] | 6710 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6711 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6712 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6713 | */ |
| 6714 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6715 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6716 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6717 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6718 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6719 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6720 | |
| 6721 | /* |
| 6722 | * Set up output mixers (0x0c - 0x0f) |
| 6723 | */ |
| 6724 | /* set vol=0 to output mixers */ |
| 6725 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6726 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6727 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6728 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6729 | /* set up input amps for analog loopback */ |
| 6730 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6731 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6732 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6733 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6734 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6735 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6736 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6737 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6738 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6739 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6740 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6741 | |
| 6742 | /* FIXME: use matrix-type input source selection */ |
| 6743 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6744 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6745 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6746 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6747 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6748 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6749 | /* Input mixer2 */ |
| 6750 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6751 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6752 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6753 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6754 | /* Input mixer3 */ |
| 6755 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6756 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6757 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6758 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6759 | |
| 6760 | { } |
| 6761 | }; |
| 6762 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6763 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6764 | #define alc882_loopbacks alc880_loopbacks |
| 6765 | #endif |
| 6766 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6767 | /* pcm configuration: identiacal with ALC880 */ |
| 6768 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6769 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6770 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6771 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6772 | |
| 6773 | /* |
| 6774 | * configuration and preset |
| 6775 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6776 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6777 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6778 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6779 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6780 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6781 | [ALC882_TARGA] = "targa", |
| 6782 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6783 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6784 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6785 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6786 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6787 | [ALC882_AUTO] = "auto", |
| 6788 | }; |
| 6789 | |
| 6790 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6791 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6792 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6793 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6794 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6795 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6796 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6797 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6798 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6799 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6800 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6801 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6802 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6803 | {} |
| 6804 | }; |
| 6805 | |
| 6806 | static struct alc_config_preset alc882_presets[] = { |
| 6807 | [ALC882_3ST_DIG] = { |
| 6808 | .mixers = { alc882_base_mixer }, |
| 6809 | .init_verbs = { alc882_init_verbs }, |
| 6810 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6811 | .dac_nids = alc882_dac_nids, |
| 6812 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6813 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6814 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6815 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6816 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6817 | .input_mux = &alc882_capture_source, |
| 6818 | }, |
| 6819 | [ALC882_6ST_DIG] = { |
| 6820 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6821 | .init_verbs = { alc882_init_verbs }, |
| 6822 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6823 | .dac_nids = alc882_dac_nids, |
| 6824 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6825 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6826 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6827 | .channel_mode = alc882_sixstack_modes, |
| 6828 | .input_mux = &alc882_capture_source, |
| 6829 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6830 | [ALC882_ARIMA] = { |
| 6831 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6832 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6833 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6834 | .dac_nids = alc882_dac_nids, |
| 6835 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6836 | .channel_mode = alc882_sixstack_modes, |
| 6837 | .input_mux = &alc882_capture_source, |
| 6838 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6839 | [ALC882_W2JC] = { |
| 6840 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6841 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6842 | alc880_gpio1_init_verbs }, |
| 6843 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6844 | .dac_nids = alc882_dac_nids, |
| 6845 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6846 | .channel_mode = alc880_threestack_modes, |
| 6847 | .need_dac_fix = 1, |
| 6848 | .input_mux = &alc882_capture_source, |
| 6849 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6850 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6851 | [ALC885_MBP3] = { |
| 6852 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6853 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6854 | alc880_gpio1_init_verbs }, |
| 6855 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6856 | .dac_nids = alc882_dac_nids, |
| 6857 | .channel_mode = alc885_mbp_6ch_modes, |
| 6858 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6859 | .input_mux = &alc882_capture_source, |
| 6860 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6861 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6862 | .unsol_event = alc885_mbp3_unsol_event, |
| 6863 | .init_hook = alc885_mbp3_automute, |
| 6864 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6865 | [ALC885_MACPRO] = { |
| 6866 | .mixers = { alc882_macpro_mixer }, |
| 6867 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6868 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6869 | .dac_nids = alc882_dac_nids, |
| 6870 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6871 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6872 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6873 | .channel_mode = alc882_ch_modes, |
| 6874 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6875 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6876 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6877 | [ALC885_IMAC24] = { |
| 6878 | .mixers = { alc885_imac24_mixer }, |
| 6879 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6880 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6881 | .dac_nids = alc882_dac_nids, |
| 6882 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6883 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6884 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6885 | .channel_mode = alc882_ch_modes, |
| 6886 | .input_mux = &alc882_capture_source, |
| 6887 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6888 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6889 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6890 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6891 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6892 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6893 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6894 | .dac_nids = alc882_dac_nids, |
| 6895 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6896 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6897 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6898 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6899 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6900 | .channel_mode = alc882_3ST_6ch_modes, |
| 6901 | .need_dac_fix = 1, |
| 6902 | .input_mux = &alc882_capture_source, |
| 6903 | .unsol_event = alc882_targa_unsol_event, |
| 6904 | .init_hook = alc882_targa_automute, |
| 6905 | }, |
| 6906 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6907 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6908 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6909 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6910 | .dac_nids = alc882_dac_nids, |
| 6911 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6912 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6913 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6914 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6915 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6916 | .channel_mode = alc882_3ST_6ch_modes, |
| 6917 | .need_dac_fix = 1, |
| 6918 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6919 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6920 | [ALC882_ASUS_A7M] = { |
| 6921 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6922 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6923 | alc880_gpio1_init_verbs, |
| 6924 | alc882_asus_a7m_verbs }, |
| 6925 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6926 | .dac_nids = alc882_dac_nids, |
| 6927 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6928 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6929 | .channel_mode = alc880_threestack_modes, |
| 6930 | .need_dac_fix = 1, |
| 6931 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6932 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6933 | }; |
| 6934 | |
| 6935 | |
| 6936 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6937 | * Pin config fixes |
| 6938 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6939 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6940 | PINFIX_ABIT_AW9D_MAX |
| 6941 | }; |
| 6942 | |
| 6943 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6944 | { 0x15, 0x01080104 }, /* side */ |
| 6945 | { 0x16, 0x01011012 }, /* rear */ |
| 6946 | { 0x17, 0x01016011 }, /* clfe */ |
| 6947 | { } |
| 6948 | }; |
| 6949 | |
| 6950 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6951 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6952 | }; |
| 6953 | |
| 6954 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6955 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6956 | {} |
| 6957 | }; |
| 6958 | |
| 6959 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6960 | * BIOS auto configuration |
| 6961 | */ |
| 6962 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6963 | hda_nid_t nid, int pin_type, |
| 6964 | int dac_idx) |
| 6965 | { |
| 6966 | /* set as output */ |
| 6967 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6968 | int idx; |
| 6969 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6970 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6971 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6972 | idx = 4; |
| 6973 | else |
| 6974 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6975 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6976 | |
| 6977 | } |
| 6978 | |
| 6979 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6980 | { |
| 6981 | struct alc_spec *spec = codec->spec; |
| 6982 | int i; |
| 6983 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6984 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6985 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6986 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6987 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6988 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6989 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6990 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6991 | } |
| 6992 | } |
| 6993 | |
| 6994 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6995 | { |
| 6996 | struct alc_spec *spec = codec->spec; |
| 6997 | hda_nid_t pin; |
| 6998 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6999 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7000 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7001 | /* use dac 0 */ |
| 7002 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7003 | pin = spec->autocfg.speaker_pins[0]; |
| 7004 | if (pin) |
| 7005 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7006 | } |
| 7007 | |
| 7008 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7009 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 7010 | |
| 7011 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 7012 | { |
| 7013 | struct alc_spec *spec = codec->spec; |
| 7014 | int i; |
| 7015 | |
| 7016 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7017 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7018 | if (!nid) |
| 7019 | continue; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 7020 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7021 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 7022 | snd_hda_codec_write(codec, nid, 0, |
| 7023 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7024 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7025 | } |
| 7026 | } |
| 7027 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7028 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 7029 | { |
| 7030 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7031 | int c; |
| 7032 | |
| 7033 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 7034 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 7035 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7036 | unsigned int mux_idx; |
| 7037 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7038 | int conns, mute, idx, item; |
| 7039 | |
| 7040 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 7041 | ARRAY_SIZE(conn_list)); |
| 7042 | if (conns < 0) |
| 7043 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7044 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 7045 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7046 | for (idx = 0; idx < conns; idx++) { |
| 7047 | /* if the current connection is the selected one, |
| 7048 | * unmute it as default - otherwise mute it |
| 7049 | */ |
| 7050 | mute = AMP_IN_MUTE(idx); |
| 7051 | for (item = 0; item < imux->num_items; item++) { |
| 7052 | if (imux->items[item].index == idx) { |
| 7053 | if (spec->cur_mux[c] == item) |
| 7054 | mute = AMP_IN_UNMUTE(idx); |
| 7055 | break; |
| 7056 | } |
| 7057 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7058 | /* check if we have a selector or mixer |
| 7059 | * we could check for the widget type instead, but |
| 7060 | * just check for Amp-In presence (in case of mixer |
| 7061 | * without amp-in there is something wrong, this |
| 7062 | * function shouldn't be used or capsrc nid is wrong) |
| 7063 | */ |
| 7064 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 7065 | snd_hda_codec_write(codec, nid, 0, |
| 7066 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7067 | mute); |
| 7068 | else if (mute != AMP_IN_MUTE(idx)) |
| 7069 | snd_hda_codec_write(codec, nid, 0, |
| 7070 | AC_VERB_SET_CONNECT_SEL, |
| 7071 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7072 | } |
| 7073 | } |
| 7074 | } |
| 7075 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7076 | /* add mic boosts if needed */ |
| 7077 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 7078 | { |
| 7079 | struct alc_spec *spec = codec->spec; |
| 7080 | int err; |
| 7081 | hda_nid_t nid; |
| 7082 | |
| 7083 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7084 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7085 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7086 | "Mic Boost", |
| 7087 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7088 | if (err < 0) |
| 7089 | return err; |
| 7090 | } |
| 7091 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7092 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7093 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7094 | "Front Mic Boost", |
| 7095 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7096 | if (err < 0) |
| 7097 | return err; |
| 7098 | } |
| 7099 | return 0; |
| 7100 | } |
| 7101 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7102 | /* almost identical with ALC880 parser... */ |
| 7103 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7104 | { |
| 7105 | struct alc_spec *spec = codec->spec; |
| 7106 | int err = alc880_parse_auto_config(codec); |
| 7107 | |
| 7108 | if (err < 0) |
| 7109 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7110 | else if (!err) |
| 7111 | return 0; /* no config found */ |
| 7112 | |
| 7113 | err = alc_auto_add_mic_boost(codec); |
| 7114 | if (err < 0) |
| 7115 | return err; |
| 7116 | |
| 7117 | /* hack - override the init verbs */ |
| 7118 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7119 | |
| 7120 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7121 | } |
| 7122 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7123 | /* additional initialization for auto-configuration model */ |
| 7124 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7125 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7126 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7127 | alc882_auto_init_multi_out(codec); |
| 7128 | alc882_auto_init_hp_out(codec); |
| 7129 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7130 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7131 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7132 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7133 | } |
| 7134 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7135 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7136 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7137 | static int patch_alc882(struct hda_codec *codec) |
| 7138 | { |
| 7139 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7140 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7141 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7142 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7143 | if (spec == NULL) |
| 7144 | return -ENOMEM; |
| 7145 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7146 | codec->spec = spec; |
| 7147 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7148 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7149 | alc882_models, |
| 7150 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7151 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7152 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7153 | /* Pick up systems that don't supply PCI SSID */ |
| 7154 | switch (codec->subsystem_id) { |
| 7155 | case 0x106b0c00: /* Mac Pro */ |
| 7156 | board_config = ALC885_MACPRO; |
| 7157 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7158 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7159 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7160 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7161 | board_config = ALC885_IMAC24; |
| 7162 | break; |
Luke Yelavich | 2d46638 | 2009-02-23 13:00:33 +1100 | [diff] [blame] | 7163 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7164 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7165 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7166 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7167 | case 0x106b3600: /* Macbook 3.1 */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7168 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7169 | board_config = ALC885_MBP3; |
| 7170 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7171 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7172 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7173 | if (codec->revision_id == 0x100101 || |
| 7174 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7175 | alc_free(codec); |
| 7176 | return patch_alc883(codec); |
| 7177 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7178 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 7179 | "trying auto-probe from BIOS...\n"); |
| 7180 | board_config = ALC882_AUTO; |
| 7181 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7182 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7183 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7184 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7185 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7186 | if (board_config == ALC882_AUTO) { |
| 7187 | /* automatic parse from the BIOS config */ |
| 7188 | err = alc882_parse_auto_config(codec); |
| 7189 | if (err < 0) { |
| 7190 | alc_free(codec); |
| 7191 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7192 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7193 | printk(KERN_INFO |
| 7194 | "hda_codec: Cannot set up configuration " |
| 7195 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7196 | board_config = ALC882_3ST_DIG; |
| 7197 | } |
| 7198 | } |
| 7199 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7200 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7201 | if (err < 0) { |
| 7202 | alc_free(codec); |
| 7203 | return err; |
| 7204 | } |
| 7205 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7206 | if (board_config != ALC882_AUTO) |
| 7207 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7208 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 7209 | if (codec->vendor_id == 0x10ec0885) { |
| 7210 | spec->stream_name_analog = "ALC885 Analog"; |
| 7211 | spec->stream_name_digital = "ALC885 Digital"; |
| 7212 | } else { |
| 7213 | spec->stream_name_analog = "ALC882 Analog"; |
| 7214 | spec->stream_name_digital = "ALC882 Digital"; |
| 7215 | } |
| 7216 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7217 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7218 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7219 | /* FIXME: setup DAC5 */ |
| 7220 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7221 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7222 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7223 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7224 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7225 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7226 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7227 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7228 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7229 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7230 | /* get type */ |
| 7231 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7232 | if (wcap != AC_WID_AUD_IN) { |
| 7233 | spec->adc_nids = alc882_adc_nids_alt; |
| 7234 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7235 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7236 | } else { |
| 7237 | spec->adc_nids = alc882_adc_nids; |
| 7238 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7239 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7240 | } |
| 7241 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7242 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7243 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7244 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7245 | spec->vmaster_nid = 0x0c; |
| 7246 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7247 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7248 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7249 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7250 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7251 | if (!spec->loopback.amplist) |
| 7252 | spec->loopback.amplist = alc882_loopbacks; |
| 7253 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7254 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7255 | |
| 7256 | return 0; |
| 7257 | } |
| 7258 | |
| 7259 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7260 | * ALC883 support |
| 7261 | * |
| 7262 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7263 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7264 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7265 | * 6-channel independent captures. |
| 7266 | * |
| 7267 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7268 | * driver yet). |
| 7269 | */ |
| 7270 | #define ALC883_DIGOUT_NID 0x06 |
| 7271 | #define ALC883_DIGIN_NID 0x0a |
| 7272 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7273 | #define ALC1200_DIGOUT_NID 0x10 |
| 7274 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7275 | static hda_nid_t alc883_dac_nids[4] = { |
| 7276 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7277 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7278 | }; |
| 7279 | |
| 7280 | static hda_nid_t alc883_adc_nids[2] = { |
| 7281 | /* ADC1-2 */ |
| 7282 | 0x08, 0x09, |
| 7283 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7284 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7285 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7286 | /* ADC1 */ |
| 7287 | 0x08, |
| 7288 | }; |
| 7289 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7290 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7291 | /* ADC2-1 */ |
| 7292 | 0x09, 0x08 |
| 7293 | }; |
| 7294 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7295 | #define alc889_adc_nids alc880_adc_nids |
| 7296 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7297 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7298 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7299 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7300 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7301 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7302 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7303 | /* input MUX */ |
| 7304 | /* FIXME: should be a matrix-type input source selection */ |
| 7305 | |
| 7306 | static struct hda_input_mux alc883_capture_source = { |
| 7307 | .num_items = 4, |
| 7308 | .items = { |
| 7309 | { "Mic", 0x0 }, |
| 7310 | { "Front Mic", 0x1 }, |
| 7311 | { "Line", 0x2 }, |
| 7312 | { "CD", 0x4 }, |
| 7313 | }, |
| 7314 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7315 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7316 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7317 | .num_items = 4, |
| 7318 | .items = { |
| 7319 | { "Mic", 0x1 }, |
| 7320 | { "Front Mic", 0x0 }, |
| 7321 | { "Line", 0x2 }, |
| 7322 | { "CD", 0x4 }, |
| 7323 | }, |
| 7324 | }; |
| 7325 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7326 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7327 | .num_items = 2, |
| 7328 | .items = { |
| 7329 | { "Mic", 0x1 }, |
| 7330 | { "Line", 0x2 }, |
| 7331 | }, |
| 7332 | }; |
| 7333 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7334 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7335 | .num_items = 4, |
| 7336 | .items = { |
| 7337 | { "Mic", 0x0 }, |
| 7338 | { "iMic", 0x1 }, |
| 7339 | { "Line", 0x2 }, |
| 7340 | { "CD", 0x4 }, |
| 7341 | }, |
| 7342 | }; |
| 7343 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7344 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7345 | .num_items = 2, |
| 7346 | .items = { |
| 7347 | { "Mic", 0x0 }, |
| 7348 | { "Int Mic", 0x1 }, |
| 7349 | }, |
| 7350 | }; |
| 7351 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7352 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7353 | .num_items = 3, |
| 7354 | .items = { |
| 7355 | { "Mic", 0x0 }, |
| 7356 | { "Front Mic", 0x1 }, |
| 7357 | { "Line", 0x4 }, |
| 7358 | }, |
| 7359 | }; |
| 7360 | |
| 7361 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7362 | .num_items = 2, |
| 7363 | .items = { |
| 7364 | { "Mic", 0x0 }, |
| 7365 | { "Line", 0x2 }, |
| 7366 | }, |
| 7367 | }; |
| 7368 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7369 | /* |
| 7370 | * 2ch mode |
| 7371 | */ |
| 7372 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7373 | { 2, NULL } |
| 7374 | }; |
| 7375 | |
| 7376 | /* |
| 7377 | * 2ch mode |
| 7378 | */ |
| 7379 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7380 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7381 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7382 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7383 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7384 | { } /* end */ |
| 7385 | }; |
| 7386 | |
| 7387 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7388 | * 4ch mode |
| 7389 | */ |
| 7390 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7391 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7392 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7393 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7394 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7395 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7396 | { } /* end */ |
| 7397 | }; |
| 7398 | |
| 7399 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7400 | * 6ch mode |
| 7401 | */ |
| 7402 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7403 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7404 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7405 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7406 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7407 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7408 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7409 | { } /* end */ |
| 7410 | }; |
| 7411 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7412 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7413 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7414 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7415 | { 6, alc883_3ST_ch6_init }, |
| 7416 | }; |
| 7417 | |
| 7418 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7419 | * 2ch mode |
| 7420 | */ |
| 7421 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7422 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7423 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7424 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7425 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7426 | { } /* end */ |
| 7427 | }; |
| 7428 | |
| 7429 | /* |
| 7430 | * 4ch mode |
| 7431 | */ |
| 7432 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7433 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7434 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7435 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7436 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7437 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7438 | { } /* end */ |
| 7439 | }; |
| 7440 | |
| 7441 | /* |
| 7442 | * 6ch mode |
| 7443 | */ |
| 7444 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7445 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7446 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7447 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7448 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7449 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7450 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7451 | { } /* end */ |
| 7452 | }; |
| 7453 | |
| 7454 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7455 | { 2, alc883_3ST_ch2_intel_init }, |
| 7456 | { 4, alc883_3ST_ch4_intel_init }, |
| 7457 | { 6, alc883_3ST_ch6_intel_init }, |
| 7458 | }; |
| 7459 | |
| 7460 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7461 | * 6ch mode |
| 7462 | */ |
| 7463 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7464 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7465 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7466 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7467 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7468 | { } /* end */ |
| 7469 | }; |
| 7470 | |
| 7471 | /* |
| 7472 | * 8ch mode |
| 7473 | */ |
| 7474 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7475 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7476 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7477 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7478 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7479 | { } /* end */ |
| 7480 | }; |
| 7481 | |
| 7482 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7483 | { 6, alc883_sixstack_ch6_init }, |
| 7484 | { 8, alc883_sixstack_ch8_init }, |
| 7485 | }; |
| 7486 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7487 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7488 | /* eanable EAPD on medion laptop */ |
| 7489 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7490 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7491 | { } |
| 7492 | }; |
| 7493 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7494 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7495 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7496 | */ |
| 7497 | |
| 7498 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7499 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7500 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7501 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7502 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7503 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7504 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7505 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7506 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7507 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7508 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7509 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7510 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7511 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7512 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7513 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7514 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7515 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7516 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7517 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7518 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7519 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7520 | { } /* end */ |
| 7521 | }; |
| 7522 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7523 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7524 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7525 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7526 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7527 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7528 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7529 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7530 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7532 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7533 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7534 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7535 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7536 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7537 | { } /* end */ |
| 7538 | }; |
| 7539 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7540 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7541 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7542 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7543 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7544 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7546 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7547 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7548 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7549 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7550 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7551 | { } /* end */ |
| 7552 | }; |
| 7553 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7554 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7555 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7556 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7557 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7558 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7559 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7560 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7561 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7562 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7563 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7564 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7565 | { } /* end */ |
| 7566 | }; |
| 7567 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7568 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7569 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7570 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7571 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7572 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7573 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7574 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7575 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7576 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7577 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7578 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7579 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7580 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7581 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7582 | { } /* end */ |
| 7583 | }; |
| 7584 | |
| 7585 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7586 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7587 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7588 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7589 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7590 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7591 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7592 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7593 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7594 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7595 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7596 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7597 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7598 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7599 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7600 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7601 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7602 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7603 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7604 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7605 | { } /* end */ |
| 7606 | }; |
| 7607 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7608 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7609 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7610 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7611 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7612 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7613 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7614 | HDA_OUTPUT), |
| 7615 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7616 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7617 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7618 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7619 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7620 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7621 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7622 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7623 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7624 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7625 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7626 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7627 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7628 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7629 | { } /* end */ |
| 7630 | }; |
| 7631 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7632 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7633 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7634 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7635 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7636 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7637 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7638 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7639 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7640 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7641 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7642 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7643 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7644 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7645 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7646 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7647 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7648 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7649 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7650 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7651 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7652 | { } /* end */ |
| 7653 | }; |
| 7654 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7655 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7656 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7657 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7658 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7659 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7660 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7661 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7662 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7663 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7664 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7665 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7666 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7667 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7668 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7669 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7670 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7671 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7672 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7673 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7674 | |
| 7675 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7676 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7677 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7678 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7679 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7680 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7682 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7683 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7684 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7685 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7686 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7687 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7688 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7689 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7690 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7691 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7692 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7693 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7694 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7695 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7696 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7697 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7698 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7699 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7700 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7701 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7702 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7703 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7704 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7705 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7706 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7707 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7708 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7709 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7710 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7711 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7712 | { } /* end */ |
| 7713 | }; |
| 7714 | |
| 7715 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7716 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7717 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7718 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7719 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7720 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7721 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7722 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7723 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7724 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7725 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7726 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7727 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7728 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7729 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7730 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7731 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7732 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7733 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7734 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7735 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7736 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7737 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7738 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7739 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7740 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7741 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7742 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7743 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7744 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7745 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7746 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7747 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7748 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7749 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7750 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7751 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7752 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7753 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7754 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7755 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7756 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7757 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7758 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7759 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7760 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7761 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7762 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7763 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7764 | { } /* end */ |
| 7765 | }; |
| 7766 | |
| 7767 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7768 | .ops = &snd_hda_bind_vol, |
| 7769 | .values = { |
| 7770 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7771 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7772 | 0 |
| 7773 | }, |
| 7774 | }; |
| 7775 | |
| 7776 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7777 | .ops = &snd_hda_bind_sw, |
| 7778 | .values = { |
| 7779 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7780 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7781 | 0 |
| 7782 | }, |
| 7783 | }; |
| 7784 | |
| 7785 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7786 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7787 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7788 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7789 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7790 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7791 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7792 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7793 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7794 | { } /* end */ |
| 7795 | }; |
| 7796 | |
| 7797 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7798 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7799 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7800 | { |
| 7801 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7802 | /* .name = "Capture Source", */ |
| 7803 | .name = "Input Source", |
| 7804 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7805 | .info = alc_mux_enum_info, |
| 7806 | .get = alc_mux_enum_get, |
| 7807 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7808 | }, |
| 7809 | { } /* end */ |
| 7810 | }; |
| 7811 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7812 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7813 | { |
| 7814 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7815 | .name = "Channel Mode", |
| 7816 | .info = alc_ch_mode_info, |
| 7817 | .get = alc_ch_mode_get, |
| 7818 | .put = alc_ch_mode_put, |
| 7819 | }, |
| 7820 | { } /* end */ |
| 7821 | }; |
| 7822 | |
| 7823 | static struct hda_verb alc883_init_verbs[] = { |
| 7824 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7825 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7826 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7827 | /* ADC2: mute amp left and right */ |
| 7828 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7829 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7830 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7831 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7832 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7833 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7834 | /* Rear mixer */ |
| 7835 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7836 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7837 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7838 | /* CLFE mixer */ |
| 7839 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7840 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7841 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7842 | /* Side mixer */ |
| 7843 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7844 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7845 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7846 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7847 | /* mute analog input loopbacks */ |
| 7848 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7849 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7850 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7851 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7852 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7853 | |
| 7854 | /* Front Pin: output 0 (0x0c) */ |
| 7855 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7856 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7857 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7858 | /* Rear Pin: output 1 (0x0d) */ |
| 7859 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7860 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7861 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7862 | /* CLFE Pin: output 2 (0x0e) */ |
| 7863 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7864 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7865 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7866 | /* Side Pin: output 3 (0x0f) */ |
| 7867 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7868 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7869 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7870 | /* Mic (rear) pin: input vref at 80% */ |
| 7871 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7872 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7873 | /* Front Mic pin: input vref at 80% */ |
| 7874 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7875 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7876 | /* Line In pin: input */ |
| 7877 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7878 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7879 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7880 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7881 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7882 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7883 | /* CD pin widget for input */ |
| 7884 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7885 | |
| 7886 | /* FIXME: use matrix-type input source selection */ |
| 7887 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7888 | /* Input mixer2 */ |
| 7889 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7890 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7891 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7892 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7893 | /* Input mixer3 */ |
| 7894 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7895 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7896 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7897 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7898 | { } |
| 7899 | }; |
| 7900 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7901 | /* toggle speaker-output according to the hp-jack state */ |
| 7902 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7903 | { |
| 7904 | unsigned int present; |
| 7905 | |
| 7906 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7907 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7908 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7909 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7910 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7911 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7912 | } |
| 7913 | |
| 7914 | /* auto-toggle front mic */ |
| 7915 | /* |
| 7916 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7917 | { |
| 7918 | unsigned int present; |
| 7919 | unsigned char bits; |
| 7920 | |
| 7921 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7922 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7923 | bits = present ? HDA_AMP_MUTE : 0; |
| 7924 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7925 | } |
| 7926 | */ |
| 7927 | |
| 7928 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7929 | { |
| 7930 | alc883_mitac_hp_automute(codec); |
| 7931 | /* alc883_mitac_mic_automute(codec); */ |
| 7932 | } |
| 7933 | |
| 7934 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7935 | unsigned int res) |
| 7936 | { |
| 7937 | switch (res >> 26) { |
| 7938 | case ALC880_HP_EVENT: |
| 7939 | alc883_mitac_hp_automute(codec); |
| 7940 | break; |
| 7941 | case ALC880_MIC_EVENT: |
| 7942 | /* alc883_mitac_mic_automute(codec); */ |
| 7943 | break; |
| 7944 | } |
| 7945 | } |
| 7946 | |
| 7947 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7948 | /* HP */ |
| 7949 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7950 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7951 | /* Subwoofer */ |
| 7952 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7953 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7954 | |
| 7955 | /* enable unsolicited event */ |
| 7956 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7957 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7958 | |
| 7959 | { } /* end */ |
| 7960 | }; |
| 7961 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7962 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7963 | /* HP */ |
| 7964 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7965 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7966 | /* Int speaker */ |
| 7967 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7968 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7969 | |
| 7970 | /* enable unsolicited event */ |
| 7971 | {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] | 7972 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7973 | |
| 7974 | { } /* end */ |
| 7975 | }; |
| 7976 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7977 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7978 | /* HP */ |
| 7979 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7980 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7981 | /* Subwoofer */ |
| 7982 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7983 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7984 | |
| 7985 | /* enable unsolicited event */ |
| 7986 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7987 | |
| 7988 | { } /* end */ |
| 7989 | }; |
| 7990 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7991 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7992 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7993 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7994 | |
| 7995 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7996 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7997 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7998 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7999 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8000 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8001 | |
| 8002 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8003 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 8004 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 8005 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8006 | |
| 8007 | { } /* end */ |
| 8008 | }; |
| 8009 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8010 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8011 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8012 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8013 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8014 | { } /* end */ |
| 8015 | }; |
| 8016 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8017 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8018 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8019 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8020 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8021 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8022 | { } /* end */ |
| 8023 | }; |
| 8024 | |
| 8025 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8027 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8028 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8029 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8030 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8031 | { } /* end */ |
| 8032 | }; |
| 8033 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8034 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8035 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8036 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8037 | |
| 8038 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8039 | |
| 8040 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8041 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8042 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8043 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8044 | { } /* end */ |
| 8045 | }; |
| 8046 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8047 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8048 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8049 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8050 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8051 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8052 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8053 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8054 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8055 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8056 | { } /* end */ |
| 8057 | }; |
| 8058 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8059 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8060 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8061 | { } |
| 8062 | }; |
| 8063 | |
| 8064 | static void alc888_3st_hp_front_automute(struct hda_codec *codec) |
| 8065 | { |
| 8066 | unsigned int present, bits; |
| 8067 | |
| 8068 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8069 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8070 | bits = present ? HDA_AMP_MUTE : 0; |
| 8071 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8072 | HDA_AMP_MUTE, bits); |
| 8073 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8074 | HDA_AMP_MUTE, bits); |
| 8075 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 8076 | HDA_AMP_MUTE, bits); |
| 8077 | } |
| 8078 | |
| 8079 | static void alc888_3st_hp_unsol_event(struct hda_codec *codec, |
| 8080 | unsigned int res) |
| 8081 | { |
| 8082 | switch (res >> 26) { |
| 8083 | case ALC880_HP_EVENT: |
| 8084 | alc888_3st_hp_front_automute(codec); |
| 8085 | break; |
| 8086 | } |
| 8087 | } |
| 8088 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8089 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8090 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8091 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8092 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8093 | {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] | 8094 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8095 | }; |
| 8096 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8097 | /* |
| 8098 | * 2ch mode |
| 8099 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8100 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8101 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8102 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8103 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8104 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8105 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8106 | }; |
| 8107 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8108 | /* |
| 8109 | * 4ch mode |
| 8110 | */ |
| 8111 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8112 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8113 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8114 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8115 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8116 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8117 | { } /* end */ |
| 8118 | }; |
| 8119 | |
| 8120 | /* |
| 8121 | * 6ch mode |
| 8122 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8123 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8124 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8125 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8126 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8127 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8128 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8129 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8130 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8131 | }; |
| 8132 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8133 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8134 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8135 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8136 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8137 | }; |
| 8138 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8139 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8140 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8141 | { |
| 8142 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8143 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8144 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8145 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8146 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8147 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8148 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8149 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8150 | } |
| 8151 | |
| 8152 | /* toggle RCA according to the front-jack state */ |
| 8153 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8154 | { |
| 8155 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8156 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8157 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8158 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8159 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8160 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8161 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8162 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8163 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8164 | unsigned int res) |
| 8165 | { |
| 8166 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8167 | alc888_lenovo_ms7195_front_automute(codec); |
| 8168 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8169 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8170 | } |
| 8171 | |
| 8172 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8173 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8174 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8175 | |
| 8176 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8177 | |
| 8178 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8179 | { } /* end */ |
| 8180 | }; |
| 8181 | |
| 8182 | /* toggle speaker-output according to the hp-jack state */ |
| 8183 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 8184 | { |
| 8185 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8186 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8187 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8188 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8189 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8190 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8191 | } |
| 8192 | |
| 8193 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 8194 | unsigned int res) |
| 8195 | { |
| 8196 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8197 | alc883_medion_md2_automute(codec); |
| 8198 | } |
| 8199 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8200 | /* toggle speaker-output according to the hp-jack state */ |
| 8201 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 8202 | { |
| 8203 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8204 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8205 | |
| 8206 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8207 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8208 | bits = present ? HDA_AMP_MUTE : 0; |
| 8209 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8210 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8211 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 8212 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8213 | } |
| 8214 | |
| 8215 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8216 | { |
| 8217 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8218 | alc883_tagra_automute(codec); |
| 8219 | } |
| 8220 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8221 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8222 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8223 | { |
| 8224 | unsigned int present; |
| 8225 | unsigned char bits; |
| 8226 | |
| 8227 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8228 | & AC_PINSENSE_PRESENCE; |
| 8229 | bits = present ? HDA_AMP_MUTE : 0; |
| 8230 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8231 | HDA_AMP_MUTE, bits); |
| 8232 | } |
| 8233 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8234 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8235 | { |
| 8236 | unsigned int present; |
| 8237 | |
| 8238 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8239 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8240 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8241 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8242 | } |
| 8243 | |
| 8244 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 8245 | { |
| 8246 | alc883_clevo_m720_hp_automute(codec); |
| 8247 | alc883_clevo_m720_mic_automute(codec); |
| 8248 | } |
| 8249 | |
| 8250 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8251 | unsigned int res) |
| 8252 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8253 | switch (res >> 26) { |
| 8254 | case ALC880_HP_EVENT: |
| 8255 | alc883_clevo_m720_hp_automute(codec); |
| 8256 | break; |
| 8257 | case ALC880_MIC_EVENT: |
| 8258 | alc883_clevo_m720_mic_automute(codec); |
| 8259 | break; |
| 8260 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8261 | } |
| 8262 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8263 | /* toggle speaker-output according to the hp-jack state */ |
| 8264 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 8265 | { |
| 8266 | unsigned int present; |
| 8267 | unsigned char bits; |
| 8268 | |
| 8269 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8270 | & AC_PINSENSE_PRESENCE; |
| 8271 | bits = present ? HDA_AMP_MUTE : 0; |
| 8272 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8273 | HDA_AMP_MUTE, bits); |
| 8274 | } |
| 8275 | |
| 8276 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 8277 | unsigned int res) |
| 8278 | { |
| 8279 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8280 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 8281 | } |
| 8282 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8283 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 8284 | { |
| 8285 | unsigned int present; |
| 8286 | unsigned char bits; |
| 8287 | |
| 8288 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8289 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8290 | bits = present ? 0x80 : 0; |
| 8291 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8292 | 0x80, bits); |
| 8293 | } |
| 8294 | |
| 8295 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 8296 | unsigned int res) |
| 8297 | { |
| 8298 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8299 | alc883_haier_w66_automute(codec); |
| 8300 | } |
| 8301 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8302 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8303 | { |
| 8304 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8305 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8306 | |
| 8307 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8308 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8309 | bits = present ? HDA_AMP_MUTE : 0; |
| 8310 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8311 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8312 | } |
| 8313 | |
| 8314 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8315 | { |
| 8316 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8317 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8318 | |
| 8319 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8320 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8321 | bits = present ? HDA_AMP_MUTE : 0; |
| 8322 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8323 | HDA_AMP_MUTE, bits); |
| 8324 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8325 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8326 | } |
| 8327 | |
| 8328 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8329 | unsigned int res) |
| 8330 | { |
| 8331 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8332 | alc883_lenovo_101e_all_automute(codec); |
| 8333 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8334 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8335 | } |
| 8336 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8337 | /* toggle speaker-output according to the hp-jack state */ |
| 8338 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 8339 | { |
| 8340 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8341 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8342 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8343 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8344 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8345 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8346 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8347 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8348 | } |
| 8349 | |
| 8350 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 8351 | unsigned int res) |
| 8352 | { |
| 8353 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8354 | alc883_acer_aspire_automute(codec); |
| 8355 | } |
| 8356 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8357 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8358 | /* HP Pin: output 0 (0x0c) */ |
| 8359 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8360 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8361 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8362 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8364 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8365 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8366 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8367 | /* eanable EAPD on medion laptop */ |
| 8368 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8369 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8370 | /* enable unsolicited event */ |
| 8371 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8372 | { } |
| 8373 | }; |
| 8374 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8375 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 8376 | { |
| 8377 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8378 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8379 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8380 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8381 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8382 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8383 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8384 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8385 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8386 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8387 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8388 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8389 | } |
| 8390 | |
| 8391 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 8392 | unsigned int res) |
| 8393 | { |
| 8394 | switch (res >> 26) { |
| 8395 | case ALC880_HP_EVENT: |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 8396 | /* printk(KERN_DEBUG "hp_event\n"); */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8397 | alc888_6st_dell_front_automute(codec); |
| 8398 | break; |
| 8399 | } |
| 8400 | } |
| 8401 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8402 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 8403 | { |
| 8404 | unsigned int mute; |
| 8405 | unsigned int present; |
| 8406 | |
| 8407 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8408 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8409 | AC_VERB_GET_PIN_SENSE, 0); |
| 8410 | present = (present & 0x80000000) != 0; |
| 8411 | if (present) { |
| 8412 | /* mute internal speaker */ |
| 8413 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8414 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8415 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8416 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8417 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8418 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8419 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8420 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8421 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8422 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8423 | } else { |
| 8424 | /* unmute internal speaker if necessary */ |
| 8425 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8426 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8427 | HDA_AMP_MUTE, mute); |
| 8428 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8429 | HDA_AMP_MUTE, mute); |
| 8430 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8431 | HDA_AMP_MUTE, mute); |
| 8432 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8433 | HDA_AMP_MUTE, mute); |
| 8434 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8435 | HDA_AMP_MUTE, mute); |
| 8436 | } |
| 8437 | } |
| 8438 | |
| 8439 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 8440 | unsigned int res) |
| 8441 | { |
| 8442 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8443 | alc888_lenovo_sky_front_automute(codec); |
| 8444 | } |
| 8445 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8446 | /* |
| 8447 | * generic initialization of ADC, input mixers and output mixers |
| 8448 | */ |
| 8449 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8450 | /* |
| 8451 | * Unmute ADC0-2 and set the default input to mic-in |
| 8452 | */ |
| 8453 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8454 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8455 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8456 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8457 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8458 | /* 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] | 8459 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8460 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8461 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8462 | */ |
| 8463 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8464 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8465 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8466 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8467 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8468 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8469 | |
| 8470 | /* |
| 8471 | * Set up output mixers (0x0c - 0x0f) |
| 8472 | */ |
| 8473 | /* set vol=0 to output mixers */ |
| 8474 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8475 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8476 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8477 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8478 | /* set up input amps for analog loopback */ |
| 8479 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8480 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8481 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8482 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8483 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8484 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8485 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8486 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8487 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8488 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8489 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8490 | |
| 8491 | /* FIXME: use matrix-type input source selection */ |
| 8492 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8493 | /* Input mixer1 */ |
| 8494 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8495 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8496 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8497 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8498 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8499 | /* Input mixer2 */ |
| 8500 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8501 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8502 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8503 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8504 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8505 | |
| 8506 | { } |
| 8507 | }; |
| 8508 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8509 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8510 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8511 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8512 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8513 | /* enable unsolicited event */ |
| 8514 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8515 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8516 | { } /* end */ |
| 8517 | }; |
| 8518 | |
| 8519 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8520 | { |
| 8521 | unsigned int present; |
| 8522 | |
| 8523 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8524 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8525 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8526 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8527 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8528 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8529 | } |
| 8530 | |
| 8531 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8532 | { |
| 8533 | unsigned int present; |
| 8534 | unsigned char bits; |
| 8535 | |
| 8536 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8537 | AC_VERB_GET_PIN_SENSE, 0) |
| 8538 | & AC_PINSENSE_PRESENCE; |
| 8539 | bits = present ? 0 : PIN_OUT; |
| 8540 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8541 | bits); |
| 8542 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8543 | bits); |
| 8544 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8545 | bits); |
| 8546 | } |
| 8547 | |
| 8548 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8549 | unsigned int res) |
| 8550 | { |
| 8551 | switch (res >> 26) { |
| 8552 | case ALC880_HP_EVENT: |
| 8553 | alc883_M90V_speaker_automute(codec); |
| 8554 | break; |
| 8555 | case ALC880_MIC_EVENT: |
| 8556 | alc883_nb_mic_automute(codec); |
| 8557 | break; |
| 8558 | } |
| 8559 | } |
| 8560 | |
| 8561 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8562 | { |
| 8563 | alc883_M90V_speaker_automute(codec); |
| 8564 | alc883_nb_mic_automute(codec); |
| 8565 | } |
| 8566 | |
| 8567 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8568 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8569 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8570 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8571 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8572 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8573 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8574 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8575 | /* enable unsolicited event */ |
| 8576 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8577 | { } /* end */ |
| 8578 | }; |
| 8579 | |
| 8580 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8581 | { |
| 8582 | unsigned int present; |
| 8583 | unsigned char bits; |
| 8584 | |
| 8585 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8586 | AC_VERB_GET_PIN_SENSE, 0) |
| 8587 | & AC_PINSENSE_PRESENCE; |
| 8588 | bits = present ? 0 : PIN_OUT; |
| 8589 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8590 | bits); |
| 8591 | } |
| 8592 | |
| 8593 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8594 | unsigned int res) |
| 8595 | { |
| 8596 | switch (res >> 26) { |
| 8597 | case ALC880_HP_EVENT: |
| 8598 | alc883_eee1601_speaker_automute(codec); |
| 8599 | break; |
| 8600 | } |
| 8601 | } |
| 8602 | |
| 8603 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8604 | { |
| 8605 | alc883_eee1601_speaker_automute(codec); |
| 8606 | } |
| 8607 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8608 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8609 | #define alc883_loopbacks alc880_loopbacks |
| 8610 | #endif |
| 8611 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8612 | /* pcm configuration: identiacal with ALC880 */ |
| 8613 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8614 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8615 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8616 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8617 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8618 | |
| 8619 | /* |
| 8620 | * configuration and preset |
| 8621 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8622 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8623 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8624 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8625 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8626 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8627 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8628 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8629 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8630 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8631 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8632 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8633 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8634 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8635 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8636 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8637 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8638 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8639 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8640 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8641 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8642 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8643 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8644 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8645 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8646 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8647 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8648 | [ALC883_AUTO] = "auto", |
| 8649 | }; |
| 8650 | |
| 8651 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8652 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8653 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8654 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8655 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8656 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8657 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8658 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8659 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8660 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8661 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | b3bdb30 | 2009-02-18 13:16:26 +0100 | [diff] [blame] | 8662 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame] | 8663 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8664 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 8665 | ALC888_ACER_ASPIRE_4930G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8666 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
| 8667 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8668 | /* default Acer */ |
| 8669 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8670 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8671 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8672 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8673 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8674 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8675 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8676 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8677 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8678 | 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] | 8679 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8680 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8681 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8682 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8683 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8684 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8685 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8686 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8687 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8688 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8689 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8690 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8691 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8692 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8693 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8694 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8695 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8696 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8697 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8698 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8699 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8700 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8701 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8702 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8703 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8704 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8705 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8706 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8707 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8708 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8709 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8710 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8711 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8712 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8713 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8714 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8715 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8716 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8717 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8718 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8719 | SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", |
| 8720 | ALC883_FUJITSU_PI2515), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8721 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8722 | SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", |
| 8723 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8724 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8725 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8726 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8727 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8728 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8729 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8730 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8731 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8732 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8733 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8734 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8735 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 8736 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8737 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8738 | {} |
| 8739 | }; |
| 8740 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 8741 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8742 | ALC883_DIGOUT_NID, 0, |
| 8743 | }; |
| 8744 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8745 | static struct alc_config_preset alc883_presets[] = { |
| 8746 | [ALC883_3ST_2ch_DIG] = { |
| 8747 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8748 | .init_verbs = { alc883_init_verbs }, |
| 8749 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8750 | .dac_nids = alc883_dac_nids, |
| 8751 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8752 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8753 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8754 | .channel_mode = alc883_3ST_2ch_modes, |
| 8755 | .input_mux = &alc883_capture_source, |
| 8756 | }, |
| 8757 | [ALC883_3ST_6ch_DIG] = { |
| 8758 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8759 | .init_verbs = { alc883_init_verbs }, |
| 8760 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8761 | .dac_nids = alc883_dac_nids, |
| 8762 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8763 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8764 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8765 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8766 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8767 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8768 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8769 | [ALC883_3ST_6ch] = { |
| 8770 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8771 | .init_verbs = { alc883_init_verbs }, |
| 8772 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8773 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8774 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8775 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8776 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8777 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8778 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8779 | [ALC883_3ST_6ch_INTEL] = { |
| 8780 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8781 | .init_verbs = { alc883_init_verbs }, |
| 8782 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8783 | .dac_nids = alc883_dac_nids, |
| 8784 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8785 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8786 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8787 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8788 | .need_dac_fix = 1, |
| 8789 | .input_mux = &alc883_3stack_6ch_intel, |
| 8790 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8791 | [ALC883_6ST_DIG] = { |
| 8792 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8793 | .init_verbs = { alc883_init_verbs }, |
| 8794 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8795 | .dac_nids = alc883_dac_nids, |
| 8796 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8797 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8798 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8799 | .channel_mode = alc883_sixstack_modes, |
| 8800 | .input_mux = &alc883_capture_source, |
| 8801 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8802 | [ALC883_TARGA_DIG] = { |
| 8803 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8804 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8805 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8806 | .dac_nids = alc883_dac_nids, |
| 8807 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8808 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8809 | .channel_mode = alc883_3ST_6ch_modes, |
| 8810 | .need_dac_fix = 1, |
| 8811 | .input_mux = &alc883_capture_source, |
| 8812 | .unsol_event = alc883_tagra_unsol_event, |
| 8813 | .init_hook = alc883_tagra_automute, |
| 8814 | }, |
| 8815 | [ALC883_TARGA_2ch_DIG] = { |
| 8816 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8817 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8818 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8819 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8820 | .adc_nids = alc883_adc_nids_alt, |
| 8821 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8822 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8823 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8824 | .channel_mode = alc883_3ST_2ch_modes, |
| 8825 | .input_mux = &alc883_capture_source, |
| 8826 | .unsol_event = alc883_tagra_unsol_event, |
| 8827 | .init_hook = alc883_tagra_automute, |
| 8828 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8829 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8830 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8831 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8832 | * and the headphone jack. Turn this on and rely on the |
| 8833 | * standard mute methods whenever the user wants to turn |
| 8834 | * these outputs off. |
| 8835 | */ |
| 8836 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8837 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8838 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8839 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8840 | .channel_mode = alc883_3ST_2ch_modes, |
| 8841 | .input_mux = &alc883_capture_source, |
| 8842 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8843 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8844 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8845 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8846 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8847 | .dac_nids = alc883_dac_nids, |
| 8848 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8849 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8850 | .channel_mode = alc883_3ST_2ch_modes, |
| 8851 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8852 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8853 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8854 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8855 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8856 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8857 | alc883_chmode_mixer }, |
| 8858 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8859 | alc888_acer_aspire_4930g_verbs }, |
| 8860 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8861 | .dac_nids = alc883_dac_nids, |
| 8862 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8863 | .adc_nids = alc883_adc_nids_rev, |
| 8864 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8865 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8866 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8867 | .channel_mode = alc883_3ST_6ch_modes, |
| 8868 | .need_dac_fix = 1, |
| 8869 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8870 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8871 | .input_mux = alc888_2_capture_sources, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8872 | .unsol_event = alc888_acer_aspire_4930g_unsol_event, |
| 8873 | .init_hook = alc888_acer_aspire_4930g_automute, |
| 8874 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8875 | [ALC883_MEDION] = { |
| 8876 | .mixers = { alc883_fivestack_mixer, |
| 8877 | alc883_chmode_mixer }, |
| 8878 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8879 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8880 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8881 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8882 | .adc_nids = alc883_adc_nids_alt, |
| 8883 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8884 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8885 | .channel_mode = alc883_sixstack_modes, |
| 8886 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8887 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8888 | [ALC883_MEDION_MD2] = { |
| 8889 | .mixers = { alc883_medion_md2_mixer}, |
| 8890 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8891 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8892 | .dac_nids = alc883_dac_nids, |
| 8893 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8894 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8895 | .channel_mode = alc883_3ST_2ch_modes, |
| 8896 | .input_mux = &alc883_capture_source, |
| 8897 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8898 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8899 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8900 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8901 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8902 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8903 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8904 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8905 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8906 | .channel_mode = alc883_3ST_2ch_modes, |
| 8907 | .input_mux = &alc883_capture_source, |
| 8908 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8909 | [ALC883_CLEVO_M720] = { |
| 8910 | .mixers = { alc883_clevo_m720_mixer }, |
| 8911 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8912 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8913 | .dac_nids = alc883_dac_nids, |
| 8914 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8915 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8916 | .channel_mode = alc883_3ST_2ch_modes, |
| 8917 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8918 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8919 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8920 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8921 | [ALC883_LENOVO_101E_2ch] = { |
| 8922 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8923 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8924 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8925 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8926 | .adc_nids = alc883_adc_nids_alt, |
| 8927 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8928 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8929 | .channel_mode = alc883_3ST_2ch_modes, |
| 8930 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8931 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8932 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8933 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8934 | [ALC883_LENOVO_NB0763] = { |
| 8935 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8936 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8937 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8938 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8939 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8940 | .channel_mode = alc883_3ST_2ch_modes, |
| 8941 | .need_dac_fix = 1, |
| 8942 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8943 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8944 | .init_hook = alc883_medion_md2_automute, |
| 8945 | }, |
| 8946 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8947 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8948 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8949 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8950 | .dac_nids = alc883_dac_nids, |
| 8951 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8952 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8953 | .channel_mode = alc883_3ST_6ch_modes, |
| 8954 | .need_dac_fix = 1, |
| 8955 | .input_mux = &alc883_capture_source, |
| 8956 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8957 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8958 | }, |
| 8959 | [ALC883_HAIER_W66] = { |
| 8960 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8961 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8962 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8963 | .dac_nids = alc883_dac_nids, |
| 8964 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8965 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8966 | .channel_mode = alc883_3ST_2ch_modes, |
| 8967 | .input_mux = &alc883_capture_source, |
| 8968 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8969 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8970 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8971 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8972 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8973 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8974 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8975 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8976 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8977 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8978 | .need_dac_fix = 1, |
| 8979 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8980 | .unsol_event = alc888_3st_hp_unsol_event, |
| 8981 | .init_hook = alc888_3st_hp_front_automute, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8982 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8983 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8984 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8985 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8986 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8987 | .dac_nids = alc883_dac_nids, |
| 8988 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8989 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8990 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8991 | .channel_mode = alc883_sixstack_modes, |
| 8992 | .input_mux = &alc883_capture_source, |
| 8993 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8994 | .init_hook = alc888_6st_dell_front_automute, |
| 8995 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8996 | [ALC883_MITAC] = { |
| 8997 | .mixers = { alc883_mitac_mixer }, |
| 8998 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8999 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9000 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9001 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9002 | .channel_mode = alc883_3ST_2ch_modes, |
| 9003 | .input_mux = &alc883_capture_source, |
| 9004 | .unsol_event = alc883_mitac_unsol_event, |
| 9005 | .init_hook = alc883_mitac_automute, |
| 9006 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9007 | [ALC883_FUJITSU_PI2515] = { |
| 9008 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9009 | .init_verbs = { alc883_init_verbs, |
| 9010 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9011 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9012 | .dac_nids = alc883_dac_nids, |
| 9013 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9014 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9015 | .channel_mode = alc883_3ST_2ch_modes, |
| 9016 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9017 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 9018 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 9019 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9020 | [ALC888_FUJITSU_XA3530] = { |
| 9021 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9022 | .init_verbs = { alc883_init_verbs, |
| 9023 | alc888_fujitsu_xa3530_verbs }, |
| 9024 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9025 | .dac_nids = alc883_dac_nids, |
| 9026 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9027 | .adc_nids = alc883_adc_nids_rev, |
| 9028 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9029 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9030 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9031 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9032 | .num_mux_defs = |
| 9033 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9034 | .input_mux = alc888_2_capture_sources, |
| 9035 | .unsol_event = alc888_fujitsu_xa3530_unsol_event, |
| 9036 | .init_hook = alc888_fujitsu_xa3530_automute, |
| 9037 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9038 | [ALC888_LENOVO_SKY] = { |
| 9039 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9040 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9041 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9042 | .dac_nids = alc883_dac_nids, |
| 9043 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9044 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9045 | .channel_mode = alc883_sixstack_modes, |
| 9046 | .need_dac_fix = 1, |
| 9047 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 9048 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 9049 | .init_hook = alc888_lenovo_sky_front_automute, |
| 9050 | }, |
| 9051 | [ALC888_ASUS_M90V] = { |
| 9052 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9053 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9054 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9055 | .dac_nids = alc883_dac_nids, |
| 9056 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9057 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9058 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9059 | .channel_mode = alc883_3ST_6ch_modes, |
| 9060 | .need_dac_fix = 1, |
| 9061 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9062 | .unsol_event = alc883_mode2_unsol_event, |
| 9063 | .init_hook = alc883_mode2_inithook, |
| 9064 | }, |
| 9065 | [ALC888_ASUS_EEE1601] = { |
| 9066 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9067 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9068 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9069 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9070 | .dac_nids = alc883_dac_nids, |
| 9071 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9072 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9073 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9074 | .channel_mode = alc883_3ST_2ch_modes, |
| 9075 | .need_dac_fix = 1, |
| 9076 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 9077 | .unsol_event = alc883_eee1601_unsol_event, |
| 9078 | .init_hook = alc883_eee1601_inithook, |
| 9079 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9080 | [ALC1200_ASUS_P5Q] = { |
| 9081 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9082 | .init_verbs = { alc883_init_verbs }, |
| 9083 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9084 | .dac_nids = alc883_dac_nids, |
| 9085 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9086 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9087 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9088 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9089 | .channel_mode = alc883_sixstack_modes, |
| 9090 | .input_mux = &alc883_capture_source, |
| 9091 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9092 | }; |
| 9093 | |
| 9094 | |
| 9095 | /* |
| 9096 | * BIOS auto configuration |
| 9097 | */ |
| 9098 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9099 | hda_nid_t nid, int pin_type, |
| 9100 | int dac_idx) |
| 9101 | { |
| 9102 | /* set as output */ |
| 9103 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9104 | int idx; |
| 9105 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9106 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9107 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9108 | idx = 4; |
| 9109 | else |
| 9110 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9111 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9112 | |
| 9113 | } |
| 9114 | |
| 9115 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 9116 | { |
| 9117 | struct alc_spec *spec = codec->spec; |
| 9118 | int i; |
| 9119 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9120 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9121 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9122 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9123 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9124 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9125 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9126 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9127 | } |
| 9128 | } |
| 9129 | |
| 9130 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 9131 | { |
| 9132 | struct alc_spec *spec = codec->spec; |
| 9133 | hda_nid_t pin; |
| 9134 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9135 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9136 | if (pin) /* connect to front */ |
| 9137 | /* use dac 0 */ |
| 9138 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9139 | pin = spec->autocfg.speaker_pins[0]; |
| 9140 | if (pin) |
| 9141 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9142 | } |
| 9143 | |
| 9144 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9145 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9146 | |
| 9147 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9148 | { |
| 9149 | struct alc_spec *spec = codec->spec; |
| 9150 | int i; |
| 9151 | |
| 9152 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9153 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9154 | if (alc883_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 9155 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9156 | if (nid != ALC883_PIN_CD_NID) |
| 9157 | snd_hda_codec_write(codec, nid, 0, |
| 9158 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9159 | AMP_OUT_MUTE); |
| 9160 | } |
| 9161 | } |
| 9162 | } |
| 9163 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9164 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9165 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9166 | /* almost identical with ALC880 parser... */ |
| 9167 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9168 | { |
| 9169 | struct alc_spec *spec = codec->spec; |
| 9170 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9171 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9172 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9173 | |
| 9174 | if (err < 0) |
| 9175 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9176 | else if (!err) |
| 9177 | return 0; /* no config found */ |
| 9178 | |
| 9179 | err = alc_auto_add_mic_boost(codec); |
| 9180 | if (err < 0) |
| 9181 | return err; |
| 9182 | |
| 9183 | /* hack - override the init verbs */ |
| 9184 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9185 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9186 | /* setup input_mux for ALC889 */ |
| 9187 | if (codec->vendor_id == 0x10ec0889) { |
| 9188 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9189 | * because it's under 0x18 |
| 9190 | */ |
| 9191 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9192 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9193 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9194 | for (i = 1; i < 3; i++) |
| 9195 | memcpy(&spec->private_imux[i], |
| 9196 | &spec->private_imux[0], |
| 9197 | sizeof(spec->private_imux[0])); |
| 9198 | imux->items[imux->num_items].label = "Int DMic"; |
| 9199 | imux->items[imux->num_items].index = 0x0b; |
| 9200 | imux->num_items++; |
| 9201 | spec->num_mux_defs = 3; |
| 9202 | spec->input_mux = spec->private_imux; |
| 9203 | } |
| 9204 | } |
| 9205 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9206 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9207 | } |
| 9208 | |
| 9209 | /* additional initialization for auto-configuration model */ |
| 9210 | static void alc883_auto_init(struct hda_codec *codec) |
| 9211 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9212 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9213 | alc883_auto_init_multi_out(codec); |
| 9214 | alc883_auto_init_hp_out(codec); |
| 9215 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9216 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9217 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9218 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9219 | } |
| 9220 | |
| 9221 | static int patch_alc883(struct hda_codec *codec) |
| 9222 | { |
| 9223 | struct alc_spec *spec; |
| 9224 | int err, board_config; |
| 9225 | |
| 9226 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9227 | if (spec == NULL) |
| 9228 | return -ENOMEM; |
| 9229 | |
| 9230 | codec->spec = spec; |
| 9231 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9232 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9233 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9234 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9235 | alc883_models, |
| 9236 | alc883_cfg_tbl); |
| 9237 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9238 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 9239 | "trying auto-probe from BIOS...\n"); |
| 9240 | board_config = ALC883_AUTO; |
| 9241 | } |
| 9242 | |
| 9243 | if (board_config == ALC883_AUTO) { |
| 9244 | /* automatic parse from the BIOS config */ |
| 9245 | err = alc883_parse_auto_config(codec); |
| 9246 | if (err < 0) { |
| 9247 | alc_free(codec); |
| 9248 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9249 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9250 | printk(KERN_INFO |
| 9251 | "hda_codec: Cannot set up configuration " |
| 9252 | "from BIOS. Using base mode...\n"); |
| 9253 | board_config = ALC883_3ST_2ch_DIG; |
| 9254 | } |
| 9255 | } |
| 9256 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9257 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9258 | if (err < 0) { |
| 9259 | alc_free(codec); |
| 9260 | return err; |
| 9261 | } |
| 9262 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9263 | if (board_config != ALC883_AUTO) |
| 9264 | setup_preset(spec, &alc883_presets[board_config]); |
| 9265 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9266 | switch (codec->vendor_id) { |
| 9267 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 9268 | if (codec->revision_id == 0x100101) { |
| 9269 | spec->stream_name_analog = "ALC1200 Analog"; |
| 9270 | spec->stream_name_digital = "ALC1200 Digital"; |
| 9271 | } else { |
| 9272 | spec->stream_name_analog = "ALC888 Analog"; |
| 9273 | spec->stream_name_digital = "ALC888 Digital"; |
| 9274 | } |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9275 | if (!spec->num_adc_nids) { |
| 9276 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9277 | spec->adc_nids = alc883_adc_nids; |
| 9278 | } |
| 9279 | if (!spec->capsrc_nids) |
| 9280 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9281 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9282 | break; |
| 9283 | case 0x10ec0889: |
| 9284 | spec->stream_name_analog = "ALC889 Analog"; |
| 9285 | spec->stream_name_digital = "ALC889 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9286 | if (!spec->num_adc_nids) { |
| 9287 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9288 | spec->adc_nids = alc889_adc_nids; |
| 9289 | } |
| 9290 | if (!spec->capsrc_nids) |
| 9291 | spec->capsrc_nids = alc889_capsrc_nids; |
| 9292 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style |
| 9293 | capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9294 | break; |
| 9295 | default: |
| 9296 | spec->stream_name_analog = "ALC883 Analog"; |
| 9297 | spec->stream_name_digital = "ALC883 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9298 | if (!spec->num_adc_nids) { |
| 9299 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9300 | spec->adc_nids = alc883_adc_nids; |
| 9301 | } |
| 9302 | if (!spec->capsrc_nids) |
| 9303 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9304 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9305 | break; |
| 9306 | } |
| 9307 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9308 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9309 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9310 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9311 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9312 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9313 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9314 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9315 | if (!spec->cap_mixer) |
| 9316 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9317 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9318 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9319 | spec->vmaster_nid = 0x0c; |
| 9320 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9321 | codec->patch_ops = alc_patch_ops; |
| 9322 | if (board_config == ALC883_AUTO) |
| 9323 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9324 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9325 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9326 | if (!spec->loopback.amplist) |
| 9327 | spec->loopback.amplist = alc883_loopbacks; |
| 9328 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9329 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9330 | |
| 9331 | return 0; |
| 9332 | } |
| 9333 | |
| 9334 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9335 | * ALC262 support |
| 9336 | */ |
| 9337 | |
| 9338 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9339 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9340 | |
| 9341 | #define alc262_dac_nids alc260_dac_nids |
| 9342 | #define alc262_adc_nids alc882_adc_nids |
| 9343 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9344 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9345 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9346 | |
| 9347 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9348 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9349 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9350 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9351 | /* ADC0 */ |
| 9352 | 0x09 |
| 9353 | }; |
| 9354 | |
| 9355 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9356 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9357 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9358 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9359 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9360 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9361 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9362 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9363 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9364 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9365 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9366 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9367 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9368 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9369 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9370 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9371 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9372 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9373 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9374 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9375 | }; |
| 9376 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9377 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9378 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9379 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9380 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9381 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9382 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9383 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9384 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9385 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9386 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9387 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9388 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9389 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9390 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 9391 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9392 | { } /* end */ |
| 9393 | }; |
| 9394 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9395 | /* update HP, line and mono-out pins according to the master switch */ |
| 9396 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9397 | { |
| 9398 | struct alc_spec *spec = codec->spec; |
| 9399 | int val = spec->master_sw; |
| 9400 | |
| 9401 | /* HP & line-out */ |
| 9402 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9403 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9404 | val ? PIN_HP : 0); |
| 9405 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9406 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9407 | val ? PIN_HP : 0); |
| 9408 | /* mono (speaker) depending on the HP jack sense */ |
| 9409 | val = val && !spec->jack_present; |
| 9410 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9411 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9412 | val ? PIN_OUT : 0); |
| 9413 | } |
| 9414 | |
| 9415 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9416 | { |
| 9417 | struct alc_spec *spec = codec->spec; |
| 9418 | unsigned int presence; |
| 9419 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9420 | AC_VERB_GET_PIN_SENSE, 0); |
| 9421 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9422 | alc262_hp_master_update(codec); |
| 9423 | } |
| 9424 | |
| 9425 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9426 | { |
| 9427 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9428 | return; |
| 9429 | alc262_hp_bpc_automute(codec); |
| 9430 | } |
| 9431 | |
| 9432 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9433 | { |
| 9434 | struct alc_spec *spec = codec->spec; |
| 9435 | unsigned int presence; |
| 9436 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9437 | AC_VERB_GET_PIN_SENSE, 0); |
| 9438 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9439 | alc262_hp_master_update(codec); |
| 9440 | } |
| 9441 | |
| 9442 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9443 | unsigned int res) |
| 9444 | { |
| 9445 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9446 | return; |
| 9447 | alc262_hp_wildwest_automute(codec); |
| 9448 | } |
| 9449 | |
| 9450 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 9451 | struct snd_ctl_elem_value *ucontrol) |
| 9452 | { |
| 9453 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9454 | struct alc_spec *spec = codec->spec; |
| 9455 | *ucontrol->value.integer.value = spec->master_sw; |
| 9456 | return 0; |
| 9457 | } |
| 9458 | |
| 9459 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9460 | struct snd_ctl_elem_value *ucontrol) |
| 9461 | { |
| 9462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9463 | struct alc_spec *spec = codec->spec; |
| 9464 | int val = !!*ucontrol->value.integer.value; |
| 9465 | |
| 9466 | if (val == spec->master_sw) |
| 9467 | return 0; |
| 9468 | spec->master_sw = val; |
| 9469 | alc262_hp_master_update(codec); |
| 9470 | return 1; |
| 9471 | } |
| 9472 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9473 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9474 | { |
| 9475 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9476 | .name = "Master Playback Switch", |
| 9477 | .info = snd_ctl_boolean_mono_info, |
| 9478 | .get = alc262_hp_master_sw_get, |
| 9479 | .put = alc262_hp_master_sw_put, |
| 9480 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9481 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9482 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9483 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9484 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9485 | HDA_OUTPUT), |
| 9486 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9487 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9488 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9489 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9490 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9491 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9492 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9493 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9494 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9495 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9496 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9497 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9498 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9499 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9500 | { } /* end */ |
| 9501 | }; |
| 9502 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9503 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9504 | { |
| 9505 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9506 | .name = "Master Playback Switch", |
| 9507 | .info = snd_ctl_boolean_mono_info, |
| 9508 | .get = alc262_hp_master_sw_get, |
| 9509 | .put = alc262_hp_master_sw_put, |
| 9510 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9511 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9512 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9513 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9514 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9515 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9516 | HDA_OUTPUT), |
| 9517 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9518 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9519 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9520 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9521 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9522 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9523 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9524 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9525 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9526 | { } /* end */ |
| 9527 | }; |
| 9528 | |
| 9529 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9530 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9531 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9532 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9533 | { } /* end */ |
| 9534 | }; |
| 9535 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9536 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9537 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 9538 | { |
| 9539 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9540 | |
| 9541 | if (force || !spec->sense_updated) { |
| 9542 | unsigned int present; |
| 9543 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9544 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9545 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9546 | spec->sense_updated = 1; |
| 9547 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9548 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 9549 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9550 | } |
| 9551 | |
| 9552 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9553 | unsigned int res) |
| 9554 | { |
| 9555 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9556 | return; |
| 9557 | alc262_hp_t5735_automute(codec, 1); |
| 9558 | } |
| 9559 | |
| 9560 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9561 | { |
| 9562 | alc262_hp_t5735_automute(codec, 1); |
| 9563 | } |
| 9564 | |
| 9565 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9566 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9567 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9568 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9569 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9570 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9571 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9572 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9573 | { } /* end */ |
| 9574 | }; |
| 9575 | |
| 9576 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9577 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9578 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9579 | |
| 9580 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9581 | { } |
| 9582 | }; |
| 9583 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9584 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9585 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9586 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9587 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9588 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9589 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9590 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9591 | { } /* end */ |
| 9592 | }; |
| 9593 | |
| 9594 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9595 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9596 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9597 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9598 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9599 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9600 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9601 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9602 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9603 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9604 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9605 | {} |
| 9606 | }; |
| 9607 | |
| 9608 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9609 | .num_items = 1, |
| 9610 | .items = { |
| 9611 | { "Line", 0x1 }, |
| 9612 | }, |
| 9613 | }; |
| 9614 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9615 | /* bind hp and internal speaker mute (with plug check) */ |
| 9616 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9617 | struct snd_ctl_elem_value *ucontrol) |
| 9618 | { |
| 9619 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9620 | long *valp = ucontrol->value.integer.value; |
| 9621 | int change; |
| 9622 | |
| 9623 | /* change hp mute */ |
| 9624 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9625 | HDA_AMP_MUTE, |
| 9626 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9627 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9628 | HDA_AMP_MUTE, |
| 9629 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9630 | if (change) { |
| 9631 | /* change speaker according to HP jack state */ |
| 9632 | struct alc_spec *spec = codec->spec; |
| 9633 | unsigned int mute; |
| 9634 | if (spec->jack_present) |
| 9635 | mute = HDA_AMP_MUTE; |
| 9636 | else |
| 9637 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9638 | HDA_OUTPUT, 0); |
| 9639 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9640 | HDA_AMP_MUTE, mute); |
| 9641 | } |
| 9642 | return change; |
| 9643 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9644 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9645 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9646 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9647 | { |
| 9648 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9649 | .name = "Master Playback Switch", |
| 9650 | .info = snd_hda_mixer_amp_switch_info, |
| 9651 | .get = snd_hda_mixer_amp_switch_get, |
| 9652 | .put = alc262_sony_master_sw_put, |
| 9653 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9654 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9655 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9656 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9657 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9658 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9659 | { } /* end */ |
| 9660 | }; |
| 9661 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9662 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9663 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9664 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9665 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9666 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9667 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9668 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9669 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9670 | { } /* end */ |
| 9671 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9672 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9673 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9674 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9675 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9676 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9677 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9678 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9679 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9680 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9681 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9682 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9683 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9684 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9685 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9686 | { } /* end */ |
| 9687 | }; |
| 9688 | |
| 9689 | static struct hda_verb alc262_tyan_verbs[] = { |
| 9690 | /* Headphone automute */ |
| 9691 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9692 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9693 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9694 | |
| 9695 | /* P11 AUX_IN, white 4-pin connector */ |
| 9696 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9697 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 9698 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 9699 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 9700 | |
| 9701 | {} |
| 9702 | }; |
| 9703 | |
| 9704 | /* unsolicited event for HP jack sensing */ |
| 9705 | static void alc262_tyan_automute(struct hda_codec *codec) |
| 9706 | { |
| 9707 | unsigned int mute; |
| 9708 | unsigned int present; |
| 9709 | |
| 9710 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9711 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9712 | AC_VERB_GET_PIN_SENSE, 0); |
| 9713 | present = (present & 0x80000000) != 0; |
| 9714 | if (present) { |
| 9715 | /* mute line output on ATX panel */ |
| 9716 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9717 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9718 | } else { |
| 9719 | /* unmute line output if necessary */ |
| 9720 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9721 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9722 | HDA_AMP_MUTE, mute); |
| 9723 | } |
| 9724 | } |
| 9725 | |
| 9726 | static void alc262_tyan_unsol_event(struct hda_codec *codec, |
| 9727 | unsigned int res) |
| 9728 | { |
| 9729 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9730 | return; |
| 9731 | alc262_tyan_automute(codec); |
| 9732 | } |
| 9733 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9734 | #define alc262_capture_mixer alc882_capture_mixer |
| 9735 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9736 | |
| 9737 | /* |
| 9738 | * generic initialization of ADC, input mixers and output mixers |
| 9739 | */ |
| 9740 | static struct hda_verb alc262_init_verbs[] = { |
| 9741 | /* |
| 9742 | * Unmute ADC0-2 and set the default input to mic-in |
| 9743 | */ |
| 9744 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9745 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9746 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9748 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9749 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9750 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9751 | /* 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] | 9752 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9753 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9754 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9755 | */ |
| 9756 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9757 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9758 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9759 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9760 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9761 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9762 | |
| 9763 | /* |
| 9764 | * Set up output mixers (0x0c - 0x0e) |
| 9765 | */ |
| 9766 | /* set vol=0 to output mixers */ |
| 9767 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9768 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9769 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9770 | /* set up input amps for analog loopback */ |
| 9771 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9772 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9773 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9774 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9775 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9776 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9777 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9778 | |
| 9779 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9780 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9781 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9782 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9783 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9784 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9785 | |
| 9786 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9787 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9788 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9789 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9790 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9791 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9792 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9793 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9794 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9795 | /* FIXME: use matrix-type input source selection */ |
| 9796 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9797 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9798 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9799 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9800 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9801 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9802 | /* Input mixer2 */ |
| 9803 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9804 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9805 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9806 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9807 | /* Input mixer3 */ |
| 9808 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9809 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9810 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9811 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9812 | |
| 9813 | { } |
| 9814 | }; |
| 9815 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9816 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9817 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9818 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9819 | { } |
| 9820 | }; |
| 9821 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9822 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9823 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9824 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9825 | {} |
| 9826 | }; |
| 9827 | |
| 9828 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9829 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9830 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9831 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9832 | |
| 9833 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9834 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9835 | {} |
| 9836 | }; |
| 9837 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9838 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9839 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9840 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9841 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9842 | |
| 9843 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9844 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9845 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9846 | }; |
| 9847 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9848 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9849 | .num_items = 2, |
| 9850 | .items = { |
| 9851 | { "Int DMic", 0x9 }, |
| 9852 | { "Mic", 0x0 }, |
| 9853 | }, |
| 9854 | }; |
| 9855 | |
| 9856 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9857 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9858 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9859 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9860 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9861 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9862 | { } /* end */ |
| 9863 | }; |
| 9864 | |
| 9865 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9866 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9867 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9868 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9869 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9870 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9871 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9872 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9873 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9874 | {} |
| 9875 | }; |
| 9876 | |
| 9877 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9878 | { |
| 9879 | unsigned int present; |
| 9880 | |
| 9881 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9882 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9883 | snd_hda_codec_write(codec, 0x22, 0, |
| 9884 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9885 | } |
| 9886 | |
| 9887 | /* toggle speaker-output according to the hp-jack state */ |
| 9888 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9889 | { |
| 9890 | unsigned int present; |
| 9891 | unsigned char bits; |
| 9892 | |
| 9893 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9894 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9895 | bits = present ? 0 : PIN_OUT; |
| 9896 | snd_hda_codec_write(codec, 0x14, 0, |
| 9897 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9898 | } |
| 9899 | |
| 9900 | |
| 9901 | |
| 9902 | /* unsolicited event for HP jack sensing */ |
| 9903 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9904 | unsigned int res) |
| 9905 | { |
| 9906 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9907 | alc262_toshiba_s06_speaker_automute(codec); |
| 9908 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9909 | alc262_dmic_automute(codec); |
| 9910 | |
| 9911 | } |
| 9912 | |
| 9913 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9914 | { |
| 9915 | alc262_toshiba_s06_speaker_automute(codec); |
| 9916 | alc262_dmic_automute(codec); |
| 9917 | } |
| 9918 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9919 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9920 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9921 | { |
| 9922 | struct alc_spec *spec = codec->spec; |
| 9923 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9924 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9925 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9926 | /* need to execute and sync at first */ |
| 9927 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9928 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9929 | AC_VERB_GET_PIN_SENSE, 0); |
| 9930 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9931 | if (spec->jack_present) { |
| 9932 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9933 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9934 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9935 | } else { |
| 9936 | /* unmute internal speaker if necessary */ |
| 9937 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9938 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9939 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9940 | } |
| 9941 | } |
| 9942 | |
| 9943 | /* unsolicited event for HP jack sensing */ |
| 9944 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9945 | unsigned int res) |
| 9946 | { |
| 9947 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9948 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9949 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9950 | } |
| 9951 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9952 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9953 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9954 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9955 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9956 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9957 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9958 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9959 | AC_VERB_GET_PIN_SENSE, 0); |
| 9960 | present = (present & 0x80000000) != 0; |
| 9961 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9962 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9963 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9964 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9965 | } else { |
| 9966 | /* unmute internal speaker if necessary */ |
| 9967 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9968 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9969 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9970 | } |
| 9971 | } |
| 9972 | |
| 9973 | /* unsolicited event for HP jack sensing */ |
| 9974 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9975 | unsigned int res) |
| 9976 | { |
| 9977 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9978 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9979 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9980 | } |
| 9981 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9982 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9983 | * nec model |
| 9984 | * 0x15 = headphone |
| 9985 | * 0x16 = internal speaker |
| 9986 | * 0x18 = external mic |
| 9987 | */ |
| 9988 | |
| 9989 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9990 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9991 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9992 | |
| 9993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9995 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9996 | |
| 9997 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9998 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9999 | { } /* end */ |
| 10000 | }; |
| 10001 | |
| 10002 | static struct hda_verb alc262_nec_verbs[] = { |
| 10003 | /* Unmute Speaker */ |
| 10004 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10005 | |
| 10006 | /* Headphone */ |
| 10007 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10008 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10009 | |
| 10010 | /* External mic to headphone */ |
| 10011 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10012 | /* External mic to speaker */ |
| 10013 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10014 | {} |
| 10015 | }; |
| 10016 | |
| 10017 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10018 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10019 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10020 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10021 | */ |
| 10022 | |
| 10023 | #define ALC_HP_EVENT 0x37 |
| 10024 | |
| 10025 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10026 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10027 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10028 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10029 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10030 | {} |
| 10031 | }; |
| 10032 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10033 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10034 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10035 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10036 | {} |
| 10037 | }; |
| 10038 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10039 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10040 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10041 | .items = { |
| 10042 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10043 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10044 | { "CD", 0x4 }, |
| 10045 | }, |
| 10046 | }; |
| 10047 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10048 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10049 | .num_items = 5, |
| 10050 | .items = { |
| 10051 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10052 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10053 | { "Line", 0x2 }, |
| 10054 | { "CD", 0x4 }, |
| 10055 | { "AUX IN", 0x6 }, |
| 10056 | }, |
| 10057 | }; |
| 10058 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10059 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10060 | .num_items = 4, |
| 10061 | .items = { |
| 10062 | { "Mic", 0x0 }, |
| 10063 | { "Front Mic", 0x2 }, |
| 10064 | { "Line", 0x1 }, |
| 10065 | { "CD", 0x4 }, |
| 10066 | }, |
| 10067 | }; |
| 10068 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10069 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10070 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10071 | { |
| 10072 | struct alc_spec *spec = codec->spec; |
| 10073 | unsigned int mute; |
| 10074 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10075 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10076 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10077 | /* need to execute and sync at first */ |
| 10078 | 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] | 10079 | /* check laptop HP jack */ |
| 10080 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10081 | AC_VERB_GET_PIN_SENSE, 0); |
| 10082 | /* need to execute and sync at first */ |
| 10083 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10084 | /* check docking HP jack */ |
| 10085 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10086 | AC_VERB_GET_PIN_SENSE, 0); |
| 10087 | if (present & AC_PINSENSE_PRESENCE) |
| 10088 | spec->jack_present = 1; |
| 10089 | else |
| 10090 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10091 | spec->sense_updated = 1; |
| 10092 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10093 | /* unmute internal speaker only if both HPs are unplugged and |
| 10094 | * master switch is on |
| 10095 | */ |
| 10096 | if (spec->jack_present) |
| 10097 | mute = HDA_AMP_MUTE; |
| 10098 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10099 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10100 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10101 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10102 | } |
| 10103 | |
| 10104 | /* unsolicited event for HP jack sensing */ |
| 10105 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10106 | unsigned int res) |
| 10107 | { |
| 10108 | if ((res >> 26) != ALC_HP_EVENT) |
| 10109 | return; |
| 10110 | alc262_fujitsu_automute(codec, 1); |
| 10111 | } |
| 10112 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10113 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10114 | { |
| 10115 | alc262_fujitsu_automute(codec, 1); |
| 10116 | } |
| 10117 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10118 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10119 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10120 | .ops = &snd_hda_bind_vol, |
| 10121 | .values = { |
| 10122 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10123 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10124 | 0 |
| 10125 | }, |
| 10126 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10127 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10128 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10129 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10130 | { |
| 10131 | struct alc_spec *spec = codec->spec; |
| 10132 | unsigned int mute; |
| 10133 | |
| 10134 | if (force || !spec->sense_updated) { |
| 10135 | unsigned int present_int_hp; |
| 10136 | /* need to execute and sync at first */ |
| 10137 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10138 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10139 | AC_VERB_GET_PIN_SENSE, 0); |
| 10140 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10141 | spec->sense_updated = 1; |
| 10142 | } |
| 10143 | if (spec->jack_present) { |
| 10144 | /* mute internal speaker */ |
| 10145 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10146 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10147 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10148 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10149 | } else { |
| 10150 | /* unmute internal speaker if necessary */ |
| 10151 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10152 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10153 | HDA_AMP_MUTE, mute); |
| 10154 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10155 | HDA_AMP_MUTE, mute); |
| 10156 | } |
| 10157 | } |
| 10158 | |
| 10159 | /* unsolicited event for HP jack sensing */ |
| 10160 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10161 | unsigned int res) |
| 10162 | { |
| 10163 | if ((res >> 26) != ALC_HP_EVENT) |
| 10164 | return; |
| 10165 | alc262_lenovo_3000_automute(codec, 1); |
| 10166 | } |
| 10167 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10168 | /* bind hp and internal speaker mute (with plug check) */ |
| 10169 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10170 | struct snd_ctl_elem_value *ucontrol) |
| 10171 | { |
| 10172 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10173 | long *valp = ucontrol->value.integer.value; |
| 10174 | int change; |
| 10175 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10176 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10177 | HDA_AMP_MUTE, |
| 10178 | valp ? 0 : HDA_AMP_MUTE); |
| 10179 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10180 | HDA_AMP_MUTE, |
| 10181 | valp ? 0 : HDA_AMP_MUTE); |
| 10182 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10183 | if (change) |
| 10184 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10185 | return change; |
| 10186 | } |
| 10187 | |
| 10188 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10189 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10190 | { |
| 10191 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10192 | .name = "Master Playback Switch", |
| 10193 | .info = snd_hda_mixer_amp_switch_info, |
| 10194 | .get = snd_hda_mixer_amp_switch_get, |
| 10195 | .put = alc262_fujitsu_master_sw_put, |
| 10196 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10197 | }, |
| 10198 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10199 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10200 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10201 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10202 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10203 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10204 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10205 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10206 | { } /* end */ |
| 10207 | }; |
| 10208 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10209 | /* bind hp and internal speaker mute (with plug check) */ |
| 10210 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10211 | struct snd_ctl_elem_value *ucontrol) |
| 10212 | { |
| 10213 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10214 | long *valp = ucontrol->value.integer.value; |
| 10215 | int change; |
| 10216 | |
| 10217 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10218 | HDA_AMP_MUTE, |
| 10219 | valp ? 0 : HDA_AMP_MUTE); |
| 10220 | |
| 10221 | if (change) |
| 10222 | alc262_lenovo_3000_automute(codec, 0); |
| 10223 | return change; |
| 10224 | } |
| 10225 | |
| 10226 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10227 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10228 | { |
| 10229 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10230 | .name = "Master Playback Switch", |
| 10231 | .info = snd_hda_mixer_amp_switch_info, |
| 10232 | .get = snd_hda_mixer_amp_switch_get, |
| 10233 | .put = alc262_lenovo_3000_master_sw_put, |
| 10234 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10235 | }, |
| 10236 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10237 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10238 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10239 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10240 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10241 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10242 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10243 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10244 | { } /* end */ |
| 10245 | }; |
| 10246 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10247 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10248 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10249 | { |
| 10250 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10251 | .name = "Master Playback Switch", |
| 10252 | .info = snd_hda_mixer_amp_switch_info, |
| 10253 | .get = snd_hda_mixer_amp_switch_get, |
| 10254 | .put = alc262_sony_master_sw_put, |
| 10255 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 10256 | }, |
| 10257 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10258 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10259 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10260 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10261 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10262 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10263 | { } /* end */ |
| 10264 | }; |
| 10265 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10266 | /* additional init verbs for Benq laptops */ |
| 10267 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10268 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10269 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10270 | {} |
| 10271 | }; |
| 10272 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10273 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10274 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10275 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10276 | |
| 10277 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10278 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10279 | {} |
| 10280 | }; |
| 10281 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10282 | /* Samsung Q1 Ultra Vista model setup */ |
| 10283 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10284 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10285 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10286 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10287 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10288 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10289 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10290 | { } /* end */ |
| 10291 | }; |
| 10292 | |
| 10293 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10294 | /* output mixer */ |
| 10295 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10296 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10297 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10298 | /* speaker */ |
| 10299 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10300 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10301 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10302 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10303 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10304 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10305 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10306 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10307 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10308 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10309 | /* internal mic */ |
| 10310 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10311 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10312 | /* ADC, choose mic */ |
| 10313 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10314 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10315 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10316 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10317 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10318 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10319 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10320 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10321 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10322 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10323 | {} |
| 10324 | }; |
| 10325 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10326 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10327 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10328 | { |
| 10329 | struct alc_spec *spec = codec->spec; |
| 10330 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10331 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10332 | mute = 0; |
| 10333 | /* auto-mute only when HP is used as HP */ |
| 10334 | if (!spec->cur_mux[0]) { |
| 10335 | unsigned int present; |
| 10336 | /* need to execute and sync at first */ |
| 10337 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10338 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10339 | AC_VERB_GET_PIN_SENSE, 0); |
| 10340 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10341 | if (spec->jack_present) |
| 10342 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10343 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10344 | /* mute/unmute internal speaker */ |
| 10345 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10346 | HDA_AMP_MUTE, mute); |
| 10347 | /* mute/unmute HP */ |
| 10348 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10349 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10350 | } |
| 10351 | |
| 10352 | /* unsolicited event for HP jack sensing */ |
| 10353 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10354 | unsigned int res) |
| 10355 | { |
| 10356 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10357 | return; |
| 10358 | alc262_ultra_automute(codec); |
| 10359 | } |
| 10360 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10361 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10362 | .num_items = 2, |
| 10363 | .items = { |
| 10364 | { "Mic", 0x1 }, |
| 10365 | { "Headphone", 0x7 }, |
| 10366 | }, |
| 10367 | }; |
| 10368 | |
| 10369 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10370 | struct snd_ctl_elem_value *ucontrol) |
| 10371 | { |
| 10372 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10373 | struct alc_spec *spec = codec->spec; |
| 10374 | int ret; |
| 10375 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10376 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10377 | if (!ret) |
| 10378 | return 0; |
| 10379 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10380 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10381 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10382 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10383 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10384 | return ret; |
| 10385 | } |
| 10386 | |
| 10387 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10388 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10389 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10390 | { |
| 10391 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10392 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10393 | .info = alc_mux_enum_info, |
| 10394 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10395 | .put = alc262_ultra_mux_enum_put, |
| 10396 | }, |
| 10397 | { } /* end */ |
| 10398 | }; |
| 10399 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10400 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10401 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10402 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10403 | { |
| 10404 | hda_nid_t nid; |
| 10405 | int err; |
| 10406 | |
| 10407 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10408 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10409 | spec->multiout.dac_nids[0] = 2; |
| 10410 | |
| 10411 | nid = cfg->line_out_pins[0]; |
| 10412 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10413 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10414 | "Front Playback Volume", |
| 10415 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10416 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10417 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10418 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10419 | "Front Playback Switch", |
| 10420 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10421 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10422 | return err; |
| 10423 | } |
| 10424 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10425 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10426 | if (nid) { |
| 10427 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10428 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10429 | "Speaker Playback Volume", |
| 10430 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10431 | HDA_OUTPUT)); |
| 10432 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10433 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10434 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10435 | "Speaker Playback Switch", |
| 10436 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10437 | HDA_OUTPUT)); |
| 10438 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10439 | return err; |
| 10440 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10441 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10442 | "Speaker Playback Switch", |
| 10443 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10444 | HDA_OUTPUT)); |
| 10445 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10446 | return err; |
| 10447 | } |
| 10448 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10449 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10450 | if (nid) { |
| 10451 | /* spec->multiout.hp_nid = 2; */ |
| 10452 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10453 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10454 | "Headphone Playback Volume", |
| 10455 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10456 | HDA_OUTPUT)); |
| 10457 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10458 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10459 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10460 | "Headphone Playback Switch", |
| 10461 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10462 | HDA_OUTPUT)); |
| 10463 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10464 | return err; |
| 10465 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10466 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10467 | "Headphone Playback Switch", |
| 10468 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10469 | HDA_OUTPUT)); |
| 10470 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10471 | return err; |
| 10472 | } |
| 10473 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10474 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10475 | } |
| 10476 | |
| 10477 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10478 | #define alc262_auto_create_analog_input_ctls \ |
| 10479 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10480 | |
| 10481 | /* |
| 10482 | * generic initialization of ADC, input mixers and output mixers |
| 10483 | */ |
| 10484 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10485 | /* |
| 10486 | * Unmute ADC0-2 and set the default input to mic-in |
| 10487 | */ |
| 10488 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10489 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10490 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10491 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10492 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10493 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10494 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10495 | /* 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] | 10496 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10497 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10498 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10499 | */ |
| 10500 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10501 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10502 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10503 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10504 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10505 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10506 | |
| 10507 | /* |
| 10508 | * Set up output mixers (0x0c - 0x0f) |
| 10509 | */ |
| 10510 | /* set vol=0 to output mixers */ |
| 10511 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10512 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10513 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10514 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10515 | /* set up input amps for analog loopback */ |
| 10516 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10519 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10520 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10521 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10522 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10523 | |
| 10524 | /* FIXME: use matrix-type input source selection */ |
| 10525 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10526 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10527 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10528 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10529 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10530 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10531 | /* Input mixer2 */ |
| 10532 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10533 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10534 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10535 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10536 | /* Input mixer3 */ |
| 10537 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10538 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10539 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10540 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10541 | |
| 10542 | { } |
| 10543 | }; |
| 10544 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10545 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10546 | /* |
| 10547 | * Unmute ADC0-2 and set the default input to mic-in |
| 10548 | */ |
| 10549 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10551 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10552 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10553 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10554 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10555 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10556 | /* 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] | 10557 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10558 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10559 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10560 | */ |
| 10561 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10562 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10563 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10565 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10566 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10569 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10570 | /* |
| 10571 | * Set up output mixers (0x0c - 0x0e) |
| 10572 | */ |
| 10573 | /* set vol=0 to output mixers */ |
| 10574 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10575 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10576 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10577 | |
| 10578 | /* set up input amps for analog loopback */ |
| 10579 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10580 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10581 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10582 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10583 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10584 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10585 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10586 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10587 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10588 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10589 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10590 | |
| 10591 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10592 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10593 | |
| 10594 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10595 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10596 | |
| 10597 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10598 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10599 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10600 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10601 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10602 | |
| 10603 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10604 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10605 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10606 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10607 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10608 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10609 | |
| 10610 | |
| 10611 | /* FIXME: use matrix-type input source selection */ |
| 10612 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10613 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10614 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10615 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10616 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10617 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10618 | /* Input mixer2 */ |
| 10619 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10620 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10621 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10622 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10623 | /* Input mixer3 */ |
| 10624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10625 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10626 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10627 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10628 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10629 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10630 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10631 | { } |
| 10632 | }; |
| 10633 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10634 | static struct hda_verb alc262_HP_BPC_WildWest_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 |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10646 | * mixer widget |
| 10647 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10648 | * panel mic (mic 2) |
| 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)}, |
| 10658 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [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 | |
| 10676 | |
| 10677 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10678 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10679 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10680 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10681 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10682 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10683 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10684 | |
| 10685 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10686 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10687 | |
| 10688 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10689 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10690 | |
| 10691 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10692 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10693 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10694 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10695 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10696 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10697 | |
| 10698 | /* FIXME: use matrix-type input source selection */ |
| 10699 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10700 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10701 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10702 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10703 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10704 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10705 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10706 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10707 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10708 | /* Input mixer2 */ |
| 10709 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10710 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10711 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10712 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10713 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10714 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10715 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10716 | /* Input mixer3 */ |
| 10717 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10718 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10719 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10720 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10721 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10722 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10723 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10724 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10725 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10726 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10727 | { } |
| 10728 | }; |
| 10729 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10730 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10731 | |
| 10732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10733 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10734 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10735 | |
| 10736 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10737 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10738 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10739 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10740 | |
| 10741 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10742 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10743 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10744 | {} |
| 10745 | }; |
| 10746 | |
| 10747 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10748 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10749 | #define alc262_loopbacks alc880_loopbacks |
| 10750 | #endif |
| 10751 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10752 | /* pcm configuration: identiacal with ALC880 */ |
| 10753 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10754 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10755 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10756 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10757 | |
| 10758 | /* |
| 10759 | * BIOS auto configuration |
| 10760 | */ |
| 10761 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10762 | { |
| 10763 | struct alc_spec *spec = codec->spec; |
| 10764 | int err; |
| 10765 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10766 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10767 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10768 | alc262_ignore); |
| 10769 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10770 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10771 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10772 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10773 | spec->multiout.max_channels = 2; |
| 10774 | spec->no_analog = 1; |
| 10775 | goto dig_only; |
| 10776 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10777 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10778 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10779 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10780 | if (err < 0) |
| 10781 | return err; |
| 10782 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10783 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10784 | return err; |
| 10785 | |
| 10786 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10787 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10788 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10789 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10790 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10791 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10792 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10793 | if (spec->autocfg.dig_in_pin) |
| 10794 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10795 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10796 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10797 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10798 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10799 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10800 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10801 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10802 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10803 | err = alc_auto_add_mic_boost(codec); |
| 10804 | if (err < 0) |
| 10805 | return err; |
| 10806 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10807 | return 1; |
| 10808 | } |
| 10809 | |
| 10810 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10811 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10812 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10813 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10814 | |
| 10815 | |
| 10816 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10817 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10818 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10819 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10820 | alc262_auto_init_multi_out(codec); |
| 10821 | alc262_auto_init_hp_out(codec); |
| 10822 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10823 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10824 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10825 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10826 | } |
| 10827 | |
| 10828 | /* |
| 10829 | * configuration and preset |
| 10830 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10831 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10832 | [ALC262_BASIC] = "basic", |
| 10833 | [ALC262_HIPPO] = "hippo", |
| 10834 | [ALC262_HIPPO_1] = "hippo_1", |
| 10835 | [ALC262_FUJITSU] = "fujitsu", |
| 10836 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10837 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10838 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10839 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10840 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10841 | [ALC262_BENQ_T31] = "benq-t31", |
| 10842 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10843 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10844 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10845 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10846 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10847 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10848 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10849 | [ALC262_AUTO] = "auto", |
| 10850 | }; |
| 10851 | |
| 10852 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10853 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10854 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10855 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 10856 | ALC262_HP_BPC), |
| 10857 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 10858 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 10859 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 10860 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10861 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10862 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10863 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10864 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10865 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10866 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10867 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10868 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10869 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10870 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10871 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10872 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10873 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10874 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10875 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10876 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10877 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 10878 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 10879 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 10880 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10881 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10882 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10883 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10884 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10885 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10886 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10887 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 10888 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 10889 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10890 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10891 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10892 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10893 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10894 | {} |
| 10895 | }; |
| 10896 | |
| 10897 | static struct alc_config_preset alc262_presets[] = { |
| 10898 | [ALC262_BASIC] = { |
| 10899 | .mixers = { alc262_base_mixer }, |
| 10900 | .init_verbs = { alc262_init_verbs }, |
| 10901 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10902 | .dac_nids = alc262_dac_nids, |
| 10903 | .hp_nid = 0x03, |
| 10904 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10905 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10906 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10907 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10908 | [ALC262_HIPPO] = { |
| 10909 | .mixers = { alc262_base_mixer }, |
| 10910 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10911 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10912 | .dac_nids = alc262_dac_nids, |
| 10913 | .hp_nid = 0x03, |
| 10914 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10915 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10916 | .channel_mode = alc262_modes, |
| 10917 | .input_mux = &alc262_capture_source, |
| 10918 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10919 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10920 | }, |
| 10921 | [ALC262_HIPPO_1] = { |
| 10922 | .mixers = { alc262_hippo1_mixer }, |
| 10923 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10924 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10925 | .dac_nids = alc262_dac_nids, |
| 10926 | .hp_nid = 0x02, |
| 10927 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10928 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10929 | .channel_mode = alc262_modes, |
| 10930 | .input_mux = &alc262_capture_source, |
| 10931 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10932 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10933 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10934 | [ALC262_FUJITSU] = { |
| 10935 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10936 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10937 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10938 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10939 | .dac_nids = alc262_dac_nids, |
| 10940 | .hp_nid = 0x03, |
| 10941 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10942 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10943 | .channel_mode = alc262_modes, |
| 10944 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10945 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10946 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10947 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10948 | [ALC262_HP_BPC] = { |
| 10949 | .mixers = { alc262_HP_BPC_mixer }, |
| 10950 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10951 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10952 | .dac_nids = alc262_dac_nids, |
| 10953 | .hp_nid = 0x03, |
| 10954 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10955 | .channel_mode = alc262_modes, |
| 10956 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10957 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10958 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10959 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10960 | [ALC262_HP_BPC_D7000_WF] = { |
| 10961 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10962 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10963 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10964 | .dac_nids = alc262_dac_nids, |
| 10965 | .hp_nid = 0x03, |
| 10966 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10967 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10968 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10969 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10970 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10971 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10972 | [ALC262_HP_BPC_D7000_WL] = { |
| 10973 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10974 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10975 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10976 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10977 | .dac_nids = alc262_dac_nids, |
| 10978 | .hp_nid = 0x03, |
| 10979 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10980 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10981 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10982 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10983 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10984 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10985 | [ALC262_HP_TC_T5735] = { |
| 10986 | .mixers = { alc262_hp_t5735_mixer }, |
| 10987 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10988 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10989 | .dac_nids = alc262_dac_nids, |
| 10990 | .hp_nid = 0x03, |
| 10991 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10992 | .channel_mode = alc262_modes, |
| 10993 | .input_mux = &alc262_capture_source, |
| 10994 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10995 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10996 | }, |
| 10997 | [ALC262_HP_RP5700] = { |
| 10998 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10999 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11000 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11001 | .dac_nids = alc262_dac_nids, |
| 11002 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11003 | .channel_mode = alc262_modes, |
| 11004 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11005 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11006 | [ALC262_BENQ_ED8] = { |
| 11007 | .mixers = { alc262_base_mixer }, |
| 11008 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11009 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11010 | .dac_nids = alc262_dac_nids, |
| 11011 | .hp_nid = 0x03, |
| 11012 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11013 | .channel_mode = alc262_modes, |
| 11014 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11015 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11016 | [ALC262_SONY_ASSAMD] = { |
| 11017 | .mixers = { alc262_sony_mixer }, |
| 11018 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11019 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11020 | .dac_nids = alc262_dac_nids, |
| 11021 | .hp_nid = 0x02, |
| 11022 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11023 | .channel_mode = alc262_modes, |
| 11024 | .input_mux = &alc262_capture_source, |
| 11025 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11026 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11027 | }, |
| 11028 | [ALC262_BENQ_T31] = { |
| 11029 | .mixers = { alc262_benq_t31_mixer }, |
| 11030 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11031 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11032 | .dac_nids = alc262_dac_nids, |
| 11033 | .hp_nid = 0x03, |
| 11034 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11035 | .channel_mode = alc262_modes, |
| 11036 | .input_mux = &alc262_capture_source, |
| 11037 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11038 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11039 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11040 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11041 | .mixers = { alc262_ultra_mixer }, |
| 11042 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11043 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11044 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11045 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11046 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11047 | .channel_mode = alc262_modes, |
| 11048 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11049 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11050 | .capsrc_nids = alc262_capsrc_nids, |
| 11051 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11052 | .unsol_event = alc262_ultra_unsol_event, |
| 11053 | .init_hook = alc262_ultra_automute, |
| 11054 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11055 | [ALC262_LENOVO_3000] = { |
| 11056 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11057 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11058 | alc262_lenovo_3000_unsol_verbs }, |
| 11059 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11060 | .dac_nids = alc262_dac_nids, |
| 11061 | .hp_nid = 0x03, |
| 11062 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11063 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11064 | .channel_mode = alc262_modes, |
| 11065 | .input_mux = &alc262_fujitsu_capture_source, |
| 11066 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11067 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11068 | [ALC262_NEC] = { |
| 11069 | .mixers = { alc262_nec_mixer }, |
| 11070 | .init_verbs = { alc262_nec_verbs }, |
| 11071 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11072 | .dac_nids = alc262_dac_nids, |
| 11073 | .hp_nid = 0x03, |
| 11074 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11075 | .channel_mode = alc262_modes, |
| 11076 | .input_mux = &alc262_capture_source, |
| 11077 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11078 | [ALC262_TOSHIBA_S06] = { |
| 11079 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11080 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11081 | alc262_eapd_verbs }, |
| 11082 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11083 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11084 | .dac_nids = alc262_dac_nids, |
| 11085 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 11086 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11087 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11088 | .channel_mode = alc262_modes, |
| 11089 | .input_mux = &alc262_dmic_capture_source, |
| 11090 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11091 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11092 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11093 | [ALC262_TOSHIBA_RX1] = { |
| 11094 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11095 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11096 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11097 | .dac_nids = alc262_dac_nids, |
| 11098 | .hp_nid = 0x03, |
| 11099 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11100 | .channel_mode = alc262_modes, |
| 11101 | .input_mux = &alc262_capture_source, |
| 11102 | .unsol_event = alc262_hippo_unsol_event, |
| 11103 | .init_hook = alc262_hippo_automute, |
| 11104 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11105 | [ALC262_TYAN] = { |
| 11106 | .mixers = { alc262_tyan_mixer }, |
| 11107 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11108 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11109 | .dac_nids = alc262_dac_nids, |
| 11110 | .hp_nid = 0x02, |
| 11111 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11112 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11113 | .channel_mode = alc262_modes, |
| 11114 | .input_mux = &alc262_capture_source, |
| 11115 | .unsol_event = alc262_tyan_unsol_event, |
| 11116 | .init_hook = alc262_tyan_automute, |
| 11117 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11118 | }; |
| 11119 | |
| 11120 | static int patch_alc262(struct hda_codec *codec) |
| 11121 | { |
| 11122 | struct alc_spec *spec; |
| 11123 | int board_config; |
| 11124 | int err; |
| 11125 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11126 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11127 | if (spec == NULL) |
| 11128 | return -ENOMEM; |
| 11129 | |
| 11130 | codec->spec = spec; |
| 11131 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11132 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11133 | * under-run |
| 11134 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11135 | { |
| 11136 | int tmp; |
| 11137 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11138 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11139 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11140 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11141 | } |
| 11142 | #endif |
| 11143 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11144 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11145 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11146 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11147 | alc262_models, |
| 11148 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11149 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11150 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11151 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 11152 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11153 | board_config = ALC262_AUTO; |
| 11154 | } |
| 11155 | |
| 11156 | if (board_config == ALC262_AUTO) { |
| 11157 | /* automatic parse from the BIOS config */ |
| 11158 | err = alc262_parse_auto_config(codec); |
| 11159 | if (err < 0) { |
| 11160 | alc_free(codec); |
| 11161 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11162 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11163 | printk(KERN_INFO |
| 11164 | "hda_codec: Cannot set up configuration " |
| 11165 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11166 | board_config = ALC262_BASIC; |
| 11167 | } |
| 11168 | } |
| 11169 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11170 | if (!spec->no_analog) { |
| 11171 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11172 | if (err < 0) { |
| 11173 | alc_free(codec); |
| 11174 | return err; |
| 11175 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11176 | } |
| 11177 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11178 | if (board_config != ALC262_AUTO) |
| 11179 | setup_preset(spec, &alc262_presets[board_config]); |
| 11180 | |
| 11181 | spec->stream_name_analog = "ALC262 Analog"; |
| 11182 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11183 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11184 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11185 | spec->stream_name_digital = "ALC262 Digital"; |
| 11186 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11187 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11188 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11189 | spec->capture_style = CAPT_MIX; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11190 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11191 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11192 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11193 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11194 | /* get type */ |
| 11195 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11196 | if (wcap != AC_WID_AUD_IN) { |
| 11197 | spec->adc_nids = alc262_adc_nids_alt; |
| 11198 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11199 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11200 | } else { |
| 11201 | spec->adc_nids = alc262_adc_nids; |
| 11202 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11203 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11204 | } |
| 11205 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11206 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11207 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11208 | if (!spec->no_analog) |
| 11209 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11210 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11211 | spec->vmaster_nid = 0x0c; |
| 11212 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11213 | codec->patch_ops = alc_patch_ops; |
| 11214 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11215 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11216 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11217 | if (!spec->loopback.amplist) |
| 11218 | spec->loopback.amplist = alc262_loopbacks; |
| 11219 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11220 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11221 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11222 | return 0; |
| 11223 | } |
| 11224 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11225 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11226 | * ALC268 channel source setting (2 channel) |
| 11227 | */ |
| 11228 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11229 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11230 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11231 | static hda_nid_t alc268_dac_nids[2] = { |
| 11232 | /* front, hp */ |
| 11233 | 0x02, 0x03 |
| 11234 | }; |
| 11235 | |
| 11236 | static hda_nid_t alc268_adc_nids[2] = { |
| 11237 | /* ADC0-1 */ |
| 11238 | 0x08, 0x07 |
| 11239 | }; |
| 11240 | |
| 11241 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11242 | /* ADC0 */ |
| 11243 | 0x08 |
| 11244 | }; |
| 11245 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11246 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11247 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11248 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11249 | /* output mixer control */ |
| 11250 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11251 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11252 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11253 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11254 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11255 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11256 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11257 | { } |
| 11258 | }; |
| 11259 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11260 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11261 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11262 | .ops = &snd_hda_bind_sw, |
| 11263 | .values = { |
| 11264 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11265 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11266 | 0 |
| 11267 | }, |
| 11268 | }; |
| 11269 | |
| 11270 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11271 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11272 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11273 | { } |
| 11274 | }; |
| 11275 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11276 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11277 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11278 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11279 | { } |
| 11280 | }; |
| 11281 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11282 | /* Toshiba specific */ |
| 11283 | #define alc268_toshiba_automute alc262_hippo_automute |
| 11284 | |
| 11285 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11286 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11287 | { } /* end */ |
| 11288 | }; |
| 11289 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11290 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11291 | .num_items = 2, |
| 11292 | .items = { |
| 11293 | { "i-Mic", 0x6 }, |
| 11294 | { "E-Mic", 0x0 }, |
| 11295 | }, |
| 11296 | }; |
| 11297 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11298 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11299 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11300 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11301 | .ops = &snd_hda_bind_vol, |
| 11302 | .values = { |
| 11303 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11304 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11305 | 0 |
| 11306 | }, |
| 11307 | }; |
| 11308 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11309 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11310 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11311 | { |
| 11312 | struct alc_spec *spec = codec->spec; |
| 11313 | unsigned int mute; |
| 11314 | |
| 11315 | if (force || !spec->sense_updated) { |
| 11316 | unsigned int present; |
| 11317 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11318 | AC_VERB_GET_PIN_SENSE, 0); |
| 11319 | spec->jack_present = (present & 0x80000000) != 0; |
| 11320 | spec->sense_updated = 1; |
| 11321 | } |
| 11322 | if (spec->jack_present) |
| 11323 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11324 | else /* unmute internal speaker if necessary */ |
| 11325 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11326 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11327 | HDA_AMP_MUTE, mute); |
| 11328 | } |
| 11329 | |
| 11330 | |
| 11331 | /* bind hp and internal speaker mute (with plug check) */ |
| 11332 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11333 | struct snd_ctl_elem_value *ucontrol) |
| 11334 | { |
| 11335 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11336 | long *valp = ucontrol->value.integer.value; |
| 11337 | int change; |
| 11338 | |
| 11339 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11340 | HDA_AMP_MUTE, |
| 11341 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11342 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11343 | HDA_AMP_MUTE, |
| 11344 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11345 | if (change) |
| 11346 | alc268_acer_automute(codec, 0); |
| 11347 | return change; |
| 11348 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11349 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11350 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11351 | /* output mixer control */ |
| 11352 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11353 | { |
| 11354 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11355 | .name = "Master Playback Switch", |
| 11356 | .info = snd_hda_mixer_amp_switch_info, |
| 11357 | .get = snd_hda_mixer_amp_switch_get, |
| 11358 | .put = alc268_acer_master_sw_put, |
| 11359 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11360 | }, |
| 11361 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11362 | { } |
| 11363 | }; |
| 11364 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11365 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11366 | /* output mixer control */ |
| 11367 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11368 | { |
| 11369 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11370 | .name = "Master Playback Switch", |
| 11371 | .info = snd_hda_mixer_amp_switch_info, |
| 11372 | .get = snd_hda_mixer_amp_switch_get, |
| 11373 | .put = alc268_acer_master_sw_put, |
| 11374 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11375 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11376 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11377 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11378 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11379 | { } |
| 11380 | }; |
| 11381 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11382 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11383 | /* output mixer control */ |
| 11384 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11385 | { |
| 11386 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11387 | .name = "Master Playback Switch", |
| 11388 | .info = snd_hda_mixer_amp_switch_info, |
| 11389 | .get = snd_hda_mixer_amp_switch_get, |
| 11390 | .put = alc268_acer_master_sw_put, |
| 11391 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11392 | }, |
| 11393 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11394 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11395 | { } |
| 11396 | }; |
| 11397 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11398 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11399 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11400 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11401 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11402 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11403 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11404 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11405 | { } |
| 11406 | }; |
| 11407 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11408 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11409 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11410 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11411 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11412 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11413 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11414 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11415 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11416 | { } |
| 11417 | }; |
| 11418 | |
| 11419 | /* unsolicited event for HP jack sensing */ |
| 11420 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 11421 | unsigned int res) |
| 11422 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11423 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11424 | return; |
| 11425 | alc268_toshiba_automute(codec); |
| 11426 | } |
| 11427 | |
| 11428 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11429 | unsigned int res) |
| 11430 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11431 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11432 | return; |
| 11433 | alc268_acer_automute(codec, 1); |
| 11434 | } |
| 11435 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11436 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11437 | { |
| 11438 | alc268_acer_automute(codec, 1); |
| 11439 | } |
| 11440 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11441 | /* toggle speaker-output according to the hp-jack state */ |
| 11442 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11443 | { |
| 11444 | unsigned int present; |
| 11445 | unsigned char bits; |
| 11446 | |
| 11447 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11448 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11449 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11450 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11451 | AMP_IN_MUTE(0), bits); |
| 11452 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11453 | AMP_IN_MUTE(0), bits); |
| 11454 | } |
| 11455 | |
| 11456 | |
| 11457 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11458 | { |
| 11459 | unsigned int present; |
| 11460 | |
| 11461 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11462 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11463 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11464 | present ? 0x0 : 0x6); |
| 11465 | } |
| 11466 | |
| 11467 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11468 | unsigned int res) |
| 11469 | { |
| 11470 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11471 | alc268_aspire_one_speaker_automute(codec); |
| 11472 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11473 | alc268_acer_mic_automute(codec); |
| 11474 | } |
| 11475 | |
| 11476 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11477 | { |
| 11478 | alc268_aspire_one_speaker_automute(codec); |
| 11479 | alc268_acer_mic_automute(codec); |
| 11480 | } |
| 11481 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11482 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11483 | /* output mixer control */ |
| 11484 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11485 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11486 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11487 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11488 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11489 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11490 | { } |
| 11491 | }; |
| 11492 | |
| 11493 | static struct hda_verb alc268_dell_verbs[] = { |
| 11494 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11495 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11496 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11497 | { } |
| 11498 | }; |
| 11499 | |
| 11500 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11501 | static void alc268_dell_automute(struct hda_codec *codec) |
| 11502 | { |
| 11503 | unsigned int present; |
| 11504 | unsigned int mute; |
| 11505 | |
| 11506 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 11507 | if (present & 0x80000000) |
| 11508 | mute = HDA_AMP_MUTE; |
| 11509 | else |
| 11510 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 11511 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11512 | HDA_AMP_MUTE, mute); |
| 11513 | } |
| 11514 | |
| 11515 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 11516 | unsigned int res) |
| 11517 | { |
| 11518 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11519 | return; |
| 11520 | alc268_dell_automute(codec); |
| 11521 | } |
| 11522 | |
| 11523 | #define alc268_dell_init_hook alc268_dell_automute |
| 11524 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11525 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11526 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11527 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11528 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11529 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11530 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11531 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11532 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11533 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11534 | { } |
| 11535 | }; |
| 11536 | |
| 11537 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11538 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11539 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11540 | { } |
| 11541 | }; |
| 11542 | |
| 11543 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 11544 | { |
| 11545 | unsigned int present; |
| 11546 | |
| 11547 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11548 | & AC_PINSENSE_PRESENCE; |
| 11549 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11550 | present ? 0 : PIN_OUT); |
| 11551 | } |
| 11552 | |
| 11553 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11554 | { |
| 11555 | unsigned int present; |
| 11556 | |
| 11557 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11558 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11559 | snd_hda_codec_write(codec, 0x23, 0, |
| 11560 | AC_VERB_SET_CONNECT_SEL, |
| 11561 | present ? 0x00 : 0x01); |
| 11562 | } |
| 11563 | |
| 11564 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 11565 | { |
| 11566 | alc267_quanta_il1_hp_automute(codec); |
| 11567 | alc267_quanta_il1_mic_automute(codec); |
| 11568 | } |
| 11569 | |
| 11570 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11571 | unsigned int res) |
| 11572 | { |
| 11573 | switch (res >> 26) { |
| 11574 | case ALC880_HP_EVENT: |
| 11575 | alc267_quanta_il1_hp_automute(codec); |
| 11576 | break; |
| 11577 | case ALC880_MIC_EVENT: |
| 11578 | alc267_quanta_il1_mic_automute(codec); |
| 11579 | break; |
| 11580 | } |
| 11581 | } |
| 11582 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11583 | /* |
| 11584 | * generic initialization of ADC, input mixers and output mixers |
| 11585 | */ |
| 11586 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11587 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11588 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11589 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11590 | |
| 11591 | /* |
| 11592 | * Set up output mixers (0x0c - 0x0e) |
| 11593 | */ |
| 11594 | /* set vol=0 to output mixers */ |
| 11595 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11596 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11597 | |
| 11598 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11599 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11600 | |
| 11601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11602 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11603 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11604 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11605 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11606 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11607 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11608 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11609 | |
| 11610 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11611 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11612 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11613 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11614 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11615 | |
| 11616 | /* set PCBEEP vol = 0, mute connections */ |
| 11617 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11618 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11619 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11620 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11621 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11622 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11623 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11624 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11625 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11626 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11627 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11628 | { } |
| 11629 | }; |
| 11630 | |
| 11631 | /* |
| 11632 | * generic initialization of ADC, input mixers and output mixers |
| 11633 | */ |
| 11634 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11635 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11636 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11637 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11638 | |
| 11639 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11640 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11641 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11642 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11643 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11644 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11645 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11646 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11647 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11648 | |
| 11649 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11650 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11651 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11652 | /* set PCBEEP vol = 0, mute connections */ |
| 11653 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11654 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11655 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11656 | |
| 11657 | { } |
| 11658 | }; |
| 11659 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11660 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11661 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11662 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11663 | { |
| 11664 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11665 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11666 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11667 | */ |
| 11668 | /* .name = "Capture Source", */ |
| 11669 | .name = "Input Source", |
| 11670 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11671 | .info = alc_mux_enum_info, |
| 11672 | .get = alc_mux_enum_get, |
| 11673 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11674 | }, |
| 11675 | { } /* end */ |
| 11676 | }; |
| 11677 | |
| 11678 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11679 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11680 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11681 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11682 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11683 | { |
| 11684 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11685 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11686 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11687 | */ |
| 11688 | /* .name = "Capture Source", */ |
| 11689 | .name = "Input Source", |
| 11690 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11691 | .info = alc_mux_enum_info, |
| 11692 | .get = alc_mux_enum_get, |
| 11693 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11694 | }, |
| 11695 | { } /* end */ |
| 11696 | }; |
| 11697 | |
| 11698 | static struct hda_input_mux alc268_capture_source = { |
| 11699 | .num_items = 4, |
| 11700 | .items = { |
| 11701 | { "Mic", 0x0 }, |
| 11702 | { "Front Mic", 0x1 }, |
| 11703 | { "Line", 0x2 }, |
| 11704 | { "CD", 0x3 }, |
| 11705 | }, |
| 11706 | }; |
| 11707 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11708 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11709 | .num_items = 3, |
| 11710 | .items = { |
| 11711 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11712 | { "Internal Mic", 0x1 }, |
| 11713 | { "Line", 0x2 }, |
| 11714 | }, |
| 11715 | }; |
| 11716 | |
| 11717 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11718 | .num_items = 3, |
| 11719 | .items = { |
| 11720 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11721 | { "Internal Mic", 0x6 }, |
| 11722 | { "Line", 0x2 }, |
| 11723 | }, |
| 11724 | }; |
| 11725 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11726 | #ifdef CONFIG_SND_DEBUG |
| 11727 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11728 | /* Volume widgets */ |
| 11729 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11730 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11731 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11732 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11733 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11734 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11735 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11736 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11737 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11738 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11739 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11740 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11741 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11742 | /* The below appears problematic on some hardwares */ |
| 11743 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11744 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11745 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11746 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11747 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11748 | |
| 11749 | /* Modes for retasking pin widgets */ |
| 11750 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11751 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11752 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11753 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11754 | |
| 11755 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11756 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11757 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11758 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11759 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11760 | |
| 11761 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11762 | * The ALC268 does not have an SPDIF input. |
| 11763 | */ |
| 11764 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11765 | |
| 11766 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11767 | * this output to turn on an external amplifier. |
| 11768 | */ |
| 11769 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11770 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11771 | |
| 11772 | { } /* end */ |
| 11773 | }; |
| 11774 | #endif |
| 11775 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11776 | /* create input playback/capture controls for the given pin */ |
| 11777 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11778 | const char *ctlname, int idx) |
| 11779 | { |
| 11780 | char name[32]; |
| 11781 | int err; |
| 11782 | |
| 11783 | sprintf(name, "%s Playback Volume", ctlname); |
| 11784 | if (nid == 0x14) { |
| 11785 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11786 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11787 | HDA_OUTPUT)); |
| 11788 | if (err < 0) |
| 11789 | return err; |
| 11790 | } else if (nid == 0x15) { |
| 11791 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11792 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11793 | HDA_OUTPUT)); |
| 11794 | if (err < 0) |
| 11795 | return err; |
| 11796 | } else |
| 11797 | return -1; |
| 11798 | sprintf(name, "%s Playback Switch", ctlname); |
| 11799 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11800 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11801 | if (err < 0) |
| 11802 | return err; |
| 11803 | return 0; |
| 11804 | } |
| 11805 | |
| 11806 | /* add playback controls from the parsed DAC table */ |
| 11807 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11808 | const struct auto_pin_cfg *cfg) |
| 11809 | { |
| 11810 | hda_nid_t nid; |
| 11811 | int err; |
| 11812 | |
| 11813 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11814 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11815 | spec->multiout.dac_nids[0] = 2; |
| 11816 | spec->multiout.dac_nids[1] = 3; |
| 11817 | |
| 11818 | nid = cfg->line_out_pins[0]; |
| 11819 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11820 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11821 | |
| 11822 | nid = cfg->speaker_pins[0]; |
| 11823 | if (nid == 0x1d) { |
| 11824 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11825 | "Speaker Playback Volume", |
| 11826 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11827 | if (err < 0) |
| 11828 | return err; |
| 11829 | } |
| 11830 | nid = cfg->hp_pins[0]; |
| 11831 | if (nid) |
| 11832 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11833 | |
| 11834 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11835 | if (nid == 0x16) { |
| 11836 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11837 | "Mono Playback Switch", |
| 11838 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11839 | if (err < 0) |
| 11840 | return err; |
| 11841 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11842 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11843 | } |
| 11844 | |
| 11845 | /* create playback/capture controls for input pins */ |
| 11846 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11847 | const struct auto_pin_cfg *cfg) |
| 11848 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11849 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11850 | int i, idx1; |
| 11851 | |
| 11852 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11853 | switch(cfg->input_pins[i]) { |
| 11854 | case 0x18: |
| 11855 | idx1 = 0; /* Mic 1 */ |
| 11856 | break; |
| 11857 | case 0x19: |
| 11858 | idx1 = 1; /* Mic 2 */ |
| 11859 | break; |
| 11860 | case 0x1a: |
| 11861 | idx1 = 2; /* Line In */ |
| 11862 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11863 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11864 | idx1 = 3; /* CD */ |
| 11865 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11866 | case 0x12: |
| 11867 | case 0x13: |
| 11868 | idx1 = 6; /* digital mics */ |
| 11869 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11870 | default: |
| 11871 | continue; |
| 11872 | } |
| 11873 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11874 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11875 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11876 | } |
| 11877 | return 0; |
| 11878 | } |
| 11879 | |
| 11880 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11881 | { |
| 11882 | struct alc_spec *spec = codec->spec; |
| 11883 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11884 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11885 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11886 | unsigned int dac_vol1, dac_vol2; |
| 11887 | |
| 11888 | if (speaker_nid) { |
| 11889 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11890 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11891 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11892 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11893 | AMP_IN_UNMUTE(1)); |
| 11894 | snd_hda_codec_write(codec, 0x10, 0, |
| 11895 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11896 | AMP_IN_UNMUTE(1)); |
| 11897 | } else { |
| 11898 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11899 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11900 | snd_hda_codec_write(codec, 0x10, 0, |
| 11901 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11902 | } |
| 11903 | |
| 11904 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11905 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11906 | dac_vol2 = AMP_OUT_ZERO; |
| 11907 | else if (line_nid == 0x15) |
| 11908 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11909 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11910 | dac_vol2 = AMP_OUT_ZERO; |
| 11911 | else if (hp_nid == 0x15) |
| 11912 | dac_vol1 = AMP_OUT_ZERO; |
| 11913 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11914 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11915 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11916 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11917 | |
| 11918 | snd_hda_codec_write(codec, 0x02, 0, |
| 11919 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11920 | snd_hda_codec_write(codec, 0x03, 0, |
| 11921 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11922 | } |
| 11923 | |
| 11924 | /* pcm configuration: identiacal with ALC880 */ |
| 11925 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11926 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11927 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11928 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11929 | |
| 11930 | /* |
| 11931 | * BIOS auto configuration |
| 11932 | */ |
| 11933 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11934 | { |
| 11935 | struct alc_spec *spec = codec->spec; |
| 11936 | int err; |
| 11937 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11938 | |
| 11939 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11940 | alc268_ignore); |
| 11941 | if (err < 0) |
| 11942 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11943 | if (!spec->autocfg.line_outs) { |
| 11944 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 11945 | spec->multiout.max_channels = 2; |
| 11946 | spec->no_analog = 1; |
| 11947 | goto dig_only; |
| 11948 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11949 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11950 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11951 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11952 | if (err < 0) |
| 11953 | return err; |
| 11954 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11955 | if (err < 0) |
| 11956 | return err; |
| 11957 | |
| 11958 | spec->multiout.max_channels = 2; |
| 11959 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11960 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11961 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11962 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11963 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11964 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 11965 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11966 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11967 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11968 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 11969 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11970 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11971 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11972 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11973 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11974 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11975 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11976 | err = alc_auto_add_mic_boost(codec); |
| 11977 | if (err < 0) |
| 11978 | return err; |
| 11979 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11980 | return 1; |
| 11981 | } |
| 11982 | |
| 11983 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11984 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11985 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11986 | |
| 11987 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11988 | static void alc268_auto_init(struct hda_codec *codec) |
| 11989 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11990 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11991 | alc268_auto_init_multi_out(codec); |
| 11992 | alc268_auto_init_hp_out(codec); |
| 11993 | alc268_auto_init_mono_speaker_out(codec); |
| 11994 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11995 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11996 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11997 | } |
| 11998 | |
| 11999 | /* |
| 12000 | * configuration and preset |
| 12001 | */ |
| 12002 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12003 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12004 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12005 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12006 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12007 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12008 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12009 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12010 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12011 | #ifdef CONFIG_SND_DEBUG |
| 12012 | [ALC268_TEST] = "test", |
| 12013 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12014 | [ALC268_AUTO] = "auto", |
| 12015 | }; |
| 12016 | |
| 12017 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12018 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12019 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12020 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12021 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12022 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12023 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12024 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12025 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12026 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12027 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12028 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12029 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 12030 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 12031 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12032 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12033 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12034 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12035 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12036 | {} |
| 12037 | }; |
| 12038 | |
| 12039 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12040 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12041 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12042 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12043 | alc267_quanta_il1_verbs }, |
| 12044 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12045 | .dac_nids = alc268_dac_nids, |
| 12046 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12047 | .adc_nids = alc268_adc_nids_alt, |
| 12048 | .hp_nid = 0x03, |
| 12049 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12050 | .channel_mode = alc268_modes, |
| 12051 | .input_mux = &alc268_capture_source, |
| 12052 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 12053 | .init_hook = alc267_quanta_il1_automute, |
| 12054 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12055 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12056 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12057 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12058 | .init_verbs = { alc268_base_init_verbs }, |
| 12059 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12060 | .dac_nids = alc268_dac_nids, |
| 12061 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12062 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12063 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12064 | .hp_nid = 0x03, |
| 12065 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12066 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12067 | .channel_mode = alc268_modes, |
| 12068 | .input_mux = &alc268_capture_source, |
| 12069 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12070 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12071 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12072 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12073 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12074 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12075 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12076 | .dac_nids = alc268_dac_nids, |
| 12077 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12078 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12079 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12080 | .hp_nid = 0x03, |
| 12081 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12082 | .channel_mode = alc268_modes, |
| 12083 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12084 | .unsol_event = alc268_toshiba_unsol_event, |
| 12085 | .init_hook = alc268_toshiba_automute, |
| 12086 | }, |
| 12087 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12088 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12089 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12090 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12091 | alc268_acer_verbs }, |
| 12092 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12093 | .dac_nids = alc268_dac_nids, |
| 12094 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12095 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12096 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12097 | .hp_nid = 0x02, |
| 12098 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12099 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12100 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12101 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12102 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12103 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12104 | [ALC268_ACER_DMIC] = { |
| 12105 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12106 | alc268_beep_mixer }, |
| 12107 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12108 | alc268_acer_verbs }, |
| 12109 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12110 | .dac_nids = alc268_dac_nids, |
| 12111 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12112 | .adc_nids = alc268_adc_nids_alt, |
| 12113 | .capsrc_nids = alc268_capsrc_nids, |
| 12114 | .hp_nid = 0x02, |
| 12115 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12116 | .channel_mode = alc268_modes, |
| 12117 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12118 | .unsol_event = alc268_acer_unsol_event, |
| 12119 | .init_hook = alc268_acer_init_hook, |
| 12120 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12121 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12122 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12123 | alc268_beep_mixer, |
| 12124 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12125 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12126 | alc268_acer_aspire_one_verbs }, |
| 12127 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12128 | .dac_nids = alc268_dac_nids, |
| 12129 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12130 | .adc_nids = alc268_adc_nids_alt, |
| 12131 | .capsrc_nids = alc268_capsrc_nids, |
| 12132 | .hp_nid = 0x03, |
| 12133 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12134 | .channel_mode = alc268_modes, |
| 12135 | .input_mux = &alc268_acer_lc_capture_source, |
| 12136 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12137 | .init_hook = alc268_acer_lc_init_hook, |
| 12138 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12139 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12140 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12141 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12142 | alc268_dell_verbs }, |
| 12143 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12144 | .dac_nids = alc268_dac_nids, |
| 12145 | .hp_nid = 0x02, |
| 12146 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12147 | .channel_mode = alc268_modes, |
| 12148 | .unsol_event = alc268_dell_unsol_event, |
| 12149 | .init_hook = alc268_dell_init_hook, |
| 12150 | .input_mux = &alc268_capture_source, |
| 12151 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12152 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12153 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12154 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12155 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12156 | alc268_toshiba_verbs }, |
| 12157 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12158 | .dac_nids = alc268_dac_nids, |
| 12159 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12160 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12161 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12162 | .hp_nid = 0x03, |
| 12163 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12164 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12165 | .channel_mode = alc268_modes, |
| 12166 | .input_mux = &alc268_capture_source, |
| 12167 | .unsol_event = alc268_toshiba_unsol_event, |
| 12168 | .init_hook = alc268_toshiba_automute |
| 12169 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12170 | #ifdef CONFIG_SND_DEBUG |
| 12171 | [ALC268_TEST] = { |
| 12172 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12173 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12174 | alc268_volume_init_verbs }, |
| 12175 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12176 | .dac_nids = alc268_dac_nids, |
| 12177 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12178 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12179 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12180 | .hp_nid = 0x03, |
| 12181 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12182 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12183 | .channel_mode = alc268_modes, |
| 12184 | .input_mux = &alc268_capture_source, |
| 12185 | }, |
| 12186 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12187 | }; |
| 12188 | |
| 12189 | static int patch_alc268(struct hda_codec *codec) |
| 12190 | { |
| 12191 | struct alc_spec *spec; |
| 12192 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12193 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12194 | |
| 12195 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12196 | if (spec == NULL) |
| 12197 | return -ENOMEM; |
| 12198 | |
| 12199 | codec->spec = spec; |
| 12200 | |
| 12201 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12202 | alc268_models, |
| 12203 | alc268_cfg_tbl); |
| 12204 | |
| 12205 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 12206 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 12207 | "trying auto-probe from BIOS...\n"); |
| 12208 | board_config = ALC268_AUTO; |
| 12209 | } |
| 12210 | |
| 12211 | if (board_config == ALC268_AUTO) { |
| 12212 | /* automatic parse from the BIOS config */ |
| 12213 | err = alc268_parse_auto_config(codec); |
| 12214 | if (err < 0) { |
| 12215 | alc_free(codec); |
| 12216 | return err; |
| 12217 | } else if (!err) { |
| 12218 | printk(KERN_INFO |
| 12219 | "hda_codec: Cannot set up configuration " |
| 12220 | "from BIOS. Using base mode...\n"); |
| 12221 | board_config = ALC268_3ST; |
| 12222 | } |
| 12223 | } |
| 12224 | |
| 12225 | if (board_config != ALC268_AUTO) |
| 12226 | setup_preset(spec, &alc268_presets[board_config]); |
| 12227 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 12228 | if (codec->vendor_id == 0x10ec0267) { |
| 12229 | spec->stream_name_analog = "ALC267 Analog"; |
| 12230 | spec->stream_name_digital = "ALC267 Digital"; |
| 12231 | } else { |
| 12232 | spec->stream_name_analog = "ALC268 Analog"; |
| 12233 | spec->stream_name_digital = "ALC268 Digital"; |
| 12234 | } |
| 12235 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12236 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12237 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12238 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12239 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12240 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12241 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12242 | has_beep = 0; |
| 12243 | for (i = 0; i < spec->num_mixers; i++) { |
| 12244 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12245 | has_beep = 1; |
| 12246 | break; |
| 12247 | } |
| 12248 | } |
| 12249 | |
| 12250 | if (has_beep) { |
| 12251 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12252 | if (err < 0) { |
| 12253 | alc_free(codec); |
| 12254 | return err; |
| 12255 | } |
| 12256 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12257 | /* override the amp caps for beep generator */ |
| 12258 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12259 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12260 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12261 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12262 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12263 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12264 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12265 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12266 | /* check whether NID 0x07 is valid */ |
| 12267 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12268 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12269 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12270 | /* get type */ |
| 12271 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12272 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12273 | spec->adc_nids = alc268_adc_nids_alt; |
| 12274 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12275 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12276 | } else { |
| 12277 | spec->adc_nids = alc268_adc_nids; |
| 12278 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12279 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12280 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12281 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12282 | /* set default input source */ |
| 12283 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12284 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12285 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12286 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12287 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12288 | |
| 12289 | spec->vmaster_nid = 0x02; |
| 12290 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12291 | codec->patch_ops = alc_patch_ops; |
| 12292 | if (board_config == ALC268_AUTO) |
| 12293 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12294 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12295 | codec->proc_widget_hook = print_realtek_coef; |
| 12296 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12297 | return 0; |
| 12298 | } |
| 12299 | |
| 12300 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12301 | * ALC269 channel source setting (2 channel) |
| 12302 | */ |
| 12303 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12304 | |
| 12305 | #define alc269_dac_nids alc260_dac_nids |
| 12306 | |
| 12307 | static hda_nid_t alc269_adc_nids[1] = { |
| 12308 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12309 | 0x08, |
| 12310 | }; |
| 12311 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12312 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12313 | 0x23, |
| 12314 | }; |
| 12315 | |
| 12316 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12317 | * not a mux! |
| 12318 | */ |
| 12319 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12320 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12321 | .num_items = 2, |
| 12322 | .items = { |
| 12323 | { "i-Mic", 0x5 }, |
| 12324 | { "e-Mic", 0x0 }, |
| 12325 | }, |
| 12326 | }; |
| 12327 | |
| 12328 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12329 | .num_items = 2, |
| 12330 | .items = { |
| 12331 | { "i-Mic", 0x1 }, |
| 12332 | { "e-Mic", 0x0 }, |
| 12333 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12334 | }; |
| 12335 | |
| 12336 | #define alc269_modes alc260_modes |
| 12337 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12338 | |
| 12339 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12340 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12341 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12342 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12343 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12344 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12345 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12346 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12347 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12348 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12349 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12350 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12351 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12352 | { } /* end */ |
| 12353 | }; |
| 12354 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12355 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12356 | /* output mixer control */ |
| 12357 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12358 | { |
| 12359 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12360 | .name = "Master Playback Switch", |
| 12361 | .info = snd_hda_mixer_amp_switch_info, |
| 12362 | .get = snd_hda_mixer_amp_switch_get, |
| 12363 | .put = alc268_acer_master_sw_put, |
| 12364 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12365 | }, |
| 12366 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12367 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12368 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12369 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12370 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12371 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12372 | { } |
| 12373 | }; |
| 12374 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12375 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12376 | /* output mixer control */ |
| 12377 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12378 | { |
| 12379 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12380 | .name = "Master Playback Switch", |
| 12381 | .info = snd_hda_mixer_amp_switch_info, |
| 12382 | .get = snd_hda_mixer_amp_switch_get, |
| 12383 | .put = alc268_acer_master_sw_put, |
| 12384 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12385 | }, |
| 12386 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12387 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12388 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12389 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12390 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12391 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12392 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12393 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12394 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12395 | { } |
| 12396 | }; |
| 12397 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12398 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12399 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12400 | .ops = &snd_hda_bind_vol, |
| 12401 | .values = { |
| 12402 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12403 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12404 | 0 |
| 12405 | }, |
| 12406 | }; |
| 12407 | |
| 12408 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12409 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12410 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12411 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12412 | { } /* end */ |
| 12413 | }; |
| 12414 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12415 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12416 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12417 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12418 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12419 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12420 | { } /* end */ |
| 12421 | }; |
| 12422 | |
| 12423 | /* FSC amilo */ |
| 12424 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12425 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12426 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12427 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12428 | { } /* end */ |
| 12429 | }; |
| 12430 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12431 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12432 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12433 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12434 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12435 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12436 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12437 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12438 | { } |
| 12439 | }; |
| 12440 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12441 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12442 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12443 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12444 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12445 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12446 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12447 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12448 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12449 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12450 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12451 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12452 | { } |
| 12453 | }; |
| 12454 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12455 | /* toggle speaker-output according to the hp-jack state */ |
| 12456 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12457 | { |
| 12458 | unsigned int present; |
| 12459 | unsigned char bits; |
| 12460 | |
| 12461 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12462 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12463 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12464 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12465 | AMP_IN_MUTE(0), bits); |
| 12466 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12467 | AMP_IN_MUTE(0), bits); |
| 12468 | |
| 12469 | snd_hda_codec_write(codec, 0x20, 0, |
| 12470 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12471 | snd_hda_codec_write(codec, 0x20, 0, |
| 12472 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12473 | |
| 12474 | snd_hda_codec_write(codec, 0x20, 0, |
| 12475 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12476 | snd_hda_codec_write(codec, 0x20, 0, |
| 12477 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12478 | } |
| 12479 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12480 | /* toggle speaker-output according to the hp-jacks state */ |
| 12481 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12482 | { |
| 12483 | unsigned int present; |
| 12484 | unsigned char bits; |
| 12485 | |
| 12486 | /* Check laptop headphone socket */ |
| 12487 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12488 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12489 | |
| 12490 | /* Check port replicator headphone socket */ |
| 12491 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12492 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12493 | |
| 12494 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12495 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12496 | AMP_IN_MUTE(0), bits); |
| 12497 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12498 | AMP_IN_MUTE(0), bits); |
| 12499 | |
| 12500 | snd_hda_codec_write(codec, 0x20, 0, |
| 12501 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12502 | snd_hda_codec_write(codec, 0x20, 0, |
| 12503 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12504 | |
| 12505 | snd_hda_codec_write(codec, 0x20, 0, |
| 12506 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12507 | snd_hda_codec_write(codec, 0x20, 0, |
| 12508 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12509 | } |
| 12510 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12511 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12512 | { |
| 12513 | unsigned int present; |
| 12514 | |
| 12515 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12516 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12517 | snd_hda_codec_write(codec, 0x23, 0, |
| 12518 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12519 | } |
| 12520 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12521 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12522 | { |
| 12523 | unsigned int present_laptop; |
| 12524 | unsigned int present_dock; |
| 12525 | |
| 12526 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12527 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12528 | |
| 12529 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12530 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12531 | |
| 12532 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12533 | if (present_dock) |
| 12534 | snd_hda_codec_write(codec, 0x23, 0, |
| 12535 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12536 | if (present_laptop) |
| 12537 | snd_hda_codec_write(codec, 0x23, 0, |
| 12538 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12539 | if (!present_dock && !present_laptop) |
| 12540 | snd_hda_codec_write(codec, 0x23, 0, |
| 12541 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12542 | } |
| 12543 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12544 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12545 | unsigned int res) |
| 12546 | { |
| 12547 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12548 | alc269_quanta_fl1_speaker_automute(codec); |
| 12549 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12550 | alc269_quanta_fl1_mic_automute(codec); |
| 12551 | } |
| 12552 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12553 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12554 | unsigned int res) |
| 12555 | { |
| 12556 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12557 | alc269_lifebook_speaker_automute(codec); |
| 12558 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12559 | alc269_lifebook_mic_autoswitch(codec); |
| 12560 | } |
| 12561 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12562 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12563 | { |
| 12564 | alc269_quanta_fl1_speaker_automute(codec); |
| 12565 | alc269_quanta_fl1_mic_automute(codec); |
| 12566 | } |
| 12567 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12568 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12569 | { |
| 12570 | alc269_lifebook_speaker_automute(codec); |
| 12571 | alc269_lifebook_mic_autoswitch(codec); |
| 12572 | } |
| 12573 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12574 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12575 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12576 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12577 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12578 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12579 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12580 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12581 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12582 | {} |
| 12583 | }; |
| 12584 | |
| 12585 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12586 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12587 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12588 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12589 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12590 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12591 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12592 | {} |
| 12593 | }; |
| 12594 | |
| 12595 | /* toggle speaker-output according to the hp-jack state */ |
| 12596 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12597 | { |
| 12598 | unsigned int present; |
| 12599 | unsigned char bits; |
| 12600 | |
| 12601 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12602 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12603 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12604 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12605 | AMP_IN_MUTE(0), bits); |
| 12606 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12607 | AMP_IN_MUTE(0), bits); |
| 12608 | } |
| 12609 | |
| 12610 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12611 | { |
| 12612 | unsigned int present; |
| 12613 | |
| 12614 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12615 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12616 | snd_hda_codec_write(codec, 0x23, 0, |
| 12617 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12618 | } |
| 12619 | |
| 12620 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12621 | { |
| 12622 | unsigned int present; |
| 12623 | |
| 12624 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12625 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12626 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12627 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12628 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12629 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12630 | } |
| 12631 | |
| 12632 | /* unsolicited event for HP jack sensing */ |
| 12633 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12634 | unsigned int res) |
| 12635 | { |
| 12636 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12637 | alc269_speaker_automute(codec); |
| 12638 | |
| 12639 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12640 | alc269_eeepc_dmic_automute(codec); |
| 12641 | } |
| 12642 | |
| 12643 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12644 | { |
| 12645 | alc269_speaker_automute(codec); |
| 12646 | alc269_eeepc_dmic_automute(codec); |
| 12647 | } |
| 12648 | |
| 12649 | /* unsolicited event for HP jack sensing */ |
| 12650 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12651 | unsigned int res) |
| 12652 | { |
| 12653 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12654 | alc269_speaker_automute(codec); |
| 12655 | |
| 12656 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12657 | alc269_eeepc_amic_automute(codec); |
| 12658 | } |
| 12659 | |
| 12660 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12661 | { |
| 12662 | alc269_speaker_automute(codec); |
| 12663 | alc269_eeepc_amic_automute(codec); |
| 12664 | } |
| 12665 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12666 | /* |
| 12667 | * generic initialization of ADC, input mixers and output mixers |
| 12668 | */ |
| 12669 | static struct hda_verb alc269_init_verbs[] = { |
| 12670 | /* |
| 12671 | * Unmute ADC0 and set the default input to mic-in |
| 12672 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12673 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12674 | |
| 12675 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12676 | * analog-loopback mixer widget |
| 12677 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12678 | * front panel mic (mic 2) |
| 12679 | */ |
| 12680 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12681 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12682 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12683 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12684 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12685 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12686 | |
| 12687 | /* |
| 12688 | * Set up output mixers (0x0c - 0x0e) |
| 12689 | */ |
| 12690 | /* set vol=0 to output mixers */ |
| 12691 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12692 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12693 | |
| 12694 | /* set up input amps for analog loopback */ |
| 12695 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12696 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12697 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12698 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12699 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12700 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12701 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12702 | |
| 12703 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12704 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12705 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12706 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12707 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12708 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12709 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12710 | |
| 12711 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12712 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12713 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12714 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12715 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12716 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12717 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12718 | |
| 12719 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12720 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12721 | |
| 12722 | /* FIXME: use matrix-type input source selection */ |
| 12723 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12724 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12725 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12726 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12727 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12728 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12729 | |
| 12730 | /* set EAPD */ |
| 12731 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12732 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12733 | { } |
| 12734 | }; |
| 12735 | |
| 12736 | /* add playback controls from the parsed DAC table */ |
| 12737 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12738 | const struct auto_pin_cfg *cfg) |
| 12739 | { |
| 12740 | hda_nid_t nid; |
| 12741 | int err; |
| 12742 | |
| 12743 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12744 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12745 | spec->multiout.dac_nids[0] = 2; |
| 12746 | |
| 12747 | nid = cfg->line_out_pins[0]; |
| 12748 | if (nid) { |
| 12749 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12750 | "Front Playback Volume", |
| 12751 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12752 | if (err < 0) |
| 12753 | return err; |
| 12754 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12755 | "Front Playback Switch", |
| 12756 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12757 | if (err < 0) |
| 12758 | return err; |
| 12759 | } |
| 12760 | |
| 12761 | nid = cfg->speaker_pins[0]; |
| 12762 | if (nid) { |
| 12763 | if (!cfg->line_out_pins[0]) { |
| 12764 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12765 | "Speaker Playback Volume", |
| 12766 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12767 | HDA_OUTPUT)); |
| 12768 | if (err < 0) |
| 12769 | return err; |
| 12770 | } |
| 12771 | if (nid == 0x16) { |
| 12772 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12773 | "Speaker Playback Switch", |
| 12774 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12775 | HDA_OUTPUT)); |
| 12776 | if (err < 0) |
| 12777 | return err; |
| 12778 | } else { |
| 12779 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12780 | "Speaker Playback Switch", |
| 12781 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12782 | HDA_OUTPUT)); |
| 12783 | if (err < 0) |
| 12784 | return err; |
| 12785 | } |
| 12786 | } |
| 12787 | nid = cfg->hp_pins[0]; |
| 12788 | if (nid) { |
| 12789 | /* spec->multiout.hp_nid = 2; */ |
| 12790 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12791 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12792 | "Headphone Playback Volume", |
| 12793 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12794 | HDA_OUTPUT)); |
| 12795 | if (err < 0) |
| 12796 | return err; |
| 12797 | } |
| 12798 | if (nid == 0x16) { |
| 12799 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12800 | "Headphone Playback Switch", |
| 12801 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12802 | HDA_OUTPUT)); |
| 12803 | if (err < 0) |
| 12804 | return err; |
| 12805 | } else { |
| 12806 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12807 | "Headphone Playback Switch", |
| 12808 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12809 | HDA_OUTPUT)); |
| 12810 | if (err < 0) |
| 12811 | return err; |
| 12812 | } |
| 12813 | } |
| 12814 | return 0; |
| 12815 | } |
| 12816 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12817 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12818 | const struct auto_pin_cfg *cfg) |
| 12819 | { |
| 12820 | int err; |
| 12821 | |
| 12822 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12823 | if (err < 0) |
| 12824 | return err; |
| 12825 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12826 | * because it's under 0x18 |
| 12827 | */ |
| 12828 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12829 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12830 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12831 | imux->items[imux->num_items].label = "Int Mic"; |
| 12832 | imux->items[imux->num_items].index = 0x05; |
| 12833 | imux->num_items++; |
| 12834 | } |
| 12835 | return 0; |
| 12836 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12837 | |
| 12838 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12839 | #define alc269_loopbacks alc880_loopbacks |
| 12840 | #endif |
| 12841 | |
| 12842 | /* pcm configuration: identiacal with ALC880 */ |
| 12843 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12844 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12845 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12846 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12847 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 12848 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 12849 | .substreams = 1, |
| 12850 | .channels_min = 2, |
| 12851 | .channels_max = 8, |
| 12852 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12853 | /* NID is set in alc_build_pcms */ |
| 12854 | .ops = { |
| 12855 | .open = alc880_playback_pcm_open, |
| 12856 | .prepare = alc880_playback_pcm_prepare, |
| 12857 | .cleanup = alc880_playback_pcm_cleanup |
| 12858 | }, |
| 12859 | }; |
| 12860 | |
| 12861 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 12862 | .substreams = 1, |
| 12863 | .channels_min = 2, |
| 12864 | .channels_max = 2, |
| 12865 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12866 | /* NID is set in alc_build_pcms */ |
| 12867 | }; |
| 12868 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12869 | /* |
| 12870 | * BIOS auto configuration |
| 12871 | */ |
| 12872 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12873 | { |
| 12874 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 12875 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12876 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12877 | |
| 12878 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12879 | alc269_ignore); |
| 12880 | if (err < 0) |
| 12881 | return err; |
| 12882 | |
| 12883 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12884 | if (err < 0) |
| 12885 | return err; |
| 12886 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12887 | if (err < 0) |
| 12888 | return err; |
| 12889 | |
| 12890 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12891 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12892 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12893 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12894 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12895 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12896 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12897 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12898 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12899 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12900 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12901 | /* set default input source */ |
| 12902 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12903 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12904 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12905 | |
| 12906 | err = alc_auto_add_mic_boost(codec); |
| 12907 | if (err < 0) |
| 12908 | return err; |
| 12909 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12910 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12911 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12912 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12913 | return 1; |
| 12914 | } |
| 12915 | |
| 12916 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12917 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12918 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12919 | |
| 12920 | |
| 12921 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12922 | static void alc269_auto_init(struct hda_codec *codec) |
| 12923 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12924 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12925 | alc269_auto_init_multi_out(codec); |
| 12926 | alc269_auto_init_hp_out(codec); |
| 12927 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12928 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12929 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12930 | } |
| 12931 | |
| 12932 | /* |
| 12933 | * configuration and preset |
| 12934 | */ |
| 12935 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12936 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12937 | [ALC269_QUANTA_FL1] = "quanta", |
| 12938 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12939 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12940 | [ALC269_FUJITSU] = "fujitsu", |
| 12941 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12942 | }; |
| 12943 | |
| 12944 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12945 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12946 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12947 | ALC269_ASUS_EEEPC_P703), |
| 12948 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12949 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12950 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12951 | ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12952 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12953 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12954 | {} |
| 12955 | }; |
| 12956 | |
| 12957 | static struct alc_config_preset alc269_presets[] = { |
| 12958 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12959 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12960 | .init_verbs = { alc269_init_verbs }, |
| 12961 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12962 | .dac_nids = alc269_dac_nids, |
| 12963 | .hp_nid = 0x03, |
| 12964 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12965 | .channel_mode = alc269_modes, |
| 12966 | .input_mux = &alc269_capture_source, |
| 12967 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12968 | [ALC269_QUANTA_FL1] = { |
| 12969 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12970 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12971 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12972 | .dac_nids = alc269_dac_nids, |
| 12973 | .hp_nid = 0x03, |
| 12974 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12975 | .channel_mode = alc269_modes, |
| 12976 | .input_mux = &alc269_capture_source, |
| 12977 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12978 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12979 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12980 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12981 | .mixers = { alc269_eeepc_mixer }, |
| 12982 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12983 | .init_verbs = { alc269_init_verbs, |
| 12984 | alc269_eeepc_amic_init_verbs }, |
| 12985 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12986 | .dac_nids = alc269_dac_nids, |
| 12987 | .hp_nid = 0x03, |
| 12988 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12989 | .channel_mode = alc269_modes, |
| 12990 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12991 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12992 | .init_hook = alc269_eeepc_amic_inithook, |
| 12993 | }, |
| 12994 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12995 | .mixers = { alc269_eeepc_mixer }, |
| 12996 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12997 | .init_verbs = { alc269_init_verbs, |
| 12998 | alc269_eeepc_dmic_init_verbs }, |
| 12999 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13000 | .dac_nids = alc269_dac_nids, |
| 13001 | .hp_nid = 0x03, |
| 13002 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13003 | .channel_mode = alc269_modes, |
| 13004 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13005 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13006 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13007 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13008 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13009 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13010 | .cap_mixer = alc269_epc_capture_mixer, |
| 13011 | .init_verbs = { alc269_init_verbs, |
| 13012 | alc269_eeepc_dmic_init_verbs }, |
| 13013 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13014 | .dac_nids = alc269_dac_nids, |
| 13015 | .hp_nid = 0x03, |
| 13016 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13017 | .channel_mode = alc269_modes, |
| 13018 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13019 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13020 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13021 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13022 | [ALC269_LIFEBOOK] = { |
| 13023 | .mixers = { alc269_lifebook_mixer }, |
| 13024 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13025 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13026 | .dac_nids = alc269_dac_nids, |
| 13027 | .hp_nid = 0x03, |
| 13028 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13029 | .channel_mode = alc269_modes, |
| 13030 | .input_mux = &alc269_capture_source, |
| 13031 | .unsol_event = alc269_lifebook_unsol_event, |
| 13032 | .init_hook = alc269_lifebook_init_hook, |
| 13033 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13034 | }; |
| 13035 | |
| 13036 | static int patch_alc269(struct hda_codec *codec) |
| 13037 | { |
| 13038 | struct alc_spec *spec; |
| 13039 | int board_config; |
| 13040 | int err; |
| 13041 | |
| 13042 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13043 | if (spec == NULL) |
| 13044 | return -ENOMEM; |
| 13045 | |
| 13046 | codec->spec = spec; |
| 13047 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13048 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13049 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13050 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13051 | alc269_models, |
| 13052 | alc269_cfg_tbl); |
| 13053 | |
| 13054 | if (board_config < 0) { |
| 13055 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 13056 | "trying auto-probe from BIOS...\n"); |
| 13057 | board_config = ALC269_AUTO; |
| 13058 | } |
| 13059 | |
| 13060 | if (board_config == ALC269_AUTO) { |
| 13061 | /* automatic parse from the BIOS config */ |
| 13062 | err = alc269_parse_auto_config(codec); |
| 13063 | if (err < 0) { |
| 13064 | alc_free(codec); |
| 13065 | return err; |
| 13066 | } else if (!err) { |
| 13067 | printk(KERN_INFO |
| 13068 | "hda_codec: Cannot set up configuration " |
| 13069 | "from BIOS. Using base mode...\n"); |
| 13070 | board_config = ALC269_BASIC; |
| 13071 | } |
| 13072 | } |
| 13073 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13074 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13075 | if (err < 0) { |
| 13076 | alc_free(codec); |
| 13077 | return err; |
| 13078 | } |
| 13079 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13080 | if (board_config != ALC269_AUTO) |
| 13081 | setup_preset(spec, &alc269_presets[board_config]); |
| 13082 | |
| 13083 | spec->stream_name_analog = "ALC269 Analog"; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13084 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13085 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13086 | * fix the sample rate of analog I/O to 44.1kHz |
| 13087 | */ |
| 13088 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13089 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13090 | } else { |
| 13091 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13092 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13093 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13094 | spec->stream_name_digital = "ALC269 Digital"; |
| 13095 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13096 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13097 | |
| 13098 | spec->adc_nids = alc269_adc_nids; |
| 13099 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13100 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13101 | if (!spec->cap_mixer) |
| 13102 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13103 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13104 | |
| 13105 | codec->patch_ops = alc_patch_ops; |
| 13106 | if (board_config == ALC269_AUTO) |
| 13107 | spec->init_hook = alc269_auto_init; |
| 13108 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13109 | if (!spec->loopback.amplist) |
| 13110 | spec->loopback.amplist = alc269_loopbacks; |
| 13111 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13112 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13113 | |
| 13114 | return 0; |
| 13115 | } |
| 13116 | |
| 13117 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13118 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13119 | */ |
| 13120 | |
| 13121 | /* |
| 13122 | * set the path ways for 2 channel output |
| 13123 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13124 | */ |
| 13125 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13126 | /* set pin widget 1Ah (line in) for input */ |
| 13127 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13128 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13129 | * the vref |
| 13130 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13131 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13132 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13133 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13134 | #if 0 |
| 13135 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13136 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13137 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13138 | { } /* end */ |
| 13139 | }; |
| 13140 | /* |
| 13141 | * 6ch mode |
| 13142 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13143 | */ |
| 13144 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13145 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13146 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13147 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13148 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13149 | |
| 13150 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13151 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13152 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13153 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13154 | #if 0 |
| 13155 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13156 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13157 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13158 | { } /* end */ |
| 13159 | }; |
| 13160 | |
| 13161 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13162 | { 2, alc861_threestack_ch2_init }, |
| 13163 | { 6, alc861_threestack_ch6_init }, |
| 13164 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13165 | /* Set mic1 as input and unmute the mixer */ |
| 13166 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13167 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13168 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13169 | { } /* end */ |
| 13170 | }; |
| 13171 | /* Set mic1 as output and mute mixer */ |
| 13172 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13173 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13174 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13175 | { } /* end */ |
| 13176 | }; |
| 13177 | |
| 13178 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13179 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13180 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13181 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13182 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13183 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13184 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13185 | /* set pin widget 1Ah (line in) for input */ |
| 13186 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13187 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13188 | * the vref |
| 13189 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13190 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13191 | |
| 13192 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13193 | #if 0 |
| 13194 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13195 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13196 | #endif |
| 13197 | { } /* end */ |
| 13198 | }; |
| 13199 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13200 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13201 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13202 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13203 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13204 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13205 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13206 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13207 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13208 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13209 | |
| 13210 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13211 | #if 0 |
| 13212 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13213 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13214 | #endif |
| 13215 | { } /* end */ |
| 13216 | }; |
| 13217 | |
| 13218 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13219 | { 2, alc861_asus_ch2_init }, |
| 13220 | { 6, alc861_asus_ch6_init }, |
| 13221 | }; |
| 13222 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13223 | /* patch-ALC861 */ |
| 13224 | |
| 13225 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13226 | /* output mixer control */ |
| 13227 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13228 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13229 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13230 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13231 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13232 | |
| 13233 | /*Input mixer control */ |
| 13234 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13235 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13236 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13237 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13238 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13239 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13240 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13241 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13242 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13243 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13244 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13245 | { } /* end */ |
| 13246 | }; |
| 13247 | |
| 13248 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13249 | /* output mixer control */ |
| 13250 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13251 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13252 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13253 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13254 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13255 | |
| 13256 | /* Input mixer control */ |
| 13257 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13258 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13259 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13260 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13261 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13262 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13263 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13264 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13265 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13266 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13268 | { |
| 13269 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13270 | .name = "Channel Mode", |
| 13271 | .info = alc_ch_mode_info, |
| 13272 | .get = alc_ch_mode_get, |
| 13273 | .put = alc_ch_mode_put, |
| 13274 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13275 | }, |
| 13276 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13277 | }; |
| 13278 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13279 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13280 | /* output mixer control */ |
| 13281 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13282 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13283 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13284 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13285 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13286 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13287 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13288 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13289 | /* output mixer control */ |
| 13290 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13291 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13292 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13293 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13294 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13295 | |
| 13296 | /* Input mixer control */ |
| 13297 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13298 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13299 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13300 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13301 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13302 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13303 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13304 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13305 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13306 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13307 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13308 | { |
| 13309 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13310 | .name = "Channel Mode", |
| 13311 | .info = alc_ch_mode_info, |
| 13312 | .get = alc_ch_mode_get, |
| 13313 | .put = alc_ch_mode_put, |
| 13314 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13315 | }, |
| 13316 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13317 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13318 | |
| 13319 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13320 | /* output mixer control */ |
| 13321 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13322 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13323 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13324 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13325 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13326 | |
| 13327 | /* Input mixer control */ |
| 13328 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13329 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13330 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13331 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13332 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13333 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13334 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13336 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13337 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13338 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13339 | { |
| 13340 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13341 | .name = "Channel Mode", |
| 13342 | .info = alc_ch_mode_info, |
| 13343 | .get = alc_ch_mode_get, |
| 13344 | .put = alc_ch_mode_put, |
| 13345 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13346 | }, |
| 13347 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13348 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13349 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13350 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13351 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13352 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13353 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13354 | { } |
| 13355 | }; |
| 13356 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13357 | /* |
| 13358 | * generic initialization of ADC, input mixers and output mixers |
| 13359 | */ |
| 13360 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13361 | /* |
| 13362 | * Unmute ADC0 and set the default input to mic-in |
| 13363 | */ |
| 13364 | /* port-A for surround (rear panel) */ |
| 13365 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13366 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13367 | /* port-B for mic-in (rear panel) with vref */ |
| 13368 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13369 | /* port-C for line-in (rear panel) */ |
| 13370 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13371 | /* port-D for Front */ |
| 13372 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13373 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13374 | /* port-E for HP out (front panel) */ |
| 13375 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13376 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13377 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13378 | /* port-F for mic-in (front panel) with vref */ |
| 13379 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13380 | /* port-G for CLFE (rear panel) */ |
| 13381 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13382 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13383 | /* port-H for side (rear panel) */ |
| 13384 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13385 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13386 | /* CD-in */ |
| 13387 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13388 | /* route front mic to ADC1*/ |
| 13389 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13390 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13391 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13392 | /* Unmute DAC0~3 & spdif out*/ |
| 13393 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13394 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13395 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13396 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13398 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13399 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13400 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13401 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13402 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13403 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13404 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13405 | /* Unmute Stereo Mixer 15 */ |
| 13406 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13407 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13408 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13409 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13410 | |
| 13411 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13412 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13413 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13414 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13415 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13416 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13417 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13418 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13419 | /* hp used DAC 3 (Front) */ |
| 13420 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13421 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13422 | |
| 13423 | { } |
| 13424 | }; |
| 13425 | |
| 13426 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13427 | /* |
| 13428 | * Unmute ADC0 and set the default input to mic-in |
| 13429 | */ |
| 13430 | /* port-A for surround (rear panel) */ |
| 13431 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13432 | /* port-B for mic-in (rear panel) with vref */ |
| 13433 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13434 | /* port-C for line-in (rear panel) */ |
| 13435 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13436 | /* port-D for Front */ |
| 13437 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13438 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13439 | /* port-E for HP out (front panel) */ |
| 13440 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13441 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13442 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13443 | /* port-F for mic-in (front panel) with vref */ |
| 13444 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13445 | /* port-G for CLFE (rear panel) */ |
| 13446 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13447 | /* port-H for side (rear panel) */ |
| 13448 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13449 | /* CD-in */ |
| 13450 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13451 | /* route front mic to ADC1*/ |
| 13452 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13453 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13454 | /* Unmute DAC0~3 & spdif out*/ |
| 13455 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13456 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13457 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13458 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13460 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13461 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13462 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13463 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13464 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13465 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13466 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13467 | /* Unmute Stereo Mixer 15 */ |
| 13468 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13469 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13470 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13471 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13472 | |
| 13473 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13474 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13475 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13476 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13477 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13478 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13479 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13480 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13481 | /* hp used DAC 3 (Front) */ |
| 13482 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13483 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13484 | { } |
| 13485 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13486 | |
| 13487 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13488 | /* |
| 13489 | * Unmute ADC0 and set the default input to mic-in |
| 13490 | */ |
| 13491 | /* port-A for surround (rear panel) */ |
| 13492 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13493 | /* port-B for mic-in (rear panel) with vref */ |
| 13494 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13495 | /* port-C for line-in (rear panel) */ |
| 13496 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13497 | /* port-D for Front */ |
| 13498 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13499 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13500 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13501 | /* this has to be set to VREF80 */ |
| 13502 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13503 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13504 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13505 | /* port-F for mic-in (front panel) with vref */ |
| 13506 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13507 | /* port-G for CLFE (rear panel) */ |
| 13508 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13509 | /* port-H for side (rear panel) */ |
| 13510 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13511 | /* CD-in */ |
| 13512 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13513 | /* route front mic to ADC1*/ |
| 13514 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13515 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13516 | /* Unmute DAC0~3 & spdif out*/ |
| 13517 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13518 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13519 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13520 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13521 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13522 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13523 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13524 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13525 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13526 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13527 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13528 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13529 | /* Unmute Stereo Mixer 15 */ |
| 13530 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13531 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13532 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13533 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13534 | |
| 13535 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13536 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13537 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13538 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13539 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13540 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13541 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13542 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13543 | /* hp used DAC 3 (Front) */ |
| 13544 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13545 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13546 | { } |
| 13547 | }; |
| 13548 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13549 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13550 | /* |
| 13551 | * Unmute ADC0 and set the default input to mic-in |
| 13552 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13553 | /* port-A for surround (rear panel) |
| 13554 | * according to codec#0 this is the HP jack |
| 13555 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13556 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13557 | /* route front PCM to HP */ |
| 13558 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13559 | /* port-B for mic-in (rear panel) with vref */ |
| 13560 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13561 | /* port-C for line-in (rear panel) */ |
| 13562 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13563 | /* port-D for Front */ |
| 13564 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13565 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13566 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13567 | /* this has to be set to VREF80 */ |
| 13568 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13569 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13570 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13571 | /* port-F for mic-in (front panel) with vref */ |
| 13572 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13573 | /* port-G for CLFE (rear panel) */ |
| 13574 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13575 | /* port-H for side (rear panel) */ |
| 13576 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13577 | /* CD-in */ |
| 13578 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13579 | /* route front mic to ADC1*/ |
| 13580 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13581 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13582 | /* Unmute DAC0~3 & spdif out*/ |
| 13583 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13584 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13585 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13586 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13587 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13588 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13589 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13590 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13591 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13592 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13593 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13594 | /* Unmute Stereo Mixer 15 */ |
| 13595 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13596 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13597 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13598 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13599 | |
| 13600 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13601 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13602 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13603 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13604 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13605 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13606 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13607 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13608 | /* hp used DAC 3 (Front) */ |
| 13609 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13610 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13611 | { } |
| 13612 | }; |
| 13613 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13614 | /* additional init verbs for ASUS laptops */ |
| 13615 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13616 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13617 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13618 | { } |
| 13619 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13620 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13621 | /* |
| 13622 | * generic initialization of ADC, input mixers and output mixers |
| 13623 | */ |
| 13624 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13625 | /* |
| 13626 | * Unmute ADC0 and set the default input to mic-in |
| 13627 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13628 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13629 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13630 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13631 | /* Unmute DAC0~3 & spdif out*/ |
| 13632 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13633 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13634 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13635 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13636 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13637 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13638 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13639 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13640 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13641 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13642 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13643 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13644 | /* Unmute Stereo Mixer 15 */ |
| 13645 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13646 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13647 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13648 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13649 | |
| 13650 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13651 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13652 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13653 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13654 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13655 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13656 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13657 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13658 | |
| 13659 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13660 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13661 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13662 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13663 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13664 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13665 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13666 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13667 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13668 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13669 | |
| 13670 | { } |
| 13671 | }; |
| 13672 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13673 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13674 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13675 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13676 | { } |
| 13677 | }; |
| 13678 | |
| 13679 | /* toggle speaker-output according to the hp-jack state */ |
| 13680 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13681 | { |
| 13682 | unsigned int present; |
| 13683 | |
| 13684 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13685 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13686 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13687 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13688 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13689 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13690 | } |
| 13691 | |
| 13692 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13693 | unsigned int res) |
| 13694 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13695 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13696 | alc861_toshiba_automute(codec); |
| 13697 | } |
| 13698 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13699 | /* pcm configuration: identiacal with ALC880 */ |
| 13700 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13701 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13702 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13703 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13704 | |
| 13705 | |
| 13706 | #define ALC861_DIGOUT_NID 0x07 |
| 13707 | |
| 13708 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13709 | { 8, NULL } |
| 13710 | }; |
| 13711 | |
| 13712 | static hda_nid_t alc861_dac_nids[4] = { |
| 13713 | /* front, surround, clfe, side */ |
| 13714 | 0x03, 0x06, 0x05, 0x04 |
| 13715 | }; |
| 13716 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13717 | static hda_nid_t alc660_dac_nids[3] = { |
| 13718 | /* front, clfe, surround */ |
| 13719 | 0x03, 0x05, 0x06 |
| 13720 | }; |
| 13721 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13722 | static hda_nid_t alc861_adc_nids[1] = { |
| 13723 | /* ADC0-2 */ |
| 13724 | 0x08, |
| 13725 | }; |
| 13726 | |
| 13727 | static struct hda_input_mux alc861_capture_source = { |
| 13728 | .num_items = 5, |
| 13729 | .items = { |
| 13730 | { "Mic", 0x0 }, |
| 13731 | { "Front Mic", 0x3 }, |
| 13732 | { "Line", 0x1 }, |
| 13733 | { "CD", 0x4 }, |
| 13734 | { "Mixer", 0x5 }, |
| 13735 | }, |
| 13736 | }; |
| 13737 | |
| 13738 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13739 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13740 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13741 | { |
| 13742 | int i; |
| 13743 | hda_nid_t nid; |
| 13744 | |
| 13745 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13746 | for (i = 0; i < cfg->line_outs; i++) { |
| 13747 | nid = cfg->line_out_pins[i]; |
| 13748 | if (nid) { |
| 13749 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13750 | continue; |
| 13751 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13752 | } |
| 13753 | } |
| 13754 | spec->multiout.num_dacs = cfg->line_outs; |
| 13755 | return 0; |
| 13756 | } |
| 13757 | |
| 13758 | /* add playback controls from the parsed DAC table */ |
| 13759 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13760 | const struct auto_pin_cfg *cfg) |
| 13761 | { |
| 13762 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13763 | static const char *chname[4] = { |
| 13764 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13765 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13766 | hda_nid_t nid; |
| 13767 | int i, idx, err; |
| 13768 | |
| 13769 | for (i = 0; i < cfg->line_outs; i++) { |
| 13770 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13771 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13772 | continue; |
| 13773 | if (nid == 0x05) { |
| 13774 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13775 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13776 | "Center Playback Switch", |
| 13777 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13778 | HDA_OUTPUT)); |
| 13779 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13780 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13781 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13782 | "LFE Playback Switch", |
| 13783 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13784 | HDA_OUTPUT)); |
| 13785 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13786 | return err; |
| 13787 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13788 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13789 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13790 | if (nid == alc861_dac_nids[idx]) |
| 13791 | break; |
| 13792 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13793 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13794 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13795 | HDA_OUTPUT)); |
| 13796 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13797 | return err; |
| 13798 | } |
| 13799 | } |
| 13800 | return 0; |
| 13801 | } |
| 13802 | |
| 13803 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13804 | { |
| 13805 | int err; |
| 13806 | hda_nid_t nid; |
| 13807 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13808 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13809 | return 0; |
| 13810 | |
| 13811 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13812 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13813 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13814 | "Headphone Playback Switch", |
| 13815 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13816 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13817 | return err; |
| 13818 | spec->multiout.hp_nid = nid; |
| 13819 | } |
| 13820 | return 0; |
| 13821 | } |
| 13822 | |
| 13823 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13824 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13825 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13826 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13827 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13828 | int i, err, idx, idx1; |
| 13829 | |
| 13830 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13831 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13832 | case 0x0c: |
| 13833 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13834 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13835 | break; |
| 13836 | case 0x0f: |
| 13837 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13838 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13839 | break; |
| 13840 | case 0x0d: |
| 13841 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13842 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13843 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13844 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13845 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13846 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13847 | break; |
| 13848 | case 0x11: |
| 13849 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13850 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13851 | break; |
| 13852 | default: |
| 13853 | continue; |
| 13854 | } |
| 13855 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13856 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13857 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13858 | if (err < 0) |
| 13859 | return err; |
| 13860 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13861 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13862 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13863 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13864 | } |
| 13865 | return 0; |
| 13866 | } |
| 13867 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13868 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13869 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13870 | int pin_type, int dac_idx) |
| 13871 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13872 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13873 | pin_type); |
| 13874 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13875 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13876 | } |
| 13877 | |
| 13878 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13879 | { |
| 13880 | struct alc_spec *spec = codec->spec; |
| 13881 | int i; |
| 13882 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13883 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13884 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13885 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13886 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13887 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13888 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13889 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13890 | } |
| 13891 | } |
| 13892 | |
| 13893 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13894 | { |
| 13895 | struct alc_spec *spec = codec->spec; |
| 13896 | hda_nid_t pin; |
| 13897 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13898 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13899 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13900 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13901 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13902 | pin = spec->autocfg.speaker_pins[0]; |
| 13903 | if (pin) |
| 13904 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13905 | } |
| 13906 | |
| 13907 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13908 | { |
| 13909 | struct alc_spec *spec = codec->spec; |
| 13910 | int i; |
| 13911 | |
| 13912 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13913 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 13914 | if (nid >= 0x0c && nid <= 0x11) |
| 13915 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13916 | } |
| 13917 | } |
| 13918 | |
| 13919 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13920 | /* return 1 if successful, 0 if the proper config is not found, |
| 13921 | * or a negative error code |
| 13922 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13923 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13924 | { |
| 13925 | struct alc_spec *spec = codec->spec; |
| 13926 | int err; |
| 13927 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13928 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13929 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13930 | alc861_ignore); |
| 13931 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13932 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13933 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13934 | return 0; /* can't find valid BIOS pin config */ |
| 13935 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13936 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13937 | if (err < 0) |
| 13938 | return err; |
| 13939 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13940 | if (err < 0) |
| 13941 | return err; |
| 13942 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13943 | if (err < 0) |
| 13944 | return err; |
| 13945 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13946 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13947 | return err; |
| 13948 | |
| 13949 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13950 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13951 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13952 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13953 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13954 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13955 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13956 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13957 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13958 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13959 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13960 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13961 | |
| 13962 | spec->adc_nids = alc861_adc_nids; |
| 13963 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13964 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13965 | |
| 13966 | return 1; |
| 13967 | } |
| 13968 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13969 | /* additional initialization for auto-configuration model */ |
| 13970 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13971 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13972 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13973 | alc861_auto_init_multi_out(codec); |
| 13974 | alc861_auto_init_hp_out(codec); |
| 13975 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13976 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13977 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13978 | } |
| 13979 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13980 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13981 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13982 | { 0x15, HDA_INPUT, 0 }, |
| 13983 | { 0x15, HDA_INPUT, 1 }, |
| 13984 | { 0x15, HDA_INPUT, 2 }, |
| 13985 | { 0x15, HDA_INPUT, 3 }, |
| 13986 | { } /* end */ |
| 13987 | }; |
| 13988 | #endif |
| 13989 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13990 | |
| 13991 | /* |
| 13992 | * configuration and preset |
| 13993 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13994 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13995 | [ALC861_3ST] = "3stack", |
| 13996 | [ALC660_3ST] = "3stack-660", |
| 13997 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13998 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13999 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14000 | [ALC861_TOSHIBA] = "toshiba", |
| 14001 | [ALC861_ASUS] = "asus", |
| 14002 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14003 | [ALC861_AUTO] = "auto", |
| 14004 | }; |
| 14005 | |
| 14006 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14007 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14008 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14009 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14010 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14011 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14012 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14013 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14014 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14015 | * Any other models that need this preset? |
| 14016 | */ |
| 14017 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14018 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14019 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14020 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14021 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14022 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14023 | /* FIXME: the below seems conflict */ |
| 14024 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14025 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14026 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14027 | {} |
| 14028 | }; |
| 14029 | |
| 14030 | static struct alc_config_preset alc861_presets[] = { |
| 14031 | [ALC861_3ST] = { |
| 14032 | .mixers = { alc861_3ST_mixer }, |
| 14033 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14034 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14035 | .dac_nids = alc861_dac_nids, |
| 14036 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14037 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14038 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14039 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14040 | .adc_nids = alc861_adc_nids, |
| 14041 | .input_mux = &alc861_capture_source, |
| 14042 | }, |
| 14043 | [ALC861_3ST_DIG] = { |
| 14044 | .mixers = { alc861_base_mixer }, |
| 14045 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14046 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14047 | .dac_nids = alc861_dac_nids, |
| 14048 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14049 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14050 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14051 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14052 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14053 | .adc_nids = alc861_adc_nids, |
| 14054 | .input_mux = &alc861_capture_source, |
| 14055 | }, |
| 14056 | [ALC861_6ST_DIG] = { |
| 14057 | .mixers = { alc861_base_mixer }, |
| 14058 | .init_verbs = { alc861_base_init_verbs }, |
| 14059 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14060 | .dac_nids = alc861_dac_nids, |
| 14061 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14062 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14063 | .channel_mode = alc861_8ch_modes, |
| 14064 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14065 | .adc_nids = alc861_adc_nids, |
| 14066 | .input_mux = &alc861_capture_source, |
| 14067 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14068 | [ALC660_3ST] = { |
| 14069 | .mixers = { alc861_3ST_mixer }, |
| 14070 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14071 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14072 | .dac_nids = alc660_dac_nids, |
| 14073 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14074 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14075 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14076 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14077 | .adc_nids = alc861_adc_nids, |
| 14078 | .input_mux = &alc861_capture_source, |
| 14079 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14080 | [ALC861_UNIWILL_M31] = { |
| 14081 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14082 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14083 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14084 | .dac_nids = alc861_dac_nids, |
| 14085 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14086 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14087 | .channel_mode = alc861_uniwill_m31_modes, |
| 14088 | .need_dac_fix = 1, |
| 14089 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14090 | .adc_nids = alc861_adc_nids, |
| 14091 | .input_mux = &alc861_capture_source, |
| 14092 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14093 | [ALC861_TOSHIBA] = { |
| 14094 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14095 | .init_verbs = { alc861_base_init_verbs, |
| 14096 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14097 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14098 | .dac_nids = alc861_dac_nids, |
| 14099 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14100 | .channel_mode = alc883_3ST_2ch_modes, |
| 14101 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14102 | .adc_nids = alc861_adc_nids, |
| 14103 | .input_mux = &alc861_capture_source, |
| 14104 | .unsol_event = alc861_toshiba_unsol_event, |
| 14105 | .init_hook = alc861_toshiba_automute, |
| 14106 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14107 | [ALC861_ASUS] = { |
| 14108 | .mixers = { alc861_asus_mixer }, |
| 14109 | .init_verbs = { alc861_asus_init_verbs }, |
| 14110 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14111 | .dac_nids = alc861_dac_nids, |
| 14112 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14113 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14114 | .channel_mode = alc861_asus_modes, |
| 14115 | .need_dac_fix = 1, |
| 14116 | .hp_nid = 0x06, |
| 14117 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14118 | .adc_nids = alc861_adc_nids, |
| 14119 | .input_mux = &alc861_capture_source, |
| 14120 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14121 | [ALC861_ASUS_LAPTOP] = { |
| 14122 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14123 | .init_verbs = { alc861_asus_init_verbs, |
| 14124 | alc861_asus_laptop_init_verbs }, |
| 14125 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14126 | .dac_nids = alc861_dac_nids, |
| 14127 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14128 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14129 | .channel_mode = alc883_3ST_2ch_modes, |
| 14130 | .need_dac_fix = 1, |
| 14131 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14132 | .adc_nids = alc861_adc_nids, |
| 14133 | .input_mux = &alc861_capture_source, |
| 14134 | }, |
| 14135 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14136 | |
| 14137 | |
| 14138 | static int patch_alc861(struct hda_codec *codec) |
| 14139 | { |
| 14140 | struct alc_spec *spec; |
| 14141 | int board_config; |
| 14142 | int err; |
| 14143 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14144 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14145 | if (spec == NULL) |
| 14146 | return -ENOMEM; |
| 14147 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14148 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14149 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14150 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14151 | alc861_models, |
| 14152 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14153 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14154 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14155 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 14156 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14157 | board_config = ALC861_AUTO; |
| 14158 | } |
| 14159 | |
| 14160 | if (board_config == ALC861_AUTO) { |
| 14161 | /* automatic parse from the BIOS config */ |
| 14162 | err = alc861_parse_auto_config(codec); |
| 14163 | if (err < 0) { |
| 14164 | alc_free(codec); |
| 14165 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14166 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14167 | printk(KERN_INFO |
| 14168 | "hda_codec: Cannot set up configuration " |
| 14169 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14170 | board_config = ALC861_3ST_DIG; |
| 14171 | } |
| 14172 | } |
| 14173 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14174 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14175 | if (err < 0) { |
| 14176 | alc_free(codec); |
| 14177 | return err; |
| 14178 | } |
| 14179 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14180 | if (board_config != ALC861_AUTO) |
| 14181 | setup_preset(spec, &alc861_presets[board_config]); |
| 14182 | |
| 14183 | spec->stream_name_analog = "ALC861 Analog"; |
| 14184 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14185 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14186 | |
| 14187 | spec->stream_name_digital = "ALC861 Digital"; |
| 14188 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14189 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14190 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14191 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14192 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14193 | spec->vmaster_nid = 0x03; |
| 14194 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14195 | codec->patch_ops = alc_patch_ops; |
| 14196 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14197 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14198 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14199 | if (!spec->loopback.amplist) |
| 14200 | spec->loopback.amplist = alc861_loopbacks; |
| 14201 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14202 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14204 | return 0; |
| 14205 | } |
| 14206 | |
| 14207 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14208 | * ALC861-VD support |
| 14209 | * |
| 14210 | * Based on ALC882 |
| 14211 | * |
| 14212 | * In addition, an independent DAC |
| 14213 | */ |
| 14214 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14215 | |
| 14216 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14217 | /* front, surr, clfe, side surr */ |
| 14218 | 0x02, 0x03, 0x04, 0x05 |
| 14219 | }; |
| 14220 | |
| 14221 | /* dac_nids for ALC660vd are in a different order - according to |
| 14222 | * Realtek's driver. |
| 14223 | * This should probably tesult in a different mixer for 6stack models |
| 14224 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14225 | * - and it is the same as in 861vd. |
| 14226 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14227 | */ |
| 14228 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14229 | /* front, rear, clfe, rear_surr */ |
| 14230 | 0x02, 0x04, 0x03 |
| 14231 | }; |
| 14232 | |
| 14233 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14234 | /* ADC0 */ |
| 14235 | 0x09, |
| 14236 | }; |
| 14237 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14238 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14239 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14240 | /* input MUX */ |
| 14241 | /* FIXME: should be a matrix-type input source selection */ |
| 14242 | static struct hda_input_mux alc861vd_capture_source = { |
| 14243 | .num_items = 4, |
| 14244 | .items = { |
| 14245 | { "Mic", 0x0 }, |
| 14246 | { "Front Mic", 0x1 }, |
| 14247 | { "Line", 0x2 }, |
| 14248 | { "CD", 0x4 }, |
| 14249 | }, |
| 14250 | }; |
| 14251 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14252 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14253 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14254 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14255 | { "Ext Mic", 0x0 }, |
| 14256 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14257 | }, |
| 14258 | }; |
| 14259 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14260 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14261 | .num_items = 2, |
| 14262 | .items = { |
| 14263 | { "Front Mic", 0x0 }, |
| 14264 | { "ATAPI Mic", 0x1 }, |
| 14265 | }, |
| 14266 | }; |
| 14267 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14268 | /* |
| 14269 | * 2ch mode |
| 14270 | */ |
| 14271 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14272 | { 2, NULL } |
| 14273 | }; |
| 14274 | |
| 14275 | /* |
| 14276 | * 6ch mode |
| 14277 | */ |
| 14278 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14279 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14280 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14281 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14282 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14283 | { } /* end */ |
| 14284 | }; |
| 14285 | |
| 14286 | /* |
| 14287 | * 8ch mode |
| 14288 | */ |
| 14289 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14290 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14291 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14292 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14293 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14294 | { } /* end */ |
| 14295 | }; |
| 14296 | |
| 14297 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14298 | { 6, alc861vd_6stack_ch6_init }, |
| 14299 | { 8, alc861vd_6stack_ch8_init }, |
| 14300 | }; |
| 14301 | |
| 14302 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14303 | { |
| 14304 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14305 | .name = "Channel Mode", |
| 14306 | .info = alc_ch_mode_info, |
| 14307 | .get = alc_ch_mode_get, |
| 14308 | .put = alc_ch_mode_put, |
| 14309 | }, |
| 14310 | { } /* end */ |
| 14311 | }; |
| 14312 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14313 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14314 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14315 | */ |
| 14316 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14317 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14318 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14319 | |
| 14320 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14321 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14322 | |
| 14323 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14324 | HDA_OUTPUT), |
| 14325 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14326 | HDA_OUTPUT), |
| 14327 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14328 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14329 | |
| 14330 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14331 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14332 | |
| 14333 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14334 | |
| 14335 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14336 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14337 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14338 | |
| 14339 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14340 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14341 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14342 | |
| 14343 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14344 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14345 | |
| 14346 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14347 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14348 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14349 | { } /* end */ |
| 14350 | }; |
| 14351 | |
| 14352 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14353 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14354 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14355 | |
| 14356 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14357 | |
| 14358 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14359 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14360 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14361 | |
| 14362 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14363 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14364 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14365 | |
| 14366 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14367 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14368 | |
| 14369 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14370 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14371 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14372 | { } /* end */ |
| 14373 | }; |
| 14374 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14375 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14376 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14377 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14378 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14379 | |
| 14380 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14381 | |
| 14382 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14383 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14384 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14385 | |
| 14386 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14387 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14388 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14389 | |
| 14390 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14391 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14392 | |
| 14393 | { } /* end */ |
| 14394 | }; |
| 14395 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14396 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14397 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14398 | */ |
| 14399 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14400 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14401 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14402 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14403 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14404 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14405 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14406 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14407 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14408 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14409 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14410 | { } /* end */ |
| 14411 | }; |
| 14412 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14413 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14414 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14415 | */ |
| 14416 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14417 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14418 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14419 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14420 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14421 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14422 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14423 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14424 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14425 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14426 | { } /* end */ |
| 14427 | }; |
| 14428 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14429 | /* |
| 14430 | * generic initialization of ADC, input mixers and output mixers |
| 14431 | */ |
| 14432 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14433 | /* |
| 14434 | * Unmute ADC0 and set the default input to mic-in |
| 14435 | */ |
| 14436 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14437 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14438 | |
| 14439 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14440 | * the analog-loopback mixer widget |
| 14441 | */ |
| 14442 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14443 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14444 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14445 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14446 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14447 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14448 | |
| 14449 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14450 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14451 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14452 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14453 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14454 | |
| 14455 | /* |
| 14456 | * Set up output mixers (0x02 - 0x05) |
| 14457 | */ |
| 14458 | /* set vol=0 to output mixers */ |
| 14459 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14460 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14461 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14462 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14463 | |
| 14464 | /* set up input amps for analog loopback */ |
| 14465 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14466 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14467 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14468 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14469 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14470 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14471 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14472 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14473 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14474 | |
| 14475 | { } |
| 14476 | }; |
| 14477 | |
| 14478 | /* |
| 14479 | * 3-stack pin configuration: |
| 14480 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14481 | */ |
| 14482 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14483 | /* |
| 14484 | * Set pin mode and muting |
| 14485 | */ |
| 14486 | /* set front pin widgets 0x14 for output */ |
| 14487 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14488 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14489 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14490 | |
| 14491 | /* Mic (rear) pin: input vref at 80% */ |
| 14492 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14493 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14494 | /* Front Mic pin: input vref at 80% */ |
| 14495 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14496 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14497 | /* Line In pin: input */ |
| 14498 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14499 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14500 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14501 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14502 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14503 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14504 | /* CD pin widget for input */ |
| 14505 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14506 | |
| 14507 | { } |
| 14508 | }; |
| 14509 | |
| 14510 | /* |
| 14511 | * 6-stack pin configuration: |
| 14512 | */ |
| 14513 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14514 | /* |
| 14515 | * Set pin mode and muting |
| 14516 | */ |
| 14517 | /* set front pin widgets 0x14 for output */ |
| 14518 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14519 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14520 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14521 | |
| 14522 | /* Rear Pin: output 1 (0x0d) */ |
| 14523 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14524 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14525 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14526 | /* CLFE Pin: output 2 (0x0e) */ |
| 14527 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14528 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14529 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14530 | /* Side Pin: output 3 (0x0f) */ |
| 14531 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14532 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14533 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14534 | |
| 14535 | /* Mic (rear) pin: input vref at 80% */ |
| 14536 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14537 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14538 | /* Front Mic pin: input vref at 80% */ |
| 14539 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14540 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14541 | /* Line In pin: input */ |
| 14542 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14543 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14544 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14545 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14546 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14547 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14548 | /* CD pin widget for input */ |
| 14549 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14550 | |
| 14551 | { } |
| 14552 | }; |
| 14553 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14554 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14555 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14556 | { } |
| 14557 | }; |
| 14558 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14559 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14560 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14561 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14562 | { } |
| 14563 | }; |
| 14564 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14565 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14566 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14567 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14569 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14570 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14571 | {} |
| 14572 | }; |
| 14573 | |
| 14574 | /* toggle speaker-output according to the hp-jack state */ |
| 14575 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 14576 | { |
| 14577 | unsigned int present; |
| 14578 | unsigned char bits; |
| 14579 | |
| 14580 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14581 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14582 | bits = present ? HDA_AMP_MUTE : 0; |
| 14583 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14584 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14585 | } |
| 14586 | |
| 14587 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14588 | { |
| 14589 | unsigned int present; |
| 14590 | unsigned char bits; |
| 14591 | |
| 14592 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14593 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14594 | bits = present ? HDA_AMP_MUTE : 0; |
| 14595 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14596 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14597 | } |
| 14598 | |
| 14599 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 14600 | { |
| 14601 | alc861vd_lenovo_hp_automute(codec); |
| 14602 | alc861vd_lenovo_mic_automute(codec); |
| 14603 | } |
| 14604 | |
| 14605 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14606 | unsigned int res) |
| 14607 | { |
| 14608 | switch (res >> 26) { |
| 14609 | case ALC880_HP_EVENT: |
| 14610 | alc861vd_lenovo_hp_automute(codec); |
| 14611 | break; |
| 14612 | case ALC880_MIC_EVENT: |
| 14613 | alc861vd_lenovo_mic_automute(codec); |
| 14614 | break; |
| 14615 | } |
| 14616 | } |
| 14617 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14618 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14619 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14620 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14621 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14622 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14623 | |
| 14624 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14625 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14626 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14627 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14628 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14629 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14630 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14631 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14632 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14633 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14634 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14635 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14636 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14637 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14638 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14639 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14640 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14641 | |
| 14642 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14643 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14644 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14645 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14646 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14647 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14648 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14649 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14650 | |
| 14651 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14652 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14653 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14654 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14655 | |
| 14656 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14657 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14658 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14659 | |
| 14660 | { } /* end */ |
| 14661 | }; |
| 14662 | |
| 14663 | /* toggle speaker-output according to the hp-jack state */ |
| 14664 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 14665 | { |
| 14666 | unsigned int present; |
| 14667 | |
| 14668 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14669 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14670 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14671 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14672 | } |
| 14673 | |
| 14674 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 14675 | { |
| 14676 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14677 | alc861vd_dallas_automute(codec); |
| 14678 | } |
| 14679 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14680 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14681 | #define alc861vd_loopbacks alc880_loopbacks |
| 14682 | #endif |
| 14683 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14684 | /* pcm configuration: identiacal with ALC880 */ |
| 14685 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14686 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14687 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14688 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14689 | |
| 14690 | /* |
| 14691 | * configuration and preset |
| 14692 | */ |
| 14693 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14694 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14695 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14696 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14697 | [ALC861VD_3ST] = "3stack", |
| 14698 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14699 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14700 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14701 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14702 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14703 | [ALC861VD_AUTO] = "auto", |
| 14704 | }; |
| 14705 | |
| 14706 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14707 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14708 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14709 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14710 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14711 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14712 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14713 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14714 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14715 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14716 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14717 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14718 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14719 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 14720 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14721 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14722 | {} |
| 14723 | }; |
| 14724 | |
| 14725 | static struct alc_config_preset alc861vd_presets[] = { |
| 14726 | [ALC660VD_3ST] = { |
| 14727 | .mixers = { alc861vd_3st_mixer }, |
| 14728 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14729 | alc861vd_3stack_init_verbs }, |
| 14730 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14731 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14732 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14733 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14734 | .input_mux = &alc861vd_capture_source, |
| 14735 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14736 | [ALC660VD_3ST_DIG] = { |
| 14737 | .mixers = { alc861vd_3st_mixer }, |
| 14738 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14739 | alc861vd_3stack_init_verbs }, |
| 14740 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14741 | .dac_nids = alc660vd_dac_nids, |
| 14742 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14743 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14744 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14745 | .input_mux = &alc861vd_capture_source, |
| 14746 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14747 | [ALC861VD_3ST] = { |
| 14748 | .mixers = { alc861vd_3st_mixer }, |
| 14749 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14750 | alc861vd_3stack_init_verbs }, |
| 14751 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14752 | .dac_nids = alc861vd_dac_nids, |
| 14753 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14754 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14755 | .input_mux = &alc861vd_capture_source, |
| 14756 | }, |
| 14757 | [ALC861VD_3ST_DIG] = { |
| 14758 | .mixers = { alc861vd_3st_mixer }, |
| 14759 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14760 | alc861vd_3stack_init_verbs }, |
| 14761 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14762 | .dac_nids = alc861vd_dac_nids, |
| 14763 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14764 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14765 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14766 | .input_mux = &alc861vd_capture_source, |
| 14767 | }, |
| 14768 | [ALC861VD_6ST_DIG] = { |
| 14769 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14770 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14771 | alc861vd_6stack_init_verbs }, |
| 14772 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14773 | .dac_nids = alc861vd_dac_nids, |
| 14774 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14775 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14776 | .channel_mode = alc861vd_6stack_modes, |
| 14777 | .input_mux = &alc861vd_capture_source, |
| 14778 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14779 | [ALC861VD_LENOVO] = { |
| 14780 | .mixers = { alc861vd_lenovo_mixer }, |
| 14781 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14782 | alc861vd_3stack_init_verbs, |
| 14783 | alc861vd_eapd_verbs, |
| 14784 | alc861vd_lenovo_unsol_verbs }, |
| 14785 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14786 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14787 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14788 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14789 | .input_mux = &alc861vd_capture_source, |
| 14790 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14791 | .init_hook = alc861vd_lenovo_automute, |
| 14792 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14793 | [ALC861VD_DALLAS] = { |
| 14794 | .mixers = { alc861vd_dallas_mixer }, |
| 14795 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14796 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14797 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14798 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14799 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14800 | .input_mux = &alc861vd_dallas_capture_source, |
| 14801 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14802 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14803 | }, |
| 14804 | [ALC861VD_HP] = { |
| 14805 | .mixers = { alc861vd_hp_mixer }, |
| 14806 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14807 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14808 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14809 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14810 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14811 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14812 | .input_mux = &alc861vd_hp_capture_source, |
| 14813 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14814 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14815 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14816 | [ALC660VD_ASUS_V1S] = { |
| 14817 | .mixers = { alc861vd_lenovo_mixer }, |
| 14818 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14819 | alc861vd_3stack_init_verbs, |
| 14820 | alc861vd_eapd_verbs, |
| 14821 | alc861vd_lenovo_unsol_verbs }, |
| 14822 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14823 | .dac_nids = alc660vd_dac_nids, |
| 14824 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14825 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14826 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14827 | .input_mux = &alc861vd_capture_source, |
| 14828 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14829 | .init_hook = alc861vd_lenovo_automute, |
| 14830 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14831 | }; |
| 14832 | |
| 14833 | /* |
| 14834 | * BIOS auto configuration |
| 14835 | */ |
| 14836 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14837 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14838 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14839 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14840 | } |
| 14841 | |
| 14842 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14843 | { |
| 14844 | struct alc_spec *spec = codec->spec; |
| 14845 | int i; |
| 14846 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14847 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14848 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14849 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14850 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14851 | if (nid) |
| 14852 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14853 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14854 | } |
| 14855 | } |
| 14856 | |
| 14857 | |
| 14858 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14859 | { |
| 14860 | struct alc_spec *spec = codec->spec; |
| 14861 | hda_nid_t pin; |
| 14862 | |
| 14863 | pin = spec->autocfg.hp_pins[0]; |
| 14864 | if (pin) /* connect to front and use dac 0 */ |
| 14865 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14866 | pin = spec->autocfg.speaker_pins[0]; |
| 14867 | if (pin) |
| 14868 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14869 | } |
| 14870 | |
| 14871 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14872 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14873 | |
| 14874 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14875 | { |
| 14876 | struct alc_spec *spec = codec->spec; |
| 14877 | int i; |
| 14878 | |
| 14879 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14880 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14881 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14882 | alc_set_input_pin(codec, nid, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14883 | if (nid != ALC861VD_PIN_CD_NID) |
| 14884 | snd_hda_codec_write(codec, nid, 0, |
| 14885 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14886 | AMP_OUT_MUTE); |
| 14887 | } |
| 14888 | } |
| 14889 | } |
| 14890 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14891 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14892 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14893 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14894 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14895 | |
| 14896 | /* add playback controls from the parsed DAC table */ |
| 14897 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14898 | * different NIDs for mute/unmute switch and volume control */ |
| 14899 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14900 | const struct auto_pin_cfg *cfg) |
| 14901 | { |
| 14902 | char name[32]; |
| 14903 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14904 | hda_nid_t nid_v, nid_s; |
| 14905 | int i, err; |
| 14906 | |
| 14907 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14908 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14909 | continue; |
| 14910 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14911 | alc880_dac_to_idx( |
| 14912 | spec->multiout.dac_nids[i])); |
| 14913 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14914 | alc880_dac_to_idx( |
| 14915 | spec->multiout.dac_nids[i])); |
| 14916 | |
| 14917 | if (i == 2) { |
| 14918 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14919 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14920 | "Center Playback Volume", |
| 14921 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14922 | HDA_OUTPUT)); |
| 14923 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14924 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14925 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14926 | "LFE Playback Volume", |
| 14927 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14928 | HDA_OUTPUT)); |
| 14929 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14930 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14931 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14932 | "Center Playback Switch", |
| 14933 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14934 | HDA_INPUT)); |
| 14935 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14936 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14937 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14938 | "LFE Playback Switch", |
| 14939 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14940 | HDA_INPUT)); |
| 14941 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14942 | return err; |
| 14943 | } else { |
| 14944 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14945 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14946 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14947 | HDA_OUTPUT)); |
| 14948 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14949 | return err; |
| 14950 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14951 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14952 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14953 | HDA_INPUT)); |
| 14954 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14955 | return err; |
| 14956 | } |
| 14957 | } |
| 14958 | return 0; |
| 14959 | } |
| 14960 | |
| 14961 | /* add playback controls for speaker and HP outputs */ |
| 14962 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14963 | * different NIDs for mute/unmute switch and volume control */ |
| 14964 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14965 | hda_nid_t pin, const char *pfx) |
| 14966 | { |
| 14967 | hda_nid_t nid_v, nid_s; |
| 14968 | int err; |
| 14969 | char name[32]; |
| 14970 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14971 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14972 | return 0; |
| 14973 | |
| 14974 | if (alc880_is_fixed_pin(pin)) { |
| 14975 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14976 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14977 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14978 | spec->multiout.hp_nid = nid_v; |
| 14979 | else |
| 14980 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14981 | /* control HP volume/switch on the output mixer amp */ |
| 14982 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14983 | alc880_fixed_pin_idx(pin)); |
| 14984 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14985 | alc880_fixed_pin_idx(pin)); |
| 14986 | |
| 14987 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14988 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14989 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14990 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14991 | return err; |
| 14992 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14993 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14994 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14995 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14996 | return err; |
| 14997 | } else if (alc880_is_multi_pin(pin)) { |
| 14998 | /* set manual connection */ |
| 14999 | /* we have only a switch on HP-out PIN */ |
| 15000 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15001 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15002 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15003 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15004 | return err; |
| 15005 | } |
| 15006 | return 0; |
| 15007 | } |
| 15008 | |
| 15009 | /* parse the BIOS configuration and set up the alc_spec |
| 15010 | * return 1 if successful, 0 if the proper config is not found, |
| 15011 | * or a negative error code |
| 15012 | * Based on ALC880 version - had to change it to override |
| 15013 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15014 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15015 | { |
| 15016 | struct alc_spec *spec = codec->spec; |
| 15017 | int err; |
| 15018 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15019 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15020 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15021 | alc861vd_ignore); |
| 15022 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15023 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15024 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15025 | return 0; /* can't find valid BIOS pin config */ |
| 15026 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15027 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15028 | if (err < 0) |
| 15029 | return err; |
| 15030 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15031 | if (err < 0) |
| 15032 | return err; |
| 15033 | err = alc861vd_auto_create_extra_out(spec, |
| 15034 | spec->autocfg.speaker_pins[0], |
| 15035 | "Speaker"); |
| 15036 | if (err < 0) |
| 15037 | return err; |
| 15038 | err = alc861vd_auto_create_extra_out(spec, |
| 15039 | spec->autocfg.hp_pins[0], |
| 15040 | "Headphone"); |
| 15041 | if (err < 0) |
| 15042 | return err; |
| 15043 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15044 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15045 | return err; |
| 15046 | |
| 15047 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15048 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15049 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15050 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15051 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15052 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15053 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15054 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15055 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15056 | |
| 15057 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15058 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15059 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15060 | err = alc_auto_add_mic_boost(codec); |
| 15061 | if (err < 0) |
| 15062 | return err; |
| 15063 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15064 | return 1; |
| 15065 | } |
| 15066 | |
| 15067 | /* additional initialization for auto-configuration model */ |
| 15068 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15069 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15070 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15071 | alc861vd_auto_init_multi_out(codec); |
| 15072 | alc861vd_auto_init_hp_out(codec); |
| 15073 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15074 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15075 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15076 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15077 | } |
| 15078 | |
| 15079 | static int patch_alc861vd(struct hda_codec *codec) |
| 15080 | { |
| 15081 | struct alc_spec *spec; |
| 15082 | int err, board_config; |
| 15083 | |
| 15084 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15085 | if (spec == NULL) |
| 15086 | return -ENOMEM; |
| 15087 | |
| 15088 | codec->spec = spec; |
| 15089 | |
| 15090 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15091 | alc861vd_models, |
| 15092 | alc861vd_cfg_tbl); |
| 15093 | |
| 15094 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 15095 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 15096 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 15097 | board_config = ALC861VD_AUTO; |
| 15098 | } |
| 15099 | |
| 15100 | if (board_config == ALC861VD_AUTO) { |
| 15101 | /* automatic parse from the BIOS config */ |
| 15102 | err = alc861vd_parse_auto_config(codec); |
| 15103 | if (err < 0) { |
| 15104 | alc_free(codec); |
| 15105 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15106 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15107 | printk(KERN_INFO |
| 15108 | "hda_codec: Cannot set up configuration " |
| 15109 | "from BIOS. Using base mode...\n"); |
| 15110 | board_config = ALC861VD_3ST; |
| 15111 | } |
| 15112 | } |
| 15113 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15114 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15115 | if (err < 0) { |
| 15116 | alc_free(codec); |
| 15117 | return err; |
| 15118 | } |
| 15119 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15120 | if (board_config != ALC861VD_AUTO) |
| 15121 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15122 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15123 | if (codec->vendor_id == 0x10ec0660) { |
| 15124 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 15125 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15126 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15127 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15128 | } else { |
| 15129 | spec->stream_name_analog = "ALC861VD Analog"; |
| 15130 | spec->stream_name_digital = "ALC861VD Digital"; |
| 15131 | } |
| 15132 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15133 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15134 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15135 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15136 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15137 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15138 | |
| 15139 | spec->adc_nids = alc861vd_adc_nids; |
| 15140 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15141 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15142 | spec->capture_style = CAPT_MIX; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15143 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15144 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15145 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15146 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15147 | spec->vmaster_nid = 0x02; |
| 15148 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15149 | codec->patch_ops = alc_patch_ops; |
| 15150 | |
| 15151 | if (board_config == ALC861VD_AUTO) |
| 15152 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15153 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15154 | if (!spec->loopback.amplist) |
| 15155 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15156 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15157 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15158 | |
| 15159 | return 0; |
| 15160 | } |
| 15161 | |
| 15162 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15163 | * ALC662 support |
| 15164 | * |
| 15165 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15166 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15167 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15168 | * 6-channel independent captures. |
| 15169 | * |
| 15170 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15171 | * driver yet). |
| 15172 | */ |
| 15173 | #define ALC662_DIGOUT_NID 0x06 |
| 15174 | #define ALC662_DIGIN_NID 0x0a |
| 15175 | |
| 15176 | static hda_nid_t alc662_dac_nids[4] = { |
| 15177 | /* front, rear, clfe, rear_surr */ |
| 15178 | 0x02, 0x03, 0x04 |
| 15179 | }; |
| 15180 | |
| 15181 | static hda_nid_t alc662_adc_nids[1] = { |
| 15182 | /* ADC1-2 */ |
| 15183 | 0x09, |
| 15184 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15185 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15186 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15187 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15188 | /* input MUX */ |
| 15189 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15190 | static struct hda_input_mux alc662_capture_source = { |
| 15191 | .num_items = 4, |
| 15192 | .items = { |
| 15193 | { "Mic", 0x0 }, |
| 15194 | { "Front Mic", 0x1 }, |
| 15195 | { "Line", 0x2 }, |
| 15196 | { "CD", 0x4 }, |
| 15197 | }, |
| 15198 | }; |
| 15199 | |
| 15200 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15201 | .num_items = 2, |
| 15202 | .items = { |
| 15203 | { "Mic", 0x1 }, |
| 15204 | { "Line", 0x2 }, |
| 15205 | }, |
| 15206 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15207 | |
| 15208 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15209 | .num_items = 2, |
| 15210 | .items = { |
| 15211 | { "i-Mic", 0x1 }, |
| 15212 | { "e-Mic", 0x0 }, |
| 15213 | }, |
| 15214 | }; |
| 15215 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15216 | static struct hda_input_mux alc663_capture_source = { |
| 15217 | .num_items = 3, |
| 15218 | .items = { |
| 15219 | { "Mic", 0x0 }, |
| 15220 | { "Front Mic", 0x1 }, |
| 15221 | { "Line", 0x2 }, |
| 15222 | }, |
| 15223 | }; |
| 15224 | |
| 15225 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15226 | .num_items = 2, |
| 15227 | .items = { |
| 15228 | { "Ext-Mic", 0x0 }, |
| 15229 | { "D-Mic", 0x9 }, |
| 15230 | }, |
| 15231 | }; |
| 15232 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15233 | /* |
| 15234 | * 2ch mode |
| 15235 | */ |
| 15236 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15237 | { 2, NULL } |
| 15238 | }; |
| 15239 | |
| 15240 | /* |
| 15241 | * 2ch mode |
| 15242 | */ |
| 15243 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15244 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15245 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15246 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15247 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15248 | { } /* end */ |
| 15249 | }; |
| 15250 | |
| 15251 | /* |
| 15252 | * 6ch mode |
| 15253 | */ |
| 15254 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15255 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15256 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15257 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15258 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15259 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15260 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15261 | { } /* end */ |
| 15262 | }; |
| 15263 | |
| 15264 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15265 | { 2, alc662_3ST_ch2_init }, |
| 15266 | { 6, alc662_3ST_ch6_init }, |
| 15267 | }; |
| 15268 | |
| 15269 | /* |
| 15270 | * 2ch mode |
| 15271 | */ |
| 15272 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15273 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15274 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15275 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15276 | { } /* end */ |
| 15277 | }; |
| 15278 | |
| 15279 | /* |
| 15280 | * 6ch mode |
| 15281 | */ |
| 15282 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15283 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15284 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15285 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15286 | { } /* end */ |
| 15287 | }; |
| 15288 | |
| 15289 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15290 | { 2, alc662_sixstack_ch6_init }, |
| 15291 | { 6, alc662_sixstack_ch8_init }, |
| 15292 | }; |
| 15293 | |
| 15294 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15295 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15296 | */ |
| 15297 | |
| 15298 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15299 | /* output mixer control */ |
| 15300 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15301 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15302 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15303 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15304 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15305 | 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] | 15306 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15307 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15308 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15309 | |
| 15310 | /*Input mixer control */ |
| 15311 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15312 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15313 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15314 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15315 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15316 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15317 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15318 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15319 | { } /* end */ |
| 15320 | }; |
| 15321 | |
| 15322 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15323 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15324 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15325 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15326 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15327 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15328 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15329 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15330 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15331 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15332 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15333 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15334 | { } /* end */ |
| 15335 | }; |
| 15336 | |
| 15337 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15338 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15339 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15340 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15341 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15342 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15343 | 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] | 15344 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15345 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15346 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15347 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15348 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15349 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15350 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15351 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15352 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15353 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15354 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15355 | { } /* end */ |
| 15356 | }; |
| 15357 | |
| 15358 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15359 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15360 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15361 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15362 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15363 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15364 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15365 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15366 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15367 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15368 | { } /* end */ |
| 15369 | }; |
| 15370 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15371 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15372 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15373 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 15374 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15375 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15376 | |
| 15377 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15378 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15379 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15380 | |
| 15381 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15382 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15383 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15384 | { } /* end */ |
| 15385 | }; |
| 15386 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15387 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 15388 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15389 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15390 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15391 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 15392 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15393 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 15394 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 15395 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15396 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15397 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15398 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15399 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15400 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15401 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15402 | { } /* end */ |
| 15403 | }; |
| 15404 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15405 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15406 | .ops = &snd_hda_bind_vol, |
| 15407 | .values = { |
| 15408 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15409 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15410 | 0 |
| 15411 | }, |
| 15412 | }; |
| 15413 | |
| 15414 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15415 | .ops = &snd_hda_bind_sw, |
| 15416 | .values = { |
| 15417 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15418 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15419 | 0 |
| 15420 | }, |
| 15421 | }; |
| 15422 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15423 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15424 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15425 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15426 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15427 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15428 | { } /* end */ |
| 15429 | }; |
| 15430 | |
| 15431 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15432 | .ops = &snd_hda_bind_sw, |
| 15433 | .values = { |
| 15434 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15435 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15436 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15437 | 0 |
| 15438 | }, |
| 15439 | }; |
| 15440 | |
| 15441 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15442 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15443 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15444 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15445 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15446 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15447 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15448 | |
| 15449 | { } /* end */ |
| 15450 | }; |
| 15451 | |
| 15452 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15453 | .ops = &snd_hda_bind_sw, |
| 15454 | .values = { |
| 15455 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15456 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15457 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15458 | 0 |
| 15459 | }, |
| 15460 | }; |
| 15461 | |
| 15462 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15463 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15464 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15465 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15466 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15467 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15468 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15469 | { } /* end */ |
| 15470 | }; |
| 15471 | |
| 15472 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15473 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15474 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15475 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15476 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15477 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15478 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15479 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15480 | { } /* end */ |
| 15481 | }; |
| 15482 | |
| 15483 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15484 | .ops = &snd_hda_bind_vol, |
| 15485 | .values = { |
| 15486 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15487 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15488 | 0 |
| 15489 | }, |
| 15490 | }; |
| 15491 | |
| 15492 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15493 | .ops = &snd_hda_bind_sw, |
| 15494 | .values = { |
| 15495 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15496 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15497 | 0 |
| 15498 | }, |
| 15499 | }; |
| 15500 | |
| 15501 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15502 | HDA_BIND_VOL("Master Playback Volume", |
| 15503 | &alc663_asus_two_bind_master_vol), |
| 15504 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15505 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15506 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15507 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15508 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15509 | { } /* end */ |
| 15510 | }; |
| 15511 | |
| 15512 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15513 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15514 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15515 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15516 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15517 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15518 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15519 | { } /* end */ |
| 15520 | }; |
| 15521 | |
| 15522 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15523 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15524 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15525 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15526 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15527 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15528 | |
| 15529 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15530 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15531 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15532 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15533 | { } /* end */ |
| 15534 | }; |
| 15535 | |
| 15536 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15537 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15538 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15539 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15540 | |
| 15541 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15542 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15543 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15544 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15545 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15546 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15547 | { } /* end */ |
| 15548 | }; |
| 15549 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15550 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15551 | { |
| 15552 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15553 | .name = "Channel Mode", |
| 15554 | .info = alc_ch_mode_info, |
| 15555 | .get = alc_ch_mode_get, |
| 15556 | .put = alc_ch_mode_put, |
| 15557 | }, |
| 15558 | { } /* end */ |
| 15559 | }; |
| 15560 | |
| 15561 | static struct hda_verb alc662_init_verbs[] = { |
| 15562 | /* ADC: mute amp left and right */ |
| 15563 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15564 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15565 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15566 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15569 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15570 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15571 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15572 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15573 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15574 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15575 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15576 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15577 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15578 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15579 | |
| 15580 | /* Front Pin: output 0 (0x0c) */ |
| 15581 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15582 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15583 | |
| 15584 | /* Rear Pin: output 1 (0x0d) */ |
| 15585 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15586 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15587 | |
| 15588 | /* CLFE Pin: output 2 (0x0e) */ |
| 15589 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15590 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15591 | |
| 15592 | /* Mic (rear) pin: input vref at 80% */ |
| 15593 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15594 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15595 | /* Front Mic pin: input vref at 80% */ |
| 15596 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15597 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15598 | /* Line In pin: input */ |
| 15599 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15600 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15601 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15602 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15603 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15604 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15605 | /* CD pin widget for input */ |
| 15606 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15607 | |
| 15608 | /* FIXME: use matrix-type input source selection */ |
| 15609 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15610 | /* Input mixer */ |
| 15611 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15612 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15613 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15614 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15615 | |
| 15616 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15617 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15618 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15619 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15620 | |
| 15621 | /* always trun on EAPD */ |
| 15622 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15623 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15624 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15625 | { } |
| 15626 | }; |
| 15627 | |
| 15628 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15629 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15630 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15631 | {} |
| 15632 | }; |
| 15633 | |
| 15634 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15635 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15636 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15637 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15638 | }; |
| 15639 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15640 | /* Set Unsolicited Event*/ |
| 15641 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15642 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15643 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15644 | {} |
| 15645 | }; |
| 15646 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15647 | /* |
| 15648 | * generic initialization of ADC, input mixers and output mixers |
| 15649 | */ |
| 15650 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15651 | /* |
| 15652 | * Unmute ADC and set the default input to mic-in |
| 15653 | */ |
| 15654 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15655 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15656 | |
| 15657 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15658 | * mixer widget |
| 15659 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15660 | * panel mic (mic 2) |
| 15661 | */ |
| 15662 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15663 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15664 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15665 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15666 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15667 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15668 | |
| 15669 | /* |
| 15670 | * Set up output mixers (0x0c - 0x0f) |
| 15671 | */ |
| 15672 | /* set vol=0 to output mixers */ |
| 15673 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15674 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15675 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15676 | |
| 15677 | /* set up input amps for analog loopback */ |
| 15678 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15679 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15680 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15681 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15682 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15683 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15684 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15685 | |
| 15686 | |
| 15687 | /* FIXME: use matrix-type input source selection */ |
| 15688 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15689 | /* Input mixer */ |
| 15690 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15691 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15692 | { } |
| 15693 | }; |
| 15694 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15695 | /* additional verbs for ALC663 */ |
| 15696 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15697 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15698 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15699 | { } |
| 15700 | }; |
| 15701 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15702 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15703 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15704 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15705 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15706 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15707 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15708 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15709 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15710 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15711 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15712 | {} |
| 15713 | }; |
| 15714 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15715 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15716 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15717 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15718 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15719 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15720 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15721 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15722 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15723 | {} |
| 15724 | }; |
| 15725 | |
| 15726 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15727 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15728 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15729 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15730 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15731 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15732 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15733 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15734 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15735 | {} |
| 15736 | }; |
| 15737 | |
| 15738 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15739 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15740 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15741 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15742 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15743 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15744 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15745 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15746 | {} |
| 15747 | }; |
| 15748 | |
| 15749 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15750 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15751 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15752 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15753 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15754 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15755 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15756 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15757 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15758 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15759 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15760 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15761 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15762 | {} |
| 15763 | }; |
| 15764 | |
| 15765 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15766 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15767 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15768 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15769 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15770 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15771 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15772 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15773 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15774 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15775 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15776 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15777 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15778 | {} |
| 15779 | }; |
| 15780 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15781 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15782 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15783 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15784 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15785 | |
| 15786 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15787 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15788 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15789 | |
| 15790 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15791 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15792 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15793 | {} |
| 15794 | }; |
| 15795 | |
| 15796 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15797 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15798 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15799 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15800 | |
| 15801 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15802 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15803 | {} |
| 15804 | }; |
| 15805 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15806 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15807 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15808 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15809 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15810 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15811 | {} |
| 15812 | }; |
| 15813 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15814 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15815 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15816 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15817 | { } /* end */ |
| 15818 | }; |
| 15819 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15820 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15821 | { |
| 15822 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15823 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15824 | |
| 15825 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15826 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15827 | bits = present ? HDA_AMP_MUTE : 0; |
| 15828 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15829 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15830 | } |
| 15831 | |
| 15832 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15833 | { |
| 15834 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15835 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15836 | |
| 15837 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15838 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15839 | bits = present ? HDA_AMP_MUTE : 0; |
| 15840 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15841 | HDA_AMP_MUTE, bits); |
| 15842 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15843 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15844 | } |
| 15845 | |
| 15846 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15847 | unsigned int res) |
| 15848 | { |
| 15849 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15850 | alc662_lenovo_101e_all_automute(codec); |
| 15851 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15852 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15853 | } |
| 15854 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15855 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15856 | { |
| 15857 | unsigned int present; |
| 15858 | |
| 15859 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15860 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15861 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15862 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15863 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15864 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15865 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15866 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15867 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15868 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15869 | } |
| 15870 | |
| 15871 | /* unsolicited event for HP jack sensing */ |
| 15872 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15873 | unsigned int res) |
| 15874 | { |
| 15875 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15876 | alc262_hippo1_automute( codec ); |
| 15877 | |
| 15878 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15879 | alc662_eeepc_mic_automute(codec); |
| 15880 | } |
| 15881 | |
| 15882 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15883 | { |
| 15884 | alc262_hippo1_automute( codec ); |
| 15885 | alc662_eeepc_mic_automute(codec); |
| 15886 | } |
| 15887 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15888 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 15889 | { |
| 15890 | unsigned int mute; |
| 15891 | unsigned int present; |
| 15892 | |
| 15893 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 15894 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15895 | AC_VERB_GET_PIN_SENSE, 0); |
| 15896 | present = (present & 0x80000000) != 0; |
| 15897 | if (present) { |
| 15898 | /* mute internal speaker */ |
| 15899 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15900 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15901 | } else { |
| 15902 | /* unmute internal speaker if necessary */ |
| 15903 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 15904 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15905 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15906 | } |
| 15907 | } |
| 15908 | |
| 15909 | /* unsolicited event for HP jack sensing */ |
| 15910 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 15911 | unsigned int res) |
| 15912 | { |
| 15913 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15914 | alc662_eeepc_ep20_automute(codec); |
| 15915 | } |
| 15916 | |
| 15917 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15918 | { |
| 15919 | alc662_eeepc_ep20_automute(codec); |
| 15920 | } |
| 15921 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15922 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15923 | { |
| 15924 | unsigned int present; |
| 15925 | unsigned char bits; |
| 15926 | |
| 15927 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15928 | AC_VERB_GET_PIN_SENSE, 0) |
| 15929 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15930 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15931 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15932 | AMP_IN_MUTE(0), bits); |
| 15933 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15934 | AMP_IN_MUTE(0), bits); |
| 15935 | } |
| 15936 | |
| 15937 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15938 | { |
| 15939 | unsigned int present; |
| 15940 | unsigned char bits; |
| 15941 | |
| 15942 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15943 | AC_VERB_GET_PIN_SENSE, 0) |
| 15944 | & AC_PINSENSE_PRESENCE; |
| 15945 | bits = present ? HDA_AMP_MUTE : 0; |
| 15946 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15947 | AMP_IN_MUTE(0), bits); |
| 15948 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15949 | AMP_IN_MUTE(0), bits); |
| 15950 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15951 | AMP_IN_MUTE(0), bits); |
| 15952 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15953 | AMP_IN_MUTE(0), bits); |
| 15954 | } |
| 15955 | |
| 15956 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15957 | { |
| 15958 | unsigned int present; |
| 15959 | unsigned char bits; |
| 15960 | |
| 15961 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15962 | AC_VERB_GET_PIN_SENSE, 0) |
| 15963 | & AC_PINSENSE_PRESENCE; |
| 15964 | bits = present ? HDA_AMP_MUTE : 0; |
| 15965 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15966 | AMP_IN_MUTE(0), bits); |
| 15967 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15968 | AMP_IN_MUTE(0), bits); |
| 15969 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15970 | AMP_IN_MUTE(0), bits); |
| 15971 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15972 | AMP_IN_MUTE(0), bits); |
| 15973 | } |
| 15974 | |
| 15975 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15976 | { |
| 15977 | unsigned int present; |
| 15978 | unsigned char bits; |
| 15979 | |
| 15980 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15981 | AC_VERB_GET_PIN_SENSE, 0) |
| 15982 | & AC_PINSENSE_PRESENCE; |
| 15983 | bits = present ? 0 : PIN_OUT; |
| 15984 | snd_hda_codec_write(codec, 0x14, 0, |
| 15985 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15986 | } |
| 15987 | |
| 15988 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15989 | { |
| 15990 | unsigned int present1, present2; |
| 15991 | |
| 15992 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15993 | AC_VERB_GET_PIN_SENSE, 0) |
| 15994 | & AC_PINSENSE_PRESENCE; |
| 15995 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15996 | AC_VERB_GET_PIN_SENSE, 0) |
| 15997 | & AC_PINSENSE_PRESENCE; |
| 15998 | |
| 15999 | if (present1 || present2) { |
| 16000 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16001 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16002 | } else { |
| 16003 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16004 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16005 | } |
| 16006 | } |
| 16007 | |
| 16008 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16009 | { |
| 16010 | unsigned int present1, present2; |
| 16011 | |
| 16012 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16013 | AC_VERB_GET_PIN_SENSE, 0) |
| 16014 | & AC_PINSENSE_PRESENCE; |
| 16015 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16016 | AC_VERB_GET_PIN_SENSE, 0) |
| 16017 | & AC_PINSENSE_PRESENCE; |
| 16018 | |
| 16019 | if (present1 || present2) { |
| 16020 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16021 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16022 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16023 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16024 | } else { |
| 16025 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16026 | AMP_IN_MUTE(0), 0); |
| 16027 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16028 | AMP_IN_MUTE(0), 0); |
| 16029 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16030 | } |
| 16031 | |
| 16032 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16033 | { |
| 16034 | unsigned int present; |
| 16035 | |
| 16036 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16037 | AC_VERB_GET_PIN_SENSE, 0) |
| 16038 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16039 | 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] | 16040 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16041 | 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] | 16042 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16043 | 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] | 16044 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16045 | 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] | 16046 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16047 | } |
| 16048 | |
| 16049 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16050 | unsigned int res) |
| 16051 | { |
| 16052 | switch (res >> 26) { |
| 16053 | case ALC880_HP_EVENT: |
| 16054 | alc663_m51va_speaker_automute(codec); |
| 16055 | break; |
| 16056 | case ALC880_MIC_EVENT: |
| 16057 | alc663_m51va_mic_automute(codec); |
| 16058 | break; |
| 16059 | } |
| 16060 | } |
| 16061 | |
| 16062 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16063 | { |
| 16064 | alc663_m51va_speaker_automute(codec); |
| 16065 | alc663_m51va_mic_automute(codec); |
| 16066 | } |
| 16067 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16068 | /* ***************** Mode1 ******************************/ |
| 16069 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16070 | unsigned int res) |
| 16071 | { |
| 16072 | switch (res >> 26) { |
| 16073 | case ALC880_HP_EVENT: |
| 16074 | alc663_m51va_speaker_automute(codec); |
| 16075 | break; |
| 16076 | case ALC880_MIC_EVENT: |
| 16077 | alc662_eeepc_mic_automute(codec); |
| 16078 | break; |
| 16079 | } |
| 16080 | } |
| 16081 | |
| 16082 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16083 | { |
| 16084 | alc663_m51va_speaker_automute(codec); |
| 16085 | alc662_eeepc_mic_automute(codec); |
| 16086 | } |
| 16087 | /* ***************** Mode2 ******************************/ |
| 16088 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16089 | unsigned int res) |
| 16090 | { |
| 16091 | switch (res >> 26) { |
| 16092 | case ALC880_HP_EVENT: |
| 16093 | alc662_f5z_speaker_automute(codec); |
| 16094 | break; |
| 16095 | case ALC880_MIC_EVENT: |
| 16096 | alc662_eeepc_mic_automute(codec); |
| 16097 | break; |
| 16098 | } |
| 16099 | } |
| 16100 | |
| 16101 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16102 | { |
| 16103 | alc662_f5z_speaker_automute(codec); |
| 16104 | alc662_eeepc_mic_automute(codec); |
| 16105 | } |
| 16106 | /* ***************** Mode3 ******************************/ |
| 16107 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16108 | unsigned int res) |
| 16109 | { |
| 16110 | switch (res >> 26) { |
| 16111 | case ALC880_HP_EVENT: |
| 16112 | alc663_two_hp_m1_speaker_automute(codec); |
| 16113 | break; |
| 16114 | case ALC880_MIC_EVENT: |
| 16115 | alc662_eeepc_mic_automute(codec); |
| 16116 | break; |
| 16117 | } |
| 16118 | } |
| 16119 | |
| 16120 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16121 | { |
| 16122 | alc663_two_hp_m1_speaker_automute(codec); |
| 16123 | alc662_eeepc_mic_automute(codec); |
| 16124 | } |
| 16125 | /* ***************** Mode4 ******************************/ |
| 16126 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16127 | unsigned int res) |
| 16128 | { |
| 16129 | switch (res >> 26) { |
| 16130 | case ALC880_HP_EVENT: |
| 16131 | alc663_21jd_two_speaker_automute(codec); |
| 16132 | break; |
| 16133 | case ALC880_MIC_EVENT: |
| 16134 | alc662_eeepc_mic_automute(codec); |
| 16135 | break; |
| 16136 | } |
| 16137 | } |
| 16138 | |
| 16139 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16140 | { |
| 16141 | alc663_21jd_two_speaker_automute(codec); |
| 16142 | alc662_eeepc_mic_automute(codec); |
| 16143 | } |
| 16144 | /* ***************** Mode5 ******************************/ |
| 16145 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16146 | unsigned int res) |
| 16147 | { |
| 16148 | switch (res >> 26) { |
| 16149 | case ALC880_HP_EVENT: |
| 16150 | alc663_15jd_two_speaker_automute(codec); |
| 16151 | break; |
| 16152 | case ALC880_MIC_EVENT: |
| 16153 | alc662_eeepc_mic_automute(codec); |
| 16154 | break; |
| 16155 | } |
| 16156 | } |
| 16157 | |
| 16158 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16159 | { |
| 16160 | alc663_15jd_two_speaker_automute(codec); |
| 16161 | alc662_eeepc_mic_automute(codec); |
| 16162 | } |
| 16163 | /* ***************** Mode6 ******************************/ |
| 16164 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16165 | unsigned int res) |
| 16166 | { |
| 16167 | switch (res >> 26) { |
| 16168 | case ALC880_HP_EVENT: |
| 16169 | alc663_two_hp_m2_speaker_automute(codec); |
| 16170 | break; |
| 16171 | case ALC880_MIC_EVENT: |
| 16172 | alc662_eeepc_mic_automute(codec); |
| 16173 | break; |
| 16174 | } |
| 16175 | } |
| 16176 | |
| 16177 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16178 | { |
| 16179 | alc663_two_hp_m2_speaker_automute(codec); |
| 16180 | alc662_eeepc_mic_automute(codec); |
| 16181 | } |
| 16182 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16183 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16184 | { |
| 16185 | unsigned int present; |
| 16186 | unsigned char bits; |
| 16187 | |
| 16188 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16189 | AC_VERB_GET_PIN_SENSE, 0) |
| 16190 | & AC_PINSENSE_PRESENCE; |
| 16191 | bits = present ? HDA_AMP_MUTE : 0; |
| 16192 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16193 | HDA_AMP_MUTE, bits); |
| 16194 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16195 | HDA_AMP_MUTE, bits); |
| 16196 | } |
| 16197 | |
| 16198 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16199 | { |
| 16200 | unsigned int present; |
| 16201 | unsigned char bits; |
| 16202 | |
| 16203 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16204 | AC_VERB_GET_PIN_SENSE, 0) |
| 16205 | & AC_PINSENSE_PRESENCE; |
| 16206 | bits = present ? HDA_AMP_MUTE : 0; |
| 16207 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16208 | HDA_AMP_MUTE, bits); |
| 16209 | } |
| 16210 | |
| 16211 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16212 | unsigned int res) |
| 16213 | { |
| 16214 | switch (res >> 26) { |
| 16215 | case ALC880_HP_EVENT: |
| 16216 | alc663_g71v_hp_automute(codec); |
| 16217 | break; |
| 16218 | case ALC880_FRONT_EVENT: |
| 16219 | alc663_g71v_front_automute(codec); |
| 16220 | break; |
| 16221 | case ALC880_MIC_EVENT: |
| 16222 | alc662_eeepc_mic_automute(codec); |
| 16223 | break; |
| 16224 | } |
| 16225 | } |
| 16226 | |
| 16227 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16228 | { |
| 16229 | alc663_g71v_front_automute(codec); |
| 16230 | alc663_g71v_hp_automute(codec); |
| 16231 | alc662_eeepc_mic_automute(codec); |
| 16232 | } |
| 16233 | |
| 16234 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16235 | unsigned int res) |
| 16236 | { |
| 16237 | switch (res >> 26) { |
| 16238 | case ALC880_HP_EVENT: |
| 16239 | alc663_m51va_speaker_automute(codec); |
| 16240 | break; |
| 16241 | case ALC880_MIC_EVENT: |
| 16242 | alc662_eeepc_mic_automute(codec); |
| 16243 | break; |
| 16244 | } |
| 16245 | } |
| 16246 | |
| 16247 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16248 | { |
| 16249 | alc663_m51va_speaker_automute(codec); |
| 16250 | alc662_eeepc_mic_automute(codec); |
| 16251 | } |
| 16252 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16253 | /* bind hp and internal speaker mute (with plug check) */ |
| 16254 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 16255 | struct snd_ctl_elem_value *ucontrol) |
| 16256 | { |
| 16257 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 16258 | long *valp = ucontrol->value.integer.value; |
| 16259 | int change; |
| 16260 | |
| 16261 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 16262 | HDA_AMP_MUTE, |
| 16263 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 16264 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 16265 | HDA_AMP_MUTE, |
| 16266 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 16267 | if (change) |
| 16268 | alc262_hippo1_automute(codec); |
| 16269 | return change; |
| 16270 | } |
| 16271 | |
| 16272 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16273 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16274 | { |
| 16275 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16276 | .name = "Master Playback Switch", |
| 16277 | .info = snd_hda_mixer_amp_switch_info, |
| 16278 | .get = snd_hda_mixer_amp_switch_get, |
| 16279 | .put = alc662_ecs_master_sw_put, |
| 16280 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16281 | }, |
| 16282 | |
| 16283 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16284 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16285 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16286 | |
| 16287 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16288 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16289 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16290 | { } /* end */ |
| 16291 | }; |
| 16292 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16293 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16294 | #define alc662_loopbacks alc880_loopbacks |
| 16295 | #endif |
| 16296 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16297 | |
| 16298 | /* pcm configuration: identiacal with ALC880 */ |
| 16299 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16300 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16301 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16302 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16303 | |
| 16304 | /* |
| 16305 | * configuration and preset |
| 16306 | */ |
| 16307 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16308 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16309 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16310 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16311 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16312 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16313 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16314 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16315 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16316 | [ALC663_ASUS_M51VA] = "m51va", |
| 16317 | [ALC663_ASUS_G71V] = "g71v", |
| 16318 | [ALC663_ASUS_H13] = "h13", |
| 16319 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16320 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16321 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16322 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16323 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16324 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16325 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16326 | [ALC662_AUTO] = "auto", |
| 16327 | }; |
| 16328 | |
| 16329 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16330 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
| 16331 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16332 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16333 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16334 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16335 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16336 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16337 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16338 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16339 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16340 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16341 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16342 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
| 16343 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16344 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16345 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16346 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
| 16347 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16348 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16349 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16350 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16351 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16352 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
| 16353 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16354 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16355 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
| 16356 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16357 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
| 16358 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16359 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16360 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16361 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16362 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
| 16363 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16364 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16365 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16366 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16367 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16368 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16369 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16370 | ALC662_3ST_6ch_DIG), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16371 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16372 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16373 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16374 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16375 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16376 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16377 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16378 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16379 | {} |
| 16380 | }; |
| 16381 | |
| 16382 | static struct alc_config_preset alc662_presets[] = { |
| 16383 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16384 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16385 | .init_verbs = { alc662_init_verbs }, |
| 16386 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16387 | .dac_nids = alc662_dac_nids, |
| 16388 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16389 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16390 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16391 | .channel_mode = alc662_3ST_2ch_modes, |
| 16392 | .input_mux = &alc662_capture_source, |
| 16393 | }, |
| 16394 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16395 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16396 | .init_verbs = { alc662_init_verbs }, |
| 16397 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16398 | .dac_nids = alc662_dac_nids, |
| 16399 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16400 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16401 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16402 | .channel_mode = alc662_3ST_6ch_modes, |
| 16403 | .need_dac_fix = 1, |
| 16404 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16405 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16406 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16407 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16408 | .init_verbs = { alc662_init_verbs }, |
| 16409 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16410 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16411 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16412 | .channel_mode = alc662_3ST_6ch_modes, |
| 16413 | .need_dac_fix = 1, |
| 16414 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16415 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16416 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16417 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16418 | .init_verbs = { alc662_init_verbs }, |
| 16419 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16420 | .dac_nids = alc662_dac_nids, |
| 16421 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16422 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16423 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16424 | .channel_mode = alc662_5stack_modes, |
| 16425 | .input_mux = &alc662_capture_source, |
| 16426 | }, |
| 16427 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16428 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16429 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16430 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16431 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16432 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16433 | .channel_mode = alc662_3ST_2ch_modes, |
| 16434 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16435 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16436 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16437 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16438 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16439 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16440 | .init_verbs = { alc662_init_verbs, |
| 16441 | alc662_eeepc_sue_init_verbs }, |
| 16442 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16443 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16444 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16445 | .channel_mode = alc662_3ST_2ch_modes, |
| 16446 | .input_mux = &alc662_eeepc_capture_source, |
| 16447 | .unsol_event = alc662_eeepc_unsol_event, |
| 16448 | .init_hook = alc662_eeepc_inithook, |
| 16449 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16450 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16451 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16452 | alc662_chmode_mixer }, |
| 16453 | .init_verbs = { alc662_init_verbs, |
| 16454 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16455 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16456 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16457 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16458 | .channel_mode = alc662_3ST_6ch_modes, |
| 16459 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16460 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 16461 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16462 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16463 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16464 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16465 | .init_verbs = { alc662_init_verbs, |
| 16466 | alc662_ecs_init_verbs }, |
| 16467 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16468 | .dac_nids = alc662_dac_nids, |
| 16469 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16470 | .channel_mode = alc662_3ST_2ch_modes, |
| 16471 | .input_mux = &alc662_eeepc_capture_source, |
| 16472 | .unsol_event = alc662_eeepc_unsol_event, |
| 16473 | .init_hook = alc662_eeepc_inithook, |
| 16474 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16475 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16476 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16477 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16478 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16479 | .dac_nids = alc662_dac_nids, |
| 16480 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16481 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16482 | .channel_mode = alc662_3ST_2ch_modes, |
| 16483 | .input_mux = &alc663_m51va_capture_source, |
| 16484 | .unsol_event = alc663_m51va_unsol_event, |
| 16485 | .init_hook = alc663_m51va_inithook, |
| 16486 | }, |
| 16487 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16488 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16489 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16490 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16491 | .dac_nids = alc662_dac_nids, |
| 16492 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16493 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16494 | .channel_mode = alc662_3ST_2ch_modes, |
| 16495 | .input_mux = &alc662_eeepc_capture_source, |
| 16496 | .unsol_event = alc663_g71v_unsol_event, |
| 16497 | .init_hook = alc663_g71v_inithook, |
| 16498 | }, |
| 16499 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16500 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16501 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16502 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16503 | .dac_nids = alc662_dac_nids, |
| 16504 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16505 | .channel_mode = alc662_3ST_2ch_modes, |
| 16506 | .input_mux = &alc663_m51va_capture_source, |
| 16507 | .unsol_event = alc663_m51va_unsol_event, |
| 16508 | .init_hook = alc663_m51va_inithook, |
| 16509 | }, |
| 16510 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16511 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16512 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16513 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16514 | .dac_nids = alc662_dac_nids, |
| 16515 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16516 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16517 | .channel_mode = alc662_3ST_6ch_modes, |
| 16518 | .input_mux = &alc663_capture_source, |
| 16519 | .unsol_event = alc663_g50v_unsol_event, |
| 16520 | .init_hook = alc663_g50v_inithook, |
| 16521 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16522 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16523 | .mixers = { alc663_m51va_mixer }, |
| 16524 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16525 | .init_verbs = { alc662_init_verbs, |
| 16526 | alc663_21jd_amic_init_verbs }, |
| 16527 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16528 | .hp_nid = 0x03, |
| 16529 | .dac_nids = alc662_dac_nids, |
| 16530 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16531 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16532 | .channel_mode = alc662_3ST_2ch_modes, |
| 16533 | .input_mux = &alc662_eeepc_capture_source, |
| 16534 | .unsol_event = alc663_mode1_unsol_event, |
| 16535 | .init_hook = alc663_mode1_inithook, |
| 16536 | }, |
| 16537 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16538 | .mixers = { alc662_1bjd_mixer }, |
| 16539 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16540 | .init_verbs = { alc662_init_verbs, |
| 16541 | alc662_1bjd_amic_init_verbs }, |
| 16542 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16543 | .dac_nids = alc662_dac_nids, |
| 16544 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16545 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16546 | .channel_mode = alc662_3ST_2ch_modes, |
| 16547 | .input_mux = &alc662_eeepc_capture_source, |
| 16548 | .unsol_event = alc662_mode2_unsol_event, |
| 16549 | .init_hook = alc662_mode2_inithook, |
| 16550 | }, |
| 16551 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16552 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16553 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16554 | .init_verbs = { alc662_init_verbs, |
| 16555 | alc663_two_hp_amic_m1_init_verbs }, |
| 16556 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16557 | .hp_nid = 0x03, |
| 16558 | .dac_nids = alc662_dac_nids, |
| 16559 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16560 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16561 | .channel_mode = alc662_3ST_2ch_modes, |
| 16562 | .input_mux = &alc662_eeepc_capture_source, |
| 16563 | .unsol_event = alc663_mode3_unsol_event, |
| 16564 | .init_hook = alc663_mode3_inithook, |
| 16565 | }, |
| 16566 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16567 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16568 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16569 | .init_verbs = { alc662_init_verbs, |
| 16570 | alc663_21jd_amic_init_verbs}, |
| 16571 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16572 | .hp_nid = 0x03, |
| 16573 | .dac_nids = alc662_dac_nids, |
| 16574 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16575 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16576 | .channel_mode = alc662_3ST_2ch_modes, |
| 16577 | .input_mux = &alc662_eeepc_capture_source, |
| 16578 | .unsol_event = alc663_mode4_unsol_event, |
| 16579 | .init_hook = alc663_mode4_inithook, |
| 16580 | }, |
| 16581 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16582 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16583 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16584 | .init_verbs = { alc662_init_verbs, |
| 16585 | alc663_15jd_amic_init_verbs }, |
| 16586 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16587 | .hp_nid = 0x03, |
| 16588 | .dac_nids = alc662_dac_nids, |
| 16589 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16590 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16591 | .channel_mode = alc662_3ST_2ch_modes, |
| 16592 | .input_mux = &alc662_eeepc_capture_source, |
| 16593 | .unsol_event = alc663_mode5_unsol_event, |
| 16594 | .init_hook = alc663_mode5_inithook, |
| 16595 | }, |
| 16596 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16597 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16598 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16599 | .init_verbs = { alc662_init_verbs, |
| 16600 | alc663_two_hp_amic_m2_init_verbs }, |
| 16601 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16602 | .hp_nid = 0x03, |
| 16603 | .dac_nids = alc662_dac_nids, |
| 16604 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16605 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16606 | .channel_mode = alc662_3ST_2ch_modes, |
| 16607 | .input_mux = &alc662_eeepc_capture_source, |
| 16608 | .unsol_event = alc663_mode6_unsol_event, |
| 16609 | .init_hook = alc663_mode6_inithook, |
| 16610 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16611 | }; |
| 16612 | |
| 16613 | |
| 16614 | /* |
| 16615 | * BIOS auto configuration |
| 16616 | */ |
| 16617 | |
| 16618 | /* add playback controls from the parsed DAC table */ |
| 16619 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16620 | const struct auto_pin_cfg *cfg) |
| 16621 | { |
| 16622 | char name[32]; |
| 16623 | static const char *chname[4] = { |
| 16624 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16625 | }; |
| 16626 | hda_nid_t nid; |
| 16627 | int i, err; |
| 16628 | |
| 16629 | for (i = 0; i < cfg->line_outs; i++) { |
| 16630 | if (!spec->multiout.dac_nids[i]) |
| 16631 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16632 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16633 | if (i == 2) { |
| 16634 | /* Center/LFE */ |
| 16635 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16636 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16637 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16638 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16639 | if (err < 0) |
| 16640 | return err; |
| 16641 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16642 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16643 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16644 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16645 | if (err < 0) |
| 16646 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16647 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16648 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16649 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16650 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16651 | if (err < 0) |
| 16652 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16653 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16654 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16655 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16656 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16657 | if (err < 0) |
| 16658 | return err; |
| 16659 | } else { |
| 16660 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16661 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16662 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16663 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16664 | if (err < 0) |
| 16665 | return err; |
| 16666 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16667 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16668 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16669 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16670 | if (err < 0) |
| 16671 | return err; |
| 16672 | } |
| 16673 | } |
| 16674 | return 0; |
| 16675 | } |
| 16676 | |
| 16677 | /* add playback controls for speaker and HP outputs */ |
| 16678 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16679 | const char *pfx) |
| 16680 | { |
| 16681 | hda_nid_t nid; |
| 16682 | int err; |
| 16683 | char name[32]; |
| 16684 | |
| 16685 | if (!pin) |
| 16686 | return 0; |
| 16687 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16688 | if (pin == 0x17) { |
| 16689 | /* ALC663 has a mono output pin on 0x17 */ |
| 16690 | sprintf(name, "%s Playback Switch", pfx); |
| 16691 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16692 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16693 | return err; |
| 16694 | } |
| 16695 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16696 | if (alc880_is_fixed_pin(pin)) { |
| 16697 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 16698 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16699 | /* specify the DAC as the extra output */ |
| 16700 | if (!spec->multiout.hp_nid) |
| 16701 | spec->multiout.hp_nid = nid; |
| 16702 | else |
| 16703 | spec->multiout.extra_out_nid[0] = nid; |
| 16704 | /* control HP volume/switch on the output mixer amp */ |
| 16705 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16706 | sprintf(name, "%s Playback Volume", pfx); |
| 16707 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16708 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16709 | if (err < 0) |
| 16710 | return err; |
| 16711 | sprintf(name, "%s Playback Switch", pfx); |
| 16712 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16713 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16714 | if (err < 0) |
| 16715 | return err; |
| 16716 | } else if (alc880_is_multi_pin(pin)) { |
| 16717 | /* set manual connection */ |
| 16718 | /* we have only a switch on HP-out PIN */ |
| 16719 | sprintf(name, "%s Playback Switch", pfx); |
| 16720 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16721 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16722 | if (err < 0) |
| 16723 | return err; |
| 16724 | } |
| 16725 | return 0; |
| 16726 | } |
| 16727 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame^] | 16728 | /* return the index of the src widget from the connection list of the nid. |
| 16729 | * return -1 if not found |
| 16730 | */ |
| 16731 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 16732 | hda_nid_t src) |
| 16733 | { |
| 16734 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 16735 | int i, conns; |
| 16736 | |
| 16737 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 16738 | ARRAY_SIZE(conn_list)); |
| 16739 | if (conns < 0) |
| 16740 | return -1; |
| 16741 | for (i = 0; i < conns; i++) |
| 16742 | if (conn_list[i] == src) |
| 16743 | return i; |
| 16744 | return -1; |
| 16745 | } |
| 16746 | |
| 16747 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 16748 | { |
| 16749 | unsigned int pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 16750 | return (pincap & AC_PINCAP_IN) != 0; |
| 16751 | } |
| 16752 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16753 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame^] | 16754 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16755 | const struct auto_pin_cfg *cfg) |
| 16756 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame^] | 16757 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16758 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16759 | int i, err, idx; |
| 16760 | |
| 16761 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame^] | 16762 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 16763 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 16764 | cfg->input_pins[i]); |
| 16765 | if (idx >= 0) { |
| 16766 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16767 | auto_pin_cfg_labels[i], |
| 16768 | idx, 0x0b); |
| 16769 | if (err < 0) |
| 16770 | return err; |
| 16771 | } |
| 16772 | idx = alc662_input_pin_idx(codec, 0x22, |
| 16773 | cfg->input_pins[i]); |
| 16774 | if (idx >= 0) { |
| 16775 | imux->items[imux->num_items].label = |
| 16776 | auto_pin_cfg_labels[i]; |
| 16777 | imux->items[imux->num_items].index = idx; |
| 16778 | imux->num_items++; |
| 16779 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16780 | } |
| 16781 | } |
| 16782 | return 0; |
| 16783 | } |
| 16784 | |
| 16785 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16786 | hda_nid_t nid, int pin_type, |
| 16787 | int dac_idx) |
| 16788 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16789 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16790 | /* need the manual connection? */ |
| 16791 | if (alc880_is_multi_pin(nid)) { |
| 16792 | struct alc_spec *spec = codec->spec; |
| 16793 | int idx = alc880_multi_pin_idx(nid); |
| 16794 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16795 | AC_VERB_SET_CONNECT_SEL, |
| 16796 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16797 | } |
| 16798 | } |
| 16799 | |
| 16800 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16801 | { |
| 16802 | struct alc_spec *spec = codec->spec; |
| 16803 | int i; |
| 16804 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16805 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16806 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16807 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16808 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16809 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16810 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16811 | i); |
| 16812 | } |
| 16813 | } |
| 16814 | |
| 16815 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16816 | { |
| 16817 | struct alc_spec *spec = codec->spec; |
| 16818 | hda_nid_t pin; |
| 16819 | |
| 16820 | pin = spec->autocfg.hp_pins[0]; |
| 16821 | if (pin) /* connect to front */ |
| 16822 | /* use dac 0 */ |
| 16823 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16824 | pin = spec->autocfg.speaker_pins[0]; |
| 16825 | if (pin) |
| 16826 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16827 | } |
| 16828 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16829 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16830 | |
| 16831 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16832 | { |
| 16833 | struct alc_spec *spec = codec->spec; |
| 16834 | int i; |
| 16835 | |
| 16836 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16837 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame^] | 16838 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16839 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16840 | if (nid != ALC662_PIN_CD_NID) |
| 16841 | snd_hda_codec_write(codec, nid, 0, |
| 16842 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16843 | AMP_OUT_MUTE); |
| 16844 | } |
| 16845 | } |
| 16846 | } |
| 16847 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16848 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16849 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16850 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16851 | { |
| 16852 | struct alc_spec *spec = codec->spec; |
| 16853 | int err; |
| 16854 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16855 | |
| 16856 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16857 | alc662_ignore); |
| 16858 | if (err < 0) |
| 16859 | return err; |
| 16860 | if (!spec->autocfg.line_outs) |
| 16861 | return 0; /* can't find valid BIOS pin config */ |
| 16862 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16863 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16864 | if (err < 0) |
| 16865 | return err; |
| 16866 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16867 | if (err < 0) |
| 16868 | return err; |
| 16869 | err = alc662_auto_create_extra_out(spec, |
| 16870 | spec->autocfg.speaker_pins[0], |
| 16871 | "Speaker"); |
| 16872 | if (err < 0) |
| 16873 | return err; |
| 16874 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16875 | "Headphone"); |
| 16876 | if (err < 0) |
| 16877 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame^] | 16878 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16879 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16880 | return err; |
| 16881 | |
| 16882 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16883 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16884 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16885 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16886 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16887 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16888 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16889 | |
| 16890 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16891 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16892 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16893 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16894 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16895 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16896 | |
| 16897 | err = alc_auto_add_mic_boost(codec); |
| 16898 | if (err < 0) |
| 16899 | return err; |
| 16900 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16901 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16902 | } |
| 16903 | |
| 16904 | /* additional initialization for auto-configuration model */ |
| 16905 | static void alc662_auto_init(struct hda_codec *codec) |
| 16906 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16907 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16908 | alc662_auto_init_multi_out(codec); |
| 16909 | alc662_auto_init_hp_out(codec); |
| 16910 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16911 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16912 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16913 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16914 | } |
| 16915 | |
| 16916 | static int patch_alc662(struct hda_codec *codec) |
| 16917 | { |
| 16918 | struct alc_spec *spec; |
| 16919 | int err, board_config; |
| 16920 | |
| 16921 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16922 | if (!spec) |
| 16923 | return -ENOMEM; |
| 16924 | |
| 16925 | codec->spec = spec; |
| 16926 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16927 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16928 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16929 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16930 | alc662_models, |
| 16931 | alc662_cfg_tbl); |
| 16932 | if (board_config < 0) { |
| 16933 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16934 | "trying auto-probe from BIOS...\n"); |
| 16935 | board_config = ALC662_AUTO; |
| 16936 | } |
| 16937 | |
| 16938 | if (board_config == ALC662_AUTO) { |
| 16939 | /* automatic parse from the BIOS config */ |
| 16940 | err = alc662_parse_auto_config(codec); |
| 16941 | if (err < 0) { |
| 16942 | alc_free(codec); |
| 16943 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16944 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16945 | printk(KERN_INFO |
| 16946 | "hda_codec: Cannot set up configuration " |
| 16947 | "from BIOS. Using base mode...\n"); |
| 16948 | board_config = ALC662_3ST_2ch_DIG; |
| 16949 | } |
| 16950 | } |
| 16951 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16952 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 16953 | if (err < 0) { |
| 16954 | alc_free(codec); |
| 16955 | return err; |
| 16956 | } |
| 16957 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16958 | if (board_config != ALC662_AUTO) |
| 16959 | setup_preset(spec, &alc662_presets[board_config]); |
| 16960 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16961 | if (codec->vendor_id == 0x10ec0663) { |
| 16962 | spec->stream_name_analog = "ALC663 Analog"; |
| 16963 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16964 | } else if (codec->vendor_id == 0x10ec0272) { |
| 16965 | spec->stream_name_analog = "ALC272 Analog"; |
| 16966 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16967 | } else { |
| 16968 | spec->stream_name_analog = "ALC662 Analog"; |
| 16969 | spec->stream_name_digital = "ALC662 Digital"; |
| 16970 | } |
| 16971 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16972 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16973 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16974 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16975 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16976 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16977 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16978 | spec->adc_nids = alc662_adc_nids; |
| 16979 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16980 | spec->capsrc_nids = alc662_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16981 | spec->capture_style = CAPT_MIX; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16982 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16983 | if (!spec->cap_mixer) |
| 16984 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 16985 | if (codec->vendor_id == 0x10ec0662) |
| 16986 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 16987 | else |
| 16988 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16989 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16990 | spec->vmaster_nid = 0x02; |
| 16991 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16992 | codec->patch_ops = alc_patch_ops; |
| 16993 | if (board_config == ALC662_AUTO) |
| 16994 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16995 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16996 | if (!spec->loopback.amplist) |
| 16997 | spec->loopback.amplist = alc662_loopbacks; |
| 16998 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 16999 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17000 | |
| 17001 | return 0; |
| 17002 | } |
| 17003 | |
| 17004 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17005 | * patch entries |
| 17006 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17007 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17008 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17009 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17010 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17011 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17012 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17013 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17014 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17015 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17016 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17017 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17018 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17019 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 17020 | .patch = patch_alc883 }, |
| 17021 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17022 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17023 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17024 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17025 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 17026 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17027 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 17028 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17029 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 17030 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17031 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 17032 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17033 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 17034 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 17035 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17036 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17037 | {} /* terminator */ |
| 17038 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17039 | |
| 17040 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17041 | |
| 17042 | MODULE_LICENSE("GPL"); |
| 17043 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17044 | |
| 17045 | static struct hda_codec_preset_list realtek_list = { |
| 17046 | .preset = snd_hda_preset_realtek, |
| 17047 | .owner = THIS_MODULE, |
| 17048 | }; |
| 17049 | |
| 17050 | static int __init patch_realtek_init(void) |
| 17051 | { |
| 17052 | return snd_hda_add_codec_preset(&realtek_list); |
| 17053 | } |
| 17054 | |
| 17055 | static void __exit patch_realtek_exit(void) |
| 17056 | { |
| 17057 | snd_hda_delete_codec_preset(&realtek_list); |
| 17058 | } |
| 17059 | |
| 17060 | module_init(patch_realtek_init) |
| 17061 | module_exit(patch_realtek_exit) |