Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
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 | 7cf51e48 | 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 | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 134 | ALC269_ASUS_AMIC, |
| 135 | ALC269_ASUS_DMIC, |
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 | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 191 | ALC663_ASUS_MODE7, |
| 192 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 193 | ALC272_DELL, |
| 194 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 195 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 196 | ALC662_AUTO, |
| 197 | ALC662_MODEL_LAST, |
| 198 | }; |
| 199 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 200 | /* ALC882 models */ |
| 201 | enum { |
| 202 | ALC882_3ST_DIG, |
| 203 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 204 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 205 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 206 | ALC882_TARGA, |
| 207 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 208 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 209 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 210 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 211 | ALC885_MB5, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 212 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 213 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 214 | ALC883_3ST_2ch_DIG, |
| 215 | ALC883_3ST_6ch_DIG, |
| 216 | ALC883_3ST_6ch, |
| 217 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 218 | ALC883_TARGA_DIG, |
| 219 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 220 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 221 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 222 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 223 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 224 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 225 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 226 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 227 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 228 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 229 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 230 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 231 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 232 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 233 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 234 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 235 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 236 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 237 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 238 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 239 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 240 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 241 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 242 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 243 | ALC889A_INTEL, |
| 244 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 245 | ALC888_ASUS_M90V, |
| 246 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 247 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 248 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 249 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 250 | ALC882_AUTO, |
| 251 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 252 | }; |
| 253 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 254 | /* for GPIO Poll */ |
| 255 | #define GPIO_MASK 0x03 |
| 256 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 257 | /* extra amp-initialization sequence types */ |
| 258 | enum { |
| 259 | ALC_INIT_NONE, |
| 260 | ALC_INIT_DEFAULT, |
| 261 | ALC_INIT_GPIO1, |
| 262 | ALC_INIT_GPIO2, |
| 263 | ALC_INIT_GPIO3, |
| 264 | }; |
| 265 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 266 | struct alc_mic_route { |
| 267 | hda_nid_t pin; |
| 268 | unsigned char mux_idx; |
| 269 | unsigned char amix_idx; |
| 270 | }; |
| 271 | |
| 272 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 273 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | struct alc_spec { |
| 275 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 276 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 278 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 279 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 281 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 282 | * don't forget NULL |
| 283 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 284 | */ |
| 285 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 287 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | struct hda_pcm_stream *stream_analog_playback; |
| 289 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 290 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 291 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 293 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | struct hda_pcm_stream *stream_digital_playback; |
| 295 | struct hda_pcm_stream *stream_digital_capture; |
| 296 | |
| 297 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 298 | struct hda_multi_out multiout; /* playback set-up |
| 299 | * max_channels, dacs must be set |
| 300 | * dig_out_nid and hp_nid are optional |
| 301 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 302 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 303 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 304 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | |
| 306 | /* capture */ |
| 307 | unsigned int num_adc_nids; |
| 308 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 309 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 310 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | |
| 312 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 313 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | const struct hda_input_mux *input_mux; |
| 315 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 316 | struct alc_mic_route ext_mic; |
| 317 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | |
| 319 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 320 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 322 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 323 | int const_channel_count; |
| 324 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | |
| 326 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 327 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 328 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 329 | /* dynamic controls, init_verbs and input_mux */ |
| 330 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 331 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 332 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 333 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 334 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 335 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 336 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 337 | /* hooks */ |
| 338 | void (*init_hook)(struct hda_codec *codec); |
| 339 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 340 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 341 | void (*power_hook)(struct hda_codec *codec, int power); |
| 342 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 343 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 344 | /* for pin sensing */ |
| 345 | unsigned int sense_updated: 1; |
| 346 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 347 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 348 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 349 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 350 | /* other flags */ |
| 351 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 352 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 353 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 354 | /* for virtual master */ |
| 355 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 356 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 357 | struct hda_loopback_check loopback; |
| 358 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 359 | |
| 360 | /* for PLL fix */ |
| 361 | hda_nid_t pll_nid; |
| 362 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 363 | }; |
| 364 | |
| 365 | /* |
| 366 | * configuration template - to be copied to the spec instance |
| 367 | */ |
| 368 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 369 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 370 | * with spec |
| 371 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 372 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 373 | const struct hda_verb *init_verbs[5]; |
| 374 | unsigned int num_dacs; |
| 375 | hda_nid_t *dac_nids; |
| 376 | hda_nid_t dig_out_nid; /* optional */ |
| 377 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 378 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 379 | unsigned int num_adc_nids; |
| 380 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 381 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 382 | hda_nid_t dig_in_nid; |
| 383 | unsigned int num_channel_mode; |
| 384 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 385 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 386 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 387 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 388 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 389 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 390 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 391 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 392 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 393 | struct hda_amp_list *loopbacks; |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 394 | void (*power_hook)(struct hda_codec *codec, int power); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 395 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | }; |
| 397 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | |
| 399 | /* |
| 400 | * input MUX handling |
| 401 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 402 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 403 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | { |
| 405 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 406 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 407 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 408 | if (mux_idx >= spec->num_mux_defs) |
| 409 | mux_idx = 0; |
| 410 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | } |
| 412 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 413 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 414 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | { |
| 416 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 417 | struct alc_spec *spec = codec->spec; |
| 418 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 419 | |
| 420 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 421 | return 0; |
| 422 | } |
| 423 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 424 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 425 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | { |
| 427 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 428 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 429 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 431 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 432 | hda_nid_t nid = spec->capsrc_nids ? |
| 433 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 434 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 436 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 437 | imux = &spec->input_mux[mux_idx]; |
| 438 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 439 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 440 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 441 | /* Matrix-mixer style (e.g. ALC882) */ |
| 442 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 443 | unsigned int i, idx; |
| 444 | |
| 445 | idx = ucontrol->value.enumerated.item[0]; |
| 446 | if (idx >= imux->num_items) |
| 447 | idx = imux->num_items - 1; |
| 448 | if (*cur_val == idx) |
| 449 | return 0; |
| 450 | for (i = 0; i < imux->num_items; i++) { |
| 451 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 452 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 453 | imux->items[i].index, |
| 454 | HDA_AMP_MUTE, v); |
| 455 | } |
| 456 | *cur_val = idx; |
| 457 | return 1; |
| 458 | } else { |
| 459 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 460 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 461 | &spec->cur_mux[adc_idx]); |
| 462 | } |
| 463 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 464 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | /* |
| 466 | * channel mode setting |
| 467 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 468 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 469 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | { |
| 471 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 472 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 473 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 474 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | } |
| 476 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 477 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 478 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | { |
| 480 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 481 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 482 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 483 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 484 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | } |
| 486 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 487 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 488 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | { |
| 490 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 491 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 492 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 493 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 494 | &spec->ext_channel_count); |
| 495 | if (err >= 0 && !spec->const_channel_count) { |
| 496 | spec->multiout.max_channels = spec->ext_channel_count; |
| 497 | if (spec->need_dac_fix) |
| 498 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 499 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 500 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | } |
| 502 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 504 | * 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] | 505 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 506 | * being part of a format specifier. Maximum allowed length of a value is |
| 507 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 508 | * |
| 509 | * Note: some retasking pin complexes seem to ignore requests for input |
| 510 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 511 | * are requested. Therefore order this list so that this behaviour will not |
| 512 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 513 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 514 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 515 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 516 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 517 | "Mic 50pc bias", "Mic 80pc bias", |
| 518 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 519 | }; |
| 520 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 521 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 522 | }; |
| 523 | /* 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] | 524 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 525 | * addition, "input" pins may or may not process the mic bias option |
| 526 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 527 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 528 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 529 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 530 | #define ALC_PIN_DIR_IN 0x00 |
| 531 | #define ALC_PIN_DIR_OUT 0x01 |
| 532 | #define ALC_PIN_DIR_INOUT 0x02 |
| 533 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 534 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 535 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 536 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 537 | * For each direction the minimum and maximum values are given. |
| 538 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 539 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 540 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 541 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 542 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 543 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 544 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 545 | }; |
| 546 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 547 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 548 | #define alc_pin_mode_n_items(_dir) \ |
| 549 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 550 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 551 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 552 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 553 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 554 | unsigned int item_num = uinfo->value.enumerated.item; |
| 555 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 556 | |
| 557 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 558 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 559 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 560 | |
| 561 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 562 | item_num = alc_pin_mode_min(dir); |
| 563 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 564 | return 0; |
| 565 | } |
| 566 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 567 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 568 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 569 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 570 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 571 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 572 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 573 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 574 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 575 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 576 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 577 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 578 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 579 | /* Find enumerated value for current pinctl setting */ |
| 580 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 581 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 582 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 583 | *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] | 584 | return 0; |
| 585 | } |
| 586 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 587 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 588 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 589 | { |
| 590 | signed int change; |
| 591 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 592 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 593 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 594 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 595 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 596 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 597 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 598 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 599 | 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] | 600 | val = alc_pin_mode_min(dir); |
| 601 | |
| 602 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 603 | if (change) { |
| 604 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 605 | snd_hda_codec_write_cache(codec, nid, 0, |
| 606 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 607 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 608 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 609 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 610 | * for the requested pin mode. Enum values of 2 or less are |
| 611 | * input modes. |
| 612 | * |
| 613 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 614 | * reduces noise slightly (particularly on input) so we'll |
| 615 | * do it. However, having both input and output buffers |
| 616 | * enabled simultaneously doesn't seem to be problematic if |
| 617 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 618 | */ |
| 619 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 620 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 621 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 622 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 623 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 624 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 625 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 626 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 627 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 628 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 629 | } |
| 630 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 631 | return change; |
| 632 | } |
| 633 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 634 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 635 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 636 | .info = alc_pin_mode_info, \ |
| 637 | .get = alc_pin_mode_get, \ |
| 638 | .put = alc_pin_mode_put, \ |
| 639 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 640 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 641 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 642 | * together using a mask with more than one bit set. This control is |
| 643 | * currently used only by the ALC260 test model. At this stage they are not |
| 644 | * needed for any "production" models. |
| 645 | */ |
| 646 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 647 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 648 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 649 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 650 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 651 | { |
| 652 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 653 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 654 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 655 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 656 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 657 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 658 | |
| 659 | *valp = (val & mask) != 0; |
| 660 | return 0; |
| 661 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 662 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 663 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 664 | { |
| 665 | signed int change; |
| 666 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 667 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 668 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 669 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 670 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 671 | AC_VERB_GET_GPIO_DATA, |
| 672 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 673 | |
| 674 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 675 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 676 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 677 | gpio_data &= ~mask; |
| 678 | else |
| 679 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 680 | snd_hda_codec_write_cache(codec, nid, 0, |
| 681 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 682 | |
| 683 | return change; |
| 684 | } |
| 685 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 686 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 687 | .info = alc_gpio_data_info, \ |
| 688 | .get = alc_gpio_data_get, \ |
| 689 | .put = alc_gpio_data_put, \ |
| 690 | .private_value = nid | (mask<<16) } |
| 691 | #endif /* CONFIG_SND_DEBUG */ |
| 692 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 693 | /* A switch control to allow the enabling of the digital IO pins on the |
| 694 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 695 | * to provide something in the test model allowing digital outputs to be |
| 696 | * identified if present. If models are found which can utilise these |
| 697 | * outputs a more complete mixer control can be devised for those models if |
| 698 | * necessary. |
| 699 | */ |
| 700 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 701 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 702 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 703 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 704 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 705 | { |
| 706 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 707 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 708 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 709 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 710 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 711 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 712 | |
| 713 | *valp = (val & mask) != 0; |
| 714 | return 0; |
| 715 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 716 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 717 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 718 | { |
| 719 | signed int change; |
| 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 val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 724 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 725 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 726 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 727 | |
| 728 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 729 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 730 | if (val==0) |
| 731 | ctrl_data &= ~mask; |
| 732 | else |
| 733 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 734 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 735 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 736 | |
| 737 | return change; |
| 738 | } |
| 739 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 740 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 741 | .info = alc_spdif_ctrl_info, \ |
| 742 | .get = alc_spdif_ctrl_get, \ |
| 743 | .put = alc_spdif_ctrl_put, \ |
| 744 | .private_value = nid | (mask<<16) } |
| 745 | #endif /* CONFIG_SND_DEBUG */ |
| 746 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 747 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 748 | * Again, this is only used in the ALC26x test models to help identify when |
| 749 | * the EAPD line must be asserted for features to work. |
| 750 | */ |
| 751 | #ifdef CONFIG_SND_DEBUG |
| 752 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 753 | |
| 754 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 755 | struct snd_ctl_elem_value *ucontrol) |
| 756 | { |
| 757 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 758 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 759 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 760 | long *valp = ucontrol->value.integer.value; |
| 761 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 762 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 763 | |
| 764 | *valp = (val & mask) != 0; |
| 765 | return 0; |
| 766 | } |
| 767 | |
| 768 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 769 | struct snd_ctl_elem_value *ucontrol) |
| 770 | { |
| 771 | int change; |
| 772 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 773 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 774 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 775 | long val = *ucontrol->value.integer.value; |
| 776 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 777 | AC_VERB_GET_EAPD_BTLENABLE, |
| 778 | 0x00); |
| 779 | |
| 780 | /* Set/unset the masked control bit(s) as needed */ |
| 781 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 782 | if (!val) |
| 783 | ctrl_data &= ~mask; |
| 784 | else |
| 785 | ctrl_data |= mask; |
| 786 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 787 | ctrl_data); |
| 788 | |
| 789 | return change; |
| 790 | } |
| 791 | |
| 792 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 793 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 794 | .info = alc_eapd_ctrl_info, \ |
| 795 | .get = alc_eapd_ctrl_get, \ |
| 796 | .put = alc_eapd_ctrl_put, \ |
| 797 | .private_value = nid | (mask<<16) } |
| 798 | #endif /* CONFIG_SND_DEBUG */ |
| 799 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 800 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 801 | * set up the input pin config (depending on the given auto-pin type) |
| 802 | */ |
| 803 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 804 | int auto_pin_type) |
| 805 | { |
| 806 | unsigned int val = PIN_IN; |
| 807 | |
| 808 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 809 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 810 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 811 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 812 | if (pincap & AC_PINCAP_VREF_80) |
| 813 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 814 | else if (pincap & AC_PINCAP_VREF_50) |
| 815 | val = PIN_VREF50; |
| 816 | else if (pincap & AC_PINCAP_VREF_100) |
| 817 | val = PIN_VREF100; |
| 818 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 819 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 820 | } |
| 821 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 822 | } |
| 823 | |
| 824 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 825 | */ |
| 826 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 827 | { |
| 828 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 829 | return; |
| 830 | spec->mixers[spec->num_mixers++] = mix; |
| 831 | } |
| 832 | |
| 833 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 834 | { |
| 835 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 836 | return; |
| 837 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 838 | } |
| 839 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 840 | #ifdef CONFIG_PROC_FS |
| 841 | /* |
| 842 | * hook for proc |
| 843 | */ |
| 844 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 845 | struct hda_codec *codec, hda_nid_t nid) |
| 846 | { |
| 847 | int coeff; |
| 848 | |
| 849 | if (nid != 0x20) |
| 850 | return; |
| 851 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 852 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 853 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 854 | AC_VERB_GET_COEF_INDEX, 0); |
| 855 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 856 | } |
| 857 | #else |
| 858 | #define print_realtek_coef NULL |
| 859 | #endif |
| 860 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 861 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 862 | * set up from the preset table |
| 863 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 864 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 865 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 866 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 867 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 868 | int i; |
| 869 | |
| 870 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 871 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 872 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 873 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 874 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 875 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 876 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 877 | spec->channel_mode = preset->channel_mode; |
| 878 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 879 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 880 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 881 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 882 | if (preset->const_channel_count) |
| 883 | spec->multiout.max_channels = preset->const_channel_count; |
| 884 | else |
| 885 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 886 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 887 | |
| 888 | spec->multiout.num_dacs = preset->num_dacs; |
| 889 | spec->multiout.dac_nids = preset->dac_nids; |
| 890 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 891 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 892 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 893 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 894 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 895 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 896 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 897 | spec->input_mux = preset->input_mux; |
| 898 | |
| 899 | spec->num_adc_nids = preset->num_adc_nids; |
| 900 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 901 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 902 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 903 | |
| 904 | spec->unsol_event = preset->unsol_event; |
| 905 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 906 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 907 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 908 | spec->loopback.amplist = preset->loopbacks; |
| 909 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 910 | |
| 911 | if (preset->setup) |
| 912 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 913 | } |
| 914 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 915 | /* Enable GPIO mask and set output */ |
| 916 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 917 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 918 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 919 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 920 | { } |
| 921 | }; |
| 922 | |
| 923 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 924 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 925 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 926 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 927 | { } |
| 928 | }; |
| 929 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 930 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 931 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 932 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 933 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 934 | { } |
| 935 | }; |
| 936 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 937 | /* |
| 938 | * Fix hardware PLL issue |
| 939 | * On some codecs, the analog PLL gating control must be off while |
| 940 | * the default value is 1. |
| 941 | */ |
| 942 | static void alc_fix_pll(struct hda_codec *codec) |
| 943 | { |
| 944 | struct alc_spec *spec = codec->spec; |
| 945 | unsigned int val; |
| 946 | |
| 947 | if (!spec->pll_nid) |
| 948 | return; |
| 949 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 950 | spec->pll_coef_idx); |
| 951 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 952 | AC_VERB_GET_PROC_COEF, 0); |
| 953 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 954 | spec->pll_coef_idx); |
| 955 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 956 | val & ~(1 << spec->pll_coef_bit)); |
| 957 | } |
| 958 | |
| 959 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 960 | unsigned int coef_idx, unsigned int coef_bit) |
| 961 | { |
| 962 | struct alc_spec *spec = codec->spec; |
| 963 | spec->pll_nid = nid; |
| 964 | spec->pll_coef_idx = coef_idx; |
| 965 | spec->pll_coef_bit = coef_bit; |
| 966 | alc_fix_pll(codec); |
| 967 | } |
| 968 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 969 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 970 | { |
| 971 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 972 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 973 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 974 | |
Takashi Iwai | ad87c64 | 2009-11-02 14:23:15 +0100 | [diff] [blame] | 975 | if (!nid) |
| 976 | return; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 977 | spec->jack_present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 978 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 979 | nid = spec->autocfg.speaker_pins[i]; |
| 980 | if (!nid) |
| 981 | break; |
| 982 | snd_hda_codec_write(codec, nid, 0, |
| 983 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 984 | spec->jack_present ? 0 : PIN_OUT); |
| 985 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 986 | } |
| 987 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 988 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 989 | hda_nid_t nid) |
| 990 | { |
| 991 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 992 | int i, nums; |
| 993 | |
| 994 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 995 | for (i = 0; i < nums; i++) |
| 996 | if (conn[i] == nid) |
| 997 | return i; |
| 998 | return -1; |
| 999 | } |
| 1000 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1001 | static void alc_mic_automute(struct hda_codec *codec) |
| 1002 | { |
| 1003 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1004 | struct alc_mic_route *dead, *alive; |
| 1005 | unsigned int present, type; |
| 1006 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1007 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1008 | if (!spec->auto_mic) |
| 1009 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1010 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1011 | return; |
| 1012 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1013 | return; |
| 1014 | |
| 1015 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1016 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1017 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1018 | if (present) { |
| 1019 | alive = &spec->ext_mic; |
| 1020 | dead = &spec->int_mic; |
| 1021 | } else { |
| 1022 | alive = &spec->int_mic; |
| 1023 | dead = &spec->ext_mic; |
| 1024 | } |
| 1025 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1026 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1027 | if (type == AC_WID_AUD_MIX) { |
| 1028 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1029 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1030 | alive->mux_idx, |
| 1031 | HDA_AMP_MUTE, 0); |
| 1032 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1033 | dead->mux_idx, |
| 1034 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1035 | } else { |
| 1036 | /* MUX style (e.g. ALC880) */ |
| 1037 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1038 | AC_VERB_SET_CONNECT_SEL, |
| 1039 | alive->mux_idx); |
| 1040 | } |
| 1041 | |
| 1042 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1043 | } |
| 1044 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1045 | /* unsolicited event for HP jack sensing */ |
| 1046 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1047 | { |
| 1048 | if (codec->vendor_id == 0x10ec0880) |
| 1049 | res >>= 28; |
| 1050 | else |
| 1051 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1052 | switch (res) { |
| 1053 | case ALC880_HP_EVENT: |
| 1054 | alc_automute_pin(codec); |
| 1055 | break; |
| 1056 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1057 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1058 | break; |
| 1059 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1060 | } |
| 1061 | |
| 1062 | static void alc_inithook(struct hda_codec *codec) |
| 1063 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1064 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1065 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1066 | } |
| 1067 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1068 | /* additional initialization for ALC888 variants */ |
| 1069 | static void alc888_coef_init(struct hda_codec *codec) |
| 1070 | { |
| 1071 | unsigned int tmp; |
| 1072 | |
| 1073 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1074 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1075 | 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] | 1076 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1077 | /* alc888S-VC */ |
| 1078 | snd_hda_codec_read(codec, 0x20, 0, |
| 1079 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1080 | else |
| 1081 | /* alc888-VB */ |
| 1082 | snd_hda_codec_read(codec, 0x20, 0, |
| 1083 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1084 | } |
| 1085 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1086 | static void alc889_coef_init(struct hda_codec *codec) |
| 1087 | { |
| 1088 | unsigned int tmp; |
| 1089 | |
| 1090 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1091 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1092 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1093 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1094 | } |
| 1095 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1096 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1097 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1098 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1099 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1100 | switch (type) { |
| 1101 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1102 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1103 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1104 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1105 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1106 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1107 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1108 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1109 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1110 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1111 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1112 | case 0x10ec0260: |
| 1113 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1114 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1115 | snd_hda_codec_write(codec, 0x10, 0, |
| 1116 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1117 | break; |
| 1118 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1119 | case 0x10ec0267: |
| 1120 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1121 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1122 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1123 | case 0x10ec0660: |
| 1124 | case 0x10ec0662: |
| 1125 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1126 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1127 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1128 | snd_hda_codec_write(codec, 0x14, 0, |
| 1129 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1130 | snd_hda_codec_write(codec, 0x15, 0, |
| 1131 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1132 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1133 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1134 | switch (codec->vendor_id) { |
| 1135 | case 0x10ec0260: |
| 1136 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1137 | AC_VERB_SET_COEF_INDEX, 7); |
| 1138 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1139 | AC_VERB_GET_PROC_COEF, 0); |
| 1140 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1141 | AC_VERB_SET_COEF_INDEX, 7); |
| 1142 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1143 | AC_VERB_SET_PROC_COEF, |
| 1144 | tmp | 0x2010); |
| 1145 | break; |
| 1146 | case 0x10ec0262: |
| 1147 | case 0x10ec0880: |
| 1148 | case 0x10ec0882: |
| 1149 | case 0x10ec0883: |
| 1150 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1151 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1152 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1153 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1154 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1155 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1156 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1157 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1158 | case 0x10ec0267: |
| 1159 | case 0x10ec0268: |
| 1160 | snd_hda_codec_write(codec, 0x20, 0, |
| 1161 | AC_VERB_SET_COEF_INDEX, 7); |
| 1162 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1163 | AC_VERB_GET_PROC_COEF, 0); |
| 1164 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1165 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1166 | snd_hda_codec_write(codec, 0x20, 0, |
| 1167 | AC_VERB_SET_PROC_COEF, |
| 1168 | tmp | 0x3000); |
| 1169 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1170 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1171 | break; |
| 1172 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1173 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1174 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1175 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1176 | { |
| 1177 | struct alc_spec *spec = codec->spec; |
| 1178 | |
| 1179 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1180 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1181 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1182 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1183 | if (spec->autocfg.line_out_pins[0] && |
| 1184 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1185 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1186 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1187 | else |
| 1188 | return; |
| 1189 | } |
| 1190 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1191 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1192 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1193 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1194 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1195 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1196 | spec->unsol_event = alc_sku_unsol_event; |
| 1197 | } |
| 1198 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1199 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1200 | { |
| 1201 | struct alc_spec *spec = codec->spec; |
| 1202 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1203 | hda_nid_t fixed, ext; |
| 1204 | int i; |
| 1205 | |
| 1206 | /* there must be only two mic inputs exclusively */ |
| 1207 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1208 | if (cfg->input_pins[i]) |
| 1209 | return; |
| 1210 | |
| 1211 | fixed = ext = 0; |
| 1212 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1213 | hda_nid_t nid = cfg->input_pins[i]; |
| 1214 | unsigned int defcfg; |
| 1215 | if (!nid) |
| 1216 | return; |
| 1217 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1218 | switch (get_defcfg_connect(defcfg)) { |
| 1219 | case AC_JACK_PORT_FIXED: |
| 1220 | if (fixed) |
| 1221 | return; /* already occupied */ |
| 1222 | fixed = nid; |
| 1223 | break; |
| 1224 | case AC_JACK_PORT_COMPLEX: |
| 1225 | if (ext) |
| 1226 | return; /* already occupied */ |
| 1227 | ext = nid; |
| 1228 | break; |
| 1229 | default: |
| 1230 | return; /* invalid entry */ |
| 1231 | } |
| 1232 | } |
| 1233 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1234 | return; /* no unsol support */ |
| 1235 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1236 | ext, fixed); |
| 1237 | spec->ext_mic.pin = ext; |
| 1238 | spec->int_mic.pin = fixed; |
| 1239 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1240 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1241 | spec->auto_mic = 1; |
| 1242 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1243 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1244 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1245 | spec->unsol_event = alc_sku_unsol_event; |
| 1246 | } |
| 1247 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1248 | /* check subsystem ID and set up device-specific initialization; |
| 1249 | * return 1 if initialized, 0 if invalid SSID |
| 1250 | */ |
| 1251 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1252 | * 31 ~ 16 : Manufacture ID |
| 1253 | * 15 ~ 8 : SKU ID |
| 1254 | * 7 ~ 0 : Assembly ID |
| 1255 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1256 | */ |
| 1257 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1258 | hda_nid_t porta, hda_nid_t porte, |
| 1259 | hda_nid_t portd) |
| 1260 | { |
| 1261 | unsigned int ass, tmp, i; |
| 1262 | unsigned nid; |
| 1263 | struct alc_spec *spec = codec->spec; |
| 1264 | |
| 1265 | ass = codec->subsystem_id & 0xffff; |
| 1266 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1267 | goto do_sku; |
| 1268 | |
| 1269 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1270 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1271 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1272 | * 29~21 : reserve |
| 1273 | * 20 : PCBEEP input |
| 1274 | * 19~16 : Check sum (15:1) |
| 1275 | * 15~1 : Custom |
| 1276 | * 0 : override |
| 1277 | */ |
| 1278 | nid = 0x1d; |
| 1279 | if (codec->vendor_id == 0x10ec0260) |
| 1280 | nid = 0x17; |
| 1281 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1282 | snd_printd("realtek: No valid SSID, " |
| 1283 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1284 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1285 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1286 | return 0; |
| 1287 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1288 | return 0; |
| 1289 | |
| 1290 | /* check sum */ |
| 1291 | tmp = 0; |
| 1292 | for (i = 1; i < 16; i++) { |
| 1293 | if ((ass >> i) & 1) |
| 1294 | tmp++; |
| 1295 | } |
| 1296 | if (((ass >> 16) & 0xf) != tmp) |
| 1297 | return 0; |
| 1298 | do_sku: |
| 1299 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1300 | ass & 0xffff, codec->vendor_id); |
| 1301 | /* |
| 1302 | * 0 : override |
| 1303 | * 1 : Swap Jack |
| 1304 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1305 | * 3~5 : External Amplifier control |
| 1306 | * 7~6 : Reserved |
| 1307 | */ |
| 1308 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1309 | switch (tmp) { |
| 1310 | case 1: |
| 1311 | spec->init_amp = ALC_INIT_GPIO1; |
| 1312 | break; |
| 1313 | case 3: |
| 1314 | spec->init_amp = ALC_INIT_GPIO2; |
| 1315 | break; |
| 1316 | case 7: |
| 1317 | spec->init_amp = ALC_INIT_GPIO3; |
| 1318 | break; |
| 1319 | case 5: |
| 1320 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1321 | break; |
| 1322 | } |
| 1323 | |
| 1324 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1325 | * when the external headphone out jack is plugged" |
| 1326 | */ |
| 1327 | if (!(ass & 0x8000)) |
| 1328 | return 1; |
| 1329 | /* |
| 1330 | * 10~8 : Jack location |
| 1331 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1332 | * 14~13: Resvered |
| 1333 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1334 | * when the external headphone out jack is plugged" |
| 1335 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1336 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1337 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1338 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1339 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1340 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1341 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1342 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1343 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1344 | nid = portd; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1345 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1346 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1347 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1348 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1349 | return 1; |
| 1350 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1351 | } |
| 1352 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1353 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1354 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1355 | return 1; |
| 1356 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1357 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1358 | static void alc_ssid_check(struct hda_codec *codec, |
| 1359 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1360 | { |
| 1361 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1362 | struct alc_spec *spec = codec->spec; |
| 1363 | snd_printd("realtek: " |
| 1364 | "Enable default setup for auto mode as fallback\n"); |
| 1365 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1366 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1367 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1368 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1369 | } |
| 1370 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1371 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1372 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1373 | */ |
| 1374 | |
| 1375 | struct alc_pincfg { |
| 1376 | hda_nid_t nid; |
| 1377 | u32 val; |
| 1378 | }; |
| 1379 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1380 | struct alc_fixup { |
| 1381 | const struct alc_pincfg *pins; |
| 1382 | const struct hda_verb *verbs; |
| 1383 | }; |
| 1384 | |
| 1385 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1386 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1387 | const struct alc_fixup *fix) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1388 | { |
| 1389 | const struct alc_pincfg *cfg; |
| 1390 | |
| 1391 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1392 | if (!quirk) |
| 1393 | return; |
| 1394 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1395 | fix += quirk->value; |
| 1396 | cfg = fix->pins; |
| 1397 | if (cfg) { |
| 1398 | for (; cfg->nid; cfg++) |
| 1399 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1400 | } |
| 1401 | if (fix->verbs) |
| 1402 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1403 | } |
| 1404 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1405 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1406 | unsigned int coef_idx) |
| 1407 | { |
| 1408 | unsigned int val; |
| 1409 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1410 | coef_idx); |
| 1411 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1412 | AC_VERB_GET_PROC_COEF, 0); |
| 1413 | return val; |
| 1414 | } |
| 1415 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1416 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1417 | * ALC888 |
| 1418 | */ |
| 1419 | |
| 1420 | /* |
| 1421 | * 2ch mode |
| 1422 | */ |
| 1423 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1424 | /* Mic-in jack as mic in */ |
| 1425 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1426 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1427 | /* Line-in jack as Line in */ |
| 1428 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1429 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1430 | /* Line-Out as Front */ |
| 1431 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1432 | { } /* end */ |
| 1433 | }; |
| 1434 | |
| 1435 | /* |
| 1436 | * 4ch mode |
| 1437 | */ |
| 1438 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1439 | /* Mic-in jack as mic in */ |
| 1440 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1441 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1442 | /* Line-in jack as Surround */ |
| 1443 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1444 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1445 | /* Line-Out as Front */ |
| 1446 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1447 | { } /* end */ |
| 1448 | }; |
| 1449 | |
| 1450 | /* |
| 1451 | * 6ch mode |
| 1452 | */ |
| 1453 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1454 | /* Mic-in jack as CLFE */ |
| 1455 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1456 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1457 | /* Line-in jack as Surround */ |
| 1458 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1459 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1460 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1461 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1462 | { } /* end */ |
| 1463 | }; |
| 1464 | |
| 1465 | /* |
| 1466 | * 8ch mode |
| 1467 | */ |
| 1468 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1469 | /* Mic-in jack as CLFE */ |
| 1470 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1471 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1472 | /* Line-in jack as Surround */ |
| 1473 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1474 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1475 | /* Line-Out as Side */ |
| 1476 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1477 | { } /* end */ |
| 1478 | }; |
| 1479 | |
| 1480 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1481 | { 2, alc888_4ST_ch2_intel_init }, |
| 1482 | { 4, alc888_4ST_ch4_intel_init }, |
| 1483 | { 6, alc888_4ST_ch6_intel_init }, |
| 1484 | { 8, alc888_4ST_ch8_intel_init }, |
| 1485 | }; |
| 1486 | |
| 1487 | /* |
| 1488 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1489 | */ |
| 1490 | |
| 1491 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1492 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1493 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1494 | /* Connect Internal HP to Front */ |
| 1495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1497 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1498 | /* Connect Bass HP to Front */ |
| 1499 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1500 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1501 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1502 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1503 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1504 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1505 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1506 | /* Connect Mic jack to CLFE */ |
| 1507 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1508 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1509 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1510 | /* Connect Line-in jack to Surround */ |
| 1511 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1512 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1513 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1514 | /* Connect HP out jack to Front */ |
| 1515 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1516 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1517 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1518 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1519 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1520 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1521 | {} |
| 1522 | }; |
| 1523 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1524 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1525 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1526 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1527 | unsigned int mute; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1528 | hda_nid_t nid; |
| 1529 | int i; |
| 1530 | |
| 1531 | spec->jack_present = 0; |
| 1532 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1533 | nid = spec->autocfg.hp_pins[i]; |
| 1534 | if (!nid) |
| 1535 | break; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1536 | if (snd_hda_jack_detect(codec, nid)) { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1537 | spec->jack_present = 1; |
| 1538 | break; |
| 1539 | } |
| 1540 | } |
| 1541 | |
| 1542 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1543 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1544 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1545 | nid = spec->autocfg.speaker_pins[i]; |
| 1546 | if (!nid) |
| 1547 | break; |
| 1548 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1549 | HDA_AMP_MUTE, mute); |
| 1550 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1551 | } |
| 1552 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1553 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1554 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1555 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1556 | if (codec->vendor_id == 0x10ec0880) |
| 1557 | res >>= 28; |
| 1558 | else |
| 1559 | res >>= 26; |
| 1560 | if (res == ALC880_HP_EVENT) |
| 1561 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1562 | } |
| 1563 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1564 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1565 | { |
| 1566 | struct alc_spec *spec = codec->spec; |
| 1567 | |
| 1568 | spec->autocfg.hp_pins[0] = 0x15; |
| 1569 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1570 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1571 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1572 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1573 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1574 | } |
| 1575 | |
| 1576 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1577 | { |
| 1578 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1579 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1580 | } |
| 1581 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1582 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1583 | { |
| 1584 | struct alc_spec *spec = codec->spec; |
| 1585 | |
| 1586 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1587 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1588 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1589 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1590 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1591 | |
| 1592 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1593 | * ALC888 Acer Aspire 4930G model |
| 1594 | */ |
| 1595 | |
| 1596 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1597 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1598 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1599 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1600 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1601 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1602 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1603 | /* Connect Internal HP to front */ |
| 1604 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1605 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1606 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1607 | /* Connect HP out to front */ |
| 1608 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1609 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1610 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1611 | { } |
| 1612 | }; |
| 1613 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1614 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1615 | * ALC888 Acer Aspire 6530G model |
| 1616 | */ |
| 1617 | |
| 1618 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1619 | /* Bias voltage on for external mic port */ |
| 1620 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1621 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1622 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1623 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1625 | /* Enable unsolicited event for HP jack */ |
| 1626 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1627 | /* Enable speaker output */ |
| 1628 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1629 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1630 | /* Enable headphone output */ |
| 1631 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1632 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1633 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1634 | { } |
| 1635 | }; |
| 1636 | |
| 1637 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1638 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1639 | */ |
| 1640 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1641 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1642 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1643 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1644 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1645 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1646 | /* Enable unsolicited event for HP jack */ |
| 1647 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1648 | /* Connect Internal Front to Front */ |
| 1649 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1650 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1651 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1652 | /* Connect Internal Rear to Rear */ |
| 1653 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1654 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1655 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1656 | /* Connect Internal CLFE to CLFE */ |
| 1657 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1658 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1659 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1660 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1661 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1662 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1663 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1664 | /* Enable all DACs */ |
| 1665 | /* DAC DISABLE/MUTE 1? */ |
| 1666 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1667 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1668 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1669 | /* DAC DISABLE/MUTE 2? */ |
| 1670 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1671 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1672 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1673 | /* DMIC fix |
| 1674 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1675 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1676 | * makes the signal become a difference/sum signal instead of standard |
| 1677 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1678 | * codec replicate the sum signal to both channels, turning it into a |
| 1679 | * normal mono mic. |
| 1680 | */ |
| 1681 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1682 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1683 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1684 | { } |
| 1685 | }; |
| 1686 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1687 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1688 | /* Front mic only available on one ADC */ |
| 1689 | { |
| 1690 | .num_items = 4, |
| 1691 | .items = { |
| 1692 | { "Mic", 0x0 }, |
| 1693 | { "Line", 0x2 }, |
| 1694 | { "CD", 0x4 }, |
| 1695 | { "Front Mic", 0xb }, |
| 1696 | }, |
| 1697 | }, |
| 1698 | { |
| 1699 | .num_items = 3, |
| 1700 | .items = { |
| 1701 | { "Mic", 0x0 }, |
| 1702 | { "Line", 0x2 }, |
| 1703 | { "CD", 0x4 }, |
| 1704 | }, |
| 1705 | } |
| 1706 | }; |
| 1707 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1708 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1709 | /* Interal mic only available on one ADC */ |
| 1710 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1711 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1712 | .items = { |
| 1713 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1714 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1715 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1716 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1717 | { "Int Mic", 0xb }, |
| 1718 | }, |
| 1719 | }, |
| 1720 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1721 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1722 | .items = { |
| 1723 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1724 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1725 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1726 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1727 | }, |
| 1728 | } |
| 1729 | }; |
| 1730 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1731 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1732 | /* Digital mic only available on first "ADC" */ |
| 1733 | { |
| 1734 | .num_items = 5, |
| 1735 | .items = { |
| 1736 | { "Mic", 0x0 }, |
| 1737 | { "Line", 0x2 }, |
| 1738 | { "CD", 0x4 }, |
| 1739 | { "Front Mic", 0xb }, |
| 1740 | { "Input Mix", 0xa }, |
| 1741 | }, |
| 1742 | }, |
| 1743 | { |
| 1744 | .num_items = 4, |
| 1745 | .items = { |
| 1746 | { "Mic", 0x0 }, |
| 1747 | { "Line", 0x2 }, |
| 1748 | { "CD", 0x4 }, |
| 1749 | { "Input Mix", 0xa }, |
| 1750 | }, |
| 1751 | }, |
| 1752 | { |
| 1753 | .num_items = 4, |
| 1754 | .items = { |
| 1755 | { "Mic", 0x0 }, |
| 1756 | { "Line", 0x2 }, |
| 1757 | { "CD", 0x4 }, |
| 1758 | { "Input Mix", 0xa }, |
| 1759 | }, |
| 1760 | } |
| 1761 | }; |
| 1762 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1763 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1764 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1765 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1766 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1767 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1768 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1769 | HDA_OUTPUT), |
| 1770 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1771 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1772 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1773 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1774 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1775 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1776 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1777 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1778 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1779 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1780 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1781 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1782 | { } /* end */ |
| 1783 | }; |
| 1784 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 1785 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 1786 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1787 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1788 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1789 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1790 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1791 | HDA_OUTPUT), |
| 1792 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1793 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1794 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1795 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1796 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1797 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1798 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1800 | { } /* end */ |
| 1801 | }; |
| 1802 | |
| 1803 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1804 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1805 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1806 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1807 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1808 | spec->autocfg.hp_pins[0] = 0x15; |
| 1809 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 1810 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1811 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1812 | } |
| 1813 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1814 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1815 | { |
| 1816 | struct alc_spec *spec = codec->spec; |
| 1817 | |
| 1818 | spec->autocfg.hp_pins[0] = 0x15; |
| 1819 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1820 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1821 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1822 | } |
| 1823 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1824 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1825 | { |
| 1826 | struct alc_spec *spec = codec->spec; |
| 1827 | |
| 1828 | spec->autocfg.hp_pins[0] = 0x15; |
| 1829 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1830 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1831 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1832 | } |
| 1833 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 1834 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 1835 | static void alc889_power_eapd(struct hda_codec *codec, int power) |
| 1836 | { |
| 1837 | snd_hda_codec_write(codec, 0x14, 0, |
| 1838 | AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); |
| 1839 | snd_hda_codec_write(codec, 0x15, 0, |
| 1840 | AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); |
| 1841 | } |
| 1842 | #endif |
| 1843 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1844 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1845 | * ALC880 3-stack model |
| 1846 | * |
| 1847 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1848 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1849 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1850 | */ |
| 1851 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1852 | static hda_nid_t alc880_dac_nids[4] = { |
| 1853 | /* front, rear, clfe, rear_surr */ |
| 1854 | 0x02, 0x05, 0x04, 0x03 |
| 1855 | }; |
| 1856 | |
| 1857 | static hda_nid_t alc880_adc_nids[3] = { |
| 1858 | /* ADC0-2 */ |
| 1859 | 0x07, 0x08, 0x09, |
| 1860 | }; |
| 1861 | |
| 1862 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1863 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1864 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1865 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1866 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1867 | /* ADC1-2 */ |
| 1868 | 0x08, 0x09, |
| 1869 | }; |
| 1870 | |
| 1871 | #define ALC880_DIGOUT_NID 0x06 |
| 1872 | #define ALC880_DIGIN_NID 0x0a |
| 1873 | |
| 1874 | static struct hda_input_mux alc880_capture_source = { |
| 1875 | .num_items = 4, |
| 1876 | .items = { |
| 1877 | { "Mic", 0x0 }, |
| 1878 | { "Front Mic", 0x3 }, |
| 1879 | { "Line", 0x2 }, |
| 1880 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1881 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1882 | }; |
| 1883 | |
| 1884 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1885 | /* 2ch mode */ |
| 1886 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1887 | /* set line-in to input, mute it */ |
| 1888 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1889 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1890 | /* set mic-in to input vref 80%, mute it */ |
| 1891 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1892 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1893 | { } /* end */ |
| 1894 | }; |
| 1895 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1896 | /* 6ch mode */ |
| 1897 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1898 | /* set line-in to output, unmute it */ |
| 1899 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1900 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1901 | /* set mic-in to output, unmute it */ |
| 1902 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1903 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1904 | { } /* end */ |
| 1905 | }; |
| 1906 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1907 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1908 | { 2, alc880_threestack_ch2_init }, |
| 1909 | { 6, alc880_threestack_ch6_init }, |
| 1910 | }; |
| 1911 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1912 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1913 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1914 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1915 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1916 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1917 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1918 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1919 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1920 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1921 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1922 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1923 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1924 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1925 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1926 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1927 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1928 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1929 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1930 | { |
| 1931 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1932 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1933 | .info = alc_ch_mode_info, |
| 1934 | .get = alc_ch_mode_get, |
| 1935 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1936 | }, |
| 1937 | { } /* end */ |
| 1938 | }; |
| 1939 | |
| 1940 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1941 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1942 | struct snd_ctl_elem_info *uinfo) |
| 1943 | { |
| 1944 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1945 | struct alc_spec *spec = codec->spec; |
| 1946 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1947 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1948 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1949 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1950 | HDA_INPUT); |
| 1951 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1952 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1953 | return err; |
| 1954 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1955 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1956 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1957 | unsigned int size, unsigned int __user *tlv) |
| 1958 | { |
| 1959 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1960 | struct alc_spec *spec = codec->spec; |
| 1961 | int err; |
| 1962 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1963 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1964 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1965 | HDA_INPUT); |
| 1966 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1967 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1968 | return err; |
| 1969 | } |
| 1970 | |
| 1971 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1972 | struct snd_ctl_elem_value *ucontrol); |
| 1973 | |
| 1974 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1975 | struct snd_ctl_elem_value *ucontrol, |
| 1976 | getput_call_t func) |
| 1977 | { |
| 1978 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1979 | struct alc_spec *spec = codec->spec; |
| 1980 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1981 | int err; |
| 1982 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1983 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1984 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1985 | 3, 0, HDA_INPUT); |
| 1986 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1987 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1988 | return err; |
| 1989 | } |
| 1990 | |
| 1991 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1992 | struct snd_ctl_elem_value *ucontrol) |
| 1993 | { |
| 1994 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1995 | snd_hda_mixer_amp_volume_get); |
| 1996 | } |
| 1997 | |
| 1998 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1999 | struct snd_ctl_elem_value *ucontrol) |
| 2000 | { |
| 2001 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2002 | snd_hda_mixer_amp_volume_put); |
| 2003 | } |
| 2004 | |
| 2005 | /* capture mixer elements */ |
| 2006 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2007 | |
| 2008 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2009 | struct snd_ctl_elem_value *ucontrol) |
| 2010 | { |
| 2011 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2012 | snd_hda_mixer_amp_switch_get); |
| 2013 | } |
| 2014 | |
| 2015 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2016 | struct snd_ctl_elem_value *ucontrol) |
| 2017 | { |
| 2018 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2019 | snd_hda_mixer_amp_switch_put); |
| 2020 | } |
| 2021 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2022 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2023 | { \ |
| 2024 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2025 | .name = "Capture Switch", \ |
| 2026 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2027 | .count = num, \ |
| 2028 | .info = alc_cap_sw_info, \ |
| 2029 | .get = alc_cap_sw_get, \ |
| 2030 | .put = alc_cap_sw_put, \ |
| 2031 | }, \ |
| 2032 | { \ |
| 2033 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2034 | .name = "Capture Volume", \ |
| 2035 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2036 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2037 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2038 | .count = num, \ |
| 2039 | .info = alc_cap_vol_info, \ |
| 2040 | .get = alc_cap_vol_get, \ |
| 2041 | .put = alc_cap_vol_put, \ |
| 2042 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2043 | } |
| 2044 | |
| 2045 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2046 | { \ |
| 2047 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2048 | /* .name = "Capture Source", */ \ |
| 2049 | .name = "Input Source", \ |
| 2050 | .count = num, \ |
| 2051 | .info = alc_mux_enum_info, \ |
| 2052 | .get = alc_mux_enum_get, \ |
| 2053 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2054 | } |
| 2055 | |
| 2056 | #define DEFINE_CAPMIX(num) \ |
| 2057 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2058 | _DEFINE_CAPMIX(num), \ |
| 2059 | _DEFINE_CAPSRC(num), \ |
| 2060 | { } /* end */ \ |
| 2061 | } |
| 2062 | |
| 2063 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2064 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2065 | _DEFINE_CAPMIX(num), \ |
| 2066 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2067 | } |
| 2068 | |
| 2069 | /* up to three ADCs */ |
| 2070 | DEFINE_CAPMIX(1); |
| 2071 | DEFINE_CAPMIX(2); |
| 2072 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2073 | DEFINE_CAPMIX_NOSRC(1); |
| 2074 | DEFINE_CAPMIX_NOSRC(2); |
| 2075 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2076 | |
| 2077 | /* |
| 2078 | * ALC880 5-stack model |
| 2079 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2080 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2081 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2082 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2083 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2084 | */ |
| 2085 | |
| 2086 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2087 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2088 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2089 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2090 | { } /* end */ |
| 2091 | }; |
| 2092 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2093 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2094 | /* 6ch mode */ |
| 2095 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2096 | /* set line-in to input, mute it */ |
| 2097 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2098 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2099 | { } /* end */ |
| 2100 | }; |
| 2101 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2102 | /* 8ch mode */ |
| 2103 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2104 | /* set line-in to output, unmute it */ |
| 2105 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2106 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2107 | { } /* end */ |
| 2108 | }; |
| 2109 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2110 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2111 | { 6, alc880_fivestack_ch6_init }, |
| 2112 | { 8, alc880_fivestack_ch8_init }, |
| 2113 | }; |
| 2114 | |
| 2115 | |
| 2116 | /* |
| 2117 | * ALC880 6-stack model |
| 2118 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2119 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2120 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2121 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2122 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2123 | */ |
| 2124 | |
| 2125 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2126 | /* front, rear, clfe, rear_surr */ |
| 2127 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2128 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2129 | |
| 2130 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2131 | .num_items = 4, |
| 2132 | .items = { |
| 2133 | { "Mic", 0x0 }, |
| 2134 | { "Front Mic", 0x1 }, |
| 2135 | { "Line", 0x2 }, |
| 2136 | { "CD", 0x4 }, |
| 2137 | }, |
| 2138 | }; |
| 2139 | |
| 2140 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2141 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2142 | { 8, NULL }, |
| 2143 | }; |
| 2144 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2145 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2146 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2147 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2148 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2149 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2150 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2151 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2152 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2153 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2154 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2155 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2156 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2157 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2158 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2159 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2160 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2161 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2162 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2163 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2164 | { |
| 2165 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2166 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2167 | .info = alc_ch_mode_info, |
| 2168 | .get = alc_ch_mode_get, |
| 2169 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2170 | }, |
| 2171 | { } /* end */ |
| 2172 | }; |
| 2173 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2174 | |
| 2175 | /* |
| 2176 | * ALC880 W810 model |
| 2177 | * |
| 2178 | * W810 has rear IO for: |
| 2179 | * Front (DAC 02) |
| 2180 | * Surround (DAC 03) |
| 2181 | * Center/LFE (DAC 04) |
| 2182 | * Digital out (06) |
| 2183 | * |
| 2184 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2185 | * 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] | 2186 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2187 | * There is a variable resistor to control the speaker or headphone |
| 2188 | * volume. This is a hardware-only device without a software API. |
| 2189 | * |
| 2190 | * Plugging headphones in will disable the internal speakers. This is |
| 2191 | * implemented in hardware, not via the driver using jack sense. In |
| 2192 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2193 | * disable both the speakers and headphones. |
| 2194 | * |
| 2195 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2196 | * These may not do anything useful with this driver yet, because I |
| 2197 | * haven't setup any initialization verbs for these yet... |
| 2198 | */ |
| 2199 | |
| 2200 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2201 | /* front, rear/surround, clfe */ |
| 2202 | 0x02, 0x03, 0x04 |
| 2203 | }; |
| 2204 | |
| 2205 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2206 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2207 | { 6, NULL } |
| 2208 | }; |
| 2209 | |
| 2210 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2211 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2212 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2213 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2214 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2215 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2216 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2217 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2218 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2219 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2220 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2221 | { } /* end */ |
| 2222 | }; |
| 2223 | |
| 2224 | |
| 2225 | /* |
| 2226 | * Z710V model |
| 2227 | * |
| 2228 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2229 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2230 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2231 | */ |
| 2232 | |
| 2233 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2234 | 0x02 |
| 2235 | }; |
| 2236 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2237 | |
| 2238 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2239 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2240 | { 2, NULL } |
| 2241 | }; |
| 2242 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2243 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2244 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2245 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2246 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2247 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2248 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2249 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2250 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2251 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2252 | { } /* end */ |
| 2253 | }; |
| 2254 | |
| 2255 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2256 | /* |
| 2257 | * ALC880 F1734 model |
| 2258 | * |
| 2259 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2260 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2261 | */ |
| 2262 | |
| 2263 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2264 | 0x03 |
| 2265 | }; |
| 2266 | #define ALC880_F1734_HP_DAC 0x02 |
| 2267 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2268 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2269 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2270 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2271 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2272 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2273 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2274 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2275 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2276 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2277 | { } /* end */ |
| 2278 | }; |
| 2279 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2280 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2281 | .num_items = 2, |
| 2282 | .items = { |
| 2283 | { "Mic", 0x1 }, |
| 2284 | { "CD", 0x4 }, |
| 2285 | }, |
| 2286 | }; |
| 2287 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2288 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2289 | /* |
| 2290 | * ALC880 ASUS model |
| 2291 | * |
| 2292 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2293 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2294 | * Mic = 0x18, Line = 0x1a |
| 2295 | */ |
| 2296 | |
| 2297 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2298 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2299 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2300 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2301 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2302 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2303 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2304 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2305 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2306 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2307 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2308 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2309 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2310 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2311 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2312 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2313 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2314 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2315 | { |
| 2316 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2317 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2318 | .info = alc_ch_mode_info, |
| 2319 | .get = alc_ch_mode_get, |
| 2320 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2321 | }, |
| 2322 | { } /* end */ |
| 2323 | }; |
| 2324 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2325 | /* |
| 2326 | * ALC880 ASUS W1V model |
| 2327 | * |
| 2328 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2329 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2330 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2331 | */ |
| 2332 | |
| 2333 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2334 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2335 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2336 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2337 | { } /* end */ |
| 2338 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2339 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2340 | /* TCL S700 */ |
| 2341 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2342 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2343 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2344 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2345 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2346 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2347 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2348 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2349 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2350 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2351 | { } /* end */ |
| 2352 | }; |
| 2353 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2354 | /* Uniwill */ |
| 2355 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2356 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2357 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2358 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2359 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2360 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2361 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2362 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2363 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2364 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2365 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2366 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2367 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2368 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2369 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2370 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2371 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2372 | { |
| 2373 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2374 | .name = "Channel Mode", |
| 2375 | .info = alc_ch_mode_info, |
| 2376 | .get = alc_ch_mode_get, |
| 2377 | .put = alc_ch_mode_put, |
| 2378 | }, |
| 2379 | { } /* end */ |
| 2380 | }; |
| 2381 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2382 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2383 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2384 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2385 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2386 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2387 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2388 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2389 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2390 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2391 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2392 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2393 | { } /* end */ |
| 2394 | }; |
| 2395 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2396 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2397 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2398 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2399 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2400 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2401 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2402 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2403 | { } /* end */ |
| 2404 | }; |
| 2405 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2406 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2407 | * virtual master controls |
| 2408 | */ |
| 2409 | |
| 2410 | /* |
| 2411 | * slave controls for virtual master |
| 2412 | */ |
| 2413 | static const char *alc_slave_vols[] = { |
| 2414 | "Front Playback Volume", |
| 2415 | "Surround Playback Volume", |
| 2416 | "Center Playback Volume", |
| 2417 | "LFE Playback Volume", |
| 2418 | "Side Playback Volume", |
| 2419 | "Headphone Playback Volume", |
| 2420 | "Speaker Playback Volume", |
| 2421 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2422 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2423 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2424 | NULL, |
| 2425 | }; |
| 2426 | |
| 2427 | static const char *alc_slave_sws[] = { |
| 2428 | "Front Playback Switch", |
| 2429 | "Surround Playback Switch", |
| 2430 | "Center Playback Switch", |
| 2431 | "LFE Playback Switch", |
| 2432 | "Side Playback Switch", |
| 2433 | "Headphone Playback Switch", |
| 2434 | "Speaker Playback Switch", |
| 2435 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2436 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2437 | "Line-Out Playback Switch", |
| 2438 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2439 | NULL, |
| 2440 | }; |
| 2441 | |
| 2442 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2443 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2444 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2445 | |
| 2446 | static void alc_free_kctls(struct hda_codec *codec); |
| 2447 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2448 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2449 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2450 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2451 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2452 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2453 | { } /* end */ |
| 2454 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2455 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2456 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2457 | static int alc_build_controls(struct hda_codec *codec) |
| 2458 | { |
| 2459 | struct alc_spec *spec = codec->spec; |
| 2460 | int err; |
| 2461 | int i; |
| 2462 | |
| 2463 | for (i = 0; i < spec->num_mixers; i++) { |
| 2464 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2465 | if (err < 0) |
| 2466 | return err; |
| 2467 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2468 | if (spec->cap_mixer) { |
| 2469 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2470 | if (err < 0) |
| 2471 | return err; |
| 2472 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2473 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2474 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2475 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2476 | if (err < 0) |
| 2477 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2478 | if (!spec->no_analog) { |
| 2479 | err = snd_hda_create_spdif_share_sw(codec, |
| 2480 | &spec->multiout); |
| 2481 | if (err < 0) |
| 2482 | return err; |
| 2483 | spec->multiout.share_spdif = 1; |
| 2484 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2485 | } |
| 2486 | if (spec->dig_in_nid) { |
| 2487 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2488 | if (err < 0) |
| 2489 | return err; |
| 2490 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2491 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2492 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2493 | /* create beep controls if needed */ |
| 2494 | if (spec->beep_amp) { |
| 2495 | struct snd_kcontrol_new *knew; |
| 2496 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2497 | struct snd_kcontrol *kctl; |
| 2498 | kctl = snd_ctl_new1(knew, codec); |
| 2499 | if (!kctl) |
| 2500 | return -ENOMEM; |
| 2501 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 2502 | err = snd_hda_ctl_add(codec, |
| 2503 | get_amp_nid_(spec->beep_amp), kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2504 | if (err < 0) |
| 2505 | return err; |
| 2506 | } |
| 2507 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2508 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2509 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2510 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2511 | if (!spec->no_analog && |
| 2512 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2513 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2514 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2515 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2516 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2517 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2518 | if (err < 0) |
| 2519 | return err; |
| 2520 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2521 | if (!spec->no_analog && |
| 2522 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2523 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2524 | NULL, alc_slave_sws); |
| 2525 | if (err < 0) |
| 2526 | return err; |
| 2527 | } |
| 2528 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2529 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2530 | return 0; |
| 2531 | } |
| 2532 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2533 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2534 | /* |
| 2535 | * initialize the codec volumes, etc |
| 2536 | */ |
| 2537 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2538 | /* |
| 2539 | * generic initialization of ADC, input mixers and output mixers |
| 2540 | */ |
| 2541 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2542 | /* |
| 2543 | * Unmute ADC0-2 and set the default input to mic-in |
| 2544 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2545 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2546 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2547 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2548 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2549 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2550 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2551 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2552 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2553 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2554 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2555 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2556 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2557 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2558 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2559 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2560 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2561 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2562 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2563 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2565 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2566 | /* |
| 2567 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2568 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2569 | /* set vol=0 to output mixers */ |
| 2570 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2571 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2572 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2573 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2574 | /* set up input amps for analog loopback */ |
| 2575 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2576 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2577 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2578 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2579 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2580 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2581 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2582 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2583 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2584 | |
| 2585 | { } |
| 2586 | }; |
| 2587 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2588 | /* |
| 2589 | * 3-stack pin configuration: |
| 2590 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2591 | */ |
| 2592 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2593 | /* |
| 2594 | * preset connection lists of input pins |
| 2595 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2596 | */ |
| 2597 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2598 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2599 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2600 | |
| 2601 | /* |
| 2602 | * Set pin mode and muting |
| 2603 | */ |
| 2604 | /* set front pin widgets 0x14 for output */ |
| 2605 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2606 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2607 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2608 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2609 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2610 | /* Mic2 (as headphone out) for HP output */ |
| 2611 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2612 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2613 | /* Line In pin widget for input */ |
| 2614 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2615 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2616 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2617 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2618 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2619 | /* CD pin widget for input */ |
| 2620 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2621 | |
| 2622 | { } |
| 2623 | }; |
| 2624 | |
| 2625 | /* |
| 2626 | * 5-stack pin configuration: |
| 2627 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2628 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2629 | */ |
| 2630 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2631 | /* |
| 2632 | * preset connection lists of input pins |
| 2633 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2634 | */ |
| 2635 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2636 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2637 | |
| 2638 | /* |
| 2639 | * Set pin mode and muting |
| 2640 | */ |
| 2641 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2642 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2643 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2644 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2645 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2646 | /* unmute pins for output (no gain on this amp) */ |
| 2647 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2648 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2649 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2650 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2651 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2652 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2653 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2654 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2655 | /* Mic2 (as headphone out) for HP output */ |
| 2656 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2657 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2658 | /* Line In pin widget for input */ |
| 2659 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2660 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2661 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2662 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2663 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2664 | /* CD pin widget for input */ |
| 2665 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2666 | |
| 2667 | { } |
| 2668 | }; |
| 2669 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2670 | /* |
| 2671 | * W810 pin configuration: |
| 2672 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2673 | */ |
| 2674 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2675 | /* hphone/speaker input selector: front DAC */ |
| 2676 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2677 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2678 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2679 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2680 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2681 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2682 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2683 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2684 | |
| 2685 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2686 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2687 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2688 | { } |
| 2689 | }; |
| 2690 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2691 | /* |
| 2692 | * Z71V pin configuration: |
| 2693 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2694 | */ |
| 2695 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2696 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2697 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2698 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2699 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2700 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2701 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2702 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2703 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2704 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2705 | |
| 2706 | { } |
| 2707 | }; |
| 2708 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2709 | /* |
| 2710 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2711 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2712 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2713 | */ |
| 2714 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2715 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2716 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2717 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2718 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2719 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2720 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2721 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2722 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2723 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2724 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2725 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2726 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2727 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2728 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2729 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2730 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2731 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2732 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2733 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2734 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2735 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2736 | { } |
| 2737 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2738 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2739 | /* |
| 2740 | * Uniwill pin configuration: |
| 2741 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2742 | * line = 0x1a |
| 2743 | */ |
| 2744 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2745 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2746 | |
| 2747 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2748 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2749 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2750 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2751 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2752 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2753 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2754 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2755 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2756 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2757 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2758 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2759 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2760 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2761 | |
| 2762 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2763 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2764 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2765 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2766 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2767 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2768 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2769 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2770 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2771 | |
| 2772 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2773 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2774 | |
| 2775 | { } |
| 2776 | }; |
| 2777 | |
| 2778 | /* |
| 2779 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2780 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2781 | */ |
| 2782 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2783 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2784 | |
| 2785 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2786 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2787 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2788 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2789 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2790 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2791 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2792 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2793 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2794 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2795 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2796 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2797 | |
| 2798 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2799 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2800 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2801 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2802 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2803 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2804 | |
| 2805 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2806 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2807 | |
| 2808 | { } |
| 2809 | }; |
| 2810 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2811 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2812 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2813 | { } |
| 2814 | }; |
| 2815 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2816 | /* auto-toggle front mic */ |
| 2817 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2818 | { |
| 2819 | unsigned int present; |
| 2820 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2821 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 2822 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2823 | bits = present ? HDA_AMP_MUTE : 0; |
| 2824 | 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] | 2825 | } |
| 2826 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2827 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2828 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2829 | struct alc_spec *spec = codec->spec; |
| 2830 | |
| 2831 | spec->autocfg.hp_pins[0] = 0x14; |
| 2832 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2833 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2834 | } |
| 2835 | |
| 2836 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 2837 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2838 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2839 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2840 | } |
| 2841 | |
| 2842 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2843 | unsigned int res) |
| 2844 | { |
| 2845 | /* Looks like the unsol event is incompatible with the standard |
| 2846 | * definition. 4bit tag is placed at 28 bit! |
| 2847 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2848 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2849 | case ALC880_MIC_EVENT: |
| 2850 | alc880_uniwill_mic_automute(codec); |
| 2851 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2852 | default: |
| 2853 | alc_automute_amp_unsol_event(codec, res); |
| 2854 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2855 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2856 | } |
| 2857 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2858 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2859 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2860 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2861 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2862 | spec->autocfg.hp_pins[0] = 0x14; |
| 2863 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2864 | } |
| 2865 | |
| 2866 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2867 | { |
| 2868 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2869 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2870 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2871 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2872 | present &= HDA_AMP_VOLMASK; |
| 2873 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2874 | HDA_AMP_VOLMASK, present); |
| 2875 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2876 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2877 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2878 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2879 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2880 | unsigned int res) |
| 2881 | { |
| 2882 | /* Looks like the unsol event is incompatible with the standard |
| 2883 | * definition. 4bit tag is placed at 28 bit! |
| 2884 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2885 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2886 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2887 | else |
| 2888 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2889 | } |
| 2890 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2891 | /* |
| 2892 | * F1734 pin configuration: |
| 2893 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2894 | */ |
| 2895 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2896 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2897 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2898 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2899 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2900 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2901 | |
| 2902 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2903 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2904 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2905 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2906 | |
| 2907 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2908 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2909 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2910 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2911 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2912 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2913 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2914 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2915 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2916 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2917 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2918 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2919 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2920 | { } |
| 2921 | }; |
| 2922 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2923 | /* |
| 2924 | * ASUS pin configuration: |
| 2925 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2926 | */ |
| 2927 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2928 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2929 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2930 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2931 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2932 | |
| 2933 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2934 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2935 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2936 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2937 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2938 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2939 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2940 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2941 | |
| 2942 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2943 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2944 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2945 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2946 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2947 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2948 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2949 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2950 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2951 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2952 | { } |
| 2953 | }; |
| 2954 | |
| 2955 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2956 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2957 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2958 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2959 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2960 | /* Clevo m520g init */ |
| 2961 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2962 | /* headphone output */ |
| 2963 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2964 | /* line-out */ |
| 2965 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2966 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2967 | /* Line-in */ |
| 2968 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2969 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2970 | /* CD */ |
| 2971 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2972 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2973 | /* Mic1 (rear panel) */ |
| 2974 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2975 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2976 | /* Mic2 (front panel) */ |
| 2977 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2978 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2979 | /* headphone */ |
| 2980 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2981 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2982 | /* change to EAPD mode */ |
| 2983 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2984 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2985 | |
| 2986 | { } |
| 2987 | }; |
| 2988 | |
| 2989 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2990 | /* change to EAPD mode */ |
| 2991 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2992 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2993 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2994 | /* Headphone output */ |
| 2995 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2996 | /* Front output*/ |
| 2997 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2998 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2999 | |
| 3000 | /* Line In pin widget for input */ |
| 3001 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3002 | /* CD pin widget for input */ |
| 3003 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3004 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3005 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3006 | |
| 3007 | /* change to EAPD mode */ |
| 3008 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3009 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3010 | |
| 3011 | { } |
| 3012 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3013 | |
| 3014 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3015 | * LG m1 express dual |
| 3016 | * |
| 3017 | * Pin assignment: |
| 3018 | * Rear Line-In/Out (blue): 0x14 |
| 3019 | * Build-in Mic-In: 0x15 |
| 3020 | * Speaker-out: 0x17 |
| 3021 | * HP-Out (green): 0x1b |
| 3022 | * Mic-In/Out (red): 0x19 |
| 3023 | * SPDIF-Out: 0x1e |
| 3024 | */ |
| 3025 | |
| 3026 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3027 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3028 | 0x05, 0x02, 0x03 |
| 3029 | }; |
| 3030 | |
| 3031 | /* seems analog CD is not working */ |
| 3032 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3033 | .num_items = 3, |
| 3034 | .items = { |
| 3035 | { "Mic", 0x1 }, |
| 3036 | { "Line", 0x5 }, |
| 3037 | { "Internal Mic", 0x6 }, |
| 3038 | }, |
| 3039 | }; |
| 3040 | |
| 3041 | /* 2,4,6 channel modes */ |
| 3042 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3043 | /* set line-in and mic-in to input */ |
| 3044 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3045 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3046 | { } |
| 3047 | }; |
| 3048 | |
| 3049 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3050 | /* set line-in to out and mic-in to input */ |
| 3051 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3052 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3053 | { } |
| 3054 | }; |
| 3055 | |
| 3056 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3057 | /* set line-in and mic-in to output */ |
| 3058 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3059 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3060 | { } |
| 3061 | }; |
| 3062 | |
| 3063 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3064 | { 2, alc880_lg_ch2_init }, |
| 3065 | { 4, alc880_lg_ch4_init }, |
| 3066 | { 6, alc880_lg_ch6_init }, |
| 3067 | }; |
| 3068 | |
| 3069 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3070 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3071 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3072 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3073 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3074 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3075 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3076 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3077 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3078 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3079 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3080 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3081 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3082 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3083 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3084 | { |
| 3085 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3086 | .name = "Channel Mode", |
| 3087 | .info = alc_ch_mode_info, |
| 3088 | .get = alc_ch_mode_get, |
| 3089 | .put = alc_ch_mode_put, |
| 3090 | }, |
| 3091 | { } /* end */ |
| 3092 | }; |
| 3093 | |
| 3094 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3095 | /* set capture source to mic-in */ |
| 3096 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3097 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3098 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3099 | /* mute all amp mixer inputs */ |
| 3100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3103 | /* line-in to input */ |
| 3104 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3105 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3106 | /* built-in mic */ |
| 3107 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3108 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3109 | /* speaker-out */ |
| 3110 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3111 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3112 | /* mic-in to input */ |
| 3113 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3114 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3115 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3116 | /* HP-out */ |
| 3117 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3118 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3119 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3120 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3121 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3122 | { } |
| 3123 | }; |
| 3124 | |
| 3125 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3126 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3127 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3128 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3129 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3130 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3131 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3132 | } |
| 3133 | |
| 3134 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3135 | * LG LW20 |
| 3136 | * |
| 3137 | * Pin assignment: |
| 3138 | * Speaker-out: 0x14 |
| 3139 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3140 | * Built-in Mic-In: 0x19 |
| 3141 | * Line-In: 0x1b |
| 3142 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3143 | * SPDIF-Out: 0x1e |
| 3144 | */ |
| 3145 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3146 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3147 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3148 | .items = { |
| 3149 | { "Mic", 0x0 }, |
| 3150 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3151 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3152 | }, |
| 3153 | }; |
| 3154 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3155 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3156 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3157 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3158 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3159 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3160 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3161 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3162 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3163 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3164 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3165 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3166 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3167 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3168 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3170 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3171 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3172 | { |
| 3173 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3174 | .name = "Channel Mode", |
| 3175 | .info = alc_ch_mode_info, |
| 3176 | .get = alc_ch_mode_get, |
| 3177 | .put = alc_ch_mode_put, |
| 3178 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3179 | { } /* end */ |
| 3180 | }; |
| 3181 | |
| 3182 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3183 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3184 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3185 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3186 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3187 | /* set capture source to mic-in */ |
| 3188 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3189 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3190 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3191 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3192 | /* speaker-out */ |
| 3193 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3194 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3195 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3196 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3197 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3198 | /* mic-in to input */ |
| 3199 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3200 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3201 | /* built-in mic */ |
| 3202 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3203 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3204 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3205 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3206 | { } |
| 3207 | }; |
| 3208 | |
| 3209 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3210 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3211 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3212 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3213 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3214 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3215 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3216 | } |
| 3217 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3218 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3219 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3220 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3221 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3223 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3224 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3225 | { } /* end */ |
| 3226 | }; |
| 3227 | |
| 3228 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3229 | .num_items = 2, |
| 3230 | .items = { |
| 3231 | { "Mic", 0x0 }, |
| 3232 | { "Internal Mic", 0x1 }, |
| 3233 | }, |
| 3234 | }; |
| 3235 | |
| 3236 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3237 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3238 | |
| 3239 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3240 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3241 | |
| 3242 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3243 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3244 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3245 | /* Mic2 (as headphone out) for HP output */ |
| 3246 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3247 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3248 | /* Internal Speaker */ |
| 3249 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3250 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3251 | |
| 3252 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3253 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3254 | |
| 3255 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3256 | { } |
| 3257 | }; |
| 3258 | |
| 3259 | /* toggle speaker-output according to the hp-jack state */ |
| 3260 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3261 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3262 | struct alc_spec *spec = codec->spec; |
| 3263 | alc_automute_amp(codec); |
| 3264 | /* toggle EAPD */ |
| 3265 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3266 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3267 | else |
| 3268 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3269 | } |
| 3270 | |
| 3271 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3272 | unsigned int res) |
| 3273 | { |
| 3274 | /* Looks like the unsol event is incompatible with the standard |
| 3275 | * definition. 4bit tag is placed at 28 bit! |
| 3276 | */ |
| 3277 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3278 | alc880_medion_rim_automute(codec); |
| 3279 | } |
| 3280 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3281 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3282 | { |
| 3283 | struct alc_spec *spec = codec->spec; |
| 3284 | |
| 3285 | spec->autocfg.hp_pins[0] = 0x14; |
| 3286 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3287 | } |
| 3288 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3289 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3290 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3291 | { 0x0b, HDA_INPUT, 0 }, |
| 3292 | { 0x0b, HDA_INPUT, 1 }, |
| 3293 | { 0x0b, HDA_INPUT, 2 }, |
| 3294 | { 0x0b, HDA_INPUT, 3 }, |
| 3295 | { 0x0b, HDA_INPUT, 4 }, |
| 3296 | { } /* end */ |
| 3297 | }; |
| 3298 | |
| 3299 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3300 | { 0x0b, HDA_INPUT, 1 }, |
| 3301 | { 0x0b, HDA_INPUT, 6 }, |
| 3302 | { 0x0b, HDA_INPUT, 7 }, |
| 3303 | { } /* end */ |
| 3304 | }; |
| 3305 | #endif |
| 3306 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3307 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3308 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3309 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3310 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3311 | static int alc_init(struct hda_codec *codec) |
| 3312 | { |
| 3313 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3314 | unsigned int i; |
| 3315 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3316 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3317 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3318 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3319 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3320 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3321 | |
| 3322 | if (spec->init_hook) |
| 3323 | spec->init_hook(codec); |
| 3324 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3325 | return 0; |
| 3326 | } |
| 3327 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3328 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3329 | { |
| 3330 | struct alc_spec *spec = codec->spec; |
| 3331 | |
| 3332 | if (spec->unsol_event) |
| 3333 | spec->unsol_event(codec, res); |
| 3334 | } |
| 3335 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3336 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3337 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3338 | { |
| 3339 | struct alc_spec *spec = codec->spec; |
| 3340 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3341 | } |
| 3342 | #endif |
| 3343 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3344 | /* |
| 3345 | * Analog playback callbacks |
| 3346 | */ |
| 3347 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3348 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3349 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3350 | { |
| 3351 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3352 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3353 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3354 | } |
| 3355 | |
| 3356 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3357 | struct hda_codec *codec, |
| 3358 | unsigned int stream_tag, |
| 3359 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3360 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3361 | { |
| 3362 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3363 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3364 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3365 | } |
| 3366 | |
| 3367 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3368 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3369 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3370 | { |
| 3371 | struct alc_spec *spec = codec->spec; |
| 3372 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3373 | } |
| 3374 | |
| 3375 | /* |
| 3376 | * Digital out |
| 3377 | */ |
| 3378 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3379 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3380 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3381 | { |
| 3382 | struct alc_spec *spec = codec->spec; |
| 3383 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3384 | } |
| 3385 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3386 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3387 | struct hda_codec *codec, |
| 3388 | unsigned int stream_tag, |
| 3389 | unsigned int format, |
| 3390 | struct snd_pcm_substream *substream) |
| 3391 | { |
| 3392 | struct alc_spec *spec = codec->spec; |
| 3393 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3394 | stream_tag, format, substream); |
| 3395 | } |
| 3396 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3397 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3398 | struct hda_codec *codec, |
| 3399 | struct snd_pcm_substream *substream) |
| 3400 | { |
| 3401 | struct alc_spec *spec = codec->spec; |
| 3402 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3403 | } |
| 3404 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3405 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3406 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3407 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3408 | { |
| 3409 | struct alc_spec *spec = codec->spec; |
| 3410 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3411 | } |
| 3412 | |
| 3413 | /* |
| 3414 | * Analog capture |
| 3415 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3416 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3417 | struct hda_codec *codec, |
| 3418 | unsigned int stream_tag, |
| 3419 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3420 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3421 | { |
| 3422 | struct alc_spec *spec = codec->spec; |
| 3423 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3424 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3425 | stream_tag, 0, format); |
| 3426 | return 0; |
| 3427 | } |
| 3428 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3429 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3430 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3431 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3432 | { |
| 3433 | struct alc_spec *spec = codec->spec; |
| 3434 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3435 | snd_hda_codec_cleanup_stream(codec, |
| 3436 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3437 | return 0; |
| 3438 | } |
| 3439 | |
| 3440 | |
| 3441 | /* |
| 3442 | */ |
| 3443 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3444 | .substreams = 1, |
| 3445 | .channels_min = 2, |
| 3446 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3447 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3448 | .ops = { |
| 3449 | .open = alc880_playback_pcm_open, |
| 3450 | .prepare = alc880_playback_pcm_prepare, |
| 3451 | .cleanup = alc880_playback_pcm_cleanup |
| 3452 | }, |
| 3453 | }; |
| 3454 | |
| 3455 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3456 | .substreams = 1, |
| 3457 | .channels_min = 2, |
| 3458 | .channels_max = 2, |
| 3459 | /* NID is set in alc_build_pcms */ |
| 3460 | }; |
| 3461 | |
| 3462 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3463 | .substreams = 1, |
| 3464 | .channels_min = 2, |
| 3465 | .channels_max = 2, |
| 3466 | /* NID is set in alc_build_pcms */ |
| 3467 | }; |
| 3468 | |
| 3469 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3470 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3471 | .channels_min = 2, |
| 3472 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3473 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3474 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3475 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3476 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3477 | }, |
| 3478 | }; |
| 3479 | |
| 3480 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3481 | .substreams = 1, |
| 3482 | .channels_min = 2, |
| 3483 | .channels_max = 2, |
| 3484 | /* NID is set in alc_build_pcms */ |
| 3485 | .ops = { |
| 3486 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3487 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3488 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3489 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3490 | }, |
| 3491 | }; |
| 3492 | |
| 3493 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3494 | .substreams = 1, |
| 3495 | .channels_min = 2, |
| 3496 | .channels_max = 2, |
| 3497 | /* NID is set in alc_build_pcms */ |
| 3498 | }; |
| 3499 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3500 | /* 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] | 3501 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3502 | .substreams = 0, |
| 3503 | .channels_min = 0, |
| 3504 | .channels_max = 0, |
| 3505 | }; |
| 3506 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3507 | static int alc_build_pcms(struct hda_codec *codec) |
| 3508 | { |
| 3509 | struct alc_spec *spec = codec->spec; |
| 3510 | struct hda_pcm *info = spec->pcm_rec; |
| 3511 | int i; |
| 3512 | |
| 3513 | codec->num_pcms = 1; |
| 3514 | codec->pcm_info = info; |
| 3515 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3516 | if (spec->no_analog) |
| 3517 | goto skip_analog; |
| 3518 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3519 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3520 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3521 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3522 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3523 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3524 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3525 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3526 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3527 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3528 | } |
| 3529 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3530 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3531 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3532 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3533 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3534 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3535 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3536 | if (spec->channel_mode) { |
| 3537 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3538 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3539 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3540 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3541 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3542 | } |
| 3543 | } |
| 3544 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3545 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3546 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3547 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3548 | snprintf(spec->stream_name_digital, |
| 3549 | sizeof(spec->stream_name_digital), |
| 3550 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3551 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3552 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3553 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3554 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3555 | if (spec->dig_out_type) |
| 3556 | info->pcm_type = spec->dig_out_type; |
| 3557 | else |
| 3558 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3559 | if (spec->multiout.dig_out_nid && |
| 3560 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3561 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3562 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3563 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3564 | if (spec->dig_in_nid && |
| 3565 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3566 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3567 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3568 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3569 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3570 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3571 | } |
| 3572 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3573 | if (spec->no_analog) |
| 3574 | return 0; |
| 3575 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3576 | /* If the use of more than one ADC is requested for the current |
| 3577 | * model, configure a second analog capture-only PCM. |
| 3578 | */ |
| 3579 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3580 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3581 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3582 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3583 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3584 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3585 | if (spec->alt_dac_nid) { |
| 3586 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3587 | *spec->stream_analog_alt_playback; |
| 3588 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3589 | spec->alt_dac_nid; |
| 3590 | } else { |
| 3591 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3592 | alc_pcm_null_stream; |
| 3593 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3594 | } |
| 3595 | if (spec->num_adc_nids > 1) { |
| 3596 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3597 | *spec->stream_analog_alt_capture; |
| 3598 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3599 | spec->adc_nids[1]; |
| 3600 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3601 | spec->num_adc_nids - 1; |
| 3602 | } else { |
| 3603 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3604 | alc_pcm_null_stream; |
| 3605 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3606 | } |
| 3607 | } |
| 3608 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3609 | return 0; |
| 3610 | } |
| 3611 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3612 | static void alc_free_kctls(struct hda_codec *codec) |
| 3613 | { |
| 3614 | struct alc_spec *spec = codec->spec; |
| 3615 | |
| 3616 | if (spec->kctls.list) { |
| 3617 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3618 | int i; |
| 3619 | for (i = 0; i < spec->kctls.used; i++) |
| 3620 | kfree(kctl[i].name); |
| 3621 | } |
| 3622 | snd_array_free(&spec->kctls); |
| 3623 | } |
| 3624 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3625 | static void alc_free(struct hda_codec *codec) |
| 3626 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3627 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3628 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3629 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3630 | return; |
| 3631 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3632 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3633 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3634 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3635 | } |
| 3636 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3637 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3638 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 3639 | { |
| 3640 | struct alc_spec *spec = codec->spec; |
| 3641 | if (spec && spec->power_hook) |
| 3642 | spec->power_hook(codec, 0); |
| 3643 | return 0; |
| 3644 | } |
| 3645 | #endif |
| 3646 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3647 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3648 | static int alc_resume(struct hda_codec *codec) |
| 3649 | { |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3650 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3651 | struct alc_spec *spec = codec->spec; |
| 3652 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3653 | codec->patch_ops.init(codec); |
| 3654 | snd_hda_codec_resume_amp(codec); |
| 3655 | snd_hda_codec_resume_cache(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3656 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3657 | if (spec && spec->power_hook) |
| 3658 | spec->power_hook(codec, 1); |
| 3659 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3660 | return 0; |
| 3661 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3662 | #endif |
| 3663 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3664 | /* |
| 3665 | */ |
| 3666 | static struct hda_codec_ops alc_patch_ops = { |
| 3667 | .build_controls = alc_build_controls, |
| 3668 | .build_pcms = alc_build_pcms, |
| 3669 | .init = alc_init, |
| 3670 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3671 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3672 | #ifdef SND_HDA_NEEDS_RESUME |
| 3673 | .resume = alc_resume, |
| 3674 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3675 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3676 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3677 | .check_power_status = alc_check_power_status, |
| 3678 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3679 | }; |
| 3680 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3681 | |
| 3682 | /* |
| 3683 | * Test configuration for debugging |
| 3684 | * |
| 3685 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3686 | * enum controls. |
| 3687 | */ |
| 3688 | #ifdef CONFIG_SND_DEBUG |
| 3689 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3690 | 0x02, 0x03, 0x04, 0x05 |
| 3691 | }; |
| 3692 | |
| 3693 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3694 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3695 | .items = { |
| 3696 | { "In-1", 0x0 }, |
| 3697 | { "In-2", 0x1 }, |
| 3698 | { "In-3", 0x2 }, |
| 3699 | { "In-4", 0x3 }, |
| 3700 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3701 | { "Front", 0x5 }, |
| 3702 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3703 | }, |
| 3704 | }; |
| 3705 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3706 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3707 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3708 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3709 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3710 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3711 | }; |
| 3712 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3713 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3714 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3715 | { |
| 3716 | static char *texts[] = { |
| 3717 | "N/A", "Line Out", "HP Out", |
| 3718 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3719 | }; |
| 3720 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3721 | uinfo->count = 1; |
| 3722 | uinfo->value.enumerated.items = 8; |
| 3723 | if (uinfo->value.enumerated.item >= 8) |
| 3724 | uinfo->value.enumerated.item = 7; |
| 3725 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3726 | return 0; |
| 3727 | } |
| 3728 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3729 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3730 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3731 | { |
| 3732 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3733 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3734 | unsigned int pin_ctl, item = 0; |
| 3735 | |
| 3736 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3737 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3738 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3739 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3740 | item = 2; |
| 3741 | else |
| 3742 | item = 1; |
| 3743 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3744 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3745 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3746 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3747 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3748 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3749 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3750 | } |
| 3751 | } |
| 3752 | ucontrol->value.enumerated.item[0] = item; |
| 3753 | return 0; |
| 3754 | } |
| 3755 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3756 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3757 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3758 | { |
| 3759 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3760 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3761 | static unsigned int ctls[] = { |
| 3762 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3763 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3764 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3765 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3766 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3767 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3768 | }; |
| 3769 | unsigned int old_ctl, new_ctl; |
| 3770 | |
| 3771 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3772 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3773 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3774 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3775 | int val; |
| 3776 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3777 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3778 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3779 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3780 | HDA_AMP_MUTE : 0; |
| 3781 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3782 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3783 | return 1; |
| 3784 | } |
| 3785 | return 0; |
| 3786 | } |
| 3787 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3788 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3789 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3790 | { |
| 3791 | static char *texts[] = { |
| 3792 | "Front", "Surround", "CLFE", "Side" |
| 3793 | }; |
| 3794 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3795 | uinfo->count = 1; |
| 3796 | uinfo->value.enumerated.items = 4; |
| 3797 | if (uinfo->value.enumerated.item >= 4) |
| 3798 | uinfo->value.enumerated.item = 3; |
| 3799 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3800 | return 0; |
| 3801 | } |
| 3802 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3803 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3804 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3805 | { |
| 3806 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3807 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3808 | unsigned int sel; |
| 3809 | |
| 3810 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3811 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3812 | return 0; |
| 3813 | } |
| 3814 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3815 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3816 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3817 | { |
| 3818 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3819 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3820 | unsigned int sel; |
| 3821 | |
| 3822 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3823 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3824 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3825 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3826 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3827 | return 1; |
| 3828 | } |
| 3829 | return 0; |
| 3830 | } |
| 3831 | |
| 3832 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3833 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3834 | .name = xname, \ |
| 3835 | .info = alc_test_pin_ctl_info, \ |
| 3836 | .get = alc_test_pin_ctl_get, \ |
| 3837 | .put = alc_test_pin_ctl_put, \ |
| 3838 | .private_value = nid \ |
| 3839 | } |
| 3840 | |
| 3841 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3842 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3843 | .name = xname, \ |
| 3844 | .info = alc_test_pin_src_info, \ |
| 3845 | .get = alc_test_pin_src_get, \ |
| 3846 | .put = alc_test_pin_src_put, \ |
| 3847 | .private_value = nid \ |
| 3848 | } |
| 3849 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3850 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3851 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3852 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3853 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3854 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3855 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3856 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3857 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3858 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3859 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3860 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3861 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3862 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3863 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3864 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3865 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3866 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3867 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3868 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3869 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3870 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3871 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3872 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3873 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3874 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3875 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3876 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3877 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3878 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3879 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3880 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3881 | { |
| 3882 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3883 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3884 | .info = alc_ch_mode_info, |
| 3885 | .get = alc_ch_mode_get, |
| 3886 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3887 | }, |
| 3888 | { } /* end */ |
| 3889 | }; |
| 3890 | |
| 3891 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3892 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3893 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3894 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3895 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3896 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3897 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3898 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3899 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3900 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3901 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3902 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3903 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3904 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3905 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3906 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3907 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3908 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3909 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3910 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3911 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3912 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3913 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3914 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3915 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3916 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3917 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3918 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3919 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3920 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3921 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3922 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3923 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3924 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3925 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3926 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3927 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3929 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3930 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3931 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3932 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3933 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3934 | /* Analog input/passthru */ |
| 3935 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3936 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3937 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3938 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3939 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3940 | { } |
| 3941 | }; |
| 3942 | #endif |
| 3943 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3944 | /* |
| 3945 | */ |
| 3946 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3947 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3948 | [ALC880_3ST] = "3stack", |
| 3949 | [ALC880_TCL_S700] = "tcl", |
| 3950 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3951 | [ALC880_CLEVO] = "clevo", |
| 3952 | [ALC880_5ST] = "5stack", |
| 3953 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3954 | [ALC880_W810] = "w810", |
| 3955 | [ALC880_Z71V] = "z71v", |
| 3956 | [ALC880_6ST] = "6stack", |
| 3957 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3958 | [ALC880_ASUS] = "asus", |
| 3959 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3960 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3961 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3962 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3963 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3964 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3965 | [ALC880_F1734] = "F1734", |
| 3966 | [ALC880_LG] = "lg", |
| 3967 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3968 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3969 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3970 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3971 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3972 | [ALC880_AUTO] = "auto", |
| 3973 | }; |
| 3974 | |
| 3975 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3976 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3977 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3978 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3979 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3980 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3981 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3982 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3983 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3984 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3985 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3986 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3987 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3988 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3989 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3990 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3991 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3992 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3993 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3994 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3995 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3996 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3997 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3998 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3999 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4000 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4001 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4002 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4003 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4004 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4005 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4006 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4007 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4008 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4009 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4010 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4011 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4012 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4013 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4014 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4015 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4016 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4017 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4018 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4019 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4020 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4021 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4022 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4023 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4024 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4025 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4026 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4027 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4028 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4029 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4030 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4031 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4032 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4033 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4034 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4035 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4036 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4037 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4038 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4039 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4040 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4041 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4042 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4043 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4044 | /* default Intel */ |
| 4045 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4046 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4047 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4048 | {} |
| 4049 | }; |
| 4050 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4051 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4052 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4053 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4054 | static struct alc_config_preset alc880_presets[] = { |
| 4055 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4056 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4057 | .init_verbs = { alc880_volume_init_verbs, |
| 4058 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4059 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4060 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4061 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4062 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4063 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4064 | .input_mux = &alc880_capture_source, |
| 4065 | }, |
| 4066 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4067 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4068 | .init_verbs = { alc880_volume_init_verbs, |
| 4069 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4070 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4071 | .dac_nids = alc880_dac_nids, |
| 4072 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4073 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4074 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4075 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4076 | .input_mux = &alc880_capture_source, |
| 4077 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4078 | [ALC880_TCL_S700] = { |
| 4079 | .mixers = { alc880_tcl_s700_mixer }, |
| 4080 | .init_verbs = { alc880_volume_init_verbs, |
| 4081 | alc880_pin_tcl_S700_init_verbs, |
| 4082 | alc880_gpio2_init_verbs }, |
| 4083 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4084 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4085 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4086 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4087 | .hp_nid = 0x03, |
| 4088 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4089 | .channel_mode = alc880_2_jack_modes, |
| 4090 | .input_mux = &alc880_capture_source, |
| 4091 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4092 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4093 | .mixers = { alc880_three_stack_mixer, |
| 4094 | alc880_five_stack_mixer}, |
| 4095 | .init_verbs = { alc880_volume_init_verbs, |
| 4096 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4097 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4098 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4099 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4100 | .channel_mode = alc880_fivestack_modes, |
| 4101 | .input_mux = &alc880_capture_source, |
| 4102 | }, |
| 4103 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4104 | .mixers = { alc880_three_stack_mixer, |
| 4105 | alc880_five_stack_mixer }, |
| 4106 | .init_verbs = { alc880_volume_init_verbs, |
| 4107 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4108 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4109 | .dac_nids = alc880_dac_nids, |
| 4110 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4111 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4112 | .channel_mode = alc880_fivestack_modes, |
| 4113 | .input_mux = &alc880_capture_source, |
| 4114 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4115 | [ALC880_6ST] = { |
| 4116 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4117 | .init_verbs = { alc880_volume_init_verbs, |
| 4118 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4119 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4120 | .dac_nids = alc880_6st_dac_nids, |
| 4121 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4122 | .channel_mode = alc880_sixstack_modes, |
| 4123 | .input_mux = &alc880_6stack_capture_source, |
| 4124 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4125 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4126 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4127 | .init_verbs = { alc880_volume_init_verbs, |
| 4128 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4129 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4130 | .dac_nids = alc880_6st_dac_nids, |
| 4131 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4132 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4133 | .channel_mode = alc880_sixstack_modes, |
| 4134 | .input_mux = &alc880_6stack_capture_source, |
| 4135 | }, |
| 4136 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4137 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4138 | .init_verbs = { alc880_volume_init_verbs, |
| 4139 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4140 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4141 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4142 | .dac_nids = alc880_w810_dac_nids, |
| 4143 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4144 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4145 | .channel_mode = alc880_w810_modes, |
| 4146 | .input_mux = &alc880_capture_source, |
| 4147 | }, |
| 4148 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4149 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4150 | .init_verbs = { alc880_volume_init_verbs, |
| 4151 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4152 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4153 | .dac_nids = alc880_z71v_dac_nids, |
| 4154 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4155 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4156 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4157 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4158 | .input_mux = &alc880_capture_source, |
| 4159 | }, |
| 4160 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4161 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4162 | .init_verbs = { alc880_volume_init_verbs, |
| 4163 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4164 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4165 | .dac_nids = alc880_f1734_dac_nids, |
| 4166 | .hp_nid = 0x02, |
| 4167 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4168 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4169 | .input_mux = &alc880_f1734_capture_source, |
| 4170 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4171 | .setup = alc880_uniwill_p53_setup, |
| 4172 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4173 | }, |
| 4174 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4175 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4176 | .init_verbs = { alc880_volume_init_verbs, |
| 4177 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4178 | alc880_gpio1_init_verbs }, |
| 4179 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4180 | .dac_nids = alc880_asus_dac_nids, |
| 4181 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4182 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4183 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4184 | .input_mux = &alc880_capture_source, |
| 4185 | }, |
| 4186 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4187 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4188 | .init_verbs = { alc880_volume_init_verbs, |
| 4189 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4190 | alc880_gpio1_init_verbs }, |
| 4191 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4192 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4193 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4194 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4195 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4196 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4197 | .input_mux = &alc880_capture_source, |
| 4198 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4199 | [ALC880_ASUS_DIG2] = { |
| 4200 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4201 | .init_verbs = { alc880_volume_init_verbs, |
| 4202 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4203 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4204 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4205 | .dac_nids = alc880_asus_dac_nids, |
| 4206 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4207 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4208 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4209 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4210 | .input_mux = &alc880_capture_source, |
| 4211 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4212 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4213 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4214 | .init_verbs = { alc880_volume_init_verbs, |
| 4215 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4216 | alc880_gpio1_init_verbs }, |
| 4217 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4218 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4219 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4220 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4221 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4222 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4223 | .input_mux = &alc880_capture_source, |
| 4224 | }, |
| 4225 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4226 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4227 | .init_verbs = { alc880_volume_init_verbs, |
| 4228 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4229 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4230 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4231 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4232 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4233 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4234 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4235 | .input_mux = &alc880_capture_source, |
| 4236 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4237 | [ALC880_UNIWILL] = { |
| 4238 | .mixers = { alc880_uniwill_mixer }, |
| 4239 | .init_verbs = { alc880_volume_init_verbs, |
| 4240 | alc880_uniwill_init_verbs }, |
| 4241 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4242 | .dac_nids = alc880_asus_dac_nids, |
| 4243 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4244 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4245 | .channel_mode = alc880_threestack_modes, |
| 4246 | .need_dac_fix = 1, |
| 4247 | .input_mux = &alc880_capture_source, |
| 4248 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4249 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4250 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4251 | }, |
| 4252 | [ALC880_UNIWILL_P53] = { |
| 4253 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4254 | .init_verbs = { alc880_volume_init_verbs, |
| 4255 | alc880_uniwill_p53_init_verbs }, |
| 4256 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4257 | .dac_nids = alc880_asus_dac_nids, |
| 4258 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4259 | .channel_mode = alc880_threestack_modes, |
| 4260 | .input_mux = &alc880_capture_source, |
| 4261 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4262 | .setup = alc880_uniwill_p53_setup, |
| 4263 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4264 | }, |
| 4265 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4266 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4267 | .init_verbs = { alc880_volume_init_verbs, |
| 4268 | alc880_uniwill_p53_init_verbs, |
| 4269 | alc880_beep_init_verbs }, |
| 4270 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4271 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4272 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4273 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4274 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4275 | .input_mux = &alc880_capture_source, |
| 4276 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4277 | .setup = alc880_uniwill_p53_setup, |
| 4278 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4279 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4280 | [ALC880_CLEVO] = { |
| 4281 | .mixers = { alc880_three_stack_mixer }, |
| 4282 | .init_verbs = { alc880_volume_init_verbs, |
| 4283 | alc880_pin_clevo_init_verbs }, |
| 4284 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4285 | .dac_nids = alc880_dac_nids, |
| 4286 | .hp_nid = 0x03, |
| 4287 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4288 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4289 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4290 | .input_mux = &alc880_capture_source, |
| 4291 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4292 | [ALC880_LG] = { |
| 4293 | .mixers = { alc880_lg_mixer }, |
| 4294 | .init_verbs = { alc880_volume_init_verbs, |
| 4295 | alc880_lg_init_verbs }, |
| 4296 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4297 | .dac_nids = alc880_lg_dac_nids, |
| 4298 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4299 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4300 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4301 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4302 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4303 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4304 | .setup = alc880_lg_setup, |
| 4305 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4306 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4307 | .loopbacks = alc880_lg_loopbacks, |
| 4308 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4309 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4310 | [ALC880_LG_LW] = { |
| 4311 | .mixers = { alc880_lg_lw_mixer }, |
| 4312 | .init_verbs = { alc880_volume_init_verbs, |
| 4313 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4314 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4315 | .dac_nids = alc880_dac_nids, |
| 4316 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4317 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4318 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4319 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4320 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4321 | .setup = alc880_lg_lw_setup, |
| 4322 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4323 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4324 | [ALC880_MEDION_RIM] = { |
| 4325 | .mixers = { alc880_medion_rim_mixer }, |
| 4326 | .init_verbs = { alc880_volume_init_verbs, |
| 4327 | alc880_medion_rim_init_verbs, |
| 4328 | alc_gpio2_init_verbs }, |
| 4329 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4330 | .dac_nids = alc880_dac_nids, |
| 4331 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4332 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4333 | .channel_mode = alc880_2_jack_modes, |
| 4334 | .input_mux = &alc880_medion_rim_capture_source, |
| 4335 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4336 | .setup = alc880_medion_rim_setup, |
| 4337 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4338 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4339 | #ifdef CONFIG_SND_DEBUG |
| 4340 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4341 | .mixers = { alc880_test_mixer }, |
| 4342 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4343 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4344 | .dac_nids = alc880_test_dac_nids, |
| 4345 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4346 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4347 | .channel_mode = alc880_test_modes, |
| 4348 | .input_mux = &alc880_test_capture_source, |
| 4349 | }, |
| 4350 | #endif |
| 4351 | }; |
| 4352 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4353 | /* |
| 4354 | * Automatic parse of I/O pins from the BIOS configuration |
| 4355 | */ |
| 4356 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | enum { |
| 4358 | ALC_CTL_WIDGET_VOL, |
| 4359 | ALC_CTL_WIDGET_MUTE, |
| 4360 | ALC_CTL_BIND_MUTE, |
| 4361 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4362 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4363 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4364 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4365 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4366 | }; |
| 4367 | |
| 4368 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4369 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4370 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4371 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4372 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4373 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4374 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4375 | knew = snd_array_new(&spec->kctls); |
| 4376 | if (!knew) |
| 4377 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4378 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4379 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4380 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4381 | return -ENOMEM; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4382 | if (get_amp_nid_(val)) |
Takashi Iwai | 9c96fa5 | 2009-11-16 11:25:33 +0100 | [diff] [blame] | 4383 | knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4384 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4385 | return 0; |
| 4386 | } |
| 4387 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4388 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4389 | const char *pfx, const char *dir, |
| 4390 | const char *sfx, unsigned long val) |
| 4391 | { |
| 4392 | char name[32]; |
| 4393 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
| 4394 | return add_control(spec, type, name, val); |
| 4395 | } |
| 4396 | |
| 4397 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4398 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) |
| 4399 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4400 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) |
| 4401 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4402 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4403 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4404 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4405 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4406 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4407 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4408 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4409 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4410 | #define ALC880_PIN_CD_NID 0x1c |
| 4411 | |
| 4412 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4413 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4414 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4415 | { |
| 4416 | hda_nid_t nid; |
| 4417 | int assigned[4]; |
| 4418 | int i, j; |
| 4419 | |
| 4420 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4421 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4422 | |
| 4423 | /* check the pins hardwired to audio widget */ |
| 4424 | for (i = 0; i < cfg->line_outs; i++) { |
| 4425 | nid = cfg->line_out_pins[i]; |
| 4426 | if (alc880_is_fixed_pin(nid)) { |
| 4427 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4428 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4429 | assigned[idx] = 1; |
| 4430 | } |
| 4431 | } |
| 4432 | /* left pins can be connect to any audio widget */ |
| 4433 | for (i = 0; i < cfg->line_outs; i++) { |
| 4434 | nid = cfg->line_out_pins[i]; |
| 4435 | if (alc880_is_fixed_pin(nid)) |
| 4436 | continue; |
| 4437 | /* search for an empty channel */ |
| 4438 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4439 | if (!assigned[j]) { |
| 4440 | spec->multiout.dac_nids[i] = |
| 4441 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4442 | assigned[j] = 1; |
| 4443 | break; |
| 4444 | } |
| 4445 | } |
| 4446 | } |
| 4447 | spec->multiout.num_dacs = cfg->line_outs; |
| 4448 | return 0; |
| 4449 | } |
| 4450 | |
| 4451 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4452 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4453 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4454 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4455 | static const char *chname[4] = { |
| 4456 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4457 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4458 | hda_nid_t nid; |
| 4459 | int i, err; |
| 4460 | |
| 4461 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4462 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4463 | continue; |
| 4464 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4465 | if (i == 2) { |
| 4466 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4467 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4468 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4469 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4470 | HDA_OUTPUT)); |
| 4471 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4472 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4473 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4474 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4475 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4476 | HDA_OUTPUT)); |
| 4477 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4478 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4479 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4480 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4481 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4482 | HDA_INPUT)); |
| 4483 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4484 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4485 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4486 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4487 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4488 | HDA_INPUT)); |
| 4489 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4490 | return err; |
| 4491 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4492 | const char *pfx; |
| 4493 | if (cfg->line_outs == 1 && |
| 4494 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4495 | pfx = "Speaker"; |
| 4496 | else |
| 4497 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4498 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4499 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4500 | HDA_OUTPUT)); |
| 4501 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4502 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4503 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4504 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4505 | HDA_INPUT)); |
| 4506 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4507 | return err; |
| 4508 | } |
| 4509 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4510 | return 0; |
| 4511 | } |
| 4512 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4513 | /* add playback controls for speaker and HP outputs */ |
| 4514 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4515 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4516 | { |
| 4517 | hda_nid_t nid; |
| 4518 | int err; |
| 4519 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4520 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4521 | return 0; |
| 4522 | |
| 4523 | if (alc880_is_fixed_pin(pin)) { |
| 4524 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4525 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4526 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4527 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4528 | else |
| 4529 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4530 | /* control HP volume/switch on the output mixer amp */ |
| 4531 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4532 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4533 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4534 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4535 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4536 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4537 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4538 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4539 | return err; |
| 4540 | } else if (alc880_is_multi_pin(pin)) { |
| 4541 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4542 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4543 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4544 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4545 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4546 | return err; |
| 4547 | } |
| 4548 | return 0; |
| 4549 | } |
| 4550 | |
| 4551 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4552 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4553 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4554 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4555 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4556 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4557 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4558 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4559 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4560 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4561 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4562 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4563 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4564 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4565 | return err; |
| 4566 | return 0; |
| 4567 | } |
| 4568 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4569 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4570 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4571 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4572 | return (pincap & AC_PINCAP_IN) != 0; |
| 4573 | } |
| 4574 | |
| 4575 | /* create playback/capture controls for input pins */ |
| 4576 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4577 | const struct auto_pin_cfg *cfg, |
| 4578 | hda_nid_t mixer, |
| 4579 | hda_nid_t cap1, hda_nid_t cap2) |
| 4580 | { |
| 4581 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4582 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4583 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4584 | |
| 4585 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4586 | hda_nid_t pin; |
| 4587 | |
| 4588 | pin = cfg->input_pins[i]; |
| 4589 | if (!alc_is_input_pin(codec, pin)) |
| 4590 | continue; |
| 4591 | |
| 4592 | if (mixer) { |
| 4593 | idx = get_connection_index(codec, mixer, pin); |
| 4594 | if (idx >= 0) { |
| 4595 | err = new_analog_input(spec, pin, |
| 4596 | auto_pin_cfg_labels[i], |
| 4597 | idx, mixer); |
| 4598 | if (err < 0) |
| 4599 | return err; |
| 4600 | } |
| 4601 | } |
| 4602 | |
| 4603 | if (!cap1) |
| 4604 | continue; |
| 4605 | idx = get_connection_index(codec, cap1, pin); |
| 4606 | if (idx < 0 && cap2) |
| 4607 | idx = get_connection_index(codec, cap2, pin); |
| 4608 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4609 | imux->items[imux->num_items].label = |
| 4610 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4611 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4612 | imux->num_items++; |
| 4613 | } |
| 4614 | } |
| 4615 | return 0; |
| 4616 | } |
| 4617 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4618 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4619 | const struct auto_pin_cfg *cfg) |
| 4620 | { |
| 4621 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4622 | } |
| 4623 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4624 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4625 | unsigned int pin_type) |
| 4626 | { |
| 4627 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4628 | pin_type); |
| 4629 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4630 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4631 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4632 | } |
| 4633 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4634 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4635 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4636 | int dac_idx) |
| 4637 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4638 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4639 | /* need the manual connection? */ |
| 4640 | if (alc880_is_multi_pin(nid)) { |
| 4641 | struct alc_spec *spec = codec->spec; |
| 4642 | int idx = alc880_multi_pin_idx(nid); |
| 4643 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4644 | AC_VERB_SET_CONNECT_SEL, |
| 4645 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4646 | } |
| 4647 | } |
| 4648 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4649 | static int get_pin_type(int line_out_type) |
| 4650 | { |
| 4651 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4652 | return PIN_HP; |
| 4653 | else |
| 4654 | return PIN_OUT; |
| 4655 | } |
| 4656 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4657 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4658 | { |
| 4659 | struct alc_spec *spec = codec->spec; |
| 4660 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4661 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4662 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4663 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4664 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4665 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4666 | } |
| 4667 | } |
| 4668 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4669 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4670 | { |
| 4671 | struct alc_spec *spec = codec->spec; |
| 4672 | hda_nid_t pin; |
| 4673 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4674 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4675 | if (pin) /* connect to front */ |
| 4676 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4677 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4678 | if (pin) /* connect to front */ |
| 4679 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4680 | } |
| 4681 | |
| 4682 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4683 | { |
| 4684 | struct alc_spec *spec = codec->spec; |
| 4685 | int i; |
| 4686 | |
| 4687 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4688 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4689 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4690 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4691 | if (nid != ALC880_PIN_CD_NID && |
| 4692 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4693 | snd_hda_codec_write(codec, nid, 0, |
| 4694 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4695 | AMP_OUT_MUTE); |
| 4696 | } |
| 4697 | } |
| 4698 | } |
| 4699 | |
| 4700 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4701 | /* return 1 if successful, 0 if the proper config is not found, |
| 4702 | * or a negative error code |
| 4703 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4704 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4705 | { |
| 4706 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4707 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4708 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4709 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4710 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4711 | alc880_ignore); |
| 4712 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4713 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4714 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4715 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4716 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4717 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4718 | if (err < 0) |
| 4719 | return err; |
| 4720 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4721 | if (err < 0) |
| 4722 | return err; |
| 4723 | err = alc880_auto_create_extra_out(spec, |
| 4724 | spec->autocfg.speaker_pins[0], |
| 4725 | "Speaker"); |
| 4726 | if (err < 0) |
| 4727 | return err; |
| 4728 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4729 | "Headphone"); |
| 4730 | if (err < 0) |
| 4731 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4732 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4733 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4734 | return err; |
| 4735 | |
| 4736 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4737 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4738 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4739 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4740 | hda_nid_t dig_nid; |
| 4741 | err = snd_hda_get_connections(codec, |
| 4742 | spec->autocfg.dig_out_pins[i], |
| 4743 | &dig_nid, 1); |
| 4744 | if (err < 0) |
| 4745 | continue; |
| 4746 | if (!i) |
| 4747 | spec->multiout.dig_out_nid = dig_nid; |
| 4748 | else { |
| 4749 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4750 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4751 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4752 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4753 | } |
| 4754 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4755 | if (spec->autocfg.dig_in_pin) |
| 4756 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4757 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4758 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4759 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4760 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4761 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4762 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4763 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4764 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4765 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4766 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4767 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4768 | return 1; |
| 4769 | } |
| 4770 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4771 | /* additional initialization for auto-configuration model */ |
| 4772 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4773 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4774 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4775 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4776 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4777 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4778 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4779 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4780 | } |
| 4781 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4782 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 4783 | * one of two digital mic pins, e.g. on ALC272 |
| 4784 | */ |
| 4785 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4786 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4787 | struct alc_spec *spec = codec->spec; |
| 4788 | int i; |
| 4789 | |
| 4790 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4791 | hda_nid_t cap = spec->capsrc_nids ? |
| 4792 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4793 | int iidx, eidx; |
| 4794 | |
| 4795 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 4796 | if (iidx < 0) |
| 4797 | continue; |
| 4798 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 4799 | if (eidx < 0) |
| 4800 | continue; |
| 4801 | spec->int_mic.mux_idx = iidx; |
| 4802 | spec->ext_mic.mux_idx = eidx; |
| 4803 | if (spec->capsrc_nids) |
| 4804 | spec->capsrc_nids += i; |
| 4805 | spec->adc_nids += i; |
| 4806 | spec->num_adc_nids = 1; |
| 4807 | return; |
| 4808 | } |
| 4809 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 4810 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 4811 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 4812 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 4813 | } |
| 4814 | |
| 4815 | static void set_capture_mixer(struct hda_codec *codec) |
| 4816 | { |
| 4817 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4818 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4819 | { alc_capture_mixer_nosrc1, |
| 4820 | alc_capture_mixer_nosrc2, |
| 4821 | alc_capture_mixer_nosrc3 }, |
| 4822 | { alc_capture_mixer1, |
| 4823 | alc_capture_mixer2, |
| 4824 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4825 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4826 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4827 | int mux; |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4828 | if (spec->auto_mic) { |
| 4829 | mux = 0; |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4830 | fixup_automic_adc(codec); |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4831 | } else if (spec->input_mux && spec->input_mux->num_items > 1) |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4832 | mux = 1; |
| 4833 | else |
| 4834 | mux = 0; |
| 4835 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4836 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4837 | } |
| 4838 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 4839 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4840 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4841 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 4842 | #else |
| 4843 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
| 4844 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4845 | |
| 4846 | /* |
| 4847 | * OK, here we have finally the patch for ALC880 |
| 4848 | */ |
| 4849 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4850 | static int patch_alc880(struct hda_codec *codec) |
| 4851 | { |
| 4852 | struct alc_spec *spec; |
| 4853 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4854 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4855 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4856 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4857 | if (spec == NULL) |
| 4858 | return -ENOMEM; |
| 4859 | |
| 4860 | codec->spec = spec; |
| 4861 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4862 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4863 | alc880_models, |
| 4864 | alc880_cfg_tbl); |
| 4865 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 4866 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 4867 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4868 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4869 | } |
| 4870 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4871 | if (board_config == ALC880_AUTO) { |
| 4872 | /* automatic parse from the BIOS config */ |
| 4873 | err = alc880_parse_auto_config(codec); |
| 4874 | if (err < 0) { |
| 4875 | alc_free(codec); |
| 4876 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4877 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4878 | printk(KERN_INFO |
| 4879 | "hda_codec: Cannot set up configuration " |
| 4880 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4881 | board_config = ALC880_3ST; |
| 4882 | } |
| 4883 | } |
| 4884 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4885 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4886 | if (err < 0) { |
| 4887 | alc_free(codec); |
| 4888 | return err; |
| 4889 | } |
| 4890 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4891 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 4892 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4893 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4894 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4895 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4896 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4897 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4898 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4899 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4900 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4901 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4902 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4903 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4904 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 4905 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4906 | if (wcap != AC_WID_AUD_IN) { |
| 4907 | spec->adc_nids = alc880_adc_nids_alt; |
| 4908 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4909 | } else { |
| 4910 | spec->adc_nids = alc880_adc_nids; |
| 4911 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4912 | } |
| 4913 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4914 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4915 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4916 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4917 | spec->vmaster_nid = 0x0c; |
| 4918 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4919 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4920 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4921 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4922 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4923 | if (!spec->loopback.amplist) |
| 4924 | spec->loopback.amplist = alc880_loopbacks; |
| 4925 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4926 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4927 | |
| 4928 | return 0; |
| 4929 | } |
| 4930 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4931 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4932 | /* |
| 4933 | * ALC260 support |
| 4934 | */ |
| 4935 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4936 | static hda_nid_t alc260_dac_nids[1] = { |
| 4937 | /* front */ |
| 4938 | 0x02, |
| 4939 | }; |
| 4940 | |
| 4941 | static hda_nid_t alc260_adc_nids[1] = { |
| 4942 | /* ADC0 */ |
| 4943 | 0x04, |
| 4944 | }; |
| 4945 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4946 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4947 | /* ADC1 */ |
| 4948 | 0x05, |
| 4949 | }; |
| 4950 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4951 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4952 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4953 | */ |
| 4954 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4955 | /* ADC0, ADC1 */ |
| 4956 | 0x04, 0x05 |
| 4957 | }; |
| 4958 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4959 | #define ALC260_DIGOUT_NID 0x03 |
| 4960 | #define ALC260_DIGIN_NID 0x06 |
| 4961 | |
| 4962 | static struct hda_input_mux alc260_capture_source = { |
| 4963 | .num_items = 4, |
| 4964 | .items = { |
| 4965 | { "Mic", 0x0 }, |
| 4966 | { "Front Mic", 0x1 }, |
| 4967 | { "Line", 0x2 }, |
| 4968 | { "CD", 0x4 }, |
| 4969 | }, |
| 4970 | }; |
| 4971 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4972 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4973 | * headphone jack and the internal CD lines since these are the only pins at |
| 4974 | * which audio can appear. For flexibility, also allow the option of |
| 4975 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4976 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4977 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4978 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4979 | { |
| 4980 | .num_items = 3, |
| 4981 | .items = { |
| 4982 | { "Mic/Line", 0x0 }, |
| 4983 | { "CD", 0x4 }, |
| 4984 | { "Headphone", 0x2 }, |
| 4985 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4986 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4987 | { |
| 4988 | .num_items = 4, |
| 4989 | .items = { |
| 4990 | { "Mic/Line", 0x0 }, |
| 4991 | { "CD", 0x4 }, |
| 4992 | { "Headphone", 0x2 }, |
| 4993 | { "Mixer", 0x5 }, |
| 4994 | }, |
| 4995 | }, |
| 4996 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4997 | }; |
| 4998 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4999 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5000 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5001 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5002 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5003 | { |
| 5004 | .num_items = 4, |
| 5005 | .items = { |
| 5006 | { "Mic", 0x0 }, |
| 5007 | { "Line", 0x2 }, |
| 5008 | { "CD", 0x4 }, |
| 5009 | { "Headphone", 0x5 }, |
| 5010 | }, |
| 5011 | }, |
| 5012 | { |
| 5013 | .num_items = 5, |
| 5014 | .items = { |
| 5015 | { "Mic", 0x0 }, |
| 5016 | { "Line", 0x2 }, |
| 5017 | { "CD", 0x4 }, |
| 5018 | { "Headphone", 0x6 }, |
| 5019 | { "Mixer", 0x5 }, |
| 5020 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5021 | }, |
| 5022 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5023 | |
| 5024 | /* Maxdata Favorit 100XS */ |
| 5025 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5026 | { |
| 5027 | .num_items = 2, |
| 5028 | .items = { |
| 5029 | { "Line/Mic", 0x0 }, |
| 5030 | { "CD", 0x4 }, |
| 5031 | }, |
| 5032 | }, |
| 5033 | { |
| 5034 | .num_items = 3, |
| 5035 | .items = { |
| 5036 | { "Line/Mic", 0x0 }, |
| 5037 | { "CD", 0x4 }, |
| 5038 | { "Mixer", 0x5 }, |
| 5039 | }, |
| 5040 | }, |
| 5041 | }; |
| 5042 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5043 | /* |
| 5044 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5045 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5046 | * element which allows changing the channel mode, so the verb list is |
| 5047 | * never used. |
| 5048 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5049 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5050 | { 2, NULL }, |
| 5051 | }; |
| 5052 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5053 | |
| 5054 | /* Mixer combinations |
| 5055 | * |
| 5056 | * basic: base_output + input + pc_beep + capture |
| 5057 | * HP: base_output + input + capture_alt |
| 5058 | * HP_3013: hp_3013 + input + capture |
| 5059 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5060 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5061 | */ |
| 5062 | |
| 5063 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5064 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5065 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5066 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5067 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5068 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5069 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5070 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5071 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5072 | |
| 5073 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5074 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5075 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5076 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5077 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5078 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5079 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5080 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5081 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5082 | { } /* end */ |
| 5083 | }; |
| 5084 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5085 | /* update HP, line and mono out pins according to the master switch */ |
| 5086 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5087 | hda_nid_t hp, hda_nid_t line, |
| 5088 | hda_nid_t mono) |
| 5089 | { |
| 5090 | struct alc_spec *spec = codec->spec; |
| 5091 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5092 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5093 | 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] | 5094 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5095 | 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] | 5096 | val); |
| 5097 | /* mono (speaker) depending on the HP jack sense */ |
| 5098 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5099 | 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] | 5100 | val); |
| 5101 | } |
| 5102 | |
| 5103 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5104 | struct snd_ctl_elem_value *ucontrol) |
| 5105 | { |
| 5106 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5107 | struct alc_spec *spec = codec->spec; |
| 5108 | *ucontrol->value.integer.value = spec->master_sw; |
| 5109 | return 0; |
| 5110 | } |
| 5111 | |
| 5112 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5113 | struct snd_ctl_elem_value *ucontrol) |
| 5114 | { |
| 5115 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5116 | struct alc_spec *spec = codec->spec; |
| 5117 | int val = !!*ucontrol->value.integer.value; |
| 5118 | hda_nid_t hp, line, mono; |
| 5119 | |
| 5120 | if (val == spec->master_sw) |
| 5121 | return 0; |
| 5122 | spec->master_sw = val; |
| 5123 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5124 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5125 | mono = kcontrol->private_value & 0xff; |
| 5126 | alc260_hp_master_update(codec, hp, line, mono); |
| 5127 | return 1; |
| 5128 | } |
| 5129 | |
| 5130 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5131 | { |
| 5132 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5133 | .name = "Master Playback Switch", |
| 5134 | .info = snd_ctl_boolean_mono_info, |
| 5135 | .get = alc260_hp_master_sw_get, |
| 5136 | .put = alc260_hp_master_sw_put, |
| 5137 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5138 | }, |
| 5139 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5140 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5141 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5142 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5143 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5144 | HDA_OUTPUT), |
| 5145 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5146 | { } /* end */ |
| 5147 | }; |
| 5148 | |
| 5149 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5150 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5151 | {}, |
| 5152 | }; |
| 5153 | |
| 5154 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5155 | { |
| 5156 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5157 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5158 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5159 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5160 | } |
| 5161 | |
| 5162 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5163 | { |
| 5164 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5165 | alc260_hp_automute(codec); |
| 5166 | } |
| 5167 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5168 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5169 | { |
| 5170 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5171 | .name = "Master Playback Switch", |
| 5172 | .info = snd_ctl_boolean_mono_info, |
| 5173 | .get = alc260_hp_master_sw_get, |
| 5174 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5175 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5176 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5177 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5178 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5179 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5180 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5181 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5182 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5183 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5184 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5185 | { } /* end */ |
| 5186 | }; |
| 5187 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5188 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5189 | .ops = &snd_hda_bind_vol, |
| 5190 | .values = { |
| 5191 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5192 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5193 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5194 | 0 |
| 5195 | }, |
| 5196 | }; |
| 5197 | |
| 5198 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5199 | .ops = &snd_hda_bind_sw, |
| 5200 | .values = { |
| 5201 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5202 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5203 | 0 |
| 5204 | }, |
| 5205 | }; |
| 5206 | |
| 5207 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5208 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5209 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5210 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5211 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5212 | { } /* end */ |
| 5213 | }; |
| 5214 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5215 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5216 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5217 | {}, |
| 5218 | }; |
| 5219 | |
| 5220 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5221 | { |
| 5222 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5223 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5224 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5225 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5226 | } |
| 5227 | |
| 5228 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5229 | unsigned int res) |
| 5230 | { |
| 5231 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5232 | alc260_hp_3013_automute(codec); |
| 5233 | } |
| 5234 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5235 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5236 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5237 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5238 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5239 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5240 | bits); |
| 5241 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5242 | bits); |
| 5243 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5244 | bits); |
| 5245 | } |
| 5246 | |
| 5247 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5248 | unsigned int res) |
| 5249 | { |
| 5250 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5251 | alc260_hp_3012_automute(codec); |
| 5252 | } |
| 5253 | |
| 5254 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5255 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5256 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5257 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5258 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5259 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5260 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5261 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5262 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5263 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5264 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5265 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5266 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5267 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5268 | { } /* end */ |
| 5269 | }; |
| 5270 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5271 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5272 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5273 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5274 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5275 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5276 | * revisions available in early 2006. Therefore for now allow the |
| 5277 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5278 | * that the lack of mic bias for this NID is intentional we could change the |
| 5279 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5280 | * |
| 5281 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5282 | * don't appear to make the mic bias available from the "line" jack, even |
| 5283 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5284 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5285 | * and the output jack. If this turns out to be the case for all such |
| 5286 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5287 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5288 | * |
| 5289 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5290 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5291 | * controls for such models. On models without a "mono speaker" the control |
| 5292 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5293 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5294 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5295 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5296 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5297 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5298 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5299 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5300 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5301 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5302 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5303 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5304 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5305 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5306 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5307 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5308 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5309 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5310 | { } /* end */ |
| 5311 | }; |
| 5312 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5313 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5314 | */ |
| 5315 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5316 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5317 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5318 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5319 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5320 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5321 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5322 | { } /* end */ |
| 5323 | }; |
| 5324 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5325 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5326 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5327 | */ |
| 5328 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5329 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5330 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5331 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5332 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5333 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5334 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5335 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5336 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5337 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5338 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5339 | { } /* end */ |
| 5340 | }; |
| 5341 | |
| 5342 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5343 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5344 | */ |
| 5345 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5346 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5347 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5348 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5349 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5350 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5351 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5352 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5353 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5354 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5355 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5356 | { } /* end */ |
| 5357 | }; |
| 5358 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5359 | /* |
| 5360 | * initialization verbs |
| 5361 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5362 | static struct hda_verb alc260_init_verbs[] = { |
| 5363 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5365 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5366 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5367 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5368 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5369 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5370 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5371 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5372 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5373 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5374 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5375 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5376 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5377 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5378 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5379 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5380 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5381 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5382 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5383 | /* set connection select to line in (default select for this ADC) */ |
| 5384 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5385 | /* mute capture amp left and right */ |
| 5386 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5387 | /* set connection select to line in (default select for this ADC) */ |
| 5388 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5389 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5390 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5391 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5392 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5393 | /* set vol=0 HP mixer amp left and right */ |
| 5394 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5395 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5396 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5397 | /* set vol=0 Mono mixer amp left and right */ |
| 5398 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5399 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5400 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5401 | /* unmute LINE-2 out pin */ |
| 5402 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5403 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5404 | * Line In 2 = 0x03 |
| 5405 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5406 | /* mute analog inputs */ |
| 5407 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5408 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5409 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5410 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5411 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5412 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5413 | /* mute Front out path */ |
| 5414 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5415 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5416 | /* mute Headphone out path */ |
| 5417 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5418 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5419 | /* mute Mono out path */ |
| 5420 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5421 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5422 | { } |
| 5423 | }; |
| 5424 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5425 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5426 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5427 | /* Headphone and output */ |
| 5428 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5429 | /* mono output */ |
| 5430 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5431 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5432 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5433 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5434 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5435 | /* Line In pin widget for input */ |
| 5436 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5437 | /* Line-2 pin widget for output */ |
| 5438 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5439 | /* CD pin widget for input */ |
| 5440 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5441 | /* unmute amp left and right */ |
| 5442 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5443 | /* set connection select to line in (default select for this ADC) */ |
| 5444 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5445 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5447 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5449 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5450 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5451 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5452 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5453 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5454 | * Line In 2 = 0x03 |
| 5455 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5456 | /* mute analog inputs */ |
| 5457 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5462 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5463 | /* Unmute Front out path */ |
| 5464 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5465 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5466 | /* Unmute Headphone out path */ |
| 5467 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5468 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5469 | /* Unmute Mono out path */ |
| 5470 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5471 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5472 | { } |
| 5473 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5474 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5475 | |
| 5476 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5477 | /* Line out and output */ |
| 5478 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5479 | /* mono output */ |
| 5480 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5481 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5482 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5483 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5484 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5485 | /* Line In pin widget for input */ |
| 5486 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5487 | /* Headphone pin widget for output */ |
| 5488 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5489 | /* CD pin widget for input */ |
| 5490 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5491 | /* unmute amp left and right */ |
| 5492 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5493 | /* set connection select to line in (default select for this ADC) */ |
| 5494 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5495 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5496 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5497 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5498 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5499 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5500 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5501 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5502 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5503 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5504 | * Line In 2 = 0x03 |
| 5505 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5506 | /* mute analog inputs */ |
| 5507 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5508 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5509 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5510 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5511 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5512 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5513 | /* Unmute Front out path */ |
| 5514 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5515 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5516 | /* Unmute Headphone out path */ |
| 5517 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5518 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5519 | /* Unmute Mono out path */ |
| 5520 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5521 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5522 | { } |
| 5523 | }; |
| 5524 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5525 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5526 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5527 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5528 | */ |
| 5529 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5530 | /* Disable all GPIOs */ |
| 5531 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5532 | /* Internal speaker is connected to headphone pin */ |
| 5533 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5534 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5535 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5536 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5537 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5538 | /* Ensure all other unused pins are disabled and muted. */ |
| 5539 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5540 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5541 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5542 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5543 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5544 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5545 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5546 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5547 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5548 | /* Disable digital (SPDIF) pins */ |
| 5549 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5550 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5551 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5552 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5553 | * when acting as an output. |
| 5554 | */ |
| 5555 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5556 | |
| 5557 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5558 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5559 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5560 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5561 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5562 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5563 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5564 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5565 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5566 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5567 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5568 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5569 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5570 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5571 | * If the pin mode is changed by the user the pin mode control will |
| 5572 | * take care of enabling the pin's input/output buffers as needed. |
| 5573 | * Therefore there's no need to enable the input buffer at this |
| 5574 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5575 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5577 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5578 | * mixer ctrl) |
| 5579 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5580 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5581 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5582 | /* Mute capture amp left and right */ |
| 5583 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5584 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5585 | * in (on mic1 pin) |
| 5586 | */ |
| 5587 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5588 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5589 | /* Do the same for the second ADC: mute capture input amp and |
| 5590 | * set ADC connection to line in (on mic1 pin) |
| 5591 | */ |
| 5592 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5593 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5594 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5595 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5596 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5597 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5598 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5599 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5600 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5601 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5602 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5603 | {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] | 5604 | |
| 5605 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5606 | }; |
| 5607 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5608 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5609 | * similar laptops (adapted from Fujitsu init verbs). |
| 5610 | */ |
| 5611 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5612 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5613 | * the headphone jack. Turn this on and rely on the standard mute |
| 5614 | * methods whenever the user wants to turn these outputs off. |
| 5615 | */ |
| 5616 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5617 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5618 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5619 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5620 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5621 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5622 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5623 | /* Line In jack is connected to Line1 pin */ |
| 5624 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5625 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5626 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5627 | /* Ensure all other unused pins are disabled and muted. */ |
| 5628 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5629 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5630 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5631 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5632 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5633 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5634 | /* Disable digital (SPDIF) pins */ |
| 5635 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5636 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5637 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5638 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5639 | * bus when acting as outputs. |
| 5640 | */ |
| 5641 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5642 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5643 | |
| 5644 | /* Start with output sum widgets muted and their output gains at min */ |
| 5645 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5646 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5647 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5648 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5649 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5650 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5651 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5652 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5653 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5654 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5655 | /* Unmute Line-out pin widget amp left and right |
| 5656 | * (no equiv mixer ctrl) |
| 5657 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5658 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5659 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5660 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5661 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5662 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5663 | * will take care of enabling the pin's input/output buffers as needed. |
| 5664 | * Therefore there's no need to enable the input buffer at this |
| 5665 | * stage. |
| 5666 | */ |
| 5667 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5668 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5669 | |
| 5670 | /* Mute capture amp left and right */ |
| 5671 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5672 | /* Set ADC connection select to match default mixer setting - mic |
| 5673 | * (on mic1 pin) |
| 5674 | */ |
| 5675 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5676 | |
| 5677 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5678 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5679 | */ |
| 5680 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5681 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5682 | |
| 5683 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5684 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5685 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5686 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5687 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5688 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5689 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5690 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5691 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5692 | |
| 5693 | { } |
| 5694 | }; |
| 5695 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5696 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5697 | * (adapted from Acer init verbs). |
| 5698 | */ |
| 5699 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5700 | /* GPIO 0 enables the output jack. |
| 5701 | * Turn this on and rely on the standard mute |
| 5702 | * methods whenever the user wants to turn these outputs off. |
| 5703 | */ |
| 5704 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5705 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5706 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5707 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5708 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5709 | /* Ensure all other unused pins are disabled and muted. */ |
| 5710 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5711 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5712 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5713 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5714 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5715 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5716 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5717 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5718 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5719 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5720 | /* Disable digital (SPDIF) pins */ |
| 5721 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5722 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5723 | |
| 5724 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5725 | * bus when acting as outputs. |
| 5726 | */ |
| 5727 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5728 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5729 | |
| 5730 | /* Start with output sum widgets muted and their output gains at min */ |
| 5731 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5732 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5733 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5734 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5735 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5736 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5737 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5738 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5739 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5740 | |
| 5741 | /* Unmute Line-out pin widget amp left and right |
| 5742 | * (no equiv mixer ctrl) |
| 5743 | */ |
| 5744 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5745 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5746 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5747 | * will take care of enabling the pin's input/output buffers as needed. |
| 5748 | * Therefore there's no need to enable the input buffer at this |
| 5749 | * stage. |
| 5750 | */ |
| 5751 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5752 | |
| 5753 | /* Mute capture amp left and right */ |
| 5754 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5755 | /* Set ADC connection select to match default mixer setting - mic |
| 5756 | * (on mic1 pin) |
| 5757 | */ |
| 5758 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5759 | |
| 5760 | /* Do similar with the second ADC: mute capture input amp and |
| 5761 | * set ADC connection to mic to match ALSA's default state. |
| 5762 | */ |
| 5763 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5764 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5765 | |
| 5766 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5767 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5768 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5769 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5770 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5771 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5772 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5773 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5774 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5775 | |
| 5776 | { } |
| 5777 | }; |
| 5778 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5779 | static struct hda_verb alc260_will_verbs[] = { |
| 5780 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5781 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5782 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5783 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5784 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5785 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5786 | {} |
| 5787 | }; |
| 5788 | |
| 5789 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5790 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5791 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5792 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5793 | |
| 5794 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5795 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5796 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5797 | |
| 5798 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5799 | {} |
| 5800 | }; |
| 5801 | |
| 5802 | /* toggle speaker-output according to the hp-jack state */ |
| 5803 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5804 | { |
| 5805 | unsigned int present; |
| 5806 | |
| 5807 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5808 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5809 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5810 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5811 | AC_VERB_SET_GPIO_DATA, 1); |
| 5812 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5813 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5814 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5815 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5816 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5817 | AC_VERB_SET_GPIO_DATA, 0); |
| 5818 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5819 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5820 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5821 | } |
| 5822 | } |
| 5823 | |
| 5824 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5825 | unsigned int res) |
| 5826 | { |
| 5827 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5828 | alc260_replacer_672v_automute(codec); |
| 5829 | } |
| 5830 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5831 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5832 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5833 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5834 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5835 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5836 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5837 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5838 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5839 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5840 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5841 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5842 | {} |
| 5843 | }; |
| 5844 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5845 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5846 | * configuration. |
| 5847 | */ |
| 5848 | #ifdef CONFIG_SND_DEBUG |
| 5849 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5850 | 0x02, |
| 5851 | }; |
| 5852 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5853 | 0x04, 0x05, |
| 5854 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5855 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5856 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5857 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5858 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5859 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5860 | { |
| 5861 | .num_items = 7, |
| 5862 | .items = { |
| 5863 | { "MIC1 pin", 0x0 }, |
| 5864 | { "MIC2 pin", 0x1 }, |
| 5865 | { "LINE1 pin", 0x2 }, |
| 5866 | { "LINE2 pin", 0x3 }, |
| 5867 | { "CD pin", 0x4 }, |
| 5868 | { "LINE-OUT pin", 0x5 }, |
| 5869 | { "HP-OUT pin", 0x6 }, |
| 5870 | }, |
| 5871 | }, |
| 5872 | { |
| 5873 | .num_items = 8, |
| 5874 | .items = { |
| 5875 | { "MIC1 pin", 0x0 }, |
| 5876 | { "MIC2 pin", 0x1 }, |
| 5877 | { "LINE1 pin", 0x2 }, |
| 5878 | { "LINE2 pin", 0x3 }, |
| 5879 | { "CD pin", 0x4 }, |
| 5880 | { "Mixer", 0x5 }, |
| 5881 | { "LINE-OUT pin", 0x6 }, |
| 5882 | { "HP-OUT pin", 0x7 }, |
| 5883 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5884 | }, |
| 5885 | }; |
| 5886 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5887 | /* Output driver widgets */ |
| 5888 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5889 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5890 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5891 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5892 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5893 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5894 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5895 | /* Modes for retasking pin widgets |
| 5896 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5897 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5898 | * mention this restriction. At this stage it's not clear whether |
| 5899 | * this behaviour is intentional or is a hardware bug in chip |
| 5900 | * revisions available at least up until early 2006. Therefore for |
| 5901 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5902 | * choices, but if it turns out that the lack of mic bias for these |
| 5903 | * NIDs is intentional we could change their modes from |
| 5904 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5905 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5906 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5907 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5908 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5909 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5910 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5911 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5912 | |
| 5913 | /* Loopback mixer controls */ |
| 5914 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5915 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5916 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5917 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5918 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5919 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5920 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5921 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5922 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5923 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5924 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5925 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5926 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5927 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5928 | |
| 5929 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5930 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5931 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5932 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5933 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5934 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5935 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5936 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5937 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5938 | */ |
| 5939 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5940 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5941 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5942 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5943 | * this output to turn on an external amplifier. |
| 5944 | */ |
| 5945 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5946 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5947 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5948 | { } /* end */ |
| 5949 | }; |
| 5950 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5951 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5952 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5953 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5954 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5955 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5956 | /* Enable retasking pins as output, initially without power amp */ |
| 5957 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5958 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5959 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5960 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5961 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5962 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5963 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5964 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5965 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5966 | * payload also sets the generation to 0, output to be in "consumer" |
| 5967 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5968 | * control. |
| 5969 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5970 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5971 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5972 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5973 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5974 | * OUT1 sum bus when acting as an output. |
| 5975 | */ |
| 5976 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5977 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5978 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5979 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5980 | |
| 5981 | /* Start with output sum widgets muted and their output gains at min */ |
| 5982 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5983 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5984 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5985 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5986 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5987 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5988 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5989 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5990 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5991 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5992 | /* Unmute retasking pin widget output buffers since the default |
| 5993 | * state appears to be output. As the pin mode is changed by the |
| 5994 | * user the pin mode control will take care of enabling the pin's |
| 5995 | * input/output buffers as needed. |
| 5996 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5997 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5998 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5999 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6000 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6001 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6002 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6003 | /* Also unmute the mono-out pin widget */ |
| 6004 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6005 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6006 | /* Mute capture amp left and right */ |
| 6007 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6008 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6009 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6010 | */ |
| 6011 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6012 | |
| 6013 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6014 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6015 | */ |
| 6016 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6017 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6018 | |
| 6019 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6020 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6021 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6022 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6023 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6024 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6025 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6026 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6027 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6028 | |
| 6029 | { } |
| 6030 | }; |
| 6031 | #endif |
| 6032 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6033 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6034 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6035 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6036 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6037 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6038 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6039 | /* |
| 6040 | * for BIOS auto-configuration |
| 6041 | */ |
| 6042 | |
| 6043 | 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] | 6044 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6045 | { |
| 6046 | hda_nid_t nid_vol; |
| 6047 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6048 | int err; |
| 6049 | |
| 6050 | if (nid >= 0x0f && nid < 0x11) { |
| 6051 | nid_vol = nid - 0x7; |
| 6052 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6053 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6054 | } else if (nid == 0x11) { |
| 6055 | nid_vol = nid - 0x7; |
| 6056 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6057 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6058 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6059 | nid_vol = 0x08; |
| 6060 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6061 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6062 | } else |
| 6063 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6064 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6065 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6066 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6067 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val); |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6068 | if (err < 0) |
| 6069 | return err; |
| 6070 | *vol_bits |= (1 << nid_vol); |
| 6071 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6072 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6073 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6074 | return err; |
| 6075 | return 1; |
| 6076 | } |
| 6077 | |
| 6078 | /* add playback controls from the parsed DAC table */ |
| 6079 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6080 | const struct auto_pin_cfg *cfg) |
| 6081 | { |
| 6082 | hda_nid_t nid; |
| 6083 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6084 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6085 | |
| 6086 | spec->multiout.num_dacs = 1; |
| 6087 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6088 | spec->multiout.dac_nids[0] = 0x02; |
| 6089 | |
| 6090 | nid = cfg->line_out_pins[0]; |
| 6091 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6092 | const char *pfx; |
| 6093 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6094 | pfx = "Master"; |
| 6095 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6096 | pfx = "Speaker"; |
| 6097 | else |
| 6098 | pfx = "Front"; |
| 6099 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6100 | if (err < 0) |
| 6101 | return err; |
| 6102 | } |
| 6103 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6104 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6105 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6106 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6107 | if (err < 0) |
| 6108 | return err; |
| 6109 | } |
| 6110 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6111 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6112 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6113 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6114 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6115 | if (err < 0) |
| 6116 | return err; |
| 6117 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6118 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6119 | } |
| 6120 | |
| 6121 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6122 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6123 | const struct auto_pin_cfg *cfg) |
| 6124 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6125 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6126 | } |
| 6127 | |
| 6128 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6129 | hda_nid_t nid, int pin_type, |
| 6130 | int sel_idx) |
| 6131 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6132 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6133 | /* need the manual connection? */ |
| 6134 | if (nid >= 0x12) { |
| 6135 | int idx = nid - 0x12; |
| 6136 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6137 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6138 | } |
| 6139 | } |
| 6140 | |
| 6141 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6142 | { |
| 6143 | struct alc_spec *spec = codec->spec; |
| 6144 | hda_nid_t nid; |
| 6145 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6146 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6147 | if (nid) { |
| 6148 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6149 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6150 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6151 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6152 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6153 | if (nid) |
| 6154 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6155 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6156 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6157 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6158 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6159 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6160 | |
| 6161 | #define ALC260_PIN_CD_NID 0x16 |
| 6162 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6163 | { |
| 6164 | struct alc_spec *spec = codec->spec; |
| 6165 | int i; |
| 6166 | |
| 6167 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6168 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6169 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6170 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6171 | if (nid != ALC260_PIN_CD_NID && |
| 6172 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6173 | snd_hda_codec_write(codec, nid, 0, |
| 6174 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6175 | AMP_OUT_MUTE); |
| 6176 | } |
| 6177 | } |
| 6178 | } |
| 6179 | |
| 6180 | /* |
| 6181 | * generic initialization of ADC, input mixers and output mixers |
| 6182 | */ |
| 6183 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6184 | /* |
| 6185 | * Unmute ADC0-1 and set the default input to mic-in |
| 6186 | */ |
| 6187 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6188 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6189 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6190 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6191 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6192 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6193 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6194 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6195 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6196 | */ |
| 6197 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6198 | /* mute analog inputs */ |
| 6199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6201 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6202 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6203 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6204 | |
| 6205 | /* |
| 6206 | * Set up output mixers (0x08 - 0x0a) |
| 6207 | */ |
| 6208 | /* set vol=0 to output mixers */ |
| 6209 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6210 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6211 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6212 | /* set up input amps for analog loopback */ |
| 6213 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6214 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6215 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6216 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6217 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6218 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6219 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6220 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6221 | { } |
| 6222 | }; |
| 6223 | |
| 6224 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6225 | { |
| 6226 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6227 | int err; |
| 6228 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6229 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6230 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6231 | alc260_ignore); |
| 6232 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6233 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6234 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6235 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6236 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6237 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6238 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6239 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6240 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6241 | return err; |
| 6242 | |
| 6243 | spec->multiout.max_channels = 2; |
| 6244 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6245 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6246 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6247 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6248 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6249 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6250 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6251 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6252 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6253 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6254 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6255 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6256 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6257 | return 1; |
| 6258 | } |
| 6259 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6260 | /* additional initialization for auto-configuration model */ |
| 6261 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6262 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6263 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6264 | alc260_auto_init_multi_out(codec); |
| 6265 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6266 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6267 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6268 | } |
| 6269 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6270 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6271 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6272 | { 0x07, HDA_INPUT, 0 }, |
| 6273 | { 0x07, HDA_INPUT, 1 }, |
| 6274 | { 0x07, HDA_INPUT, 2 }, |
| 6275 | { 0x07, HDA_INPUT, 3 }, |
| 6276 | { 0x07, HDA_INPUT, 4 }, |
| 6277 | { } /* end */ |
| 6278 | }; |
| 6279 | #endif |
| 6280 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6281 | /* |
| 6282 | * ALC260 configurations |
| 6283 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6284 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6285 | [ALC260_BASIC] = "basic", |
| 6286 | [ALC260_HP] = "hp", |
| 6287 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6288 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6289 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6290 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6291 | [ALC260_WILL] = "will", |
| 6292 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6293 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6294 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6295 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6296 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6297 | [ALC260_AUTO] = "auto", |
| 6298 | }; |
| 6299 | |
| 6300 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6301 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6302 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6303 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6304 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6305 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6306 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6307 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6308 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6309 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6310 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6311 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6312 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6313 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6314 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6315 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6316 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6317 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6318 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6319 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6320 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6321 | {} |
| 6322 | }; |
| 6323 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6324 | static struct alc_config_preset alc260_presets[] = { |
| 6325 | [ALC260_BASIC] = { |
| 6326 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6327 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6328 | .init_verbs = { alc260_init_verbs }, |
| 6329 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6330 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6331 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6332 | .adc_nids = alc260_adc_nids, |
| 6333 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6334 | .channel_mode = alc260_modes, |
| 6335 | .input_mux = &alc260_capture_source, |
| 6336 | }, |
| 6337 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6338 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6339 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6340 | .init_verbs = { alc260_init_verbs, |
| 6341 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6342 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6343 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6344 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6345 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6346 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6347 | .channel_mode = alc260_modes, |
| 6348 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6349 | .unsol_event = alc260_hp_unsol_event, |
| 6350 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6351 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6352 | [ALC260_HP_DC7600] = { |
| 6353 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6354 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6355 | .init_verbs = { alc260_init_verbs, |
| 6356 | alc260_hp_dc7600_verbs }, |
| 6357 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6358 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6359 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6360 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6361 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6362 | .channel_mode = alc260_modes, |
| 6363 | .input_mux = &alc260_capture_source, |
| 6364 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6365 | .init_hook = alc260_hp_3012_automute, |
| 6366 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6367 | [ALC260_HP_3013] = { |
| 6368 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6369 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6370 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6371 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6372 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6373 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6374 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6375 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6376 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6377 | .channel_mode = alc260_modes, |
| 6378 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6379 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6380 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6381 | }, |
| 6382 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6383 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6384 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6385 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6386 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6387 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6388 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6389 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6390 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6391 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6392 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6393 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6394 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6395 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6396 | .init_verbs = { alc260_acer_init_verbs }, |
| 6397 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6398 | .dac_nids = alc260_dac_nids, |
| 6399 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6400 | .adc_nids = alc260_dual_adc_nids, |
| 6401 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6402 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6403 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6404 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6405 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6406 | [ALC260_FAVORIT100] = { |
| 6407 | .mixers = { alc260_favorit100_mixer }, |
| 6408 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6409 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6410 | .dac_nids = alc260_dac_nids, |
| 6411 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6412 | .adc_nids = alc260_dual_adc_nids, |
| 6413 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6414 | .channel_mode = alc260_modes, |
| 6415 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6416 | .input_mux = alc260_favorit100_capture_sources, |
| 6417 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6418 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6419 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6420 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6421 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6422 | .dac_nids = alc260_dac_nids, |
| 6423 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6424 | .adc_nids = alc260_adc_nids, |
| 6425 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6426 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6427 | .channel_mode = alc260_modes, |
| 6428 | .input_mux = &alc260_capture_source, |
| 6429 | }, |
| 6430 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6431 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6432 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6433 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6434 | .dac_nids = alc260_dac_nids, |
| 6435 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6436 | .adc_nids = alc260_adc_nids, |
| 6437 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6438 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6439 | .channel_mode = alc260_modes, |
| 6440 | .input_mux = &alc260_capture_source, |
| 6441 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6442 | .init_hook = alc260_replacer_672v_automute, |
| 6443 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6444 | #ifdef CONFIG_SND_DEBUG |
| 6445 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6446 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6447 | .init_verbs = { alc260_test_init_verbs }, |
| 6448 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6449 | .dac_nids = alc260_test_dac_nids, |
| 6450 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6451 | .adc_nids = alc260_test_adc_nids, |
| 6452 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6453 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6454 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6455 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6456 | }, |
| 6457 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6458 | }; |
| 6459 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6460 | static int patch_alc260(struct hda_codec *codec) |
| 6461 | { |
| 6462 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6463 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6464 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6465 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6466 | if (spec == NULL) |
| 6467 | return -ENOMEM; |
| 6468 | |
| 6469 | codec->spec = spec; |
| 6470 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6471 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6472 | alc260_models, |
| 6473 | alc260_cfg_tbl); |
| 6474 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6475 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6476 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6477 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6478 | } |
| 6479 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6480 | if (board_config == ALC260_AUTO) { |
| 6481 | /* automatic parse from the BIOS config */ |
| 6482 | err = alc260_parse_auto_config(codec); |
| 6483 | if (err < 0) { |
| 6484 | alc_free(codec); |
| 6485 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6486 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6487 | printk(KERN_INFO |
| 6488 | "hda_codec: Cannot set up configuration " |
| 6489 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6490 | board_config = ALC260_BASIC; |
| 6491 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6492 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6493 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6494 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6495 | if (err < 0) { |
| 6496 | alc_free(codec); |
| 6497 | return err; |
| 6498 | } |
| 6499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6500 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6501 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6502 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6503 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6504 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6505 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6506 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6507 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6508 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6509 | if (!spec->adc_nids && spec->input_mux) { |
| 6510 | /* check whether NID 0x04 is valid */ |
| 6511 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6512 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6513 | /* get type */ |
| 6514 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6515 | spec->adc_nids = alc260_adc_nids_alt; |
| 6516 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6517 | } else { |
| 6518 | spec->adc_nids = alc260_adc_nids; |
| 6519 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6520 | } |
| 6521 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6522 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6523 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6524 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6525 | spec->vmaster_nid = 0x08; |
| 6526 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6527 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6528 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6529 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6530 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6531 | if (!spec->loopback.amplist) |
| 6532 | spec->loopback.amplist = alc260_loopbacks; |
| 6533 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6534 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6535 | |
| 6536 | return 0; |
| 6537 | } |
| 6538 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6539 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6540 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6541 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6542 | * |
| 6543 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6544 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6545 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6546 | * 6-channel independent captures. |
| 6547 | * |
| 6548 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6549 | * driver yet). |
| 6550 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6551 | #define ALC882_DIGOUT_NID 0x06 |
| 6552 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6553 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6554 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6555 | #define ALC1200_DIGOUT_NID 0x10 |
| 6556 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6557 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6558 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6559 | { 8, NULL } |
| 6560 | }; |
| 6561 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6562 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6563 | static hda_nid_t alc882_dac_nids[4] = { |
| 6564 | /* front, rear, clfe, rear_surr */ |
| 6565 | 0x02, 0x03, 0x04, 0x05 |
| 6566 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6567 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6568 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6569 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6570 | #define alc882_adc_nids alc880_adc_nids |
| 6571 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6572 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6573 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6574 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6575 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6576 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6577 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6578 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6579 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6580 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6581 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6582 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6583 | /* input MUX */ |
| 6584 | /* FIXME: should be a matrix-type input source selection */ |
| 6585 | |
| 6586 | static struct hda_input_mux alc882_capture_source = { |
| 6587 | .num_items = 4, |
| 6588 | .items = { |
| 6589 | { "Mic", 0x0 }, |
| 6590 | { "Front Mic", 0x1 }, |
| 6591 | { "Line", 0x2 }, |
| 6592 | { "CD", 0x4 }, |
| 6593 | }, |
| 6594 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6595 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6596 | #define alc883_capture_source alc882_capture_source |
| 6597 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6598 | static struct hda_input_mux alc889_capture_source = { |
| 6599 | .num_items = 3, |
| 6600 | .items = { |
| 6601 | { "Front Mic", 0x0 }, |
| 6602 | { "Mic", 0x3 }, |
| 6603 | { "Line", 0x2 }, |
| 6604 | }, |
| 6605 | }; |
| 6606 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6607 | static struct hda_input_mux mb5_capture_source = { |
| 6608 | .num_items = 3, |
| 6609 | .items = { |
| 6610 | { "Mic", 0x1 }, |
| 6611 | { "Line", 0x2 }, |
| 6612 | { "CD", 0x4 }, |
| 6613 | }, |
| 6614 | }; |
| 6615 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6616 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6617 | .num_items = 4, |
| 6618 | .items = { |
| 6619 | { "Mic", 0x1 }, |
| 6620 | { "Front Mic", 0x0 }, |
| 6621 | { "Line", 0x2 }, |
| 6622 | { "CD", 0x4 }, |
| 6623 | }, |
| 6624 | }; |
| 6625 | |
| 6626 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6627 | .num_items = 2, |
| 6628 | .items = { |
| 6629 | { "Mic", 0x1 }, |
| 6630 | { "Line", 0x2 }, |
| 6631 | }, |
| 6632 | }; |
| 6633 | |
| 6634 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6635 | .num_items = 4, |
| 6636 | .items = { |
| 6637 | { "Mic", 0x0 }, |
| 6638 | { "iMic", 0x1 }, |
| 6639 | { "Line", 0x2 }, |
| 6640 | { "CD", 0x4 }, |
| 6641 | }, |
| 6642 | }; |
| 6643 | |
| 6644 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6645 | .num_items = 2, |
| 6646 | .items = { |
| 6647 | { "Mic", 0x0 }, |
| 6648 | { "Int Mic", 0x1 }, |
| 6649 | }, |
| 6650 | }; |
| 6651 | |
| 6652 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6653 | .num_items = 3, |
| 6654 | .items = { |
| 6655 | { "Mic", 0x0 }, |
| 6656 | { "Front Mic", 0x1 }, |
| 6657 | { "Line", 0x4 }, |
| 6658 | }, |
| 6659 | }; |
| 6660 | |
| 6661 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6662 | .num_items = 2, |
| 6663 | .items = { |
| 6664 | { "Mic", 0x0 }, |
| 6665 | { "Line", 0x2 }, |
| 6666 | }, |
| 6667 | }; |
| 6668 | |
| 6669 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6670 | .num_items = 2, |
| 6671 | .items = { |
| 6672 | { "Mic", 0x0 }, |
| 6673 | /* Front Mic (0x01) unused */ |
| 6674 | { "Line", 0x2 }, |
| 6675 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 6676 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6677 | }, |
| 6678 | }; |
| 6679 | |
| 6680 | /* |
| 6681 | * 2ch mode |
| 6682 | */ |
| 6683 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6684 | { 2, NULL } |
| 6685 | }; |
| 6686 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6687 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6688 | * 2ch mode |
| 6689 | */ |
| 6690 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6691 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6692 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6693 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6694 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6695 | { } /* end */ |
| 6696 | }; |
| 6697 | |
| 6698 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6699 | * 4ch mode |
| 6700 | */ |
| 6701 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6702 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6703 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6704 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6705 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6706 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6707 | { } /* end */ |
| 6708 | }; |
| 6709 | |
| 6710 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6711 | * 6ch mode |
| 6712 | */ |
| 6713 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6714 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6715 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6716 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6717 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6718 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6719 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6720 | { } /* end */ |
| 6721 | }; |
| 6722 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6723 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6724 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6725 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6726 | { 6, alc882_3ST_ch6_init }, |
| 6727 | }; |
| 6728 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6729 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6730 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6731 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 6732 | * 2ch mode |
| 6733 | */ |
| 6734 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 6735 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 6736 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6737 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6738 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6739 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6740 | { } /* end */ |
| 6741 | }; |
| 6742 | |
| 6743 | /* |
| 6744 | * 4ch mode |
| 6745 | */ |
| 6746 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 6747 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6748 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6749 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6750 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6751 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6752 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6753 | { } /* end */ |
| 6754 | }; |
| 6755 | |
| 6756 | /* |
| 6757 | * 6ch mode |
| 6758 | */ |
| 6759 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 6760 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6761 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6762 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6763 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6764 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6765 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6766 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6767 | { } /* end */ |
| 6768 | }; |
| 6769 | |
| 6770 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 6771 | { 2, alc883_3ST_ch2_clevo_init }, |
| 6772 | { 4, alc883_3ST_ch4_clevo_init }, |
| 6773 | { 6, alc883_3ST_ch6_clevo_init }, |
| 6774 | }; |
| 6775 | |
| 6776 | |
| 6777 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6778 | * 6ch mode |
| 6779 | */ |
| 6780 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6781 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6782 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6783 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6784 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6785 | { } /* end */ |
| 6786 | }; |
| 6787 | |
| 6788 | /* |
| 6789 | * 8ch mode |
| 6790 | */ |
| 6791 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6792 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6793 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6794 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6795 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6796 | { } /* end */ |
| 6797 | }; |
| 6798 | |
| 6799 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6800 | { 6, alc882_sixstack_ch6_init }, |
| 6801 | { 8, alc882_sixstack_ch8_init }, |
| 6802 | }; |
| 6803 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6804 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6805 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6806 | */ |
| 6807 | |
| 6808 | /* |
| 6809 | * 2ch mode |
| 6810 | */ |
| 6811 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6812 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6813 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6814 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6815 | { } /* end */ |
| 6816 | }; |
| 6817 | |
| 6818 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6819 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6820 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6821 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6822 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6823 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6824 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6825 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6826 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6827 | { } /* end */ |
| 6828 | }; |
| 6829 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6830 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6831 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6832 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6833 | }; |
| 6834 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6835 | /* |
| 6836 | * 2ch |
| 6837 | * Speakers/Woofer/HP = Front |
| 6838 | * LineIn = Input |
| 6839 | */ |
| 6840 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6841 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6842 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6843 | { } /* end */ |
| 6844 | }; |
| 6845 | |
| 6846 | /* |
| 6847 | * 6ch mode |
| 6848 | * Speakers/HP = Front |
| 6849 | * Woofer = LFE |
| 6850 | * LineIn = Surround |
| 6851 | */ |
| 6852 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6853 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6854 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6855 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6856 | { } /* end */ |
| 6857 | }; |
| 6858 | |
| 6859 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6860 | { 2, alc885_mb5_ch2_init }, |
| 6861 | { 6, alc885_mb5_ch6_init }, |
| 6862 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6863 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6864 | |
| 6865 | /* |
| 6866 | * 2ch mode |
| 6867 | */ |
| 6868 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6869 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6870 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6871 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6872 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6873 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6874 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6875 | { } /* end */ |
| 6876 | }; |
| 6877 | |
| 6878 | /* |
| 6879 | * 4ch mode |
| 6880 | */ |
| 6881 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6882 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6883 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6884 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6885 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6886 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6887 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6888 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6889 | { } /* end */ |
| 6890 | }; |
| 6891 | |
| 6892 | /* |
| 6893 | * 6ch mode |
| 6894 | */ |
| 6895 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6896 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6897 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6898 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6899 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6900 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6901 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6902 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6903 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6904 | { } /* end */ |
| 6905 | }; |
| 6906 | |
| 6907 | /* |
| 6908 | * 8ch mode |
| 6909 | */ |
| 6910 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6911 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6912 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6913 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6914 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6915 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6916 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6917 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6918 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6919 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6920 | { } /* end */ |
| 6921 | }; |
| 6922 | |
| 6923 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6924 | { 2, alc883_4ST_ch2_init }, |
| 6925 | { 4, alc883_4ST_ch4_init }, |
| 6926 | { 6, alc883_4ST_ch6_init }, |
| 6927 | { 8, alc883_4ST_ch8_init }, |
| 6928 | }; |
| 6929 | |
| 6930 | |
| 6931 | /* |
| 6932 | * 2ch mode |
| 6933 | */ |
| 6934 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6935 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6936 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6937 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6938 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6939 | { } /* end */ |
| 6940 | }; |
| 6941 | |
| 6942 | /* |
| 6943 | * 4ch mode |
| 6944 | */ |
| 6945 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6946 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6947 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6948 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6949 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6950 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6951 | { } /* end */ |
| 6952 | }; |
| 6953 | |
| 6954 | /* |
| 6955 | * 6ch mode |
| 6956 | */ |
| 6957 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6958 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6959 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6960 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6961 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6962 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6963 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6964 | { } /* end */ |
| 6965 | }; |
| 6966 | |
| 6967 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6968 | { 2, alc883_3ST_ch2_intel_init }, |
| 6969 | { 4, alc883_3ST_ch4_intel_init }, |
| 6970 | { 6, alc883_3ST_ch6_intel_init }, |
| 6971 | }; |
| 6972 | |
| 6973 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6974 | * 2ch mode |
| 6975 | */ |
| 6976 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 6977 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6978 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6979 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6980 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6981 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6982 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6983 | { } /* end */ |
| 6984 | }; |
| 6985 | |
| 6986 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6987 | * 6ch mode |
| 6988 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6989 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6990 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6991 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6992 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6993 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6994 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6995 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6996 | { } /* end */ |
| 6997 | }; |
| 6998 | |
| 6999 | /* |
| 7000 | * 8ch mode |
| 7001 | */ |
| 7002 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7003 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7004 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7005 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7006 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7007 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7008 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7009 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7010 | { } /* end */ |
| 7011 | }; |
| 7012 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7013 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7014 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7015 | { 6, alc889_ch6_intel_init }, |
| 7016 | { 8, alc889_ch8_intel_init }, |
| 7017 | }; |
| 7018 | |
| 7019 | /* |
| 7020 | * 6ch mode |
| 7021 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7022 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7023 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7024 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7025 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7026 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7027 | { } /* end */ |
| 7028 | }; |
| 7029 | |
| 7030 | /* |
| 7031 | * 8ch mode |
| 7032 | */ |
| 7033 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7034 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7035 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7036 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7037 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7038 | { } /* end */ |
| 7039 | }; |
| 7040 | |
| 7041 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7042 | { 6, alc883_sixstack_ch6_init }, |
| 7043 | { 8, alc883_sixstack_ch8_init }, |
| 7044 | }; |
| 7045 | |
| 7046 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7047 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7048 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7049 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7050 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7051 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7052 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7053 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7054 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7055 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7056 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7057 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7058 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7059 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7060 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7061 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7062 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7063 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7064 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7065 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7066 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7067 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7068 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7069 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7070 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7071 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7072 | { } /* end */ |
| 7073 | }; |
| 7074 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7075 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7076 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7077 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7078 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7079 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7080 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7081 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7082 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7083 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7084 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7085 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7086 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7087 | { } /* end */ |
| 7088 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7089 | |
| 7090 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7092 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7093 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7094 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7095 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7096 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7097 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7098 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7099 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7100 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7101 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7102 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7103 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7104 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7105 | { } /* end */ |
| 7106 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7107 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7108 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
| 7109 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7110 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7111 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 7112 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7113 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7114 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7115 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7116 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 7117 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7118 | { } /* end */ |
| 7119 | }; |
| 7120 | |
| 7121 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7122 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7123 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7124 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7125 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7126 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7130 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7131 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7132 | { } /* end */ |
| 7133 | }; |
| 7134 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7135 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7136 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7137 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7138 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7139 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7140 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7141 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7142 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7143 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7144 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7145 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7146 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7147 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7148 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7149 | { } /* end */ |
| 7150 | }; |
| 7151 | |
| 7152 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7153 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7154 | */ |
| 7155 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7156 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7157 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7158 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7159 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7160 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7161 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7162 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7163 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7164 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7165 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7166 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7167 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7168 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7169 | { } /* end */ |
| 7170 | }; |
| 7171 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7172 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7173 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7174 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7175 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7176 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7177 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7178 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7179 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7180 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7181 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7182 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7183 | { } /* end */ |
| 7184 | }; |
| 7185 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7186 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7187 | { |
| 7188 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7189 | .name = "Channel Mode", |
| 7190 | .info = alc_ch_mode_info, |
| 7191 | .get = alc_ch_mode_get, |
| 7192 | .put = alc_ch_mode_put, |
| 7193 | }, |
| 7194 | { } /* end */ |
| 7195 | }; |
| 7196 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7197 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7198 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7199 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7200 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7201 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7202 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7203 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7204 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7205 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7206 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7207 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7208 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7209 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7210 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7211 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7212 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7213 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7214 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 7215 | /* mute analog input loopbacks */ |
| 7216 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7217 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7218 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7219 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7220 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7221 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7222 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7223 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7224 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7225 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7226 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7227 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7228 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7229 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7230 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7231 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7232 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7233 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7234 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7235 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7236 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7237 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7238 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7239 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7240 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7241 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7242 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7243 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7244 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7245 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7246 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7247 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7248 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7249 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7250 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7251 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7252 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7253 | |
| 7254 | /* FIXME: use matrix-type input source selection */ |
| 7255 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7256 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7257 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7258 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7259 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7261 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7262 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7263 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7264 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7266 | /* ADC2: mute amp left and right */ |
| 7267 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7268 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7269 | /* ADC3: mute amp left and right */ |
| 7270 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7271 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7272 | |
| 7273 | { } |
| 7274 | }; |
| 7275 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7276 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7277 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7278 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7279 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7280 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7281 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7282 | /* ADC1: mute amp left and right */ |
| 7283 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7284 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7285 | { } |
| 7286 | }; |
| 7287 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7288 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7289 | /* change to EAPD mode */ |
| 7290 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7291 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7292 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7293 | }; |
| 7294 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7295 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7296 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7297 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7298 | { } |
| 7299 | }; |
| 7300 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7301 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7302 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7303 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7304 | {} |
| 7305 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7306 | |
| 7307 | static struct hda_verb alc885_init_verbs[] = { |
| 7308 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7310 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7311 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7312 | /* Rear mixer */ |
| 7313 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7314 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7315 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7316 | /* CLFE mixer */ |
| 7317 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7318 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7319 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7320 | /* Side mixer */ |
| 7321 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7322 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7323 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7324 | |
| 7325 | /* mute analog input loopbacks */ |
| 7326 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7329 | |
| 7330 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7331 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7332 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7333 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7334 | /* Front Pin: output 0 (0x0c) */ |
| 7335 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7336 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7337 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7338 | /* Rear Pin: output 1 (0x0d) */ |
| 7339 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7340 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7341 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7342 | /* CLFE Pin: output 2 (0x0e) */ |
| 7343 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7344 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7345 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7346 | /* Side Pin: output 3 (0x0f) */ |
| 7347 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7348 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7349 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7350 | /* Mic (rear) pin: input vref at 80% */ |
| 7351 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7352 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7353 | /* Front Mic pin: input vref at 80% */ |
| 7354 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7355 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7356 | /* Line In pin: input */ |
| 7357 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7358 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7359 | |
| 7360 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7361 | /* Input mixer1 */ |
| 7362 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7363 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7364 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7365 | /* Input mixer2 */ |
| 7366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7367 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7368 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7369 | /* Input mixer3 */ |
| 7370 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7372 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7373 | /* ADC2: mute amp left and right */ |
| 7374 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7375 | /* ADC3: mute amp left and right */ |
| 7376 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7377 | |
| 7378 | { } |
| 7379 | }; |
| 7380 | |
| 7381 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7382 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7383 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7384 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7385 | { } |
| 7386 | }; |
| 7387 | |
| 7388 | |
| 7389 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7390 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7391 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7392 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7393 | { } |
| 7394 | }; |
| 7395 | |
| 7396 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7397 | #define alc883_init_verbs alc882_base_init_verbs |
| 7398 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7399 | /* Mac Pro test */ |
| 7400 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7401 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7402 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7403 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7404 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7405 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7406 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7407 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7408 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7409 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7410 | { } /* end */ |
| 7411 | }; |
| 7412 | |
| 7413 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7414 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7415 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7416 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7417 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7418 | /* Front Pin: output 0 (0x0c) */ |
| 7419 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7420 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7421 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7422 | /* Front Mic pin: input vref at 80% */ |
| 7423 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7424 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7425 | /* Speaker: output */ |
| 7426 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7427 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7428 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7429 | /* Headphone output (output 0 - 0x0c) */ |
| 7430 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7431 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7432 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7433 | |
| 7434 | /* FIXME: use matrix-type input source selection */ |
| 7435 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7436 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7437 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7438 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7439 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7440 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7441 | /* Input mixer2 */ |
| 7442 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7443 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7444 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7445 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7446 | /* Input mixer3 */ |
| 7447 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7448 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7449 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7450 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7451 | /* ADC1: mute amp left and right */ |
| 7452 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7453 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7454 | /* ADC2: mute amp left and right */ |
| 7455 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7456 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7457 | /* ADC3: mute amp left and right */ |
| 7458 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7459 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7460 | |
| 7461 | { } |
| 7462 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7463 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7464 | /* Macbook 5,1 */ |
| 7465 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7466 | /* DACs */ |
| 7467 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7468 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7469 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7470 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7471 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7473 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7474 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7475 | /* Surround mixer */ |
| 7476 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7477 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7478 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7479 | /* LFE mixer */ |
| 7480 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7481 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7482 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7483 | /* HP mixer */ |
| 7484 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7485 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7486 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7487 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7488 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7489 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7490 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7491 | /* LFE Pin (0x0e) */ |
| 7492 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7493 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7494 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7495 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7496 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7497 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7498 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7499 | /* Front Mic pin: input vref at 80% */ |
| 7500 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7501 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7502 | /* Line In pin */ |
| 7503 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7504 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7505 | |
| 7506 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7507 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7508 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7509 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7510 | { } |
| 7511 | }; |
| 7512 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7513 | /* Macbook Pro rev3 */ |
| 7514 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7515 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7516 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7519 | /* Rear mixer */ |
| 7520 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7521 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7522 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7523 | /* HP mixer */ |
| 7524 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7525 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7526 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7527 | /* Front Pin: output 0 (0x0c) */ |
| 7528 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7529 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7530 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7531 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7532 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7533 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7534 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7535 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7536 | /* Mic (rear) pin: input vref at 80% */ |
| 7537 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7538 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7539 | /* Front Mic pin: input vref at 80% */ |
| 7540 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7541 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7542 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7543 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7544 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7545 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7546 | |
| 7547 | /* FIXME: use matrix-type input source selection */ |
| 7548 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7549 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7550 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7551 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7552 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7553 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7554 | /* Input mixer2 */ |
| 7555 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7556 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7557 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7558 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7559 | /* Input mixer3 */ |
| 7560 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7561 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7562 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7563 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7564 | /* ADC1: mute amp left and right */ |
| 7565 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7566 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7567 | /* ADC2: mute amp left and right */ |
| 7568 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7569 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7570 | /* ADC3: mute amp left and right */ |
| 7571 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7572 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7573 | |
| 7574 | { } |
| 7575 | }; |
| 7576 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7577 | /* iMac 9,1 */ |
| 7578 | static struct hda_verb alc885_imac91_init_verbs[] = { |
| 7579 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 7580 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7581 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7582 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7583 | /* Rear mixer */ |
| 7584 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7585 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7587 | /* HP Pin: output 0 (0x0c) */ |
| 7588 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7589 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7590 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7591 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7592 | /* Internal Speakers: output 0 (0x0d) */ |
| 7593 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7594 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7595 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7596 | /* Mic (rear) pin: input vref at 80% */ |
| 7597 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7598 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7599 | /* Front Mic pin: input vref at 80% */ |
| 7600 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7601 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7602 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7603 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7604 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7605 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7606 | |
| 7607 | /* FIXME: use matrix-type input source selection */ |
| 7608 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7609 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7610 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7611 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7612 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7613 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7614 | /* Input mixer2 */ |
| 7615 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7616 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7617 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7618 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7619 | /* Input mixer3 */ |
| 7620 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7621 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7622 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7624 | /* ADC1: mute amp left and right */ |
| 7625 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7626 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7627 | /* ADC2: mute amp left and right */ |
| 7628 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7629 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7630 | /* ADC3: mute amp left and right */ |
| 7631 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7632 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7633 | |
| 7634 | { } |
| 7635 | }; |
| 7636 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7637 | /* iMac 24 mixer. */ |
| 7638 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7639 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7640 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7641 | { } /* end */ |
| 7642 | }; |
| 7643 | |
| 7644 | /* iMac 24 init verbs. */ |
| 7645 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7646 | /* Internal speakers: output 0 (0x0c) */ |
| 7647 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7648 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7649 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7650 | /* Internal speakers: output 0 (0x0c) */ |
| 7651 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7652 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7653 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7654 | /* Headphone: output 0 (0x0c) */ |
| 7655 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7656 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7657 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7658 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7659 | /* Front Mic: input vref at 80% */ |
| 7660 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7661 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7662 | { } |
| 7663 | }; |
| 7664 | |
| 7665 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7666 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7667 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7668 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7669 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7670 | spec->autocfg.hp_pins[0] = 0x14; |
| 7671 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7672 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7673 | } |
| 7674 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7675 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7676 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7677 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7678 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7679 | spec->autocfg.hp_pins[0] = 0x15; |
| 7680 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7681 | } |
| 7682 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7683 | static void alc885_imac91_automute(struct hda_codec *codec) |
| 7684 | { |
| 7685 | unsigned int present; |
| 7686 | |
| 7687 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7688 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7689 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7690 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7691 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 7692 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7693 | |
| 7694 | } |
| 7695 | |
| 7696 | static void alc885_imac91_unsol_event(struct hda_codec *codec, |
| 7697 | unsigned int res) |
| 7698 | { |
| 7699 | /* Headphone insertion or removal. */ |
| 7700 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7701 | alc885_imac91_automute(codec); |
| 7702 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7703 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7704 | static struct hda_verb alc882_targa_verbs[] = { |
| 7705 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7706 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7707 | |
| 7708 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7709 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7710 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7711 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7712 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7713 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7714 | |
| 7715 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7716 | { } /* end */ |
| 7717 | }; |
| 7718 | |
| 7719 | /* toggle speaker-output according to the hp-jack state */ |
| 7720 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7721 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7722 | struct alc_spec *spec = codec->spec; |
| 7723 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7724 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7725 | spec->jack_present ? 1 : 3); |
| 7726 | } |
| 7727 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7728 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7729 | { |
| 7730 | struct alc_spec *spec = codec->spec; |
| 7731 | |
| 7732 | spec->autocfg.hp_pins[0] = 0x14; |
| 7733 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7734 | } |
| 7735 | |
| 7736 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7737 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7738 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7739 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7740 | } |
| 7741 | |
| 7742 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7743 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7744 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7745 | |
| 7746 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7747 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7748 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7749 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7750 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7751 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7752 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7753 | |
| 7754 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7755 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7756 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7757 | { } /* end */ |
| 7758 | }; |
| 7759 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7760 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7761 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7762 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7763 | |
| 7764 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7765 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7766 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7767 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7768 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7769 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7770 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7771 | |
| 7772 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7773 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7774 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7775 | { } /* end */ |
| 7776 | }; |
| 7777 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7778 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7779 | { |
| 7780 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7781 | |
| 7782 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7783 | AC_VERB_GET_GPIO_DATA, 0); |
| 7784 | |
| 7785 | if (!muted) |
| 7786 | gpiostate |= (1 << pin); |
| 7787 | else |
| 7788 | gpiostate &= ~(1 << pin); |
| 7789 | |
| 7790 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7791 | AC_VERB_GET_GPIO_MASK, 0); |
| 7792 | gpiomask |= (1 << pin); |
| 7793 | |
| 7794 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7795 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7796 | gpiodir |= (1 << pin); |
| 7797 | |
| 7798 | |
| 7799 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7800 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7801 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7802 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7803 | |
| 7804 | msleep(1); |
| 7805 | |
| 7806 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7807 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7808 | } |
| 7809 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7810 | /* set up GPIO at initialization */ |
| 7811 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7812 | { |
| 7813 | alc882_gpio_mute(codec, 0, 0); |
| 7814 | alc882_gpio_mute(codec, 1, 0); |
| 7815 | } |
| 7816 | |
| 7817 | /* set up GPIO and update auto-muting at initialization */ |
| 7818 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7819 | { |
| 7820 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7821 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7822 | } |
| 7823 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7824 | /* |
| 7825 | * generic initialization of ADC, input mixers and output mixers |
| 7826 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7827 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7828 | /* |
| 7829 | * Unmute ADC0-2 and set the default input to mic-in |
| 7830 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7831 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7832 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7833 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7834 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7835 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7836 | /* 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] | 7837 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7838 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7839 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7840 | */ |
| 7841 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7842 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7843 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7844 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7845 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7846 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7847 | |
| 7848 | /* |
| 7849 | * Set up output mixers (0x0c - 0x0f) |
| 7850 | */ |
| 7851 | /* set vol=0 to output mixers */ |
| 7852 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7853 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7854 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7855 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7856 | /* set up input amps for analog loopback */ |
| 7857 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7858 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7859 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7860 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7861 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7862 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7863 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7864 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7865 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7866 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7867 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7868 | |
| 7869 | /* FIXME: use matrix-type input source selection */ |
| 7870 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7871 | /* Input mixer2 */ |
| 7872 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7873 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7874 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7875 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7876 | /* Input mixer3 */ |
| 7877 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7878 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7879 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7880 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7881 | |
| 7882 | { } |
| 7883 | }; |
| 7884 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7885 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7886 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7887 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7888 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7889 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7890 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7891 | { } /* end */ |
| 7892 | }; |
| 7893 | |
| 7894 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7895 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7896 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7897 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7898 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7899 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7900 | { } /* end */ |
| 7901 | }; |
| 7902 | |
| 7903 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7904 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7905 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7906 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7907 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7908 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7909 | { } /* end */ |
| 7910 | }; |
| 7911 | |
| 7912 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7913 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7914 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7915 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7916 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7917 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7918 | { } /* end */ |
| 7919 | }; |
| 7920 | |
| 7921 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7922 | { 2, alc889A_mb31_ch2_init }, |
| 7923 | { 4, alc889A_mb31_ch4_init }, |
| 7924 | { 5, alc889A_mb31_ch5_init }, |
| 7925 | { 6, alc889A_mb31_ch6_init }, |
| 7926 | }; |
| 7927 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7928 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7929 | /* eanable EAPD on medion laptop */ |
| 7930 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7931 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7932 | { } |
| 7933 | }; |
| 7934 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7935 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7936 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7937 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7938 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7939 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7940 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7941 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7942 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7943 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7944 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7945 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7946 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7947 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7948 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7949 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7950 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7951 | { } /* end */ |
| 7952 | }; |
| 7953 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7954 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7955 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7956 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7957 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7958 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7959 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7960 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7961 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7962 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7963 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7964 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7965 | { } /* end */ |
| 7966 | }; |
| 7967 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7968 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7969 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7970 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7971 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7972 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7973 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7974 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7975 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7976 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7977 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7978 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7979 | { } /* end */ |
| 7980 | }; |
| 7981 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7982 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7984 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7985 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7986 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7987 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7988 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7989 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7990 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7991 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7992 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7993 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7994 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7995 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7996 | { } /* end */ |
| 7997 | }; |
| 7998 | |
| 7999 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8000 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8001 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8002 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8003 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8004 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8005 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8006 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8007 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8008 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8009 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8010 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8011 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8012 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8013 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8014 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8015 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8016 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8017 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8018 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8019 | { } /* end */ |
| 8020 | }; |
| 8021 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8022 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8023 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8024 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8025 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8026 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8027 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8028 | HDA_OUTPUT), |
| 8029 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8030 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8031 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8032 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8033 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8034 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8035 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8036 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8037 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8038 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8039 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8040 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8041 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8042 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8043 | { } /* end */ |
| 8044 | }; |
| 8045 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8046 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8047 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8048 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8049 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8050 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8051 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8052 | HDA_OUTPUT), |
| 8053 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8054 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8055 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8056 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8057 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8058 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8059 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8060 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8061 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8062 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8064 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8065 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8066 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8067 | { } /* end */ |
| 8068 | }; |
| 8069 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8070 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8071 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8072 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8073 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8074 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8075 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8076 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8077 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8078 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8079 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8080 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8081 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8082 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8083 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8084 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8085 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8086 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8087 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8088 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8089 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8090 | { } /* end */ |
| 8091 | }; |
| 8092 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8093 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8094 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8095 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8096 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8097 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8098 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8099 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8100 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8101 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8102 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8103 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8104 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8105 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8106 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8107 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8108 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8109 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8110 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8111 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8112 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8113 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8114 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8115 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8116 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8117 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8118 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8119 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8120 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8121 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8122 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8123 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8124 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8125 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8126 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8127 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8128 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8129 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8130 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8131 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8132 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8133 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8134 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8135 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8136 | { } /* end */ |
| 8137 | }; |
| 8138 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8139 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8140 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8141 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8142 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8143 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8144 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8145 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8146 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8147 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8148 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8149 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8150 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8151 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8152 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8153 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8154 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8155 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8156 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8157 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8158 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8159 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8160 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8161 | { } /* end */ |
| 8162 | }; |
| 8163 | |
| 8164 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8165 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8166 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8167 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8168 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8169 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8170 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8171 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8172 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8173 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8174 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8175 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8176 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8177 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8178 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8179 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8180 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8181 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8182 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8183 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8184 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8185 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8186 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8187 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8188 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8189 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8190 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8191 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8192 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8193 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8194 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8195 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8196 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8197 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8199 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8200 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8201 | { } /* end */ |
| 8202 | }; |
| 8203 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8204 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8205 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8206 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8207 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8208 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8209 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8210 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8211 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8212 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8213 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8214 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8215 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8216 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8217 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8218 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8219 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8220 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8221 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8223 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8224 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8225 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8226 | { } /* end */ |
| 8227 | }; |
| 8228 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8229 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8230 | /* Output mixers */ |
| 8231 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8232 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8233 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8234 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8235 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8236 | HDA_OUTPUT), |
| 8237 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8238 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8239 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8240 | /* Output switches */ |
| 8241 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8242 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8243 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8244 | /* Boost mixers */ |
| 8245 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8246 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8247 | /* Input mixers */ |
| 8248 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8249 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8250 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8251 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8252 | { } /* end */ |
| 8253 | }; |
| 8254 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8255 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8256 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8257 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8258 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8259 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8260 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8261 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8262 | { } /* end */ |
| 8263 | }; |
| 8264 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8265 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8266 | .ops = &snd_hda_bind_vol, |
| 8267 | .values = { |
| 8268 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8269 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8270 | 0 |
| 8271 | }, |
| 8272 | }; |
| 8273 | |
| 8274 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8275 | .ops = &snd_hda_bind_sw, |
| 8276 | .values = { |
| 8277 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8278 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8279 | 0 |
| 8280 | }, |
| 8281 | }; |
| 8282 | |
| 8283 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8284 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8285 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8286 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8287 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8288 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8289 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8290 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8291 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8292 | { } /* end */ |
| 8293 | }; |
| 8294 | |
| 8295 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8296 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8297 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8298 | { |
| 8299 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8300 | /* .name = "Capture Source", */ |
| 8301 | .name = "Input Source", |
| 8302 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8303 | .info = alc_mux_enum_info, |
| 8304 | .get = alc_mux_enum_get, |
| 8305 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8306 | }, |
| 8307 | { } /* end */ |
| 8308 | }; |
| 8309 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8310 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8311 | { |
| 8312 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8313 | .name = "Channel Mode", |
| 8314 | .info = alc_ch_mode_info, |
| 8315 | .get = alc_ch_mode_get, |
| 8316 | .put = alc_ch_mode_put, |
| 8317 | }, |
| 8318 | { } /* end */ |
| 8319 | }; |
| 8320 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8321 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8322 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8323 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8324 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8325 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8326 | spec->autocfg.hp_pins[0] = 0x15; |
| 8327 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8328 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8329 | } |
| 8330 | |
| 8331 | /* auto-toggle front mic */ |
| 8332 | /* |
| 8333 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8334 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8335 | unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8336 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8337 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8338 | } |
| 8339 | */ |
| 8340 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8341 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8342 | /* HP */ |
| 8343 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8344 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8345 | /* Subwoofer */ |
| 8346 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8347 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8348 | |
| 8349 | /* enable unsolicited event */ |
| 8350 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8351 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8352 | |
| 8353 | { } /* end */ |
| 8354 | }; |
| 8355 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8356 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8357 | /* HP */ |
| 8358 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8359 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8360 | /* Int speaker */ |
| 8361 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8362 | |
| 8363 | /* enable unsolicited event */ |
| 8364 | /* |
| 8365 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8366 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8367 | */ |
| 8368 | |
| 8369 | { } /* end */ |
| 8370 | }; |
| 8371 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8372 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8373 | /* HP */ |
| 8374 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8375 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8376 | /* Int speaker */ |
| 8377 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8378 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8379 | |
| 8380 | /* enable unsolicited event */ |
| 8381 | {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] | 8382 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8383 | |
| 8384 | { } /* end */ |
| 8385 | }; |
| 8386 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8387 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8388 | /* HP */ |
| 8389 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8390 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8391 | /* Subwoofer */ |
| 8392 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8393 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8394 | |
| 8395 | /* enable unsolicited event */ |
| 8396 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8397 | |
| 8398 | { } /* end */ |
| 8399 | }; |
| 8400 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8401 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8402 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8403 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8404 | |
| 8405 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8406 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8407 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8408 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8409 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8410 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8411 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8412 | /* Connect Mic jack to CLFE */ |
| 8413 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8414 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8415 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8416 | /* Connect Line-in jack to Surround */ |
| 8417 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8418 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8419 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8420 | /* Connect HP out jack to Front */ |
| 8421 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8422 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8423 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8424 | |
| 8425 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8426 | |
| 8427 | { } /* end */ |
| 8428 | }; |
| 8429 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8430 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8431 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8432 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8433 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8434 | { } /* end */ |
| 8435 | }; |
| 8436 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8437 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8438 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8439 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8440 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8441 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8442 | { } /* end */ |
| 8443 | }; |
| 8444 | |
| 8445 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8446 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8447 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8448 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8449 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8450 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8451 | { } /* end */ |
| 8452 | }; |
| 8453 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8454 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8455 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8456 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8457 | |
| 8458 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8459 | |
| 8460 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8461 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8462 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8463 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8464 | { } /* end */ |
| 8465 | }; |
| 8466 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8467 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8468 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8469 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8470 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8471 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8472 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8473 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8474 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8475 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8476 | { } /* end */ |
| 8477 | }; |
| 8478 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8479 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8480 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8481 | { } |
| 8482 | }; |
| 8483 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8484 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8485 | /* HP */ |
| 8486 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8487 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8488 | |
| 8489 | /* enable unsolicited event */ |
| 8490 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8491 | |
| 8492 | { } /* end */ |
| 8493 | }; |
| 8494 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8495 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8496 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8497 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8498 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8499 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8500 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8501 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8502 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8503 | } |
| 8504 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8505 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8506 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8507 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8508 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8509 | {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] | 8510 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8511 | }; |
| 8512 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8513 | /* |
| 8514 | * 2ch mode |
| 8515 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8516 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8517 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8518 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8519 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8520 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8521 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8522 | }; |
| 8523 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8524 | /* |
| 8525 | * 4ch mode |
| 8526 | */ |
| 8527 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8528 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8529 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8530 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8531 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8532 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8533 | { } /* end */ |
| 8534 | }; |
| 8535 | |
| 8536 | /* |
| 8537 | * 6ch mode |
| 8538 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8539 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8540 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8541 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8542 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8543 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8544 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8545 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8546 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8547 | }; |
| 8548 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8549 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8550 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8551 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8552 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8553 | }; |
| 8554 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8555 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8556 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8557 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8558 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8559 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8560 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8561 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8562 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8563 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8564 | } |
| 8565 | |
| 8566 | /* toggle RCA according to the front-jack state */ |
| 8567 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8568 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8569 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8570 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8571 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8572 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8573 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8574 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8575 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8576 | unsigned int res) |
| 8577 | { |
| 8578 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8579 | alc888_lenovo_ms7195_front_automute(codec); |
| 8580 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8581 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8582 | } |
| 8583 | |
| 8584 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8586 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8587 | |
| 8588 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8589 | |
| 8590 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8591 | { } /* end */ |
| 8592 | }; |
| 8593 | |
| 8594 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8595 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8596 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8597 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8598 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8599 | spec->autocfg.hp_pins[0] = 0x14; |
| 8600 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8601 | } |
| 8602 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8603 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8604 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8605 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8606 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8607 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8608 | { |
| 8609 | unsigned int present; |
| 8610 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 8611 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8612 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8613 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8614 | } |
| 8615 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8616 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8617 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8618 | struct alc_spec *spec = codec->spec; |
| 8619 | |
| 8620 | spec->autocfg.hp_pins[0] = 0x15; |
| 8621 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8622 | } |
| 8623 | |
| 8624 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 8625 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8626 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8627 | alc883_clevo_m720_mic_automute(codec); |
| 8628 | } |
| 8629 | |
| 8630 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8631 | unsigned int res) |
| 8632 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8633 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8634 | case ALC880_MIC_EVENT: |
| 8635 | alc883_clevo_m720_mic_automute(codec); |
| 8636 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8637 | default: |
| 8638 | alc_automute_amp_unsol_event(codec, res); |
| 8639 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8640 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8641 | } |
| 8642 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8643 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8644 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8645 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8646 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8647 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8648 | spec->autocfg.hp_pins[0] = 0x14; |
| 8649 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8650 | } |
| 8651 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8652 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8653 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8654 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8655 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8656 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8657 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8658 | } |
| 8659 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8660 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8661 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8662 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8663 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8664 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8665 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8666 | } |
| 8667 | |
| 8668 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8669 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8670 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8671 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8672 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8673 | HDA_AMP_MUTE, bits); |
| 8674 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8675 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8676 | } |
| 8677 | |
| 8678 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8679 | unsigned int res) |
| 8680 | { |
| 8681 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8682 | alc883_lenovo_101e_all_automute(codec); |
| 8683 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8684 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8685 | } |
| 8686 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8687 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8688 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8689 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8690 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8691 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8692 | spec->autocfg.hp_pins[0] = 0x14; |
| 8693 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8694 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8695 | } |
| 8696 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8697 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8698 | /* HP Pin: output 0 (0x0c) */ |
| 8699 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8700 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8701 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8702 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8703 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8704 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8705 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8706 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8707 | /* eanable EAPD on medion laptop */ |
| 8708 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8709 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8710 | /* enable unsolicited event */ |
| 8711 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8712 | { } |
| 8713 | }; |
| 8714 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8715 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 8716 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8717 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8718 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8719 | { } /* end */ |
| 8720 | }; |
| 8721 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8722 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8723 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8724 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8725 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8726 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8727 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8728 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8729 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8730 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8731 | } |
| 8732 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8733 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8734 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8735 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8736 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8737 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8738 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8739 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8740 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8741 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8742 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8743 | } |
| 8744 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8745 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8746 | { |
| 8747 | struct alc_spec *spec = codec->spec; |
| 8748 | |
| 8749 | spec->autocfg.hp_pins[0] = 0x15; |
| 8750 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8751 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8752 | } |
| 8753 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8754 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8755 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8756 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8757 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8758 | /* enable unsolicited event */ |
| 8759 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8760 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8761 | { } /* end */ |
| 8762 | }; |
| 8763 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8764 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8765 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8766 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8767 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8768 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8769 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8770 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8771 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8772 | spec->ext_mic.pin = 0x18; |
| 8773 | spec->int_mic.pin = 0x19; |
| 8774 | spec->ext_mic.mux_idx = 0; |
| 8775 | spec->int_mic.mux_idx = 1; |
| 8776 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8777 | } |
| 8778 | |
| 8779 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8780 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8781 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8782 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8783 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8784 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8785 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8786 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8787 | /* enable unsolicited event */ |
| 8788 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8789 | { } /* end */ |
| 8790 | }; |
| 8791 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8792 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8793 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8794 | struct alc_spec *spec = codec->spec; |
| 8795 | |
| 8796 | spec->autocfg.hp_pins[0] = 0x14; |
| 8797 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8798 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8799 | } |
| 8800 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8801 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8802 | /* Init rear pin (used as headphone output) */ |
| 8803 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8804 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8805 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8806 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8807 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8808 | /* Init line 2 pin (used as headphone out by default) */ |
| 8809 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8810 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8811 | { } /* end */ |
| 8812 | }; |
| 8813 | |
| 8814 | /* Mute speakers according to the headphone jack state */ |
| 8815 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8816 | { |
| 8817 | unsigned int present; |
| 8818 | |
| 8819 | /* Mute only in 2ch or 4ch mode */ |
| 8820 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8821 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8822 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8823 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8824 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8825 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8826 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8827 | } |
| 8828 | } |
| 8829 | |
| 8830 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8831 | { |
| 8832 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8833 | alc889A_mb31_automute(codec); |
| 8834 | } |
| 8835 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8836 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8837 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8838 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8839 | #endif |
| 8840 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8841 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8842 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8843 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8844 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8845 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8846 | |
| 8847 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8848 | ALC1200_DIGOUT_NID, 0, |
| 8849 | }; |
| 8850 | |
| 8851 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8852 | ALC883_DIGOUT_NID, 0, |
| 8853 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8854 | |
| 8855 | /* |
| 8856 | * configuration and preset |
| 8857 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8858 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8859 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8860 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8861 | [ALC882_ARIMA] = "arima", |
| 8862 | [ALC882_W2JC] = "w2jc", |
| 8863 | [ALC882_TARGA] = "targa", |
| 8864 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8865 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8866 | [ALC885_MACPRO] = "macpro", |
| 8867 | [ALC885_MB5] = "mb5", |
| 8868 | [ALC885_MBP3] = "mbp3", |
| 8869 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8870 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8871 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8872 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8873 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8874 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8875 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8876 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8877 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8878 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8879 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8880 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8881 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8882 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8883 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8884 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8885 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8886 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8887 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8888 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8889 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8890 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8891 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8892 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8893 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8894 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8895 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8896 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8897 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8898 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8899 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8900 | [ALC889A_INTEL] = "intel-alc889a", |
| 8901 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8902 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8903 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8904 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8905 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8906 | }; |
| 8907 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8908 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8909 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8910 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8911 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8912 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8913 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8914 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8915 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8916 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8917 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8918 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8919 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 8920 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8921 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8922 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8923 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8924 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8925 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8926 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8927 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8928 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8929 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8930 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8931 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 8932 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8933 | /* default Acer -- disabled as it causes more problems. |
| 8934 | * model=auto should work fine now |
| 8935 | */ |
| 8936 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8937 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8938 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8939 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8940 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8941 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8942 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8943 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8944 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8945 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8946 | |
| 8947 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8948 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8949 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8950 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8951 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8952 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8953 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8954 | 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] | 8955 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8956 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8957 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8958 | |
| 8959 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8960 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8961 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8962 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8963 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8964 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8965 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8966 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8967 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8968 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8969 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8970 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8971 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8972 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 8973 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8974 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8975 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8976 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8977 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8978 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8979 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8980 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8981 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8982 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8983 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8984 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8985 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8986 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8987 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8988 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8989 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8990 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8991 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8992 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8993 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8994 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 8995 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8996 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8997 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8998 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8999 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9000 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9001 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9002 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9003 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9004 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9005 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9006 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9007 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9008 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9009 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9010 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9011 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9012 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9013 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9014 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9015 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9016 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9017 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9018 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9019 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9020 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9021 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9022 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9023 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9024 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9025 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9026 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9027 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9028 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9029 | {} |
| 9030 | }; |
| 9031 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9032 | /* codec SSID table for Intel Mac */ |
| 9033 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9034 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9035 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9036 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9037 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9038 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9039 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9040 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 9041 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9042 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9043 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9044 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9045 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9046 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9047 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9048 | */ |
| 9049 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9050 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9051 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9052 | }; |
| 9053 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9054 | static struct alc_config_preset alc882_presets[] = { |
| 9055 | [ALC882_3ST_DIG] = { |
| 9056 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9057 | .init_verbs = { alc882_base_init_verbs, |
| 9058 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9059 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9060 | .dac_nids = alc882_dac_nids, |
| 9061 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9062 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9063 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9064 | .channel_mode = alc882_ch_modes, |
| 9065 | .need_dac_fix = 1, |
| 9066 | .input_mux = &alc882_capture_source, |
| 9067 | }, |
| 9068 | [ALC882_6ST_DIG] = { |
| 9069 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9070 | .init_verbs = { alc882_base_init_verbs, |
| 9071 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9072 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9073 | .dac_nids = alc882_dac_nids, |
| 9074 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9075 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9076 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9077 | .channel_mode = alc882_sixstack_modes, |
| 9078 | .input_mux = &alc882_capture_source, |
| 9079 | }, |
| 9080 | [ALC882_ARIMA] = { |
| 9081 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9082 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9083 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9084 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9085 | .dac_nids = alc882_dac_nids, |
| 9086 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9087 | .channel_mode = alc882_sixstack_modes, |
| 9088 | .input_mux = &alc882_capture_source, |
| 9089 | }, |
| 9090 | [ALC882_W2JC] = { |
| 9091 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9092 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9093 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9094 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9095 | .dac_nids = alc882_dac_nids, |
| 9096 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9097 | .channel_mode = alc880_threestack_modes, |
| 9098 | .need_dac_fix = 1, |
| 9099 | .input_mux = &alc882_capture_source, |
| 9100 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9101 | }, |
| 9102 | [ALC885_MBP3] = { |
| 9103 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9104 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9105 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9106 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9107 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9108 | .hp_nid = 0x04, |
| 9109 | .channel_mode = alc885_mbp_4ch_modes, |
| 9110 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9111 | .input_mux = &alc882_capture_source, |
| 9112 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9113 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9114 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9115 | .setup = alc885_mbp3_setup, |
| 9116 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9117 | }, |
| 9118 | [ALC885_MB5] = { |
| 9119 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9120 | .init_verbs = { alc885_mb5_init_verbs, |
| 9121 | alc880_gpio1_init_verbs }, |
| 9122 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9123 | .dac_nids = alc882_dac_nids, |
| 9124 | .channel_mode = alc885_mb5_6ch_modes, |
| 9125 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9126 | .input_mux = &mb5_capture_source, |
| 9127 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9128 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9129 | }, |
| 9130 | [ALC885_MACPRO] = { |
| 9131 | .mixers = { alc882_macpro_mixer }, |
| 9132 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9133 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9134 | .dac_nids = alc882_dac_nids, |
| 9135 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9136 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9137 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9138 | .channel_mode = alc882_ch_modes, |
| 9139 | .input_mux = &alc882_capture_source, |
| 9140 | .init_hook = alc885_macpro_init_hook, |
| 9141 | }, |
| 9142 | [ALC885_IMAC24] = { |
| 9143 | .mixers = { alc885_imac24_mixer }, |
| 9144 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9145 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9146 | .dac_nids = alc882_dac_nids, |
| 9147 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9148 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9149 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9150 | .channel_mode = alc882_ch_modes, |
| 9151 | .input_mux = &alc882_capture_source, |
| 9152 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9153 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9154 | .init_hook = alc885_imac24_init_hook, |
| 9155 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9156 | [ALC885_IMAC91] = { |
| 9157 | .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, |
| 9158 | .init_verbs = { alc885_imac91_init_verbs, |
| 9159 | alc880_gpio1_init_verbs }, |
| 9160 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9161 | .dac_nids = alc882_dac_nids, |
| 9162 | .channel_mode = alc885_mbp_4ch_modes, |
| 9163 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
| 9164 | .input_mux = &alc882_capture_source, |
| 9165 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9166 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9167 | .unsol_event = alc885_imac91_unsol_event, |
| 9168 | .init_hook = alc885_imac91_automute, |
| 9169 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9170 | [ALC882_TARGA] = { |
| 9171 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9172 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9173 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9174 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9175 | .dac_nids = alc882_dac_nids, |
| 9176 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9177 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9178 | .adc_nids = alc882_adc_nids, |
| 9179 | .capsrc_nids = alc882_capsrc_nids, |
| 9180 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9181 | .channel_mode = alc882_3ST_6ch_modes, |
| 9182 | .need_dac_fix = 1, |
| 9183 | .input_mux = &alc882_capture_source, |
| 9184 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9185 | .setup = alc882_targa_setup, |
| 9186 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9187 | }, |
| 9188 | [ALC882_ASUS_A7J] = { |
| 9189 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9190 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9191 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9192 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9193 | .dac_nids = alc882_dac_nids, |
| 9194 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9195 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9196 | .adc_nids = alc882_adc_nids, |
| 9197 | .capsrc_nids = alc882_capsrc_nids, |
| 9198 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9199 | .channel_mode = alc882_3ST_6ch_modes, |
| 9200 | .need_dac_fix = 1, |
| 9201 | .input_mux = &alc882_capture_source, |
| 9202 | }, |
| 9203 | [ALC882_ASUS_A7M] = { |
| 9204 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9205 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9206 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9207 | alc882_asus_a7m_verbs }, |
| 9208 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9209 | .dac_nids = alc882_dac_nids, |
| 9210 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9211 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9212 | .channel_mode = alc880_threestack_modes, |
| 9213 | .need_dac_fix = 1, |
| 9214 | .input_mux = &alc882_capture_source, |
| 9215 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9216 | [ALC883_3ST_2ch_DIG] = { |
| 9217 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9218 | .init_verbs = { alc883_init_verbs }, |
| 9219 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9220 | .dac_nids = alc883_dac_nids, |
| 9221 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9222 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9223 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9224 | .channel_mode = alc883_3ST_2ch_modes, |
| 9225 | .input_mux = &alc883_capture_source, |
| 9226 | }, |
| 9227 | [ALC883_3ST_6ch_DIG] = { |
| 9228 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9229 | .init_verbs = { alc883_init_verbs }, |
| 9230 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9231 | .dac_nids = alc883_dac_nids, |
| 9232 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9233 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9234 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9235 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9236 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9237 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9238 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9239 | [ALC883_3ST_6ch] = { |
| 9240 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9241 | .init_verbs = { alc883_init_verbs }, |
| 9242 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9243 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9244 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9245 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9246 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9247 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9248 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9249 | [ALC883_3ST_6ch_INTEL] = { |
| 9250 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9251 | .init_verbs = { alc883_init_verbs }, |
| 9252 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9253 | .dac_nids = alc883_dac_nids, |
| 9254 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9255 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9256 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9257 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9258 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9259 | .need_dac_fix = 1, |
| 9260 | .input_mux = &alc883_3stack_6ch_intel, |
| 9261 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9262 | [ALC889A_INTEL] = { |
| 9263 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9264 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9265 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9266 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9267 | .dac_nids = alc883_dac_nids, |
| 9268 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9269 | .adc_nids = alc889_adc_nids, |
| 9270 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9271 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9272 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9273 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9274 | .channel_mode = alc889_8ch_intel_modes, |
| 9275 | .capsrc_nids = alc889_capsrc_nids, |
| 9276 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9277 | .setup = alc889_automute_setup, |
| 9278 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9279 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9280 | .need_dac_fix = 1, |
| 9281 | }, |
| 9282 | [ALC889_INTEL] = { |
| 9283 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9284 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9285 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9286 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9287 | .dac_nids = alc883_dac_nids, |
| 9288 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9289 | .adc_nids = alc889_adc_nids, |
| 9290 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9291 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9292 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9293 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9294 | .channel_mode = alc889_8ch_intel_modes, |
| 9295 | .capsrc_nids = alc889_capsrc_nids, |
| 9296 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9297 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9298 | .init_hook = alc889_intel_init_hook, |
| 9299 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9300 | .need_dac_fix = 1, |
| 9301 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9302 | [ALC883_6ST_DIG] = { |
| 9303 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9304 | .init_verbs = { alc883_init_verbs }, |
| 9305 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9306 | .dac_nids = alc883_dac_nids, |
| 9307 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9308 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9309 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9310 | .channel_mode = alc883_sixstack_modes, |
| 9311 | .input_mux = &alc883_capture_source, |
| 9312 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9313 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9314 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9315 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9316 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9317 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9318 | .dac_nids = alc883_dac_nids, |
| 9319 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9320 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9321 | .channel_mode = alc883_3ST_6ch_modes, |
| 9322 | .need_dac_fix = 1, |
| 9323 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9324 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9325 | .setup = alc882_targa_setup, |
| 9326 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9327 | }, |
| 9328 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9329 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9330 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9331 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9332 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9333 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9334 | .adc_nids = alc883_adc_nids_alt, |
| 9335 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9336 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9337 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9338 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9339 | .channel_mode = alc883_3ST_2ch_modes, |
| 9340 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9341 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9342 | .setup = alc882_targa_setup, |
| 9343 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9344 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9345 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9346 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 9347 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9348 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9349 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9350 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9351 | .dac_nids = alc883_dac_nids, |
| 9352 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9353 | .adc_nids = alc883_adc_nids_rev, |
| 9354 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9355 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9356 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9357 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9358 | .channel_mode = alc883_4ST_8ch_modes, |
| 9359 | .need_dac_fix = 1, |
| 9360 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9361 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9362 | .setup = alc882_targa_setup, |
| 9363 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9364 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9365 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9366 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9367 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9368 | * and the headphone jack. Turn this on and rely on the |
| 9369 | * standard mute methods whenever the user wants to turn |
| 9370 | * these outputs off. |
| 9371 | */ |
| 9372 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9373 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9374 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9375 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9376 | .channel_mode = alc883_3ST_2ch_modes, |
| 9377 | .input_mux = &alc883_capture_source, |
| 9378 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9379 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9380 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9381 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9382 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9383 | .dac_nids = alc883_dac_nids, |
| 9384 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9385 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9386 | .channel_mode = alc883_3ST_2ch_modes, |
| 9387 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9388 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9389 | .setup = alc883_acer_aspire_setup, |
| 9390 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9391 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9392 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9393 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9394 | alc883_chmode_mixer }, |
| 9395 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9396 | alc888_acer_aspire_4930g_verbs }, |
| 9397 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9398 | .dac_nids = alc883_dac_nids, |
| 9399 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9400 | .adc_nids = alc883_adc_nids_rev, |
| 9401 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9402 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9403 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9404 | .channel_mode = alc883_3ST_6ch_modes, |
| 9405 | .need_dac_fix = 1, |
| 9406 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9407 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9408 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9409 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9410 | .setup = alc888_acer_aspire_4930g_setup, |
| 9411 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9412 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9413 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9414 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9415 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9416 | alc888_acer_aspire_6530g_verbs }, |
| 9417 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9418 | .dac_nids = alc883_dac_nids, |
| 9419 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9420 | .adc_nids = alc883_adc_nids_rev, |
| 9421 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9422 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9423 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9424 | .channel_mode = alc883_3ST_2ch_modes, |
| 9425 | .num_mux_defs = |
| 9426 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9427 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9428 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9429 | .setup = alc888_acer_aspire_6530g_setup, |
| 9430 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9431 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9432 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 9433 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9434 | alc883_chmode_mixer }, |
| 9435 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 9436 | alc889_acer_aspire_8930g_verbs, |
| 9437 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9438 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9439 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9440 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9441 | .adc_nids = alc889_adc_nids, |
| 9442 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9443 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9444 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9445 | .channel_mode = alc883_3ST_6ch_modes, |
| 9446 | .need_dac_fix = 1, |
| 9447 | .const_channel_count = 6, |
| 9448 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9449 | ARRAY_SIZE(alc889_capture_sources), |
| 9450 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9451 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9452 | .setup = alc889_acer_aspire_8930g_setup, |
| 9453 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9454 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9455 | .power_hook = alc889_power_eapd, |
| 9456 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9457 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9458 | [ALC888_ACER_ASPIRE_7730G] = { |
| 9459 | .mixers = { alc883_3ST_6ch_mixer, |
| 9460 | alc883_chmode_mixer }, |
| 9461 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9462 | alc888_acer_aspire_7730G_verbs }, |
| 9463 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9464 | .dac_nids = alc883_dac_nids, |
| 9465 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9466 | .adc_nids = alc883_adc_nids_rev, |
| 9467 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9468 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9469 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9470 | .channel_mode = alc883_3ST_6ch_modes, |
| 9471 | .need_dac_fix = 1, |
| 9472 | .const_channel_count = 6, |
| 9473 | .input_mux = &alc883_capture_source, |
| 9474 | .unsol_event = alc_automute_amp_unsol_event, |
| 9475 | .setup = alc888_acer_aspire_6530g_setup, |
| 9476 | .init_hook = alc_automute_amp, |
| 9477 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9478 | [ALC883_MEDION] = { |
| 9479 | .mixers = { alc883_fivestack_mixer, |
| 9480 | alc883_chmode_mixer }, |
| 9481 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9482 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9483 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9484 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9485 | .adc_nids = alc883_adc_nids_alt, |
| 9486 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9487 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9488 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9489 | .channel_mode = alc883_sixstack_modes, |
| 9490 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9491 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9492 | [ALC883_MEDION_MD2] = { |
| 9493 | .mixers = { alc883_medion_md2_mixer}, |
| 9494 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9495 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9496 | .dac_nids = alc883_dac_nids, |
| 9497 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9498 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9499 | .channel_mode = alc883_3ST_2ch_modes, |
| 9500 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9501 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9502 | .setup = alc883_medion_md2_setup, |
| 9503 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9504 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9505 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9506 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9507 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9508 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9509 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9510 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9511 | .channel_mode = alc883_3ST_2ch_modes, |
| 9512 | .input_mux = &alc883_capture_source, |
| 9513 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9514 | [ALC883_CLEVO_M540R] = { |
| 9515 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9516 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 9517 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9518 | .dac_nids = alc883_dac_nids, |
| 9519 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9520 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9521 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 9522 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 9523 | .need_dac_fix = 1, |
| 9524 | .input_mux = &alc883_capture_source, |
| 9525 | /* This machine has the hardware HP auto-muting, thus |
| 9526 | * we need no software mute via unsol event |
| 9527 | */ |
| 9528 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9529 | [ALC883_CLEVO_M720] = { |
| 9530 | .mixers = { alc883_clevo_m720_mixer }, |
| 9531 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9532 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9533 | .dac_nids = alc883_dac_nids, |
| 9534 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9535 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9536 | .channel_mode = alc883_3ST_2ch_modes, |
| 9537 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9538 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9539 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9540 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9541 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9542 | [ALC883_LENOVO_101E_2ch] = { |
| 9543 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9544 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9545 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9546 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9547 | .adc_nids = alc883_adc_nids_alt, |
| 9548 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9549 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9550 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9551 | .channel_mode = alc883_3ST_2ch_modes, |
| 9552 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9553 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9554 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9555 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9556 | [ALC883_LENOVO_NB0763] = { |
| 9557 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9558 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9559 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9560 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9561 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9562 | .channel_mode = alc883_3ST_2ch_modes, |
| 9563 | .need_dac_fix = 1, |
| 9564 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9565 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9566 | .setup = alc883_medion_md2_setup, |
| 9567 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9568 | }, |
| 9569 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9570 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9571 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9572 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9573 | .dac_nids = alc883_dac_nids, |
| 9574 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9575 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9576 | .channel_mode = alc883_3ST_6ch_modes, |
| 9577 | .need_dac_fix = 1, |
| 9578 | .input_mux = &alc883_capture_source, |
| 9579 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9580 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9581 | }, |
| 9582 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9583 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9584 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9585 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9586 | .dac_nids = alc883_dac_nids, |
| 9587 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9588 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9589 | .channel_mode = alc883_3ST_2ch_modes, |
| 9590 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9591 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9592 | .setup = alc883_haier_w66_setup, |
| 9593 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9594 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9595 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9596 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9597 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9598 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9599 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9600 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9601 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9602 | .need_dac_fix = 1, |
| 9603 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9604 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9605 | .setup = alc888_3st_hp_setup, |
| 9606 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9607 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9608 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9609 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9610 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9611 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9612 | .dac_nids = alc883_dac_nids, |
| 9613 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9614 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9615 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9616 | .channel_mode = alc883_sixstack_modes, |
| 9617 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9618 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9619 | .setup = alc888_6st_dell_setup, |
| 9620 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9621 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9622 | [ALC883_MITAC] = { |
| 9623 | .mixers = { alc883_mitac_mixer }, |
| 9624 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9625 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9626 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9627 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9628 | .channel_mode = alc883_3ST_2ch_modes, |
| 9629 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9630 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9631 | .setup = alc883_mitac_setup, |
| 9632 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9633 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9634 | [ALC883_FUJITSU_PI2515] = { |
| 9635 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9636 | .init_verbs = { alc883_init_verbs, |
| 9637 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9638 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9639 | .dac_nids = alc883_dac_nids, |
| 9640 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9641 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9642 | .channel_mode = alc883_3ST_2ch_modes, |
| 9643 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9644 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9645 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 9646 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9647 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9648 | [ALC888_FUJITSU_XA3530] = { |
| 9649 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9650 | .init_verbs = { alc883_init_verbs, |
| 9651 | alc888_fujitsu_xa3530_verbs }, |
| 9652 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9653 | .dac_nids = alc883_dac_nids, |
| 9654 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9655 | .adc_nids = alc883_adc_nids_rev, |
| 9656 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9657 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9658 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9659 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9660 | .num_mux_defs = |
| 9661 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9662 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9663 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9664 | .setup = alc888_fujitsu_xa3530_setup, |
| 9665 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9666 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9667 | [ALC888_LENOVO_SKY] = { |
| 9668 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9669 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9670 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9671 | .dac_nids = alc883_dac_nids, |
| 9672 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9673 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9674 | .channel_mode = alc883_sixstack_modes, |
| 9675 | .need_dac_fix = 1, |
| 9676 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9677 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9678 | .setup = alc888_lenovo_sky_setup, |
| 9679 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9680 | }, |
| 9681 | [ALC888_ASUS_M90V] = { |
| 9682 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9683 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9684 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9685 | .dac_nids = alc883_dac_nids, |
| 9686 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9687 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9688 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9689 | .channel_mode = alc883_3ST_6ch_modes, |
| 9690 | .need_dac_fix = 1, |
| 9691 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9692 | .unsol_event = alc_sku_unsol_event, |
| 9693 | .setup = alc883_mode2_setup, |
| 9694 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9695 | }, |
| 9696 | [ALC888_ASUS_EEE1601] = { |
| 9697 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9698 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9699 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9700 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9701 | .dac_nids = alc883_dac_nids, |
| 9702 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9703 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9704 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9705 | .channel_mode = alc883_3ST_2ch_modes, |
| 9706 | .need_dac_fix = 1, |
| 9707 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9708 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9709 | .init_hook = alc883_eee1601_inithook, |
| 9710 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9711 | [ALC1200_ASUS_P5Q] = { |
| 9712 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9713 | .init_verbs = { alc883_init_verbs }, |
| 9714 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9715 | .dac_nids = alc883_dac_nids, |
| 9716 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9717 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9718 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9719 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9720 | .channel_mode = alc883_sixstack_modes, |
| 9721 | .input_mux = &alc883_capture_source, |
| 9722 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9723 | [ALC889A_MB31] = { |
| 9724 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9725 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9726 | alc880_gpio1_init_verbs }, |
| 9727 | .adc_nids = alc883_adc_nids, |
| 9728 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9729 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9730 | .dac_nids = alc883_dac_nids, |
| 9731 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9732 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9733 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9734 | .input_mux = &alc889A_mb31_capture_source, |
| 9735 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9736 | .unsol_event = alc889A_mb31_unsol_event, |
| 9737 | .init_hook = alc889A_mb31_automute, |
| 9738 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9739 | [ALC883_SONY_VAIO_TT] = { |
| 9740 | .mixers = { alc883_vaiott_mixer }, |
| 9741 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9742 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9743 | .dac_nids = alc883_dac_nids, |
| 9744 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9745 | .channel_mode = alc883_3ST_2ch_modes, |
| 9746 | .input_mux = &alc883_capture_source, |
| 9747 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9748 | .setup = alc883_vaiott_setup, |
| 9749 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9750 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9751 | }; |
| 9752 | |
| 9753 | |
| 9754 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9755 | * Pin config fixes |
| 9756 | */ |
| 9757 | enum { |
| 9758 | PINFIX_ABIT_AW9D_MAX |
| 9759 | }; |
| 9760 | |
| 9761 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9762 | { 0x15, 0x01080104 }, /* side */ |
| 9763 | { 0x16, 0x01011012 }, /* rear */ |
| 9764 | { 0x17, 0x01016011 }, /* clfe */ |
| 9765 | { } |
| 9766 | }; |
| 9767 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9768 | static const struct alc_fixup alc882_fixups[] = { |
| 9769 | [PINFIX_ABIT_AW9D_MAX] = { |
| 9770 | .pins = alc882_abit_aw9d_pinfix |
| 9771 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9772 | }; |
| 9773 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9774 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9775 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9776 | {} |
| 9777 | }; |
| 9778 | |
| 9779 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9780 | * BIOS auto configuration |
| 9781 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9782 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 9783 | const struct auto_pin_cfg *cfg) |
| 9784 | { |
| 9785 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 9786 | } |
| 9787 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9788 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9789 | hda_nid_t nid, int pin_type, |
| 9790 | int dac_idx) |
| 9791 | { |
| 9792 | /* set as output */ |
| 9793 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9794 | int idx; |
| 9795 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9796 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9797 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9798 | idx = 4; |
| 9799 | else |
| 9800 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9801 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9802 | |
| 9803 | } |
| 9804 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9805 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9806 | { |
| 9807 | struct alc_spec *spec = codec->spec; |
| 9808 | int i; |
| 9809 | |
| 9810 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9811 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9812 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9813 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9814 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9815 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9816 | } |
| 9817 | } |
| 9818 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9819 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9820 | { |
| 9821 | struct alc_spec *spec = codec->spec; |
| 9822 | hda_nid_t pin; |
| 9823 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9824 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9825 | if (pin) /* connect to front */ |
| 9826 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9827 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9828 | pin = spec->autocfg.speaker_pins[0]; |
| 9829 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9830 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9831 | } |
| 9832 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9833 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9834 | { |
| 9835 | struct alc_spec *spec = codec->spec; |
| 9836 | int i; |
| 9837 | |
| 9838 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9839 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9840 | if (!nid) |
| 9841 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9842 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9843 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9844 | snd_hda_codec_write(codec, nid, 0, |
| 9845 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9846 | AMP_OUT_MUTE); |
| 9847 | } |
| 9848 | } |
| 9849 | |
| 9850 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9851 | { |
| 9852 | struct alc_spec *spec = codec->spec; |
| 9853 | int c; |
| 9854 | |
| 9855 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9856 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9857 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9858 | unsigned int mux_idx; |
| 9859 | const struct hda_input_mux *imux; |
| 9860 | int conns, mute, idx, item; |
| 9861 | |
| 9862 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9863 | ARRAY_SIZE(conn_list)); |
| 9864 | if (conns < 0) |
| 9865 | continue; |
| 9866 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9867 | imux = &spec->input_mux[mux_idx]; |
| 9868 | for (idx = 0; idx < conns; idx++) { |
| 9869 | /* if the current connection is the selected one, |
| 9870 | * unmute it as default - otherwise mute it |
| 9871 | */ |
| 9872 | mute = AMP_IN_MUTE(idx); |
| 9873 | for (item = 0; item < imux->num_items; item++) { |
| 9874 | if (imux->items[item].index == idx) { |
| 9875 | if (spec->cur_mux[c] == item) |
| 9876 | mute = AMP_IN_UNMUTE(idx); |
| 9877 | break; |
| 9878 | } |
| 9879 | } |
| 9880 | /* check if we have a selector or mixer |
| 9881 | * we could check for the widget type instead, but |
| 9882 | * just check for Amp-In presence (in case of mixer |
| 9883 | * without amp-in there is something wrong, this |
| 9884 | * function shouldn't be used or capsrc nid is wrong) |
| 9885 | */ |
| 9886 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9887 | snd_hda_codec_write(codec, nid, 0, |
| 9888 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9889 | mute); |
| 9890 | else if (mute != AMP_IN_MUTE(idx)) |
| 9891 | snd_hda_codec_write(codec, nid, 0, |
| 9892 | AC_VERB_SET_CONNECT_SEL, |
| 9893 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9894 | } |
| 9895 | } |
| 9896 | } |
| 9897 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9898 | /* add mic boosts if needed */ |
| 9899 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9900 | { |
| 9901 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9902 | int err; |
| 9903 | hda_nid_t nid; |
| 9904 | |
| 9905 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9906 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9907 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9908 | "Mic Boost", |
| 9909 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9910 | if (err < 0) |
| 9911 | return err; |
| 9912 | } |
| 9913 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9914 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9915 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9916 | "Front Mic Boost", |
| 9917 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9918 | if (err < 0) |
| 9919 | return err; |
| 9920 | } |
| 9921 | return 0; |
| 9922 | } |
| 9923 | |
| 9924 | /* almost identical with ALC880 parser... */ |
| 9925 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9926 | { |
| 9927 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9928 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 9929 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9930 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9931 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9932 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9933 | if (err < 0) |
| 9934 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9935 | if (!spec->autocfg.line_outs) |
| 9936 | return 0; /* can't find valid BIOS pin config */ |
| 9937 | |
| 9938 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 9939 | if (err < 0) |
| 9940 | return err; |
| 9941 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9942 | if (err < 0) |
| 9943 | return err; |
| 9944 | err = alc880_auto_create_extra_out(spec, |
| 9945 | spec->autocfg.speaker_pins[0], |
| 9946 | "Speaker"); |
| 9947 | if (err < 0) |
| 9948 | return err; |
| 9949 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 9950 | "Headphone"); |
| 9951 | if (err < 0) |
| 9952 | return err; |
| 9953 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 9954 | if (err < 0) |
| 9955 | return err; |
| 9956 | |
| 9957 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9958 | |
| 9959 | /* check multiple SPDIF-out (for recent codecs) */ |
| 9960 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 9961 | hda_nid_t dig_nid; |
| 9962 | err = snd_hda_get_connections(codec, |
| 9963 | spec->autocfg.dig_out_pins[i], |
| 9964 | &dig_nid, 1); |
| 9965 | if (err < 0) |
| 9966 | continue; |
| 9967 | if (!i) |
| 9968 | spec->multiout.dig_out_nid = dig_nid; |
| 9969 | else { |
| 9970 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 9971 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9972 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 9973 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9974 | } |
| 9975 | } |
| 9976 | if (spec->autocfg.dig_in_pin) |
| 9977 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 9978 | |
| 9979 | if (spec->kctls.list) |
| 9980 | add_mixer(spec, spec->kctls.list); |
| 9981 | |
| 9982 | add_verb(spec, alc883_auto_init_verbs); |
| 9983 | /* if ADC 0x07 is available, initialize it, too */ |
| 9984 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 9985 | add_verb(spec, alc882_adc1_init_verbs); |
| 9986 | |
| 9987 | spec->num_mux_defs = 1; |
| 9988 | spec->input_mux = &spec->private_imux[0]; |
| 9989 | |
| 9990 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9991 | |
| 9992 | err = alc_auto_add_mic_boost(codec); |
| 9993 | if (err < 0) |
| 9994 | return err; |
| 9995 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9996 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9997 | } |
| 9998 | |
| 9999 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10000 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10001 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10002 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10003 | alc882_auto_init_multi_out(codec); |
| 10004 | alc882_auto_init_hp_out(codec); |
| 10005 | alc882_auto_init_analog_input(codec); |
| 10006 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10007 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10008 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10009 | } |
| 10010 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10011 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10012 | { |
| 10013 | struct alc_spec *spec; |
| 10014 | int err, board_config; |
| 10015 | |
| 10016 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10017 | if (spec == NULL) |
| 10018 | return -ENOMEM; |
| 10019 | |
| 10020 | codec->spec = spec; |
| 10021 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10022 | switch (codec->vendor_id) { |
| 10023 | case 0x10ec0882: |
| 10024 | case 0x10ec0885: |
| 10025 | break; |
| 10026 | default: |
| 10027 | /* ALC883 and variants */ |
| 10028 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10029 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10030 | } |
| 10031 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10032 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10033 | alc882_models, |
| 10034 | alc882_cfg_tbl); |
| 10035 | |
| 10036 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10037 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10038 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10039 | |
| 10040 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10041 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10042 | codec->chip_name); |
| 10043 | board_config = ALC882_AUTO; |
| 10044 | } |
| 10045 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10046 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10047 | |
| 10048 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10049 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10050 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10051 | if (err < 0) { |
| 10052 | alc_free(codec); |
| 10053 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10054 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10055 | printk(KERN_INFO |
| 10056 | "hda_codec: Cannot set up configuration " |
| 10057 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10058 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10059 | } |
| 10060 | } |
| 10061 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10062 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10063 | if (err < 0) { |
| 10064 | alc_free(codec); |
| 10065 | return err; |
| 10066 | } |
| 10067 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10068 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10069 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10070 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10071 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10072 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10073 | /* FIXME: setup DAC5 */ |
| 10074 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10075 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10076 | |
| 10077 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10078 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10079 | |
| 10080 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 10081 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10082 | |
| 10083 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10084 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10085 | spec->num_adc_nids = 0; |
| 10086 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10087 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10088 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10089 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10090 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10091 | unsigned int wcap = get_wcaps(codec, nid); |
| 10092 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10093 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10094 | if (wcap != AC_WID_AUD_IN) |
| 10095 | continue; |
| 10096 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10097 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10098 | if (err < 0) |
| 10099 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10100 | err = snd_hda_get_connections(codec, cap, items, |
| 10101 | ARRAY_SIZE(items)); |
| 10102 | if (err < 0) |
| 10103 | continue; |
| 10104 | for (j = 0; j < imux->num_items; j++) |
| 10105 | if (imux->items[j].index >= err) |
| 10106 | break; |
| 10107 | if (j < imux->num_items) |
| 10108 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10109 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10110 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10111 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10112 | spec->adc_nids = spec->private_adc_nids; |
| 10113 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10114 | } |
| 10115 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10116 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 10117 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10118 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10119 | spec->vmaster_nid = 0x0c; |
| 10120 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10121 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10122 | if (board_config == ALC882_AUTO) |
| 10123 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10124 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10125 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10126 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10127 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 10128 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10129 | |
| 10130 | return 0; |
| 10131 | } |
| 10132 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10133 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10134 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10135 | * ALC262 support |
| 10136 | */ |
| 10137 | |
| 10138 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10139 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10140 | |
| 10141 | #define alc262_dac_nids alc260_dac_nids |
| 10142 | #define alc262_adc_nids alc882_adc_nids |
| 10143 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10144 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10145 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10146 | |
| 10147 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10148 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10149 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10150 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10151 | /* ADC0 */ |
| 10152 | 0x09 |
| 10153 | }; |
| 10154 | |
| 10155 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10156 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10157 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10158 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10159 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10160 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10161 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10162 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10163 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10164 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10165 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10166 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10167 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10168 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10169 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10170 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10171 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10172 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10173 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10174 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10175 | }; |
| 10176 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10177 | /* update HP, line and mono-out pins according to the master switch */ |
| 10178 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10179 | { |
| 10180 | struct alc_spec *spec = codec->spec; |
| 10181 | int val = spec->master_sw; |
| 10182 | |
| 10183 | /* HP & line-out */ |
| 10184 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10185 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10186 | val ? PIN_HP : 0); |
| 10187 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10188 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10189 | val ? PIN_HP : 0); |
| 10190 | /* mono (speaker) depending on the HP jack sense */ |
| 10191 | val = val && !spec->jack_present; |
| 10192 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10193 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10194 | val ? PIN_OUT : 0); |
| 10195 | } |
| 10196 | |
| 10197 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10198 | { |
| 10199 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10200 | |
| 10201 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10202 | alc262_hp_master_update(codec); |
| 10203 | } |
| 10204 | |
| 10205 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10206 | { |
| 10207 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10208 | return; |
| 10209 | alc262_hp_bpc_automute(codec); |
| 10210 | } |
| 10211 | |
| 10212 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10213 | { |
| 10214 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10215 | |
| 10216 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10217 | alc262_hp_master_update(codec); |
| 10218 | } |
| 10219 | |
| 10220 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10221 | unsigned int res) |
| 10222 | { |
| 10223 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10224 | return; |
| 10225 | alc262_hp_wildwest_automute(codec); |
| 10226 | } |
| 10227 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10228 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10229 | |
| 10230 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10231 | struct snd_ctl_elem_value *ucontrol) |
| 10232 | { |
| 10233 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10234 | struct alc_spec *spec = codec->spec; |
| 10235 | int val = !!*ucontrol->value.integer.value; |
| 10236 | |
| 10237 | if (val == spec->master_sw) |
| 10238 | return 0; |
| 10239 | spec->master_sw = val; |
| 10240 | alc262_hp_master_update(codec); |
| 10241 | return 1; |
| 10242 | } |
| 10243 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10244 | #define ALC262_HP_MASTER_SWITCH \ |
| 10245 | { \ |
| 10246 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10247 | .name = "Master Playback Switch", \ |
| 10248 | .info = snd_ctl_boolean_mono_info, \ |
| 10249 | .get = alc262_hp_master_sw_get, \ |
| 10250 | .put = alc262_hp_master_sw_put, \ |
| 10251 | } |
| 10252 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10253 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10254 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10255 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10256 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10257 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10258 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10259 | HDA_OUTPUT), |
| 10260 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10261 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10263 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10264 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10265 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10266 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10267 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10268 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10269 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10270 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10271 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10272 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10273 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10274 | { } /* end */ |
| 10275 | }; |
| 10276 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10277 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10278 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10279 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10280 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10281 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10282 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10283 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10284 | HDA_OUTPUT), |
| 10285 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10286 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10287 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10288 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10289 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10290 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10291 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10292 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10293 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10294 | { } /* end */ |
| 10295 | }; |
| 10296 | |
| 10297 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10298 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10299 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10300 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10301 | { } /* end */ |
| 10302 | }; |
| 10303 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10304 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10305 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10306 | { |
| 10307 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10308 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10309 | spec->autocfg.hp_pins[0] = 0x15; |
| 10310 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10311 | } |
| 10312 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10313 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10314 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10315 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10316 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10317 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10318 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10319 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10320 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10321 | { } /* end */ |
| 10322 | }; |
| 10323 | |
| 10324 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10326 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10327 | |
| 10328 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10329 | { } |
| 10330 | }; |
| 10331 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10332 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10333 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10334 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10335 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10336 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10337 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10338 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10339 | { } /* end */ |
| 10340 | }; |
| 10341 | |
| 10342 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10343 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10344 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10345 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10346 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10347 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10348 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10349 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10350 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10351 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10352 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10353 | {} |
| 10354 | }; |
| 10355 | |
| 10356 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10357 | .num_items = 1, |
| 10358 | .items = { |
| 10359 | { "Line", 0x1 }, |
| 10360 | }, |
| 10361 | }; |
| 10362 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10363 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10364 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10365 | { |
| 10366 | struct alc_spec *spec = codec->spec; |
| 10367 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10368 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10369 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10370 | unsigned int mute; |
| 10371 | |
| 10372 | /* HP */ |
| 10373 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10374 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10375 | HDA_AMP_MUTE, mute); |
| 10376 | /* mute internal speaker per jack sense */ |
| 10377 | if (spec->jack_present) |
| 10378 | mute = HDA_AMP_MUTE; |
| 10379 | if (line_nid) |
| 10380 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10381 | HDA_AMP_MUTE, mute); |
| 10382 | if (speaker_nid && speaker_nid != line_nid) |
| 10383 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10384 | HDA_AMP_MUTE, mute); |
| 10385 | } |
| 10386 | |
| 10387 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10388 | |
| 10389 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10390 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10391 | { |
| 10392 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10393 | struct alc_spec *spec = codec->spec; |
| 10394 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10395 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10396 | if (val == spec->master_sw) |
| 10397 | return 0; |
| 10398 | spec->master_sw = val; |
| 10399 | alc262_hippo_master_update(codec); |
| 10400 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10401 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10402 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10403 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10404 | { \ |
| 10405 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10406 | .name = "Master Playback Switch", \ |
| 10407 | .info = snd_ctl_boolean_mono_info, \ |
| 10408 | .get = alc262_hippo_master_sw_get, \ |
| 10409 | .put = alc262_hippo_master_sw_put, \ |
| 10410 | } |
| 10411 | |
| 10412 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10413 | ALC262_HIPPO_MASTER_SWITCH, |
| 10414 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10415 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10416 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10417 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10418 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10419 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10420 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10421 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10422 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10423 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10424 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10425 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10426 | { } /* end */ |
| 10427 | }; |
| 10428 | |
| 10429 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10430 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10431 | ALC262_HIPPO_MASTER_SWITCH, |
| 10432 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10433 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10434 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10435 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10436 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10437 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10438 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10439 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10440 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10441 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10442 | { } /* end */ |
| 10443 | }; |
| 10444 | |
| 10445 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10446 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10447 | { |
| 10448 | struct alc_spec *spec = codec->spec; |
| 10449 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10450 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10451 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10452 | alc262_hippo_master_update(codec); |
| 10453 | } |
| 10454 | |
| 10455 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10456 | { |
| 10457 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10458 | return; |
| 10459 | alc262_hippo_automute(codec); |
| 10460 | } |
| 10461 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10462 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10463 | { |
| 10464 | struct alc_spec *spec = codec->spec; |
| 10465 | |
| 10466 | spec->autocfg.hp_pins[0] = 0x15; |
| 10467 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10468 | } |
| 10469 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10470 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10471 | { |
| 10472 | struct alc_spec *spec = codec->spec; |
| 10473 | |
| 10474 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10475 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10476 | } |
| 10477 | |
| 10478 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10479 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10480 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10481 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10482 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10483 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10484 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10485 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10486 | { } /* end */ |
| 10487 | }; |
| 10488 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10489 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10490 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10491 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10492 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10493 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10494 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10495 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10496 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10497 | { } /* end */ |
| 10498 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10499 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10500 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10501 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10502 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10503 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10504 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10505 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10506 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10507 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10508 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10509 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10510 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10511 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10512 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10513 | { } /* end */ |
| 10514 | }; |
| 10515 | |
| 10516 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10517 | /* Headphone automute */ |
| 10518 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10519 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10520 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10521 | |
| 10522 | /* P11 AUX_IN, white 4-pin connector */ |
| 10523 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10524 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10525 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10526 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10527 | |
| 10528 | {} |
| 10529 | }; |
| 10530 | |
| 10531 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10532 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10533 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10534 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10535 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10536 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10537 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10538 | } |
| 10539 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10540 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10541 | #define alc262_capture_mixer alc882_capture_mixer |
| 10542 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10543 | |
| 10544 | /* |
| 10545 | * generic initialization of ADC, input mixers and output mixers |
| 10546 | */ |
| 10547 | static struct hda_verb alc262_init_verbs[] = { |
| 10548 | /* |
| 10549 | * Unmute ADC0-2 and set the default input to mic-in |
| 10550 | */ |
| 10551 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10552 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10553 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10554 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10555 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10556 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10557 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10558 | /* 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] | 10559 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10560 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10561 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10562 | */ |
| 10563 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10565 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10566 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10569 | |
| 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 | /* set up input amps for analog loopback */ |
| 10578 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10579 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10580 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10581 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10582 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10583 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10584 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10585 | |
| 10586 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10587 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10588 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10589 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10590 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10591 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10592 | |
| 10593 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10594 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10595 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10596 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10597 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10598 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10599 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10600 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10601 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10602 | /* FIXME: use matrix-type input source selection */ |
| 10603 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10604 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10605 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10606 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10607 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10608 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10609 | /* Input mixer2 */ |
| 10610 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10611 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10612 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10613 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10614 | /* Input mixer3 */ |
| 10615 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10616 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10617 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10618 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10619 | |
| 10620 | { } |
| 10621 | }; |
| 10622 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10623 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10624 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10625 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10626 | { } |
| 10627 | }; |
| 10628 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10629 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10630 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10631 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10632 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10633 | |
| 10634 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10635 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10636 | {} |
| 10637 | }; |
| 10638 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10639 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10640 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10641 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10642 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10643 | |
| 10644 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10645 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10646 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10647 | }; |
| 10648 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10649 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10650 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10651 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10652 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10653 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10654 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10655 | { } /* end */ |
| 10656 | }; |
| 10657 | |
| 10658 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10659 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10660 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10661 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10662 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10663 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10664 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10665 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10666 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10667 | {} |
| 10668 | }; |
| 10669 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10670 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10671 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10672 | struct alc_spec *spec = codec->spec; |
| 10673 | |
| 10674 | spec->autocfg.hp_pins[0] = 0x15; |
| 10675 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10676 | spec->ext_mic.pin = 0x18; |
| 10677 | spec->ext_mic.mux_idx = 0; |
| 10678 | spec->int_mic.pin = 0x12; |
| 10679 | spec->int_mic.mux_idx = 9; |
| 10680 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10681 | } |
| 10682 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10683 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10684 | * nec model |
| 10685 | * 0x15 = headphone |
| 10686 | * 0x16 = internal speaker |
| 10687 | * 0x18 = external mic |
| 10688 | */ |
| 10689 | |
| 10690 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10691 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10692 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10693 | |
| 10694 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10695 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10696 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10697 | |
| 10698 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10699 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10700 | { } /* end */ |
| 10701 | }; |
| 10702 | |
| 10703 | static struct hda_verb alc262_nec_verbs[] = { |
| 10704 | /* Unmute Speaker */ |
| 10705 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10706 | |
| 10707 | /* Headphone */ |
| 10708 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10709 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10710 | |
| 10711 | /* External mic to headphone */ |
| 10712 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10713 | /* External mic to speaker */ |
| 10714 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10715 | {} |
| 10716 | }; |
| 10717 | |
| 10718 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10719 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10720 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10721 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10722 | */ |
| 10723 | |
| 10724 | #define ALC_HP_EVENT 0x37 |
| 10725 | |
| 10726 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10727 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10728 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10729 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10730 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10731 | {} |
| 10732 | }; |
| 10733 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10734 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10735 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10736 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10737 | {} |
| 10738 | }; |
| 10739 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 10740 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 10741 | /* Front Mic pin: input vref at 50% */ |
| 10742 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 10743 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10744 | {} |
| 10745 | }; |
| 10746 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10747 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10748 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10749 | .items = { |
| 10750 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10751 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10752 | { "CD", 0x4 }, |
| 10753 | }, |
| 10754 | }; |
| 10755 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10756 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10757 | .num_items = 5, |
| 10758 | .items = { |
| 10759 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10760 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10761 | { "Line", 0x2 }, |
| 10762 | { "CD", 0x4 }, |
| 10763 | { "AUX IN", 0x6 }, |
| 10764 | }, |
| 10765 | }; |
| 10766 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10767 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10768 | .num_items = 4, |
| 10769 | .items = { |
| 10770 | { "Mic", 0x0 }, |
| 10771 | { "Front Mic", 0x2 }, |
| 10772 | { "Line", 0x1 }, |
| 10773 | { "CD", 0x4 }, |
| 10774 | }, |
| 10775 | }; |
| 10776 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10777 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10778 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10779 | { |
| 10780 | struct alc_spec *spec = codec->spec; |
| 10781 | unsigned int mute; |
| 10782 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10783 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10784 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 10785 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10786 | spec->sense_updated = 1; |
| 10787 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10788 | /* unmute internal speaker only if both HPs are unplugged and |
| 10789 | * master switch is on |
| 10790 | */ |
| 10791 | if (spec->jack_present) |
| 10792 | mute = HDA_AMP_MUTE; |
| 10793 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10794 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10795 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10796 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10797 | } |
| 10798 | |
| 10799 | /* unsolicited event for HP jack sensing */ |
| 10800 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10801 | unsigned int res) |
| 10802 | { |
| 10803 | if ((res >> 26) != ALC_HP_EVENT) |
| 10804 | return; |
| 10805 | alc262_fujitsu_automute(codec, 1); |
| 10806 | } |
| 10807 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10808 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10809 | { |
| 10810 | alc262_fujitsu_automute(codec, 1); |
| 10811 | } |
| 10812 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10813 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10814 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10815 | .ops = &snd_hda_bind_vol, |
| 10816 | .values = { |
| 10817 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10818 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10819 | 0 |
| 10820 | }, |
| 10821 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10822 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10823 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10824 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10825 | { |
| 10826 | struct alc_spec *spec = codec->spec; |
| 10827 | unsigned int mute; |
| 10828 | |
| 10829 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10830 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10831 | spec->sense_updated = 1; |
| 10832 | } |
| 10833 | if (spec->jack_present) { |
| 10834 | /* mute internal speaker */ |
| 10835 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10836 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10837 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10838 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10839 | } else { |
| 10840 | /* unmute internal speaker if necessary */ |
| 10841 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10842 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10843 | HDA_AMP_MUTE, mute); |
| 10844 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10845 | HDA_AMP_MUTE, mute); |
| 10846 | } |
| 10847 | } |
| 10848 | |
| 10849 | /* unsolicited event for HP jack sensing */ |
| 10850 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10851 | unsigned int res) |
| 10852 | { |
| 10853 | if ((res >> 26) != ALC_HP_EVENT) |
| 10854 | return; |
| 10855 | alc262_lenovo_3000_automute(codec, 1); |
| 10856 | } |
| 10857 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10858 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 10859 | int dir, int idx, long *valp) |
| 10860 | { |
| 10861 | int i, change = 0; |
| 10862 | |
| 10863 | for (i = 0; i < 2; i++, valp++) |
| 10864 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 10865 | HDA_AMP_MUTE, |
| 10866 | *valp ? 0 : HDA_AMP_MUTE); |
| 10867 | return change; |
| 10868 | } |
| 10869 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10870 | /* bind hp and internal speaker mute (with plug check) */ |
| 10871 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10872 | struct snd_ctl_elem_value *ucontrol) |
| 10873 | { |
| 10874 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10875 | long *valp = ucontrol->value.integer.value; |
| 10876 | int change; |
| 10877 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10878 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 10879 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10880 | if (change) |
| 10881 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10882 | return change; |
| 10883 | } |
| 10884 | |
| 10885 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10886 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10887 | { |
| 10888 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10889 | .name = "Master Playback Switch", |
| 10890 | .info = snd_hda_mixer_amp_switch_info, |
| 10891 | .get = snd_hda_mixer_amp_switch_get, |
| 10892 | .put = alc262_fujitsu_master_sw_put, |
| 10893 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10894 | }, |
| 10895 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10896 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10897 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10900 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10901 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10902 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10903 | { } /* end */ |
| 10904 | }; |
| 10905 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10906 | /* bind hp and internal speaker mute (with plug check) */ |
| 10907 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10908 | struct snd_ctl_elem_value *ucontrol) |
| 10909 | { |
| 10910 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10911 | long *valp = ucontrol->value.integer.value; |
| 10912 | int change; |
| 10913 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10914 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10915 | if (change) |
| 10916 | alc262_lenovo_3000_automute(codec, 0); |
| 10917 | return change; |
| 10918 | } |
| 10919 | |
| 10920 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10921 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10922 | { |
| 10923 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10924 | .name = "Master Playback Switch", |
| 10925 | .info = snd_hda_mixer_amp_switch_info, |
| 10926 | .get = snd_hda_mixer_amp_switch_get, |
| 10927 | .put = alc262_lenovo_3000_master_sw_put, |
| 10928 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10929 | }, |
| 10930 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10931 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10932 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10933 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10934 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10935 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10936 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10937 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10938 | { } /* end */ |
| 10939 | }; |
| 10940 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10941 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10942 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10943 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10944 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10945 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10946 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10947 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10948 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10949 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10950 | { } /* end */ |
| 10951 | }; |
| 10952 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10953 | /* additional init verbs for Benq laptops */ |
| 10954 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10955 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10956 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10957 | {} |
| 10958 | }; |
| 10959 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10960 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10961 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10962 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10963 | |
| 10964 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10965 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10966 | {} |
| 10967 | }; |
| 10968 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10969 | /* Samsung Q1 Ultra Vista model setup */ |
| 10970 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10971 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10972 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10973 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10974 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10975 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10976 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10977 | { } /* end */ |
| 10978 | }; |
| 10979 | |
| 10980 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10981 | /* output mixer */ |
| 10982 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10983 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10984 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10985 | /* speaker */ |
| 10986 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10987 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10988 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10989 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10990 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10991 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10992 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10993 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10994 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10995 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10996 | /* internal mic */ |
| 10997 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10998 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10999 | /* ADC, choose mic */ |
| 11000 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11001 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11002 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11003 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11004 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11005 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11006 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11007 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11008 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11009 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11010 | {} |
| 11011 | }; |
| 11012 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11013 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11014 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11015 | { |
| 11016 | struct alc_spec *spec = codec->spec; |
| 11017 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11018 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11019 | mute = 0; |
| 11020 | /* auto-mute only when HP is used as HP */ |
| 11021 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11022 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11023 | if (spec->jack_present) |
| 11024 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11025 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11026 | /* mute/unmute internal speaker */ |
| 11027 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11028 | HDA_AMP_MUTE, mute); |
| 11029 | /* mute/unmute HP */ |
| 11030 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11031 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11032 | } |
| 11033 | |
| 11034 | /* unsolicited event for HP jack sensing */ |
| 11035 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11036 | unsigned int res) |
| 11037 | { |
| 11038 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11039 | return; |
| 11040 | alc262_ultra_automute(codec); |
| 11041 | } |
| 11042 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11043 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11044 | .num_items = 2, |
| 11045 | .items = { |
| 11046 | { "Mic", 0x1 }, |
| 11047 | { "Headphone", 0x7 }, |
| 11048 | }, |
| 11049 | }; |
| 11050 | |
| 11051 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11052 | struct snd_ctl_elem_value *ucontrol) |
| 11053 | { |
| 11054 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11055 | struct alc_spec *spec = codec->spec; |
| 11056 | int ret; |
| 11057 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11058 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11059 | if (!ret) |
| 11060 | return 0; |
| 11061 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11062 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11063 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11064 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11065 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11066 | return ret; |
| 11067 | } |
| 11068 | |
| 11069 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11070 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11071 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11072 | { |
| 11073 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11074 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11075 | .info = alc_mux_enum_info, |
| 11076 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11077 | .put = alc262_ultra_mux_enum_put, |
| 11078 | }, |
| 11079 | { } /* end */ |
| 11080 | }; |
| 11081 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11082 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11083 | * and thus it's bound with a different mixer. |
| 11084 | * This function returns which mixer amp should be used. |
| 11085 | */ |
| 11086 | static int alc262_check_volbit(hda_nid_t nid) |
| 11087 | { |
| 11088 | if (!nid) |
| 11089 | return 0; |
| 11090 | else if (nid == 0x16) |
| 11091 | return 2; |
| 11092 | else |
| 11093 | return 1; |
| 11094 | } |
| 11095 | |
| 11096 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11097 | const char *pfx, int *vbits) |
| 11098 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11099 | unsigned long val; |
| 11100 | int vbit; |
| 11101 | |
| 11102 | vbit = alc262_check_volbit(nid); |
| 11103 | if (!vbit) |
| 11104 | return 0; |
| 11105 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11106 | return 0; |
| 11107 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11108 | if (vbit == 2) |
| 11109 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11110 | else |
| 11111 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11112 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11113 | } |
| 11114 | |
| 11115 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11116 | const char *pfx) |
| 11117 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11118 | unsigned long val; |
| 11119 | |
| 11120 | if (!nid) |
| 11121 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11122 | if (nid == 0x16) |
| 11123 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11124 | else |
| 11125 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11126 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11127 | } |
| 11128 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11129 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11130 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11131 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11132 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11133 | const char *pfx; |
| 11134 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11135 | int err; |
| 11136 | |
| 11137 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11138 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11139 | spec->multiout.dac_nids[0] = 2; |
| 11140 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11141 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11142 | pfx = "Master"; |
| 11143 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11144 | pfx = "Speaker"; |
| 11145 | else |
| 11146 | pfx = "Front"; |
| 11147 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11148 | if (err < 0) |
| 11149 | return err; |
| 11150 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11151 | if (err < 0) |
| 11152 | return err; |
| 11153 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11154 | if (err < 0) |
| 11155 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11156 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11157 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11158 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11159 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11160 | if (vbits == 1 || vbits == 2) |
| 11161 | pfx = "Master"; /* only one mixer is used */ |
| 11162 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11163 | pfx = "Speaker"; |
| 11164 | else |
| 11165 | pfx = "Front"; |
| 11166 | vbits = 0; |
| 11167 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11168 | if (err < 0) |
| 11169 | return err; |
| 11170 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11171 | &vbits); |
| 11172 | if (err < 0) |
| 11173 | return err; |
| 11174 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11175 | &vbits); |
| 11176 | if (err < 0) |
| 11177 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11178 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11179 | } |
| 11180 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11181 | #define alc262_auto_create_input_ctls \ |
| 11182 | alc880_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11183 | |
| 11184 | /* |
| 11185 | * generic initialization of ADC, input mixers and output mixers |
| 11186 | */ |
| 11187 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11188 | /* |
| 11189 | * Unmute ADC0-2 and set the default input to mic-in |
| 11190 | */ |
| 11191 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11192 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11193 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11194 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11195 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11196 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11197 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11198 | /* 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] | 11199 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11200 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11201 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11202 | */ |
| 11203 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11204 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11205 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11206 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11207 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11208 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11209 | |
| 11210 | /* |
| 11211 | * Set up output mixers (0x0c - 0x0f) |
| 11212 | */ |
| 11213 | /* set vol=0 to output mixers */ |
| 11214 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11215 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11216 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11217 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11218 | /* set up input amps for analog loopback */ |
| 11219 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11220 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11221 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11222 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11223 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11224 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11225 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11226 | |
| 11227 | /* FIXME: use matrix-type input source selection */ |
| 11228 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11229 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11230 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11231 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11232 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11233 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11234 | /* Input mixer2 */ |
| 11235 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11236 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11237 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11238 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11239 | /* Input mixer3 */ |
| 11240 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11241 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11242 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11243 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11244 | |
| 11245 | { } |
| 11246 | }; |
| 11247 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11248 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11249 | /* |
| 11250 | * Unmute ADC0-2 and set the default input to mic-in |
| 11251 | */ |
| 11252 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11253 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11254 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11255 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11256 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11257 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11258 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11259 | /* 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] | 11260 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11261 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11262 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11263 | */ |
| 11264 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11265 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11266 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11267 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11268 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11269 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11270 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11271 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11272 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11273 | /* |
| 11274 | * Set up output mixers (0x0c - 0x0e) |
| 11275 | */ |
| 11276 | /* set vol=0 to output mixers */ |
| 11277 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11278 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11279 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11280 | |
| 11281 | /* set up input amps for analog loopback */ |
| 11282 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11283 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11284 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11285 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11286 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11287 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11288 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11289 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11290 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11291 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11292 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11293 | |
| 11294 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11295 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11296 | |
| 11297 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11298 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11299 | |
| 11300 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11301 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11302 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11303 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11304 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11305 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11306 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11307 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11308 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11309 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11310 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11311 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11312 | |
| 11313 | |
| 11314 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11315 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11316 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11317 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11318 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11319 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11320 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11321 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11322 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11323 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11324 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11325 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11326 | /* Input mixer2 */ |
| 11327 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11328 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11329 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11330 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11331 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11332 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11333 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11334 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11335 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11336 | /* Input mixer3 */ |
| 11337 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11338 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11339 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11340 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11341 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11342 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11343 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11344 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11345 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11346 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11347 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11348 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11349 | { } |
| 11350 | }; |
| 11351 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11352 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11353 | /* |
| 11354 | * Unmute ADC0-2 and set the default input to mic-in |
| 11355 | */ |
| 11356 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11357 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11358 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11359 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11360 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11361 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11362 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11363 | /* 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] | 11364 | * mixer widget |
| 11365 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11366 | * panel mic (mic 2) |
| 11367 | */ |
| 11368 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11369 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11370 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11371 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11372 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11373 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11374 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11375 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11376 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11377 | /* |
| 11378 | * Set up output mixers (0x0c - 0x0e) |
| 11379 | */ |
| 11380 | /* set vol=0 to output mixers */ |
| 11381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11382 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11383 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11384 | |
| 11385 | /* set up input amps for analog loopback */ |
| 11386 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11387 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11388 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11389 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11390 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11391 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11392 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11393 | |
| 11394 | |
| 11395 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11396 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11397 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11398 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11399 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11400 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11401 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11402 | |
| 11403 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11404 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11405 | |
| 11406 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11407 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11408 | |
| 11409 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11410 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11411 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11412 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11413 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11414 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11415 | |
| 11416 | /* FIXME: use matrix-type input source selection */ |
| 11417 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11418 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11419 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11420 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11421 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11422 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11423 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11424 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11425 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11426 | /* Input mixer2 */ |
| 11427 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11428 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11429 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11430 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11431 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11432 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11433 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11434 | /* Input mixer3 */ |
| 11435 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11436 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11437 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11438 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11439 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11440 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11441 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11442 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11443 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11444 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11445 | { } |
| 11446 | }; |
| 11447 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11448 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11449 | |
| 11450 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11451 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11452 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11453 | |
| 11454 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11455 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11456 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11457 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11458 | |
| 11459 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11460 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11461 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11462 | {} |
| 11463 | }; |
| 11464 | |
| 11465 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11466 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11467 | #define alc262_loopbacks alc880_loopbacks |
| 11468 | #endif |
| 11469 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11470 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11471 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11472 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11473 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11474 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11475 | |
| 11476 | /* |
| 11477 | * BIOS auto configuration |
| 11478 | */ |
| 11479 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11480 | { |
| 11481 | struct alc_spec *spec = codec->spec; |
| 11482 | int err; |
| 11483 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11484 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11485 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11486 | alc262_ignore); |
| 11487 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11488 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11489 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11490 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11491 | spec->multiout.max_channels = 2; |
| 11492 | spec->no_analog = 1; |
| 11493 | goto dig_only; |
| 11494 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11495 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11496 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11497 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11498 | if (err < 0) |
| 11499 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11500 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11501 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11502 | return err; |
| 11503 | |
| 11504 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11505 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11506 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11507 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11508 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11509 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11510 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11511 | if (spec->autocfg.dig_in_pin) |
| 11512 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11513 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11514 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11515 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11516 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11517 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11518 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11519 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11520 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11521 | err = alc_auto_add_mic_boost(codec); |
| 11522 | if (err < 0) |
| 11523 | return err; |
| 11524 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11525 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11526 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11527 | return 1; |
| 11528 | } |
| 11529 | |
| 11530 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11531 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11532 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11533 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11534 | |
| 11535 | |
| 11536 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11537 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11538 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11539 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11540 | alc262_auto_init_multi_out(codec); |
| 11541 | alc262_auto_init_hp_out(codec); |
| 11542 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11543 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11544 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11545 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11546 | } |
| 11547 | |
| 11548 | /* |
| 11549 | * configuration and preset |
| 11550 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11551 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11552 | [ALC262_BASIC] = "basic", |
| 11553 | [ALC262_HIPPO] = "hippo", |
| 11554 | [ALC262_HIPPO_1] = "hippo_1", |
| 11555 | [ALC262_FUJITSU] = "fujitsu", |
| 11556 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11557 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11558 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11559 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11560 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11561 | [ALC262_BENQ_T31] = "benq-t31", |
| 11562 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11563 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11564 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11565 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11566 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11567 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11568 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11569 | [ALC262_AUTO] = "auto", |
| 11570 | }; |
| 11571 | |
| 11572 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11573 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11574 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11575 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11576 | ALC262_HP_BPC), |
| 11577 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11578 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11579 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11580 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11581 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11582 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11583 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11584 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11585 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11586 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11587 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11588 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11589 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11590 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11591 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11592 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11593 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11594 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11595 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11596 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11597 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11598 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11599 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 11600 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 11601 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 11602 | #if 0 /* disable the quirk since model=auto works better in recent versions */ |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11603 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11604 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 11605 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11606 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11607 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11608 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11609 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11610 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11611 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11612 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11613 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11614 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11615 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11616 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11617 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11618 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11619 | {} |
| 11620 | }; |
| 11621 | |
| 11622 | static struct alc_config_preset alc262_presets[] = { |
| 11623 | [ALC262_BASIC] = { |
| 11624 | .mixers = { alc262_base_mixer }, |
| 11625 | .init_verbs = { alc262_init_verbs }, |
| 11626 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11627 | .dac_nids = alc262_dac_nids, |
| 11628 | .hp_nid = 0x03, |
| 11629 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11630 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11631 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11632 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11633 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11634 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11635 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11636 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11637 | .dac_nids = alc262_dac_nids, |
| 11638 | .hp_nid = 0x03, |
| 11639 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11640 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11641 | .channel_mode = alc262_modes, |
| 11642 | .input_mux = &alc262_capture_source, |
| 11643 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11644 | .setup = alc262_hippo_setup, |
| 11645 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11646 | }, |
| 11647 | [ALC262_HIPPO_1] = { |
| 11648 | .mixers = { alc262_hippo1_mixer }, |
| 11649 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11650 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11651 | .dac_nids = alc262_dac_nids, |
| 11652 | .hp_nid = 0x02, |
| 11653 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11654 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11655 | .channel_mode = alc262_modes, |
| 11656 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11657 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11658 | .setup = alc262_hippo1_setup, |
| 11659 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11660 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11661 | [ALC262_FUJITSU] = { |
| 11662 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11663 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11664 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11665 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11666 | .dac_nids = alc262_dac_nids, |
| 11667 | .hp_nid = 0x03, |
| 11668 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11669 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11670 | .channel_mode = alc262_modes, |
| 11671 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11672 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11673 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11674 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11675 | [ALC262_HP_BPC] = { |
| 11676 | .mixers = { alc262_HP_BPC_mixer }, |
| 11677 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11678 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11679 | .dac_nids = alc262_dac_nids, |
| 11680 | .hp_nid = 0x03, |
| 11681 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11682 | .channel_mode = alc262_modes, |
| 11683 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11684 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11685 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11686 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11687 | [ALC262_HP_BPC_D7000_WF] = { |
| 11688 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11689 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11690 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11691 | .dac_nids = alc262_dac_nids, |
| 11692 | .hp_nid = 0x03, |
| 11693 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11694 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11695 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11696 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11697 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11698 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11699 | [ALC262_HP_BPC_D7000_WL] = { |
| 11700 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11701 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11702 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11703 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11704 | .dac_nids = alc262_dac_nids, |
| 11705 | .hp_nid = 0x03, |
| 11706 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11707 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11708 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11709 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11710 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11711 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11712 | [ALC262_HP_TC_T5735] = { |
| 11713 | .mixers = { alc262_hp_t5735_mixer }, |
| 11714 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11715 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11716 | .dac_nids = alc262_dac_nids, |
| 11717 | .hp_nid = 0x03, |
| 11718 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11719 | .channel_mode = alc262_modes, |
| 11720 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11721 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11722 | .setup = alc262_hp_t5735_setup, |
| 11723 | .init_hook = alc_automute_amp, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11724 | }, |
| 11725 | [ALC262_HP_RP5700] = { |
| 11726 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11727 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11728 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11729 | .dac_nids = alc262_dac_nids, |
| 11730 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11731 | .channel_mode = alc262_modes, |
| 11732 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11733 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11734 | [ALC262_BENQ_ED8] = { |
| 11735 | .mixers = { alc262_base_mixer }, |
| 11736 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11737 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11738 | .dac_nids = alc262_dac_nids, |
| 11739 | .hp_nid = 0x03, |
| 11740 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11741 | .channel_mode = alc262_modes, |
| 11742 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11743 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11744 | [ALC262_SONY_ASSAMD] = { |
| 11745 | .mixers = { alc262_sony_mixer }, |
| 11746 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11747 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11748 | .dac_nids = alc262_dac_nids, |
| 11749 | .hp_nid = 0x02, |
| 11750 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11751 | .channel_mode = alc262_modes, |
| 11752 | .input_mux = &alc262_capture_source, |
| 11753 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11754 | .setup = alc262_hippo_setup, |
| 11755 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11756 | }, |
| 11757 | [ALC262_BENQ_T31] = { |
| 11758 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11759 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 11760 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11761 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11762 | .dac_nids = alc262_dac_nids, |
| 11763 | .hp_nid = 0x03, |
| 11764 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11765 | .channel_mode = alc262_modes, |
| 11766 | .input_mux = &alc262_capture_source, |
| 11767 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11768 | .setup = alc262_hippo_setup, |
| 11769 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11770 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11771 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11772 | .mixers = { alc262_ultra_mixer }, |
| 11773 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11774 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11775 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11776 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11777 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11778 | .channel_mode = alc262_modes, |
| 11779 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11780 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11781 | .capsrc_nids = alc262_capsrc_nids, |
| 11782 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11783 | .unsol_event = alc262_ultra_unsol_event, |
| 11784 | .init_hook = alc262_ultra_automute, |
| 11785 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11786 | [ALC262_LENOVO_3000] = { |
| 11787 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11788 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11789 | alc262_lenovo_3000_unsol_verbs, |
| 11790 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11791 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11792 | .dac_nids = alc262_dac_nids, |
| 11793 | .hp_nid = 0x03, |
| 11794 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11795 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11796 | .channel_mode = alc262_modes, |
| 11797 | .input_mux = &alc262_fujitsu_capture_source, |
| 11798 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11799 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11800 | [ALC262_NEC] = { |
| 11801 | .mixers = { alc262_nec_mixer }, |
| 11802 | .init_verbs = { alc262_nec_verbs }, |
| 11803 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11804 | .dac_nids = alc262_dac_nids, |
| 11805 | .hp_nid = 0x03, |
| 11806 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11807 | .channel_mode = alc262_modes, |
| 11808 | .input_mux = &alc262_capture_source, |
| 11809 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11810 | [ALC262_TOSHIBA_S06] = { |
| 11811 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11812 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11813 | alc262_eapd_verbs }, |
| 11814 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11815 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11816 | .dac_nids = alc262_dac_nids, |
| 11817 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11818 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11819 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11820 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11821 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11822 | .unsol_event = alc_sku_unsol_event, |
| 11823 | .setup = alc262_toshiba_s06_setup, |
| 11824 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11825 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11826 | [ALC262_TOSHIBA_RX1] = { |
| 11827 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11828 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11829 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11830 | .dac_nids = alc262_dac_nids, |
| 11831 | .hp_nid = 0x03, |
| 11832 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11833 | .channel_mode = alc262_modes, |
| 11834 | .input_mux = &alc262_capture_source, |
| 11835 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11836 | .setup = alc262_hippo_setup, |
| 11837 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11838 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11839 | [ALC262_TYAN] = { |
| 11840 | .mixers = { alc262_tyan_mixer }, |
| 11841 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11842 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11843 | .dac_nids = alc262_dac_nids, |
| 11844 | .hp_nid = 0x02, |
| 11845 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11846 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11847 | .channel_mode = alc262_modes, |
| 11848 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11849 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11850 | .setup = alc262_tyan_setup, |
| 11851 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11852 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11853 | }; |
| 11854 | |
| 11855 | static int patch_alc262(struct hda_codec *codec) |
| 11856 | { |
| 11857 | struct alc_spec *spec; |
| 11858 | int board_config; |
| 11859 | int err; |
| 11860 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11861 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11862 | if (spec == NULL) |
| 11863 | return -ENOMEM; |
| 11864 | |
| 11865 | codec->spec = spec; |
| 11866 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11867 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11868 | * under-run |
| 11869 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11870 | { |
| 11871 | int tmp; |
| 11872 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11873 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11874 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11875 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11876 | } |
| 11877 | #endif |
| 11878 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11879 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11880 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11881 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11882 | alc262_models, |
| 11883 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11884 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11885 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11886 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 11887 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11888 | board_config = ALC262_AUTO; |
| 11889 | } |
| 11890 | |
| 11891 | if (board_config == ALC262_AUTO) { |
| 11892 | /* automatic parse from the BIOS config */ |
| 11893 | err = alc262_parse_auto_config(codec); |
| 11894 | if (err < 0) { |
| 11895 | alc_free(codec); |
| 11896 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11897 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11898 | printk(KERN_INFO |
| 11899 | "hda_codec: Cannot set up configuration " |
| 11900 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11901 | board_config = ALC262_BASIC; |
| 11902 | } |
| 11903 | } |
| 11904 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11905 | if (!spec->no_analog) { |
| 11906 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11907 | if (err < 0) { |
| 11908 | alc_free(codec); |
| 11909 | return err; |
| 11910 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11911 | } |
| 11912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11913 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11914 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11915 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11916 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11917 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11918 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11919 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11920 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11921 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11922 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11923 | int i; |
| 11924 | /* check whether the digital-mic has to be supported */ |
| 11925 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11926 | if (spec->input_mux->items[i].index >= 9) |
| 11927 | break; |
| 11928 | } |
| 11929 | if (i < spec->input_mux->num_items) { |
| 11930 | /* use only ADC0 */ |
| 11931 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11932 | spec->num_adc_nids = 1; |
| 11933 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11934 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11935 | /* all analog inputs */ |
| 11936 | /* check whether NID 0x07 is valid */ |
| 11937 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11938 | |
| 11939 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11940 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11941 | if (wcap != AC_WID_AUD_IN) { |
| 11942 | spec->adc_nids = alc262_adc_nids_alt; |
| 11943 | spec->num_adc_nids = |
| 11944 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11945 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11946 | } else { |
| 11947 | spec->adc_nids = alc262_adc_nids; |
| 11948 | spec->num_adc_nids = |
| 11949 | ARRAY_SIZE(alc262_adc_nids); |
| 11950 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11951 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11952 | } |
| 11953 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11954 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11955 | set_capture_mixer(codec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11956 | if (!spec->no_analog) |
| 11957 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11958 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11959 | spec->vmaster_nid = 0x0c; |
| 11960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11961 | codec->patch_ops = alc_patch_ops; |
| 11962 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11963 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11964 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11965 | if (!spec->loopback.amplist) |
| 11966 | spec->loopback.amplist = alc262_loopbacks; |
| 11967 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11968 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11969 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11970 | return 0; |
| 11971 | } |
| 11972 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11973 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11974 | * ALC268 channel source setting (2 channel) |
| 11975 | */ |
| 11976 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11977 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11978 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11979 | static hda_nid_t alc268_dac_nids[2] = { |
| 11980 | /* front, hp */ |
| 11981 | 0x02, 0x03 |
| 11982 | }; |
| 11983 | |
| 11984 | static hda_nid_t alc268_adc_nids[2] = { |
| 11985 | /* ADC0-1 */ |
| 11986 | 0x08, 0x07 |
| 11987 | }; |
| 11988 | |
| 11989 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11990 | /* ADC0 */ |
| 11991 | 0x08 |
| 11992 | }; |
| 11993 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11994 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11995 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11996 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11997 | /* output mixer control */ |
| 11998 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11999 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12000 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12001 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12002 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12003 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12004 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12005 | { } |
| 12006 | }; |
| 12007 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12008 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12009 | /* output mixer control */ |
| 12010 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12011 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12012 | ALC262_HIPPO_MASTER_SWITCH, |
| 12013 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12014 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12015 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12016 | { } |
| 12017 | }; |
| 12018 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12019 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12020 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12021 | .ops = &snd_hda_bind_sw, |
| 12022 | .values = { |
| 12023 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12024 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12025 | 0 |
| 12026 | }, |
| 12027 | }; |
| 12028 | |
| 12029 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12030 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12031 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12032 | { } |
| 12033 | }; |
| 12034 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12035 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12036 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12037 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12038 | { } |
| 12039 | }; |
| 12040 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12041 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12042 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12043 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12044 | { } /* end */ |
| 12045 | }; |
| 12046 | |
| 12047 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12048 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12049 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12050 | .ops = &snd_hda_bind_vol, |
| 12051 | .values = { |
| 12052 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12053 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12054 | 0 |
| 12055 | }, |
| 12056 | }; |
| 12057 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12058 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12059 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12060 | { |
| 12061 | struct alc_spec *spec = codec->spec; |
| 12062 | unsigned int mute; |
| 12063 | |
| 12064 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12065 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12066 | spec->sense_updated = 1; |
| 12067 | } |
| 12068 | if (spec->jack_present) |
| 12069 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12070 | else /* unmute internal speaker if necessary */ |
| 12071 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12072 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12073 | HDA_AMP_MUTE, mute); |
| 12074 | } |
| 12075 | |
| 12076 | |
| 12077 | /* bind hp and internal speaker mute (with plug check) */ |
| 12078 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12079 | struct snd_ctl_elem_value *ucontrol) |
| 12080 | { |
| 12081 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12082 | long *valp = ucontrol->value.integer.value; |
| 12083 | int change; |
| 12084 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12085 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12086 | if (change) |
| 12087 | alc268_acer_automute(codec, 0); |
| 12088 | return change; |
| 12089 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12090 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12091 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12092 | /* output mixer control */ |
| 12093 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12094 | { |
| 12095 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12096 | .name = "Master Playback Switch", |
| 12097 | .info = snd_hda_mixer_amp_switch_info, |
| 12098 | .get = snd_hda_mixer_amp_switch_get, |
| 12099 | .put = alc268_acer_master_sw_put, |
| 12100 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12101 | }, |
| 12102 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12103 | { } |
| 12104 | }; |
| 12105 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12106 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12107 | /* output mixer control */ |
| 12108 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12109 | { |
| 12110 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12111 | .name = "Master Playback Switch", |
| 12112 | .info = snd_hda_mixer_amp_switch_info, |
| 12113 | .get = snd_hda_mixer_amp_switch_get, |
| 12114 | .put = alc268_acer_master_sw_put, |
| 12115 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12116 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12117 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12118 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12119 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12120 | { } |
| 12121 | }; |
| 12122 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12123 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12124 | /* output mixer control */ |
| 12125 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12126 | { |
| 12127 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12128 | .name = "Master Playback Switch", |
| 12129 | .info = snd_hda_mixer_amp_switch_info, |
| 12130 | .get = snd_hda_mixer_amp_switch_get, |
| 12131 | .put = alc268_acer_master_sw_put, |
| 12132 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12133 | }, |
| 12134 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12135 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12136 | { } |
| 12137 | }; |
| 12138 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12139 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12140 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12141 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12142 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12143 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12144 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12145 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12146 | { } |
| 12147 | }; |
| 12148 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12149 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12150 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12151 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12152 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12153 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12154 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12155 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12156 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12157 | { } |
| 12158 | }; |
| 12159 | |
| 12160 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12161 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12162 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12163 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12164 | |
| 12165 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12166 | unsigned int res) |
| 12167 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12168 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12169 | return; |
| 12170 | alc268_acer_automute(codec, 1); |
| 12171 | } |
| 12172 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12173 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12174 | { |
| 12175 | alc268_acer_automute(codec, 1); |
| 12176 | } |
| 12177 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12178 | /* toggle speaker-output according to the hp-jack state */ |
| 12179 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12180 | { |
| 12181 | unsigned int present; |
| 12182 | unsigned char bits; |
| 12183 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12184 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12185 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12186 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 12187 | AMP_IN_MUTE(0), bits); |
| 12188 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 12189 | AMP_IN_MUTE(0), bits); |
| 12190 | } |
| 12191 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12192 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12193 | unsigned int res) |
| 12194 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12195 | switch (res >> 26) { |
| 12196 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12197 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12198 | break; |
| 12199 | case ALC880_MIC_EVENT: |
| 12200 | alc_mic_automute(codec); |
| 12201 | break; |
| 12202 | } |
| 12203 | } |
| 12204 | |
| 12205 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12206 | { |
| 12207 | struct alc_spec *spec = codec->spec; |
| 12208 | spec->ext_mic.pin = 0x18; |
| 12209 | spec->ext_mic.mux_idx = 0; |
| 12210 | spec->int_mic.pin = 0x12; |
| 12211 | spec->int_mic.mux_idx = 6; |
| 12212 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12213 | } |
| 12214 | |
| 12215 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12216 | { |
| 12217 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12218 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12219 | } |
| 12220 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12221 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12222 | /* output mixer control */ |
| 12223 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12224 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12225 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12227 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12228 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12229 | { } |
| 12230 | }; |
| 12231 | |
| 12232 | static struct hda_verb alc268_dell_verbs[] = { |
| 12233 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12234 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12235 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12236 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12237 | { } |
| 12238 | }; |
| 12239 | |
| 12240 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12241 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12242 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12243 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12244 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12245 | spec->autocfg.hp_pins[0] = 0x15; |
| 12246 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12247 | spec->ext_mic.pin = 0x18; |
| 12248 | spec->ext_mic.mux_idx = 0; |
| 12249 | spec->int_mic.pin = 0x19; |
| 12250 | spec->int_mic.mux_idx = 1; |
| 12251 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12252 | } |
| 12253 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12254 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12255 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12256 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12257 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12258 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12259 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12260 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12261 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12262 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12263 | { } |
| 12264 | }; |
| 12265 | |
| 12266 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12267 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12268 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12269 | { } |
| 12270 | }; |
| 12271 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12272 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12273 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12274 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12275 | spec->autocfg.hp_pins[0] = 0x15; |
| 12276 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12277 | spec->ext_mic.pin = 0x18; |
| 12278 | spec->ext_mic.mux_idx = 0; |
| 12279 | spec->int_mic.pin = 0x19; |
| 12280 | spec->int_mic.mux_idx = 1; |
| 12281 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12282 | } |
| 12283 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12284 | /* |
| 12285 | * generic initialization of ADC, input mixers and output mixers |
| 12286 | */ |
| 12287 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12288 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12289 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12290 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12291 | |
| 12292 | /* |
| 12293 | * Set up output mixers (0x0c - 0x0e) |
| 12294 | */ |
| 12295 | /* set vol=0 to output mixers */ |
| 12296 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12297 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12298 | |
| 12299 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12300 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12301 | |
| 12302 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12303 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12304 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12305 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12306 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12307 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12308 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12309 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12310 | |
| 12311 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12312 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12313 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12314 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12315 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12316 | |
| 12317 | /* set PCBEEP vol = 0, mute connections */ |
| 12318 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12319 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12320 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12321 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12322 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12323 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12324 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12325 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12326 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12327 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12328 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12329 | { } |
| 12330 | }; |
| 12331 | |
| 12332 | /* |
| 12333 | * generic initialization of ADC, input mixers and output mixers |
| 12334 | */ |
| 12335 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12336 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12337 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12338 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12339 | |
| 12340 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12341 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12342 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12343 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12344 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12345 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12346 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12347 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12348 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12349 | |
| 12350 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12351 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12352 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12353 | /* set PCBEEP vol = 0, mute connections */ |
| 12354 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12355 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12356 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12357 | |
| 12358 | { } |
| 12359 | }; |
| 12360 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12361 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12362 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12363 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12364 | { } /* end */ |
| 12365 | }; |
| 12366 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12367 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12368 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12369 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12370 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12371 | { } /* end */ |
| 12372 | }; |
| 12373 | |
| 12374 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12375 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12376 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12377 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12378 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12379 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12380 | { } /* end */ |
| 12381 | }; |
| 12382 | |
| 12383 | static struct hda_input_mux alc268_capture_source = { |
| 12384 | .num_items = 4, |
| 12385 | .items = { |
| 12386 | { "Mic", 0x0 }, |
| 12387 | { "Front Mic", 0x1 }, |
| 12388 | { "Line", 0x2 }, |
| 12389 | { "CD", 0x3 }, |
| 12390 | }, |
| 12391 | }; |
| 12392 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12393 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12394 | .num_items = 3, |
| 12395 | .items = { |
| 12396 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12397 | { "Internal Mic", 0x1 }, |
| 12398 | { "Line", 0x2 }, |
| 12399 | }, |
| 12400 | }; |
| 12401 | |
| 12402 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12403 | .num_items = 3, |
| 12404 | .items = { |
| 12405 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12406 | { "Internal Mic", 0x6 }, |
| 12407 | { "Line", 0x2 }, |
| 12408 | }, |
| 12409 | }; |
| 12410 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12411 | #ifdef CONFIG_SND_DEBUG |
| 12412 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12413 | /* Volume widgets */ |
| 12414 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12415 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12416 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12417 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12418 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12419 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12420 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12421 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12422 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12423 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12424 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12425 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12426 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12427 | /* The below appears problematic on some hardwares */ |
| 12428 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12429 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12430 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12431 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12432 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12433 | |
| 12434 | /* Modes for retasking pin widgets */ |
| 12435 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12436 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12437 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12438 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12439 | |
| 12440 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12441 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12442 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12443 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12444 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12445 | |
| 12446 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12447 | * The ALC268 does not have an SPDIF input. |
| 12448 | */ |
| 12449 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12450 | |
| 12451 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12452 | * this output to turn on an external amplifier. |
| 12453 | */ |
| 12454 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12455 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12456 | |
| 12457 | { } /* end */ |
| 12458 | }; |
| 12459 | #endif |
| 12460 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12461 | /* create input playback/capture controls for the given pin */ |
| 12462 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12463 | const char *ctlname, int idx) |
| 12464 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12465 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12466 | int err; |
| 12467 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12468 | switch (nid) { |
| 12469 | case 0x14: |
| 12470 | case 0x16: |
| 12471 | dac = 0x02; |
| 12472 | break; |
| 12473 | case 0x15: |
| 12474 | dac = 0x03; |
| 12475 | break; |
| 12476 | default: |
| 12477 | return 0; |
| 12478 | } |
| 12479 | if (spec->multiout.dac_nids[0] != dac && |
| 12480 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12481 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12482 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12483 | HDA_OUTPUT)); |
| 12484 | if (err < 0) |
| 12485 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12486 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12487 | } |
| 12488 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12489 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12490 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12491 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12492 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12493 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12494 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12495 | if (err < 0) |
| 12496 | return err; |
| 12497 | return 0; |
| 12498 | } |
| 12499 | |
| 12500 | /* add playback controls from the parsed DAC table */ |
| 12501 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12502 | const struct auto_pin_cfg *cfg) |
| 12503 | { |
| 12504 | hda_nid_t nid; |
| 12505 | int err; |
| 12506 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12507 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12508 | |
| 12509 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12510 | if (nid) { |
| 12511 | const char *name; |
| 12512 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12513 | name = "Speaker"; |
| 12514 | else |
| 12515 | name = "Front"; |
| 12516 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12517 | if (err < 0) |
| 12518 | return err; |
| 12519 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12520 | |
| 12521 | nid = cfg->speaker_pins[0]; |
| 12522 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12523 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12524 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12525 | if (err < 0) |
| 12526 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12527 | } else { |
| 12528 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12529 | if (err < 0) |
| 12530 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12531 | } |
| 12532 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12533 | if (nid) { |
| 12534 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12535 | if (err < 0) |
| 12536 | return err; |
| 12537 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12538 | |
| 12539 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12540 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12541 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12542 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12543 | if (err < 0) |
| 12544 | return err; |
| 12545 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12546 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12547 | } |
| 12548 | |
| 12549 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12550 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12551 | const struct auto_pin_cfg *cfg) |
| 12552 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12553 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12554 | } |
| 12555 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12556 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12557 | hda_nid_t nid, int pin_type) |
| 12558 | { |
| 12559 | int idx; |
| 12560 | |
| 12561 | alc_set_pin_output(codec, nid, pin_type); |
| 12562 | if (nid == 0x14 || nid == 0x16) |
| 12563 | idx = 0; |
| 12564 | else |
| 12565 | idx = 1; |
| 12566 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 12567 | } |
| 12568 | |
| 12569 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 12570 | { |
| 12571 | struct alc_spec *spec = codec->spec; |
| 12572 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 12573 | if (nid) { |
| 12574 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 12575 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 12576 | } |
| 12577 | } |
| 12578 | |
| 12579 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 12580 | { |
| 12581 | struct alc_spec *spec = codec->spec; |
| 12582 | hda_nid_t pin; |
| 12583 | |
| 12584 | pin = spec->autocfg.hp_pins[0]; |
| 12585 | if (pin) |
| 12586 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 12587 | pin = spec->autocfg.speaker_pins[0]; |
| 12588 | if (pin) |
| 12589 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 12590 | } |
| 12591 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12592 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12593 | { |
| 12594 | struct alc_spec *spec = codec->spec; |
| 12595 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12596 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12597 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12598 | unsigned int dac_vol1, dac_vol2; |
| 12599 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12600 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12601 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12602 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12603 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12604 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12605 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12606 | AMP_IN_UNMUTE(1)); |
| 12607 | snd_hda_codec_write(codec, 0x10, 0, |
| 12608 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12609 | AMP_IN_UNMUTE(1)); |
| 12610 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12611 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12612 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12613 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12614 | snd_hda_codec_write(codec, 0x10, 0, |
| 12615 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12616 | } |
| 12617 | |
| 12618 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12619 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12620 | dac_vol2 = AMP_OUT_ZERO; |
| 12621 | else if (line_nid == 0x15) |
| 12622 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12623 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12624 | dac_vol2 = AMP_OUT_ZERO; |
| 12625 | else if (hp_nid == 0x15) |
| 12626 | dac_vol1 = AMP_OUT_ZERO; |
| 12627 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12628 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12629 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12630 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12631 | |
| 12632 | snd_hda_codec_write(codec, 0x02, 0, |
| 12633 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12634 | snd_hda_codec_write(codec, 0x03, 0, |
| 12635 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12636 | } |
| 12637 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12638 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12639 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12640 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12641 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12642 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12643 | |
| 12644 | /* |
| 12645 | * BIOS auto configuration |
| 12646 | */ |
| 12647 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12648 | { |
| 12649 | struct alc_spec *spec = codec->spec; |
| 12650 | int err; |
| 12651 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12652 | |
| 12653 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12654 | alc268_ignore); |
| 12655 | if (err < 0) |
| 12656 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12657 | if (!spec->autocfg.line_outs) { |
| 12658 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12659 | spec->multiout.max_channels = 2; |
| 12660 | spec->no_analog = 1; |
| 12661 | goto dig_only; |
| 12662 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12663 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12664 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12665 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12666 | if (err < 0) |
| 12667 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12668 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12669 | if (err < 0) |
| 12670 | return err; |
| 12671 | |
| 12672 | spec->multiout.max_channels = 2; |
| 12673 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12674 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12675 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12676 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12677 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12678 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12679 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12680 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12681 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12682 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12683 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12684 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12685 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12686 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12687 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12688 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12689 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12690 | err = alc_auto_add_mic_boost(codec); |
| 12691 | if (err < 0) |
| 12692 | return err; |
| 12693 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12694 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12695 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12696 | return 1; |
| 12697 | } |
| 12698 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12699 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12700 | |
| 12701 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12702 | static void alc268_auto_init(struct hda_codec *codec) |
| 12703 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12704 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12705 | alc268_auto_init_multi_out(codec); |
| 12706 | alc268_auto_init_hp_out(codec); |
| 12707 | alc268_auto_init_mono_speaker_out(codec); |
| 12708 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12709 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12710 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12711 | } |
| 12712 | |
| 12713 | /* |
| 12714 | * configuration and preset |
| 12715 | */ |
| 12716 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12717 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12718 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12719 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12720 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12721 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12722 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12723 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12724 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12725 | #ifdef CONFIG_SND_DEBUG |
| 12726 | [ALC268_TEST] = "test", |
| 12727 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12728 | [ALC268_AUTO] = "auto", |
| 12729 | }; |
| 12730 | |
| 12731 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12732 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12733 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12734 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12735 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12736 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12737 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12738 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12739 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 12740 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 12741 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 12742 | /* almost compatible with toshiba but with optional digital outs; |
| 12743 | * auto-probing seems working fine |
| 12744 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12745 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 12746 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12747 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12748 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12749 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12750 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12751 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12752 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12753 | {} |
| 12754 | }; |
| 12755 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12756 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 12757 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 12758 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 12759 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 12760 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12761 | ALC268_TOSHIBA), |
| 12762 | {} |
| 12763 | }; |
| 12764 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12765 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12766 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12767 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 12768 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12769 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12770 | alc267_quanta_il1_verbs }, |
| 12771 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12772 | .dac_nids = alc268_dac_nids, |
| 12773 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12774 | .adc_nids = alc268_adc_nids_alt, |
| 12775 | .hp_nid = 0x03, |
| 12776 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12777 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12778 | .unsol_event = alc_sku_unsol_event, |
| 12779 | .setup = alc267_quanta_il1_setup, |
| 12780 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12781 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12782 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12783 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12784 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12785 | .init_verbs = { alc268_base_init_verbs }, |
| 12786 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12787 | .dac_nids = alc268_dac_nids, |
| 12788 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12789 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12790 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12791 | .hp_nid = 0x03, |
| 12792 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12793 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12794 | .channel_mode = alc268_modes, |
| 12795 | .input_mux = &alc268_capture_source, |
| 12796 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12797 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12798 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12799 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12800 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12801 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12802 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12803 | .dac_nids = alc268_dac_nids, |
| 12804 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12805 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12806 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12807 | .hp_nid = 0x03, |
| 12808 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12809 | .channel_mode = alc268_modes, |
| 12810 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12811 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12812 | .setup = alc268_toshiba_setup, |
| 12813 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12814 | }, |
| 12815 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 12816 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12817 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12818 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12819 | alc268_acer_verbs }, |
| 12820 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12821 | .dac_nids = alc268_dac_nids, |
| 12822 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12823 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12824 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12825 | .hp_nid = 0x02, |
| 12826 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12827 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12828 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12829 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12830 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12831 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12832 | [ALC268_ACER_DMIC] = { |
| 12833 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12834 | alc268_beep_mixer }, |
| 12835 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12836 | alc268_acer_verbs }, |
| 12837 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12838 | .dac_nids = alc268_dac_nids, |
| 12839 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12840 | .adc_nids = alc268_adc_nids_alt, |
| 12841 | .capsrc_nids = alc268_capsrc_nids, |
| 12842 | .hp_nid = 0x02, |
| 12843 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12844 | .channel_mode = alc268_modes, |
| 12845 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12846 | .unsol_event = alc268_acer_unsol_event, |
| 12847 | .init_hook = alc268_acer_init_hook, |
| 12848 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12849 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12850 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12851 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12852 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12853 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12854 | alc268_acer_aspire_one_verbs }, |
| 12855 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12856 | .dac_nids = alc268_dac_nids, |
| 12857 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12858 | .adc_nids = alc268_adc_nids_alt, |
| 12859 | .capsrc_nids = alc268_capsrc_nids, |
| 12860 | .hp_nid = 0x03, |
| 12861 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12862 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12863 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12864 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12865 | .init_hook = alc268_acer_lc_init_hook, |
| 12866 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12867 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12868 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 12869 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12870 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12871 | alc268_dell_verbs }, |
| 12872 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12873 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12874 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12875 | .adc_nids = alc268_adc_nids_alt, |
| 12876 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12877 | .hp_nid = 0x02, |
| 12878 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12879 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12880 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12881 | .setup = alc268_dell_setup, |
| 12882 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12883 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12884 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12885 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12886 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12887 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12888 | alc268_toshiba_verbs }, |
| 12889 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12890 | .dac_nids = alc268_dac_nids, |
| 12891 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12892 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12893 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12894 | .hp_nid = 0x03, |
| 12895 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12896 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12897 | .channel_mode = alc268_modes, |
| 12898 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12899 | .setup = alc268_toshiba_setup, |
| 12900 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12901 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12902 | #ifdef CONFIG_SND_DEBUG |
| 12903 | [ALC268_TEST] = { |
| 12904 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12905 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12906 | alc268_volume_init_verbs }, |
| 12907 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12908 | .dac_nids = alc268_dac_nids, |
| 12909 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12910 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12911 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12912 | .hp_nid = 0x03, |
| 12913 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12914 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12915 | .channel_mode = alc268_modes, |
| 12916 | .input_mux = &alc268_capture_source, |
| 12917 | }, |
| 12918 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12919 | }; |
| 12920 | |
| 12921 | static int patch_alc268(struct hda_codec *codec) |
| 12922 | { |
| 12923 | struct alc_spec *spec; |
| 12924 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12925 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12926 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 12927 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12928 | if (spec == NULL) |
| 12929 | return -ENOMEM; |
| 12930 | |
| 12931 | codec->spec = spec; |
| 12932 | |
| 12933 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12934 | alc268_models, |
| 12935 | alc268_cfg_tbl); |
| 12936 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12937 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 12938 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 12939 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
| 12940 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12941 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12942 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12943 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12944 | board_config = ALC268_AUTO; |
| 12945 | } |
| 12946 | |
| 12947 | if (board_config == ALC268_AUTO) { |
| 12948 | /* automatic parse from the BIOS config */ |
| 12949 | err = alc268_parse_auto_config(codec); |
| 12950 | if (err < 0) { |
| 12951 | alc_free(codec); |
| 12952 | return err; |
| 12953 | } else if (!err) { |
| 12954 | printk(KERN_INFO |
| 12955 | "hda_codec: Cannot set up configuration " |
| 12956 | "from BIOS. Using base mode...\n"); |
| 12957 | board_config = ALC268_3ST; |
| 12958 | } |
| 12959 | } |
| 12960 | |
| 12961 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12962 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12963 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12964 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12965 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12966 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12967 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12968 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12969 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12970 | has_beep = 0; |
| 12971 | for (i = 0; i < spec->num_mixers; i++) { |
| 12972 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12973 | has_beep = 1; |
| 12974 | break; |
| 12975 | } |
| 12976 | } |
| 12977 | |
| 12978 | if (has_beep) { |
| 12979 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12980 | if (err < 0) { |
| 12981 | alc_free(codec); |
| 12982 | return err; |
| 12983 | } |
| 12984 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12985 | /* override the amp caps for beep generator */ |
| 12986 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12987 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12988 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12989 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12990 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12991 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12992 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12993 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12994 | /* check whether NID 0x07 is valid */ |
| 12995 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12996 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12997 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 12998 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12999 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13000 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13001 | if (spec->auto_mic || |
| 13002 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13003 | spec->adc_nids = alc268_adc_nids_alt; |
| 13004 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13005 | if (spec->auto_mic) |
| 13006 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13007 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13008 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13009 | else |
| 13010 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13011 | } else { |
| 13012 | spec->adc_nids = alc268_adc_nids; |
| 13013 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13014 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13015 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13016 | /* set default input source */ |
| 13017 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13018 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13019 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13020 | i < spec->num_mux_defs ? |
| 13021 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13022 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13023 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13024 | |
| 13025 | spec->vmaster_nid = 0x02; |
| 13026 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13027 | codec->patch_ops = alc_patch_ops; |
| 13028 | if (board_config == ALC268_AUTO) |
| 13029 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13030 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13031 | codec->proc_widget_hook = print_realtek_coef; |
| 13032 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13033 | return 0; |
| 13034 | } |
| 13035 | |
| 13036 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13037 | * ALC269 channel source setting (2 channel) |
| 13038 | */ |
| 13039 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13040 | |
| 13041 | #define alc269_dac_nids alc260_dac_nids |
| 13042 | |
| 13043 | static hda_nid_t alc269_adc_nids[1] = { |
| 13044 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13045 | 0x08, |
| 13046 | }; |
| 13047 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13048 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13049 | 0x23, |
| 13050 | }; |
| 13051 | |
| 13052 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 13053 | * not a mux! |
| 13054 | */ |
| 13055 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13056 | #define alc269_modes alc260_modes |
| 13057 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13058 | |
| 13059 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13060 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13061 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13062 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13063 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13064 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13065 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13066 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13067 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13068 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13069 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13070 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13071 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13072 | { } /* end */ |
| 13073 | }; |
| 13074 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13075 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13076 | /* output mixer control */ |
| 13077 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13078 | { |
| 13079 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13080 | .name = "Master Playback Switch", |
| 13081 | .info = snd_hda_mixer_amp_switch_info, |
| 13082 | .get = snd_hda_mixer_amp_switch_get, |
| 13083 | .put = alc268_acer_master_sw_put, |
| 13084 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13085 | }, |
| 13086 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13087 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13088 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13089 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13090 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13091 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13092 | { } |
| 13093 | }; |
| 13094 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13095 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13096 | /* output mixer control */ |
| 13097 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13098 | { |
| 13099 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13100 | .name = "Master Playback Switch", |
| 13101 | .info = snd_hda_mixer_amp_switch_info, |
| 13102 | .get = snd_hda_mixer_amp_switch_get, |
| 13103 | .put = alc268_acer_master_sw_put, |
| 13104 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13105 | }, |
| 13106 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13107 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13108 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13109 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13110 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13111 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13112 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13113 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13114 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13115 | { } |
| 13116 | }; |
| 13117 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13118 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13119 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13120 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13121 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13122 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13123 | { } /* end */ |
| 13124 | }; |
| 13125 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13126 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13127 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 13128 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13129 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13130 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13131 | { } /* end */ |
| 13132 | }; |
| 13133 | |
| 13134 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13135 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13136 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13137 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13138 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13139 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13140 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13141 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13142 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13143 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13144 | { } |
| 13145 | }; |
| 13146 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13147 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13148 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13149 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13150 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13151 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13152 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13153 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13154 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13155 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13156 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13157 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13158 | { } |
| 13159 | }; |
| 13160 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13161 | /* toggle speaker-output according to the hp-jack state */ |
| 13162 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13163 | { |
| 13164 | unsigned int present; |
| 13165 | unsigned char bits; |
| 13166 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13167 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13168 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13169 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13170 | AMP_IN_MUTE(0), bits); |
| 13171 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13172 | AMP_IN_MUTE(0), bits); |
| 13173 | |
| 13174 | snd_hda_codec_write(codec, 0x20, 0, |
| 13175 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13176 | snd_hda_codec_write(codec, 0x20, 0, |
| 13177 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13178 | |
| 13179 | snd_hda_codec_write(codec, 0x20, 0, |
| 13180 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13181 | snd_hda_codec_write(codec, 0x20, 0, |
| 13182 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13183 | } |
| 13184 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13185 | /* toggle speaker-output according to the hp-jacks state */ |
| 13186 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13187 | { |
| 13188 | unsigned int present; |
| 13189 | unsigned char bits; |
| 13190 | |
| 13191 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13192 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13193 | |
| 13194 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13195 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13196 | |
| 13197 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13198 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13199 | AMP_IN_MUTE(0), bits); |
| 13200 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13201 | AMP_IN_MUTE(0), bits); |
| 13202 | |
| 13203 | snd_hda_codec_write(codec, 0x20, 0, |
| 13204 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13205 | snd_hda_codec_write(codec, 0x20, 0, |
| 13206 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13207 | |
| 13208 | snd_hda_codec_write(codec, 0x20, 0, |
| 13209 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13210 | snd_hda_codec_write(codec, 0x20, 0, |
| 13211 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13212 | } |
| 13213 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13214 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13215 | { |
| 13216 | unsigned int present_laptop; |
| 13217 | unsigned int present_dock; |
| 13218 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13219 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13220 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13221 | |
| 13222 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13223 | if (present_dock) |
| 13224 | snd_hda_codec_write(codec, 0x23, 0, |
| 13225 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13226 | if (present_laptop) |
| 13227 | snd_hda_codec_write(codec, 0x23, 0, |
| 13228 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13229 | if (!present_dock && !present_laptop) |
| 13230 | snd_hda_codec_write(codec, 0x23, 0, |
| 13231 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13232 | } |
| 13233 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13234 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13235 | unsigned int res) |
| 13236 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13237 | switch (res >> 26) { |
| 13238 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13239 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13240 | break; |
| 13241 | case ALC880_MIC_EVENT: |
| 13242 | alc_mic_automute(codec); |
| 13243 | break; |
| 13244 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13245 | } |
| 13246 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13247 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13248 | unsigned int res) |
| 13249 | { |
| 13250 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13251 | alc269_lifebook_speaker_automute(codec); |
| 13252 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13253 | alc269_lifebook_mic_autoswitch(codec); |
| 13254 | } |
| 13255 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13256 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13257 | { |
| 13258 | struct alc_spec *spec = codec->spec; |
| 13259 | spec->ext_mic.pin = 0x18; |
| 13260 | spec->ext_mic.mux_idx = 0; |
| 13261 | spec->int_mic.pin = 0x19; |
| 13262 | spec->int_mic.mux_idx = 1; |
| 13263 | spec->auto_mic = 1; |
| 13264 | } |
| 13265 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13266 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13267 | { |
| 13268 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13269 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13270 | } |
| 13271 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13272 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13273 | { |
| 13274 | alc269_lifebook_speaker_automute(codec); |
| 13275 | alc269_lifebook_mic_autoswitch(codec); |
| 13276 | } |
| 13277 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13278 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 13279 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13280 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13281 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13282 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13283 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13284 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13285 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13286 | {} |
| 13287 | }; |
| 13288 | |
| 13289 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 13290 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13291 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13292 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13293 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13294 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13295 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13296 | {} |
| 13297 | }; |
| 13298 | |
| 13299 | /* toggle speaker-output according to the hp-jack state */ |
| 13300 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13301 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13302 | struct alc_spec *spec = codec->spec; |
| 13303 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13304 | unsigned int present; |
| 13305 | unsigned char bits; |
| 13306 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13307 | present = snd_hda_jack_detect(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13308 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13309 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13310 | AMP_IN_MUTE(0), bits); |
| 13311 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13312 | AMP_IN_MUTE(0), bits); |
| 13313 | } |
| 13314 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13315 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13316 | static void alc269_eeepc_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13317 | unsigned int res) |
| 13318 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13319 | switch (res >> 26) { |
| 13320 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13321 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13322 | break; |
| 13323 | case ALC880_MIC_EVENT: |
| 13324 | alc_mic_automute(codec); |
| 13325 | break; |
| 13326 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13327 | } |
| 13328 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13329 | static void alc269_eeepc_dmic_setup(struct hda_codec *codec) |
| 13330 | { |
| 13331 | struct alc_spec *spec = codec->spec; |
| 13332 | spec->ext_mic.pin = 0x18; |
| 13333 | spec->ext_mic.mux_idx = 0; |
| 13334 | spec->int_mic.pin = 0x12; |
| 13335 | spec->int_mic.mux_idx = 5; |
| 13336 | spec->auto_mic = 1; |
| 13337 | } |
| 13338 | |
| 13339 | static void alc269_eeepc_amic_setup(struct hda_codec *codec) |
| 13340 | { |
| 13341 | struct alc_spec *spec = codec->spec; |
| 13342 | spec->ext_mic.pin = 0x18; |
| 13343 | spec->ext_mic.mux_idx = 0; |
| 13344 | spec->int_mic.pin = 0x19; |
| 13345 | spec->int_mic.mux_idx = 1; |
| 13346 | spec->auto_mic = 1; |
| 13347 | } |
| 13348 | |
| 13349 | static void alc269_eeepc_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13350 | { |
| 13351 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13352 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13353 | } |
| 13354 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13355 | /* |
| 13356 | * generic initialization of ADC, input mixers and output mixers |
| 13357 | */ |
| 13358 | static struct hda_verb alc269_init_verbs[] = { |
| 13359 | /* |
| 13360 | * Unmute ADC0 and set the default input to mic-in |
| 13361 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13362 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13363 | |
| 13364 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13365 | * analog-loopback mixer widget |
| 13366 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13367 | * front panel mic (mic 2) |
| 13368 | */ |
| 13369 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13370 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13371 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13372 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13373 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13374 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13375 | |
| 13376 | /* |
| 13377 | * Set up output mixers (0x0c - 0x0e) |
| 13378 | */ |
| 13379 | /* set vol=0 to output mixers */ |
| 13380 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13381 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13382 | |
| 13383 | /* set up input amps for analog loopback */ |
| 13384 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13385 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13386 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13387 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13388 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13389 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13390 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13391 | |
| 13392 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13393 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13394 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13395 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13396 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13397 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13398 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13399 | |
| 13400 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13401 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13402 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13403 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13404 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13405 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13406 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13407 | |
| 13408 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13409 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13410 | |
| 13411 | /* FIXME: use matrix-type input source selection */ |
| 13412 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13413 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13414 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13415 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13416 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13417 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13418 | |
| 13419 | /* set EAPD */ |
| 13420 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13421 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13422 | { } |
| 13423 | }; |
| 13424 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 13425 | #define alc269_auto_create_multi_out_ctls \ |
| 13426 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13427 | #define alc269_auto_create_input_ctls \ |
| 13428 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13429 | |
| 13430 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13431 | #define alc269_loopbacks alc880_loopbacks |
| 13432 | #endif |
| 13433 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13434 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13435 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13436 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13437 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13438 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13439 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13440 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13441 | .substreams = 1, |
| 13442 | .channels_min = 2, |
| 13443 | .channels_max = 8, |
| 13444 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13445 | /* NID is set in alc_build_pcms */ |
| 13446 | .ops = { |
| 13447 | .open = alc880_playback_pcm_open, |
| 13448 | .prepare = alc880_playback_pcm_prepare, |
| 13449 | .cleanup = alc880_playback_pcm_cleanup |
| 13450 | }, |
| 13451 | }; |
| 13452 | |
| 13453 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13454 | .substreams = 1, |
| 13455 | .channels_min = 2, |
| 13456 | .channels_max = 2, |
| 13457 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13458 | /* NID is set in alc_build_pcms */ |
| 13459 | }; |
| 13460 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13461 | /* |
| 13462 | * BIOS auto configuration |
| 13463 | */ |
| 13464 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13465 | { |
| 13466 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13467 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13468 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13469 | |
| 13470 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13471 | alc269_ignore); |
| 13472 | if (err < 0) |
| 13473 | return err; |
| 13474 | |
| 13475 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13476 | if (err < 0) |
| 13477 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13478 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13479 | if (err < 0) |
| 13480 | return err; |
| 13481 | |
| 13482 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13483 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13484 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13485 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13486 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13487 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13488 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13489 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13490 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13491 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13492 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13493 | /* set default input source */ |
| 13494 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13495 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13496 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13497 | |
| 13498 | err = alc_auto_add_mic_boost(codec); |
| 13499 | if (err < 0) |
| 13500 | return err; |
| 13501 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13502 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13503 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13504 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13505 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13506 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13507 | return 1; |
| 13508 | } |
| 13509 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13510 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 13511 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13512 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13513 | |
| 13514 | |
| 13515 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13516 | static void alc269_auto_init(struct hda_codec *codec) |
| 13517 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13518 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13519 | alc269_auto_init_multi_out(codec); |
| 13520 | alc269_auto_init_hp_out(codec); |
| 13521 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13522 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13523 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13524 | } |
| 13525 | |
| 13526 | /* |
| 13527 | * configuration and preset |
| 13528 | */ |
| 13529 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13530 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13531 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13532 | [ALC269_ASUS_AMIC] = "asus-amic", |
| 13533 | [ALC269_ASUS_DMIC] = "asus-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13534 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 13535 | [ALC269_LIFEBOOK] = "lifebook", |
| 13536 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13537 | }; |
| 13538 | |
| 13539 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13540 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13541 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13542 | ALC269_ASUS_AMIC), |
| 13543 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC), |
| 13544 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC), |
| 13545 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC), |
| 13546 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC), |
| 13547 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC), |
| 13548 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC), |
| 13549 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC), |
| 13550 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC), |
| 13551 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC), |
| 13552 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC), |
| 13553 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC), |
| 13554 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC), |
| 13555 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC), |
| 13556 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC), |
| 13557 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC), |
| 13558 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC), |
| 13559 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC), |
| 13560 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC), |
| 13561 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC), |
| 13562 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC), |
| 13563 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC), |
| 13564 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC), |
| 13565 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC), |
| 13566 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC), |
| 13567 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC), |
| 13568 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC), |
| 13569 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC), |
| 13570 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13571 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13572 | ALC269_ASUS_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13573 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13574 | ALC269_ASUS_DMIC), |
| 13575 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC), |
| 13576 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13577 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13578 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13579 | {} |
| 13580 | }; |
| 13581 | |
| 13582 | static struct alc_config_preset alc269_presets[] = { |
| 13583 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13584 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13585 | .init_verbs = { alc269_init_verbs }, |
| 13586 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13587 | .dac_nids = alc269_dac_nids, |
| 13588 | .hp_nid = 0x03, |
| 13589 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13590 | .channel_mode = alc269_modes, |
| 13591 | .input_mux = &alc269_capture_source, |
| 13592 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13593 | [ALC269_QUANTA_FL1] = { |
| 13594 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13595 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13596 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13597 | .dac_nids = alc269_dac_nids, |
| 13598 | .hp_nid = 0x03, |
| 13599 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13600 | .channel_mode = alc269_modes, |
| 13601 | .input_mux = &alc269_capture_source, |
| 13602 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13603 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13604 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13605 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13606 | [ALC269_ASUS_AMIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13607 | .mixers = { alc269_eeepc_mixer }, |
| 13608 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13609 | .init_verbs = { alc269_init_verbs, |
| 13610 | alc269_eeepc_amic_init_verbs }, |
| 13611 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13612 | .dac_nids = alc269_dac_nids, |
| 13613 | .hp_nid = 0x03, |
| 13614 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13615 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13616 | .unsol_event = alc269_eeepc_unsol_event, |
| 13617 | .setup = alc269_eeepc_amic_setup, |
| 13618 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13619 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13620 | [ALC269_ASUS_DMIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13621 | .mixers = { alc269_eeepc_mixer }, |
| 13622 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13623 | .init_verbs = { alc269_init_verbs, |
| 13624 | alc269_eeepc_dmic_init_verbs }, |
| 13625 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13626 | .dac_nids = alc269_dac_nids, |
| 13627 | .hp_nid = 0x03, |
| 13628 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13629 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13630 | .unsol_event = alc269_eeepc_unsol_event, |
| 13631 | .setup = alc269_eeepc_dmic_setup, |
| 13632 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13633 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13634 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13635 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13636 | .cap_mixer = alc269_epc_capture_mixer, |
| 13637 | .init_verbs = { alc269_init_verbs, |
| 13638 | alc269_eeepc_dmic_init_verbs }, |
| 13639 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13640 | .dac_nids = alc269_dac_nids, |
| 13641 | .hp_nid = 0x03, |
| 13642 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13643 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13644 | .unsol_event = alc269_eeepc_unsol_event, |
| 13645 | .setup = alc269_eeepc_dmic_setup, |
| 13646 | .init_hook = alc269_eeepc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13647 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13648 | [ALC269_LIFEBOOK] = { |
| 13649 | .mixers = { alc269_lifebook_mixer }, |
| 13650 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13651 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13652 | .dac_nids = alc269_dac_nids, |
| 13653 | .hp_nid = 0x03, |
| 13654 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13655 | .channel_mode = alc269_modes, |
| 13656 | .input_mux = &alc269_capture_source, |
| 13657 | .unsol_event = alc269_lifebook_unsol_event, |
| 13658 | .init_hook = alc269_lifebook_init_hook, |
| 13659 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13660 | }; |
| 13661 | |
| 13662 | static int patch_alc269(struct hda_codec *codec) |
| 13663 | { |
| 13664 | struct alc_spec *spec; |
| 13665 | int board_config; |
| 13666 | int err; |
| 13667 | |
| 13668 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13669 | if (spec == NULL) |
| 13670 | return -ENOMEM; |
| 13671 | |
| 13672 | codec->spec = spec; |
| 13673 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13674 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13675 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 13676 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
| 13677 | kfree(codec->chip_name); |
| 13678 | codec->chip_name = kstrdup("ALC259", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 13679 | if (!codec->chip_name) { |
| 13680 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 13681 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 13682 | } |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 13683 | } |
| 13684 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13685 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13686 | alc269_models, |
| 13687 | alc269_cfg_tbl); |
| 13688 | |
| 13689 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13690 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13691 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13692 | board_config = ALC269_AUTO; |
| 13693 | } |
| 13694 | |
| 13695 | if (board_config == ALC269_AUTO) { |
| 13696 | /* automatic parse from the BIOS config */ |
| 13697 | err = alc269_parse_auto_config(codec); |
| 13698 | if (err < 0) { |
| 13699 | alc_free(codec); |
| 13700 | return err; |
| 13701 | } else if (!err) { |
| 13702 | printk(KERN_INFO |
| 13703 | "hda_codec: Cannot set up configuration " |
| 13704 | "from BIOS. Using base mode...\n"); |
| 13705 | board_config = ALC269_BASIC; |
| 13706 | } |
| 13707 | } |
| 13708 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13709 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13710 | if (err < 0) { |
| 13711 | alc_free(codec); |
| 13712 | return err; |
| 13713 | } |
| 13714 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13715 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13716 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13717 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13718 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13719 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13720 | * fix the sample rate of analog I/O to 44.1kHz |
| 13721 | */ |
| 13722 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13723 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13724 | } else { |
| 13725 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13726 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13727 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13728 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13729 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13730 | |
| 13731 | spec->adc_nids = alc269_adc_nids; |
| 13732 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13733 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13734 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13735 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13736 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13737 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 13738 | spec->vmaster_nid = 0x02; |
| 13739 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13740 | codec->patch_ops = alc_patch_ops; |
| 13741 | if (board_config == ALC269_AUTO) |
| 13742 | spec->init_hook = alc269_auto_init; |
| 13743 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13744 | if (!spec->loopback.amplist) |
| 13745 | spec->loopback.amplist = alc269_loopbacks; |
| 13746 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13747 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13748 | |
| 13749 | return 0; |
| 13750 | } |
| 13751 | |
| 13752 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13753 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13754 | */ |
| 13755 | |
| 13756 | /* |
| 13757 | * set the path ways for 2 channel output |
| 13758 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13759 | */ |
| 13760 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13761 | /* set pin widget 1Ah (line in) for input */ |
| 13762 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13763 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13764 | * the vref |
| 13765 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13766 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13767 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13768 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13769 | #if 0 |
| 13770 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13771 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13772 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13773 | { } /* end */ |
| 13774 | }; |
| 13775 | /* |
| 13776 | * 6ch mode |
| 13777 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13778 | */ |
| 13779 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13780 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13781 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13782 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13783 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13784 | |
| 13785 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13786 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13787 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13788 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13789 | #if 0 |
| 13790 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13791 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13792 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13793 | { } /* end */ |
| 13794 | }; |
| 13795 | |
| 13796 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13797 | { 2, alc861_threestack_ch2_init }, |
| 13798 | { 6, alc861_threestack_ch6_init }, |
| 13799 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13800 | /* Set mic1 as input and unmute the mixer */ |
| 13801 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13802 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13803 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13804 | { } /* end */ |
| 13805 | }; |
| 13806 | /* Set mic1 as output and mute mixer */ |
| 13807 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13808 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13809 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13810 | { } /* end */ |
| 13811 | }; |
| 13812 | |
| 13813 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13814 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13815 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13816 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13817 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13818 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13819 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13820 | /* set pin widget 1Ah (line in) for input */ |
| 13821 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13822 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13823 | * the vref |
| 13824 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13825 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13826 | |
| 13827 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13828 | #if 0 |
| 13829 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13830 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13831 | #endif |
| 13832 | { } /* end */ |
| 13833 | }; |
| 13834 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13835 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13836 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13837 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13838 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13839 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13840 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13841 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13842 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13843 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13844 | |
| 13845 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13846 | #if 0 |
| 13847 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13848 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13849 | #endif |
| 13850 | { } /* end */ |
| 13851 | }; |
| 13852 | |
| 13853 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13854 | { 2, alc861_asus_ch2_init }, |
| 13855 | { 6, alc861_asus_ch6_init }, |
| 13856 | }; |
| 13857 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13858 | /* patch-ALC861 */ |
| 13859 | |
| 13860 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13861 | /* output mixer control */ |
| 13862 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13863 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13864 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13865 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13866 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13867 | |
| 13868 | /*Input mixer control */ |
| 13869 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13870 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13871 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13872 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13873 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13874 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13875 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13876 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13877 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13878 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13879 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13880 | { } /* end */ |
| 13881 | }; |
| 13882 | |
| 13883 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13884 | /* output mixer control */ |
| 13885 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13886 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13887 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13888 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13889 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13890 | |
| 13891 | /* Input mixer control */ |
| 13892 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13893 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13894 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13895 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13896 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13897 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13900 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13901 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13902 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13903 | { |
| 13904 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13905 | .name = "Channel Mode", |
| 13906 | .info = alc_ch_mode_info, |
| 13907 | .get = alc_ch_mode_get, |
| 13908 | .put = alc_ch_mode_put, |
| 13909 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13910 | }, |
| 13911 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13912 | }; |
| 13913 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13914 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13915 | /* output mixer control */ |
| 13916 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13917 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13918 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13919 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13920 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13921 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13922 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13923 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13924 | /* output mixer control */ |
| 13925 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13926 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13927 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13928 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13929 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13930 | |
| 13931 | /* Input mixer control */ |
| 13932 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13933 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13934 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13935 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13936 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13937 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13938 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13939 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13940 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13941 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13942 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13943 | { |
| 13944 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13945 | .name = "Channel Mode", |
| 13946 | .info = alc_ch_mode_info, |
| 13947 | .get = alc_ch_mode_get, |
| 13948 | .put = alc_ch_mode_put, |
| 13949 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13950 | }, |
| 13951 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13952 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13953 | |
| 13954 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13955 | /* output mixer control */ |
| 13956 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13957 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13958 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13959 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13960 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13961 | |
| 13962 | /* Input mixer control */ |
| 13963 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13964 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13965 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13966 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13968 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13971 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13972 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13973 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13974 | { |
| 13975 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13976 | .name = "Channel Mode", |
| 13977 | .info = alc_ch_mode_info, |
| 13978 | .get = alc_ch_mode_get, |
| 13979 | .put = alc_ch_mode_put, |
| 13980 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13981 | }, |
| 13982 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13983 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13984 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13985 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13986 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13987 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13988 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13989 | { } |
| 13990 | }; |
| 13991 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13992 | /* |
| 13993 | * generic initialization of ADC, input mixers and output mixers |
| 13994 | */ |
| 13995 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13996 | /* |
| 13997 | * Unmute ADC0 and set the default input to mic-in |
| 13998 | */ |
| 13999 | /* port-A for surround (rear panel) */ |
| 14000 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14001 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14002 | /* port-B for mic-in (rear panel) with vref */ |
| 14003 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14004 | /* port-C for line-in (rear panel) */ |
| 14005 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14006 | /* port-D for Front */ |
| 14007 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14008 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14009 | /* port-E for HP out (front panel) */ |
| 14010 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14011 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14012 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14013 | /* port-F for mic-in (front panel) with vref */ |
| 14014 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14015 | /* port-G for CLFE (rear panel) */ |
| 14016 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14017 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14018 | /* port-H for side (rear panel) */ |
| 14019 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14020 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14021 | /* CD-in */ |
| 14022 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14023 | /* route front mic to ADC1*/ |
| 14024 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14025 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14026 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14027 | /* Unmute DAC0~3 & spdif out*/ |
| 14028 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14029 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14030 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14031 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14032 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14033 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14034 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14035 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14036 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14037 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14038 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14039 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14040 | /* Unmute Stereo Mixer 15 */ |
| 14041 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14042 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14043 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14044 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14045 | |
| 14046 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14047 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14048 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14049 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14050 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14051 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14052 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14053 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14054 | /* hp used DAC 3 (Front) */ |
| 14055 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14056 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14057 | |
| 14058 | { } |
| 14059 | }; |
| 14060 | |
| 14061 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 14062 | /* |
| 14063 | * Unmute ADC0 and set the default input to mic-in |
| 14064 | */ |
| 14065 | /* port-A for surround (rear panel) */ |
| 14066 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14067 | /* port-B for mic-in (rear panel) with vref */ |
| 14068 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14069 | /* port-C for line-in (rear panel) */ |
| 14070 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14071 | /* port-D for Front */ |
| 14072 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14073 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14074 | /* port-E for HP out (front panel) */ |
| 14075 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14076 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14077 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14078 | /* port-F for mic-in (front panel) with vref */ |
| 14079 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14080 | /* port-G for CLFE (rear panel) */ |
| 14081 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14082 | /* port-H for side (rear panel) */ |
| 14083 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14084 | /* CD-in */ |
| 14085 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14086 | /* route front mic to ADC1*/ |
| 14087 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14088 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14089 | /* Unmute DAC0~3 & spdif out*/ |
| 14090 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14091 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14092 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14093 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14094 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14095 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14096 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14097 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14098 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14099 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14100 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14101 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14102 | /* Unmute Stereo Mixer 15 */ |
| 14103 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14104 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14105 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14106 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14107 | |
| 14108 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14109 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14110 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14111 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14112 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14113 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14114 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14115 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14116 | /* hp used DAC 3 (Front) */ |
| 14117 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14118 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14119 | { } |
| 14120 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14121 | |
| 14122 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 14123 | /* |
| 14124 | * Unmute ADC0 and set the default input to mic-in |
| 14125 | */ |
| 14126 | /* port-A for surround (rear panel) */ |
| 14127 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14128 | /* port-B for mic-in (rear panel) with vref */ |
| 14129 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14130 | /* port-C for line-in (rear panel) */ |
| 14131 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14132 | /* port-D for Front */ |
| 14133 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14134 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14135 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14136 | /* this has to be set to VREF80 */ |
| 14137 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14138 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14139 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14140 | /* port-F for mic-in (front panel) with vref */ |
| 14141 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14142 | /* port-G for CLFE (rear panel) */ |
| 14143 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14144 | /* port-H for side (rear panel) */ |
| 14145 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14146 | /* CD-in */ |
| 14147 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14148 | /* route front mic to ADC1*/ |
| 14149 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14150 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14151 | /* Unmute DAC0~3 & spdif out*/ |
| 14152 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14153 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14154 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14155 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14156 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14157 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14158 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14159 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14160 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14161 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14162 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14163 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14164 | /* Unmute Stereo Mixer 15 */ |
| 14165 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14166 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14167 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14168 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14169 | |
| 14170 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14171 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14172 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14173 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14174 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14175 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14176 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14177 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14178 | /* hp used DAC 3 (Front) */ |
| 14179 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14180 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14181 | { } |
| 14182 | }; |
| 14183 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14184 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 14185 | /* |
| 14186 | * Unmute ADC0 and set the default input to mic-in |
| 14187 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14188 | /* port-A for surround (rear panel) |
| 14189 | * according to codec#0 this is the HP jack |
| 14190 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14191 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 14192 | /* route front PCM to HP */ |
| 14193 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14194 | /* port-B for mic-in (rear panel) with vref */ |
| 14195 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14196 | /* port-C for line-in (rear panel) */ |
| 14197 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14198 | /* port-D for Front */ |
| 14199 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14200 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14201 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14202 | /* this has to be set to VREF80 */ |
| 14203 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14204 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14205 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14206 | /* port-F for mic-in (front panel) with vref */ |
| 14207 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14208 | /* port-G for CLFE (rear panel) */ |
| 14209 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14210 | /* port-H for side (rear panel) */ |
| 14211 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14212 | /* CD-in */ |
| 14213 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14214 | /* route front mic to ADC1*/ |
| 14215 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14216 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14217 | /* Unmute DAC0~3 & spdif out*/ |
| 14218 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14219 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14220 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14221 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14222 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14223 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14224 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14225 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14226 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14227 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14228 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14229 | /* Unmute Stereo Mixer 15 */ |
| 14230 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14231 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14232 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14233 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14234 | |
| 14235 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14236 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14237 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14238 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14239 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14240 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14241 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14242 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14243 | /* hp used DAC 3 (Front) */ |
| 14244 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14245 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14246 | { } |
| 14247 | }; |
| 14248 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14249 | /* additional init verbs for ASUS laptops */ |
| 14250 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14251 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14252 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14253 | { } |
| 14254 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14255 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14256 | /* |
| 14257 | * generic initialization of ADC, input mixers and output mixers |
| 14258 | */ |
| 14259 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14260 | /* |
| 14261 | * Unmute ADC0 and set the default input to mic-in |
| 14262 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14263 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14264 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14265 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14266 | /* Unmute DAC0~3 & spdif out*/ |
| 14267 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14268 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14269 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14270 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14271 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14272 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14273 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14274 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14275 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14276 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14277 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14278 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14279 | /* Unmute Stereo Mixer 15 */ |
| 14280 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14281 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14282 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14283 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14284 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14285 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14286 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14287 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14288 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14289 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14290 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14291 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14292 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14293 | |
| 14294 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14295 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14296 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14297 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14298 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14299 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14300 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14301 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14302 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14303 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14304 | |
| 14305 | { } |
| 14306 | }; |
| 14307 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14308 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14309 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14310 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14311 | { } |
| 14312 | }; |
| 14313 | |
| 14314 | /* toggle speaker-output according to the hp-jack state */ |
| 14315 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14316 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14317 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14318 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14319 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14320 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14321 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14322 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14323 | } |
| 14324 | |
| 14325 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14326 | unsigned int res) |
| 14327 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14328 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14329 | alc861_toshiba_automute(codec); |
| 14330 | } |
| 14331 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14332 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14333 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14334 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14335 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14336 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14337 | |
| 14338 | |
| 14339 | #define ALC861_DIGOUT_NID 0x07 |
| 14340 | |
| 14341 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14342 | { 8, NULL } |
| 14343 | }; |
| 14344 | |
| 14345 | static hda_nid_t alc861_dac_nids[4] = { |
| 14346 | /* front, surround, clfe, side */ |
| 14347 | 0x03, 0x06, 0x05, 0x04 |
| 14348 | }; |
| 14349 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14350 | static hda_nid_t alc660_dac_nids[3] = { |
| 14351 | /* front, clfe, surround */ |
| 14352 | 0x03, 0x05, 0x06 |
| 14353 | }; |
| 14354 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14355 | static hda_nid_t alc861_adc_nids[1] = { |
| 14356 | /* ADC0-2 */ |
| 14357 | 0x08, |
| 14358 | }; |
| 14359 | |
| 14360 | static struct hda_input_mux alc861_capture_source = { |
| 14361 | .num_items = 5, |
| 14362 | .items = { |
| 14363 | { "Mic", 0x0 }, |
| 14364 | { "Front Mic", 0x3 }, |
| 14365 | { "Line", 0x1 }, |
| 14366 | { "CD", 0x4 }, |
| 14367 | { "Mixer", 0x5 }, |
| 14368 | }, |
| 14369 | }; |
| 14370 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14371 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 14372 | { |
| 14373 | struct alc_spec *spec = codec->spec; |
| 14374 | hda_nid_t mix, srcs[5]; |
| 14375 | int i, j, num; |
| 14376 | |
| 14377 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 14378 | return 0; |
| 14379 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14380 | if (num < 0) |
| 14381 | return 0; |
| 14382 | for (i = 0; i < num; i++) { |
| 14383 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14384 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14385 | if (type != AC_WID_AUD_OUT) |
| 14386 | continue; |
| 14387 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 14388 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 14389 | break; |
| 14390 | if (j >= spec->multiout.num_dacs) |
| 14391 | return srcs[i]; |
| 14392 | } |
| 14393 | return 0; |
| 14394 | } |
| 14395 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14396 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14397 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14398 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14399 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14400 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14401 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14402 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14403 | |
| 14404 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14405 | for (i = 0; i < cfg->line_outs; i++) { |
| 14406 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14407 | dac = alc861_look_for_dac(codec, nid); |
| 14408 | if (!dac) |
| 14409 | continue; |
| 14410 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14411 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14412 | return 0; |
| 14413 | } |
| 14414 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14415 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14416 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14417 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 14418 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14419 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14420 | } |
| 14421 | |
| 14422 | /* add playback controls from the parsed DAC table */ |
| 14423 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14424 | const struct auto_pin_cfg *cfg) |
| 14425 | { |
| 14426 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14427 | static const char *chname[4] = { |
| 14428 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14429 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14430 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14431 | int i, err; |
| 14432 | |
| 14433 | if (cfg->line_outs == 1) { |
| 14434 | const char *pfx = NULL; |
| 14435 | if (!cfg->hp_outs) |
| 14436 | pfx = "Master"; |
| 14437 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14438 | pfx = "Speaker"; |
| 14439 | if (pfx) { |
| 14440 | nid = spec->multiout.dac_nids[0]; |
| 14441 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14442 | } |
| 14443 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14444 | |
| 14445 | for (i = 0; i < cfg->line_outs; i++) { |
| 14446 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14447 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14448 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14449 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14450 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14451 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14452 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14453 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14454 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14455 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14456 | return err; |
| 14457 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14458 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14459 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14460 | return err; |
| 14461 | } |
| 14462 | } |
| 14463 | return 0; |
| 14464 | } |
| 14465 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14466 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14467 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14468 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14469 | int err; |
| 14470 | hda_nid_t nid; |
| 14471 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14472 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14473 | return 0; |
| 14474 | |
| 14475 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14476 | nid = alc861_look_for_dac(codec, pin); |
| 14477 | if (nid) { |
| 14478 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14479 | if (err < 0) |
| 14480 | return err; |
| 14481 | spec->multiout.hp_nid = nid; |
| 14482 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14483 | } |
| 14484 | return 0; |
| 14485 | } |
| 14486 | |
| 14487 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14488 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14489 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14490 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14491 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14492 | } |
| 14493 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14494 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14495 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14496 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14497 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14498 | hda_nid_t mix, srcs[5]; |
| 14499 | int i, num; |
| 14500 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14501 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14502 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14503 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14504 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14505 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14506 | return; |
| 14507 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14508 | if (num < 0) |
| 14509 | return; |
| 14510 | for (i = 0; i < num; i++) { |
| 14511 | unsigned int mute; |
| 14512 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14513 | mute = AMP_IN_UNMUTE(i); |
| 14514 | else |
| 14515 | mute = AMP_IN_MUTE(i); |
| 14516 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14517 | mute); |
| 14518 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14519 | } |
| 14520 | |
| 14521 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14522 | { |
| 14523 | struct alc_spec *spec = codec->spec; |
| 14524 | int i; |
| 14525 | |
| 14526 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14527 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14528 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14529 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14530 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14531 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14532 | } |
| 14533 | } |
| 14534 | |
| 14535 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14536 | { |
| 14537 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14538 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 14539 | if (spec->autocfg.hp_outs) |
| 14540 | alc861_auto_set_output_and_unmute(codec, |
| 14541 | spec->autocfg.hp_pins[0], |
| 14542 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14543 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 14544 | if (spec->autocfg.speaker_outs) |
| 14545 | alc861_auto_set_output_and_unmute(codec, |
| 14546 | spec->autocfg.speaker_pins[0], |
| 14547 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14548 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14549 | } |
| 14550 | |
| 14551 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14552 | { |
| 14553 | struct alc_spec *spec = codec->spec; |
| 14554 | int i; |
| 14555 | |
| 14556 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14557 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14558 | if (nid >= 0x0c && nid <= 0x11) |
| 14559 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14560 | } |
| 14561 | } |
| 14562 | |
| 14563 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14564 | /* return 1 if successful, 0 if the proper config is not found, |
| 14565 | * or a negative error code |
| 14566 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14567 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14568 | { |
| 14569 | struct alc_spec *spec = codec->spec; |
| 14570 | int err; |
| 14571 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14572 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14573 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14574 | alc861_ignore); |
| 14575 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14576 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14577 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14578 | return 0; /* can't find valid BIOS pin config */ |
| 14579 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14580 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14581 | if (err < 0) |
| 14582 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14583 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14584 | if (err < 0) |
| 14585 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14586 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14587 | if (err < 0) |
| 14588 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14589 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14590 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14591 | return err; |
| 14592 | |
| 14593 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14594 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14595 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14596 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14597 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14598 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14599 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14600 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14601 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14602 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14603 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14604 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14605 | |
| 14606 | spec->adc_nids = alc861_adc_nids; |
| 14607 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14608 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14609 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14610 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14611 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14612 | return 1; |
| 14613 | } |
| 14614 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14615 | /* additional initialization for auto-configuration model */ |
| 14616 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14617 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14618 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14619 | alc861_auto_init_multi_out(codec); |
| 14620 | alc861_auto_init_hp_out(codec); |
| 14621 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14622 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14623 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14624 | } |
| 14625 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14626 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14627 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14628 | { 0x15, HDA_INPUT, 0 }, |
| 14629 | { 0x15, HDA_INPUT, 1 }, |
| 14630 | { 0x15, HDA_INPUT, 2 }, |
| 14631 | { 0x15, HDA_INPUT, 3 }, |
| 14632 | { } /* end */ |
| 14633 | }; |
| 14634 | #endif |
| 14635 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14636 | |
| 14637 | /* |
| 14638 | * configuration and preset |
| 14639 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14640 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14641 | [ALC861_3ST] = "3stack", |
| 14642 | [ALC660_3ST] = "3stack-660", |
| 14643 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14644 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14645 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14646 | [ALC861_TOSHIBA] = "toshiba", |
| 14647 | [ALC861_ASUS] = "asus", |
| 14648 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14649 | [ALC861_AUTO] = "auto", |
| 14650 | }; |
| 14651 | |
| 14652 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14653 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14654 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14655 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14656 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14657 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14658 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14659 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14660 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14661 | * Any other models that need this preset? |
| 14662 | */ |
| 14663 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14664 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14665 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14666 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14667 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14668 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14669 | /* FIXME: the below seems conflict */ |
| 14670 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14671 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14672 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14673 | {} |
| 14674 | }; |
| 14675 | |
| 14676 | static struct alc_config_preset alc861_presets[] = { |
| 14677 | [ALC861_3ST] = { |
| 14678 | .mixers = { alc861_3ST_mixer }, |
| 14679 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14680 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14681 | .dac_nids = alc861_dac_nids, |
| 14682 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14683 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14684 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14685 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14686 | .adc_nids = alc861_adc_nids, |
| 14687 | .input_mux = &alc861_capture_source, |
| 14688 | }, |
| 14689 | [ALC861_3ST_DIG] = { |
| 14690 | .mixers = { alc861_base_mixer }, |
| 14691 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14692 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14693 | .dac_nids = alc861_dac_nids, |
| 14694 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14695 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14696 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14697 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14698 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14699 | .adc_nids = alc861_adc_nids, |
| 14700 | .input_mux = &alc861_capture_source, |
| 14701 | }, |
| 14702 | [ALC861_6ST_DIG] = { |
| 14703 | .mixers = { alc861_base_mixer }, |
| 14704 | .init_verbs = { alc861_base_init_verbs }, |
| 14705 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14706 | .dac_nids = alc861_dac_nids, |
| 14707 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14708 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14709 | .channel_mode = alc861_8ch_modes, |
| 14710 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14711 | .adc_nids = alc861_adc_nids, |
| 14712 | .input_mux = &alc861_capture_source, |
| 14713 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14714 | [ALC660_3ST] = { |
| 14715 | .mixers = { alc861_3ST_mixer }, |
| 14716 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14717 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14718 | .dac_nids = alc660_dac_nids, |
| 14719 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14720 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14721 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14722 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14723 | .adc_nids = alc861_adc_nids, |
| 14724 | .input_mux = &alc861_capture_source, |
| 14725 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14726 | [ALC861_UNIWILL_M31] = { |
| 14727 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14728 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14729 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14730 | .dac_nids = alc861_dac_nids, |
| 14731 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14732 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14733 | .channel_mode = alc861_uniwill_m31_modes, |
| 14734 | .need_dac_fix = 1, |
| 14735 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14736 | .adc_nids = alc861_adc_nids, |
| 14737 | .input_mux = &alc861_capture_source, |
| 14738 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14739 | [ALC861_TOSHIBA] = { |
| 14740 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14741 | .init_verbs = { alc861_base_init_verbs, |
| 14742 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14743 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14744 | .dac_nids = alc861_dac_nids, |
| 14745 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14746 | .channel_mode = alc883_3ST_2ch_modes, |
| 14747 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14748 | .adc_nids = alc861_adc_nids, |
| 14749 | .input_mux = &alc861_capture_source, |
| 14750 | .unsol_event = alc861_toshiba_unsol_event, |
| 14751 | .init_hook = alc861_toshiba_automute, |
| 14752 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14753 | [ALC861_ASUS] = { |
| 14754 | .mixers = { alc861_asus_mixer }, |
| 14755 | .init_verbs = { alc861_asus_init_verbs }, |
| 14756 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14757 | .dac_nids = alc861_dac_nids, |
| 14758 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14759 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14760 | .channel_mode = alc861_asus_modes, |
| 14761 | .need_dac_fix = 1, |
| 14762 | .hp_nid = 0x06, |
| 14763 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14764 | .adc_nids = alc861_adc_nids, |
| 14765 | .input_mux = &alc861_capture_source, |
| 14766 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14767 | [ALC861_ASUS_LAPTOP] = { |
| 14768 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14769 | .init_verbs = { alc861_asus_init_verbs, |
| 14770 | alc861_asus_laptop_init_verbs }, |
| 14771 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14772 | .dac_nids = alc861_dac_nids, |
| 14773 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14774 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14775 | .channel_mode = alc883_3ST_2ch_modes, |
| 14776 | .need_dac_fix = 1, |
| 14777 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14778 | .adc_nids = alc861_adc_nids, |
| 14779 | .input_mux = &alc861_capture_source, |
| 14780 | }, |
| 14781 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14782 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 14783 | /* Pin config fixes */ |
| 14784 | enum { |
| 14785 | PINFIX_FSC_AMILO_PI1505, |
| 14786 | }; |
| 14787 | |
| 14788 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { |
| 14789 | { 0x0b, 0x0221101f }, /* HP */ |
| 14790 | { 0x0f, 0x90170310 }, /* speaker */ |
| 14791 | { } |
| 14792 | }; |
| 14793 | |
| 14794 | static const struct alc_fixup alc861_fixups[] = { |
| 14795 | [PINFIX_FSC_AMILO_PI1505] = { |
| 14796 | .pins = alc861_fsc_amilo_pi1505_pinfix |
| 14797 | }, |
| 14798 | }; |
| 14799 | |
| 14800 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 14801 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 14802 | {} |
| 14803 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14804 | |
| 14805 | static int patch_alc861(struct hda_codec *codec) |
| 14806 | { |
| 14807 | struct alc_spec *spec; |
| 14808 | int board_config; |
| 14809 | int err; |
| 14810 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14811 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14812 | if (spec == NULL) |
| 14813 | return -ENOMEM; |
| 14814 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14815 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14816 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14817 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14818 | alc861_models, |
| 14819 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14820 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14821 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14822 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14823 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14824 | board_config = ALC861_AUTO; |
| 14825 | } |
| 14826 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 14827 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups); |
| 14828 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14829 | if (board_config == ALC861_AUTO) { |
| 14830 | /* automatic parse from the BIOS config */ |
| 14831 | err = alc861_parse_auto_config(codec); |
| 14832 | if (err < 0) { |
| 14833 | alc_free(codec); |
| 14834 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14835 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14836 | printk(KERN_INFO |
| 14837 | "hda_codec: Cannot set up configuration " |
| 14838 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14839 | board_config = ALC861_3ST_DIG; |
| 14840 | } |
| 14841 | } |
| 14842 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14843 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14844 | if (err < 0) { |
| 14845 | alc_free(codec); |
| 14846 | return err; |
| 14847 | } |
| 14848 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14849 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14850 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14851 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14852 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14853 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14854 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14855 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14856 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14857 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14858 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14859 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14860 | spec->vmaster_nid = 0x03; |
| 14861 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14862 | codec->patch_ops = alc_patch_ops; |
| 14863 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14864 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14865 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14866 | if (!spec->loopback.amplist) |
| 14867 | spec->loopback.amplist = alc861_loopbacks; |
| 14868 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14869 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14870 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14871 | return 0; |
| 14872 | } |
| 14873 | |
| 14874 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14875 | * ALC861-VD support |
| 14876 | * |
| 14877 | * Based on ALC882 |
| 14878 | * |
| 14879 | * In addition, an independent DAC |
| 14880 | */ |
| 14881 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14882 | |
| 14883 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14884 | /* front, surr, clfe, side surr */ |
| 14885 | 0x02, 0x03, 0x04, 0x05 |
| 14886 | }; |
| 14887 | |
| 14888 | /* dac_nids for ALC660vd are in a different order - according to |
| 14889 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14890 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14891 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14892 | * - and it is the same as in 861vd. |
| 14893 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14894 | */ |
| 14895 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14896 | /* front, rear, clfe, rear_surr */ |
| 14897 | 0x02, 0x04, 0x03 |
| 14898 | }; |
| 14899 | |
| 14900 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14901 | /* ADC0 */ |
| 14902 | 0x09, |
| 14903 | }; |
| 14904 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14905 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14906 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14907 | /* input MUX */ |
| 14908 | /* FIXME: should be a matrix-type input source selection */ |
| 14909 | static struct hda_input_mux alc861vd_capture_source = { |
| 14910 | .num_items = 4, |
| 14911 | .items = { |
| 14912 | { "Mic", 0x0 }, |
| 14913 | { "Front Mic", 0x1 }, |
| 14914 | { "Line", 0x2 }, |
| 14915 | { "CD", 0x4 }, |
| 14916 | }, |
| 14917 | }; |
| 14918 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14919 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14920 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14921 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14922 | { "Ext Mic", 0x0 }, |
| 14923 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14924 | }, |
| 14925 | }; |
| 14926 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14927 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14928 | .num_items = 2, |
| 14929 | .items = { |
| 14930 | { "Front Mic", 0x0 }, |
| 14931 | { "ATAPI Mic", 0x1 }, |
| 14932 | }, |
| 14933 | }; |
| 14934 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14935 | /* |
| 14936 | * 2ch mode |
| 14937 | */ |
| 14938 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14939 | { 2, NULL } |
| 14940 | }; |
| 14941 | |
| 14942 | /* |
| 14943 | * 6ch mode |
| 14944 | */ |
| 14945 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14946 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14947 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14948 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14949 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14950 | { } /* end */ |
| 14951 | }; |
| 14952 | |
| 14953 | /* |
| 14954 | * 8ch mode |
| 14955 | */ |
| 14956 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14957 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14958 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14959 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14960 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14961 | { } /* end */ |
| 14962 | }; |
| 14963 | |
| 14964 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14965 | { 6, alc861vd_6stack_ch6_init }, |
| 14966 | { 8, alc861vd_6stack_ch8_init }, |
| 14967 | }; |
| 14968 | |
| 14969 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14970 | { |
| 14971 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14972 | .name = "Channel Mode", |
| 14973 | .info = alc_ch_mode_info, |
| 14974 | .get = alc_ch_mode_get, |
| 14975 | .put = alc_ch_mode_put, |
| 14976 | }, |
| 14977 | { } /* end */ |
| 14978 | }; |
| 14979 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14980 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14981 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14982 | */ |
| 14983 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14984 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14985 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14986 | |
| 14987 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14988 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14989 | |
| 14990 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14991 | HDA_OUTPUT), |
| 14992 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14993 | HDA_OUTPUT), |
| 14994 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14995 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14996 | |
| 14997 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14998 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14999 | |
| 15000 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15001 | |
| 15002 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15003 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15004 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15005 | |
| 15006 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15007 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15008 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15009 | |
| 15010 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15011 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15012 | |
| 15013 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15014 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15015 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15016 | { } /* end */ |
| 15017 | }; |
| 15018 | |
| 15019 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 15020 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15021 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15022 | |
| 15023 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15024 | |
| 15025 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15026 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15027 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15028 | |
| 15029 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15030 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15031 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15032 | |
| 15033 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15034 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15035 | |
| 15036 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15037 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15038 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15039 | { } /* end */ |
| 15040 | }; |
| 15041 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15042 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 15043 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15044 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 15045 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15046 | |
| 15047 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15048 | |
| 15049 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15050 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15051 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15052 | |
| 15053 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15054 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15055 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15056 | |
| 15057 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15058 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15059 | |
| 15060 | { } /* end */ |
| 15061 | }; |
| 15062 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15063 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 15064 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15065 | */ |
| 15066 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15067 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15068 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15069 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15070 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15071 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 15072 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15073 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15074 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 15075 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15076 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15077 | { } /* end */ |
| 15078 | }; |
| 15079 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15080 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 15081 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 15082 | */ |
| 15083 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 15084 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15085 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15086 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15087 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15088 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15089 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15090 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15091 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15092 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15093 | { } /* end */ |
| 15094 | }; |
| 15095 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15096 | /* |
| 15097 | * generic initialization of ADC, input mixers and output mixers |
| 15098 | */ |
| 15099 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 15100 | /* |
| 15101 | * Unmute ADC0 and set the default input to mic-in |
| 15102 | */ |
| 15103 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15104 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15105 | |
| 15106 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 15107 | * the analog-loopback mixer widget |
| 15108 | */ |
| 15109 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15110 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15111 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15115 | |
| 15116 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15117 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15118 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15119 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15120 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15121 | |
| 15122 | /* |
| 15123 | * Set up output mixers (0x02 - 0x05) |
| 15124 | */ |
| 15125 | /* set vol=0 to output mixers */ |
| 15126 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15127 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15128 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15129 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15130 | |
| 15131 | /* set up input amps for analog loopback */ |
| 15132 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 15133 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15134 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15135 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15136 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15137 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15138 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15139 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15140 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15141 | |
| 15142 | { } |
| 15143 | }; |
| 15144 | |
| 15145 | /* |
| 15146 | * 3-stack pin configuration: |
| 15147 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 15148 | */ |
| 15149 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 15150 | /* |
| 15151 | * Set pin mode and muting |
| 15152 | */ |
| 15153 | /* set front pin widgets 0x14 for output */ |
| 15154 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15155 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15156 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15157 | |
| 15158 | /* Mic (rear) pin: input vref at 80% */ |
| 15159 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15160 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15161 | /* Front Mic pin: input vref at 80% */ |
| 15162 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15163 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15164 | /* Line In pin: input */ |
| 15165 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15166 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15167 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15168 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15169 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15170 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15171 | /* CD pin widget for input */ |
| 15172 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15173 | |
| 15174 | { } |
| 15175 | }; |
| 15176 | |
| 15177 | /* |
| 15178 | * 6-stack pin configuration: |
| 15179 | */ |
| 15180 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 15181 | /* |
| 15182 | * Set pin mode and muting |
| 15183 | */ |
| 15184 | /* set front pin widgets 0x14 for output */ |
| 15185 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15186 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15187 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15188 | |
| 15189 | /* Rear Pin: output 1 (0x0d) */ |
| 15190 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15191 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15192 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 15193 | /* CLFE Pin: output 2 (0x0e) */ |
| 15194 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15195 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15196 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 15197 | /* Side Pin: output 3 (0x0f) */ |
| 15198 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15199 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15200 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 15201 | |
| 15202 | /* Mic (rear) pin: input vref at 80% */ |
| 15203 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15204 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15205 | /* Front Mic pin: input vref at 80% */ |
| 15206 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15207 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15208 | /* Line In pin: input */ |
| 15209 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15210 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15211 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15212 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15213 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15214 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15215 | /* CD pin widget for input */ |
| 15216 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15217 | |
| 15218 | { } |
| 15219 | }; |
| 15220 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15221 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 15222 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15223 | { } |
| 15224 | }; |
| 15225 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15226 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 15227 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15228 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15229 | { } |
| 15230 | }; |
| 15231 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15232 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15233 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15234 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15235 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15236 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15237 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15238 | {} |
| 15239 | }; |
| 15240 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15241 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15242 | { |
| 15243 | unsigned int present; |
| 15244 | unsigned char bits; |
| 15245 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15246 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15247 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15248 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15249 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15250 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15251 | } |
| 15252 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15253 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15254 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15255 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15256 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15257 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15258 | } |
| 15259 | |
| 15260 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 15261 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15262 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15263 | alc861vd_lenovo_mic_automute(codec); |
| 15264 | } |
| 15265 | |
| 15266 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15267 | unsigned int res) |
| 15268 | { |
| 15269 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15270 | case ALC880_MIC_EVENT: |
| 15271 | alc861vd_lenovo_mic_automute(codec); |
| 15272 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15273 | default: |
| 15274 | alc_automute_amp_unsol_event(codec, res); |
| 15275 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15276 | } |
| 15277 | } |
| 15278 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15279 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15280 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15281 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15282 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15283 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15284 | |
| 15285 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15286 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15287 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15288 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15289 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15290 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15291 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15292 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15293 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15294 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15295 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15296 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15297 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15298 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15299 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15300 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15301 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15302 | |
| 15303 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15304 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15305 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15306 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15307 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15308 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15309 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15310 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15311 | |
| 15312 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15313 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15314 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15315 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15316 | |
| 15317 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15318 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15319 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15320 | |
| 15321 | { } /* end */ |
| 15322 | }; |
| 15323 | |
| 15324 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15325 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15326 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15327 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15328 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15329 | spec->autocfg.hp_pins[0] = 0x15; |
| 15330 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15331 | } |
| 15332 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15333 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15334 | #define alc861vd_loopbacks alc880_loopbacks |
| 15335 | #endif |
| 15336 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15337 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15338 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15339 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15340 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15341 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15342 | |
| 15343 | /* |
| 15344 | * configuration and preset |
| 15345 | */ |
| 15346 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15347 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15348 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15349 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15350 | [ALC861VD_3ST] = "3stack", |
| 15351 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15352 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15353 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15354 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15355 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15356 | [ALC861VD_AUTO] = "auto", |
| 15357 | }; |
| 15358 | |
| 15359 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15360 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15361 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15362 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15363 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15364 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15365 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15366 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15367 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15368 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 15369 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15370 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15371 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15372 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15373 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15374 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15375 | {} |
| 15376 | }; |
| 15377 | |
| 15378 | static struct alc_config_preset alc861vd_presets[] = { |
| 15379 | [ALC660VD_3ST] = { |
| 15380 | .mixers = { alc861vd_3st_mixer }, |
| 15381 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15382 | alc861vd_3stack_init_verbs }, |
| 15383 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15384 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15385 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15386 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15387 | .input_mux = &alc861vd_capture_source, |
| 15388 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15389 | [ALC660VD_3ST_DIG] = { |
| 15390 | .mixers = { alc861vd_3st_mixer }, |
| 15391 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15392 | alc861vd_3stack_init_verbs }, |
| 15393 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15394 | .dac_nids = alc660vd_dac_nids, |
| 15395 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15396 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15397 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15398 | .input_mux = &alc861vd_capture_source, |
| 15399 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15400 | [ALC861VD_3ST] = { |
| 15401 | .mixers = { alc861vd_3st_mixer }, |
| 15402 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15403 | alc861vd_3stack_init_verbs }, |
| 15404 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15405 | .dac_nids = alc861vd_dac_nids, |
| 15406 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15407 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15408 | .input_mux = &alc861vd_capture_source, |
| 15409 | }, |
| 15410 | [ALC861VD_3ST_DIG] = { |
| 15411 | .mixers = { alc861vd_3st_mixer }, |
| 15412 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15413 | alc861vd_3stack_init_verbs }, |
| 15414 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15415 | .dac_nids = alc861vd_dac_nids, |
| 15416 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15417 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15418 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15419 | .input_mux = &alc861vd_capture_source, |
| 15420 | }, |
| 15421 | [ALC861VD_6ST_DIG] = { |
| 15422 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15423 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15424 | alc861vd_6stack_init_verbs }, |
| 15425 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15426 | .dac_nids = alc861vd_dac_nids, |
| 15427 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15428 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15429 | .channel_mode = alc861vd_6stack_modes, |
| 15430 | .input_mux = &alc861vd_capture_source, |
| 15431 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15432 | [ALC861VD_LENOVO] = { |
| 15433 | .mixers = { alc861vd_lenovo_mixer }, |
| 15434 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15435 | alc861vd_3stack_init_verbs, |
| 15436 | alc861vd_eapd_verbs, |
| 15437 | alc861vd_lenovo_unsol_verbs }, |
| 15438 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15439 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15440 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15441 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15442 | .input_mux = &alc861vd_capture_source, |
| 15443 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15444 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15445 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15446 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15447 | [ALC861VD_DALLAS] = { |
| 15448 | .mixers = { alc861vd_dallas_mixer }, |
| 15449 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15450 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15451 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15452 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15453 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15454 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15455 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15456 | .setup = alc861vd_dallas_setup, |
| 15457 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15458 | }, |
| 15459 | [ALC861VD_HP] = { |
| 15460 | .mixers = { alc861vd_hp_mixer }, |
| 15461 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15462 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15463 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15464 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15465 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15466 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15467 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15468 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15469 | .setup = alc861vd_dallas_setup, |
| 15470 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15471 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15472 | [ALC660VD_ASUS_V1S] = { |
| 15473 | .mixers = { alc861vd_lenovo_mixer }, |
| 15474 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15475 | alc861vd_3stack_init_verbs, |
| 15476 | alc861vd_eapd_verbs, |
| 15477 | alc861vd_lenovo_unsol_verbs }, |
| 15478 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15479 | .dac_nids = alc660vd_dac_nids, |
| 15480 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15481 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15482 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15483 | .input_mux = &alc861vd_capture_source, |
| 15484 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15485 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15486 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15487 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15488 | }; |
| 15489 | |
| 15490 | /* |
| 15491 | * BIOS auto configuration |
| 15492 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15493 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 15494 | const struct auto_pin_cfg *cfg) |
| 15495 | { |
Takashi Iwai | 9c0afc8 | 2010-01-12 14:00:11 +0100 | [diff] [blame] | 15496 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15497 | } |
| 15498 | |
| 15499 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15500 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15501 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15502 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15503 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15504 | } |
| 15505 | |
| 15506 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15507 | { |
| 15508 | struct alc_spec *spec = codec->spec; |
| 15509 | int i; |
| 15510 | |
| 15511 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15512 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15513 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15514 | if (nid) |
| 15515 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15516 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15517 | } |
| 15518 | } |
| 15519 | |
| 15520 | |
| 15521 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15522 | { |
| 15523 | struct alc_spec *spec = codec->spec; |
| 15524 | hda_nid_t pin; |
| 15525 | |
| 15526 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15527 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15528 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15529 | pin = spec->autocfg.speaker_pins[0]; |
| 15530 | if (pin) |
| 15531 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15532 | } |
| 15533 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15534 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15535 | |
| 15536 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15537 | { |
| 15538 | struct alc_spec *spec = codec->spec; |
| 15539 | int i; |
| 15540 | |
| 15541 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15542 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15543 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15544 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15545 | if (nid != ALC861VD_PIN_CD_NID && |
| 15546 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15547 | snd_hda_codec_write(codec, nid, 0, |
| 15548 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15549 | AMP_OUT_MUTE); |
| 15550 | } |
| 15551 | } |
| 15552 | } |
| 15553 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15554 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15555 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15556 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15557 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15558 | |
| 15559 | /* add playback controls from the parsed DAC table */ |
| 15560 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15561 | * different NIDs for mute/unmute switch and volume control */ |
| 15562 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15563 | const struct auto_pin_cfg *cfg) |
| 15564 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15565 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15566 | hda_nid_t nid_v, nid_s; |
| 15567 | int i, err; |
| 15568 | |
| 15569 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15570 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15571 | continue; |
| 15572 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15573 | alc880_dac_to_idx( |
| 15574 | spec->multiout.dac_nids[i])); |
| 15575 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15576 | alc880_dac_to_idx( |
| 15577 | spec->multiout.dac_nids[i])); |
| 15578 | |
| 15579 | if (i == 2) { |
| 15580 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15581 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 15582 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15583 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15584 | HDA_OUTPUT)); |
| 15585 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15586 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15587 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 15588 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15589 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15590 | HDA_OUTPUT)); |
| 15591 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15592 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15593 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 15594 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15595 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15596 | HDA_INPUT)); |
| 15597 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15598 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15599 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 15600 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15601 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15602 | HDA_INPUT)); |
| 15603 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15604 | return err; |
| 15605 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15606 | const char *pfx; |
| 15607 | if (cfg->line_outs == 1 && |
| 15608 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 15609 | if (!cfg->hp_pins) |
| 15610 | pfx = "Speaker"; |
| 15611 | else |
| 15612 | pfx = "PCM"; |
| 15613 | } else |
| 15614 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15615 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15616 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15617 | HDA_OUTPUT)); |
| 15618 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15619 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15620 | if (cfg->line_outs == 1 && |
| 15621 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15622 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15623 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15624 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15625 | HDA_INPUT)); |
| 15626 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15627 | return err; |
| 15628 | } |
| 15629 | } |
| 15630 | return 0; |
| 15631 | } |
| 15632 | |
| 15633 | /* add playback controls for speaker and HP outputs */ |
| 15634 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15635 | * different NIDs for mute/unmute switch and volume control */ |
| 15636 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15637 | hda_nid_t pin, const char *pfx) |
| 15638 | { |
| 15639 | hda_nid_t nid_v, nid_s; |
| 15640 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15641 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15642 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15643 | return 0; |
| 15644 | |
| 15645 | if (alc880_is_fixed_pin(pin)) { |
| 15646 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15647 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15648 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15649 | spec->multiout.hp_nid = nid_v; |
| 15650 | else |
| 15651 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15652 | /* control HP volume/switch on the output mixer amp */ |
| 15653 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15654 | alc880_fixed_pin_idx(pin)); |
| 15655 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15656 | alc880_fixed_pin_idx(pin)); |
| 15657 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15658 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15659 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15660 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15661 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15662 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15663 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15664 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15665 | return err; |
| 15666 | } else if (alc880_is_multi_pin(pin)) { |
| 15667 | /* set manual connection */ |
| 15668 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15669 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15670 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15671 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15672 | return err; |
| 15673 | } |
| 15674 | return 0; |
| 15675 | } |
| 15676 | |
| 15677 | /* parse the BIOS configuration and set up the alc_spec |
| 15678 | * return 1 if successful, 0 if the proper config is not found, |
| 15679 | * or a negative error code |
| 15680 | * Based on ALC880 version - had to change it to override |
| 15681 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15682 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15683 | { |
| 15684 | struct alc_spec *spec = codec->spec; |
| 15685 | int err; |
| 15686 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15687 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15688 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15689 | alc861vd_ignore); |
| 15690 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15691 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15692 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15693 | return 0; /* can't find valid BIOS pin config */ |
| 15694 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15695 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15696 | if (err < 0) |
| 15697 | return err; |
| 15698 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15699 | if (err < 0) |
| 15700 | return err; |
| 15701 | err = alc861vd_auto_create_extra_out(spec, |
| 15702 | spec->autocfg.speaker_pins[0], |
| 15703 | "Speaker"); |
| 15704 | if (err < 0) |
| 15705 | return err; |
| 15706 | err = alc861vd_auto_create_extra_out(spec, |
| 15707 | spec->autocfg.hp_pins[0], |
| 15708 | "Headphone"); |
| 15709 | if (err < 0) |
| 15710 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15711 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15712 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15713 | return err; |
| 15714 | |
| 15715 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15716 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15717 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15718 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15719 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15720 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15721 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15722 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15723 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15724 | |
| 15725 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15726 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15727 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15728 | err = alc_auto_add_mic_boost(codec); |
| 15729 | if (err < 0) |
| 15730 | return err; |
| 15731 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15732 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15733 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15734 | return 1; |
| 15735 | } |
| 15736 | |
| 15737 | /* additional initialization for auto-configuration model */ |
| 15738 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15739 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15740 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15741 | alc861vd_auto_init_multi_out(codec); |
| 15742 | alc861vd_auto_init_hp_out(codec); |
| 15743 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15744 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15745 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15746 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15747 | } |
| 15748 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15749 | enum { |
| 15750 | ALC660VD_FIX_ASUS_GPIO1 |
| 15751 | }; |
| 15752 | |
| 15753 | /* reset GPIO1 */ |
| 15754 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 15755 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 15756 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 15757 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 15758 | { } |
| 15759 | }; |
| 15760 | |
| 15761 | static const struct alc_fixup alc861vd_fixups[] = { |
| 15762 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 15763 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 15764 | }, |
| 15765 | }; |
| 15766 | |
| 15767 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 15768 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 15769 | {} |
| 15770 | }; |
| 15771 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15772 | static int patch_alc861vd(struct hda_codec *codec) |
| 15773 | { |
| 15774 | struct alc_spec *spec; |
| 15775 | int err, board_config; |
| 15776 | |
| 15777 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15778 | if (spec == NULL) |
| 15779 | return -ENOMEM; |
| 15780 | |
| 15781 | codec->spec = spec; |
| 15782 | |
| 15783 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15784 | alc861vd_models, |
| 15785 | alc861vd_cfg_tbl); |
| 15786 | |
| 15787 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15788 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15789 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15790 | board_config = ALC861VD_AUTO; |
| 15791 | } |
| 15792 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15793 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups); |
| 15794 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15795 | if (board_config == ALC861VD_AUTO) { |
| 15796 | /* automatic parse from the BIOS config */ |
| 15797 | err = alc861vd_parse_auto_config(codec); |
| 15798 | if (err < 0) { |
| 15799 | alc_free(codec); |
| 15800 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15801 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15802 | printk(KERN_INFO |
| 15803 | "hda_codec: Cannot set up configuration " |
| 15804 | "from BIOS. Using base mode...\n"); |
| 15805 | board_config = ALC861VD_3ST; |
| 15806 | } |
| 15807 | } |
| 15808 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15809 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15810 | if (err < 0) { |
| 15811 | alc_free(codec); |
| 15812 | return err; |
| 15813 | } |
| 15814 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15815 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15816 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15817 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15818 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15819 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15820 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15821 | } |
| 15822 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15823 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15824 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15825 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15826 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15827 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15828 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 15829 | if (!spec->adc_nids) { |
| 15830 | spec->adc_nids = alc861vd_adc_nids; |
| 15831 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 15832 | } |
| 15833 | if (!spec->capsrc_nids) |
| 15834 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15835 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15836 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15837 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15838 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15839 | spec->vmaster_nid = 0x02; |
| 15840 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15841 | codec->patch_ops = alc_patch_ops; |
| 15842 | |
| 15843 | if (board_config == ALC861VD_AUTO) |
| 15844 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15845 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15846 | if (!spec->loopback.amplist) |
| 15847 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15848 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15849 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15850 | |
| 15851 | return 0; |
| 15852 | } |
| 15853 | |
| 15854 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15855 | * ALC662 support |
| 15856 | * |
| 15857 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15858 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15859 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15860 | * 6-channel independent captures. |
| 15861 | * |
| 15862 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15863 | * driver yet). |
| 15864 | */ |
| 15865 | #define ALC662_DIGOUT_NID 0x06 |
| 15866 | #define ALC662_DIGIN_NID 0x0a |
| 15867 | |
| 15868 | static hda_nid_t alc662_dac_nids[4] = { |
| 15869 | /* front, rear, clfe, rear_surr */ |
| 15870 | 0x02, 0x03, 0x04 |
| 15871 | }; |
| 15872 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15873 | static hda_nid_t alc272_dac_nids[2] = { |
| 15874 | 0x02, 0x03 |
| 15875 | }; |
| 15876 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15877 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15878 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15879 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15880 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15881 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15882 | static hda_nid_t alc272_adc_nids[1] = { |
| 15883 | /* ADC1-2 */ |
| 15884 | 0x08, |
| 15885 | }; |
| 15886 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15887 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15888 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15889 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15890 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15891 | /* input MUX */ |
| 15892 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15893 | static struct hda_input_mux alc662_capture_source = { |
| 15894 | .num_items = 4, |
| 15895 | .items = { |
| 15896 | { "Mic", 0x0 }, |
| 15897 | { "Front Mic", 0x1 }, |
| 15898 | { "Line", 0x2 }, |
| 15899 | { "CD", 0x4 }, |
| 15900 | }, |
| 15901 | }; |
| 15902 | |
| 15903 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15904 | .num_items = 2, |
| 15905 | .items = { |
| 15906 | { "Mic", 0x1 }, |
| 15907 | { "Line", 0x2 }, |
| 15908 | }, |
| 15909 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15910 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15911 | static struct hda_input_mux alc663_capture_source = { |
| 15912 | .num_items = 3, |
| 15913 | .items = { |
| 15914 | { "Mic", 0x0 }, |
| 15915 | { "Front Mic", 0x1 }, |
| 15916 | { "Line", 0x2 }, |
| 15917 | }, |
| 15918 | }; |
| 15919 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15920 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15921 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15922 | .num_items = 16, |
| 15923 | .items = { |
| 15924 | { "Autoselect Mic", 0x0 }, |
| 15925 | { "Internal Mic", 0x1 }, |
| 15926 | { "In-0x02", 0x2 }, |
| 15927 | { "In-0x03", 0x3 }, |
| 15928 | { "In-0x04", 0x4 }, |
| 15929 | { "In-0x05", 0x5 }, |
| 15930 | { "In-0x06", 0x6 }, |
| 15931 | { "In-0x07", 0x7 }, |
| 15932 | { "In-0x08", 0x8 }, |
| 15933 | { "In-0x09", 0x9 }, |
| 15934 | { "In-0x0a", 0x0a }, |
| 15935 | { "In-0x0b", 0x0b }, |
| 15936 | { "In-0x0c", 0x0c }, |
| 15937 | { "In-0x0d", 0x0d }, |
| 15938 | { "In-0x0e", 0x0e }, |
| 15939 | { "In-0x0f", 0x0f }, |
| 15940 | }, |
| 15941 | }; |
| 15942 | #endif |
| 15943 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15944 | /* |
| 15945 | * 2ch mode |
| 15946 | */ |
| 15947 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15948 | { 2, NULL } |
| 15949 | }; |
| 15950 | |
| 15951 | /* |
| 15952 | * 2ch mode |
| 15953 | */ |
| 15954 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15955 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15956 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15957 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15958 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15959 | { } /* end */ |
| 15960 | }; |
| 15961 | |
| 15962 | /* |
| 15963 | * 6ch mode |
| 15964 | */ |
| 15965 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15966 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15967 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15968 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15969 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15970 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15971 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15972 | { } /* end */ |
| 15973 | }; |
| 15974 | |
| 15975 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15976 | { 2, alc662_3ST_ch2_init }, |
| 15977 | { 6, alc662_3ST_ch6_init }, |
| 15978 | }; |
| 15979 | |
| 15980 | /* |
| 15981 | * 2ch mode |
| 15982 | */ |
| 15983 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15984 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15985 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15986 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15987 | { } /* end */ |
| 15988 | }; |
| 15989 | |
| 15990 | /* |
| 15991 | * 6ch mode |
| 15992 | */ |
| 15993 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15994 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15995 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15996 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15997 | { } /* end */ |
| 15998 | }; |
| 15999 | |
| 16000 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 16001 | { 2, alc662_sixstack_ch6_init }, |
| 16002 | { 6, alc662_sixstack_ch8_init }, |
| 16003 | }; |
| 16004 | |
| 16005 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16006 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16007 | */ |
| 16008 | |
| 16009 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 16010 | /* output mixer control */ |
| 16011 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16012 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16013 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16014 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16015 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16016 | 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] | 16017 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16018 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16019 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16020 | |
| 16021 | /*Input mixer control */ |
| 16022 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 16023 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 16024 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 16025 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 16026 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 16027 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 16028 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 16029 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16030 | { } /* end */ |
| 16031 | }; |
| 16032 | |
| 16033 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 16034 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16035 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16036 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16037 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16038 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16039 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16040 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16041 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16042 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16043 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16044 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16045 | { } /* end */ |
| 16046 | }; |
| 16047 | |
| 16048 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 16049 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16050 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16051 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16052 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16053 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16054 | 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] | 16055 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16056 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16057 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16058 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16059 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16060 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16061 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16064 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16065 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16066 | { } /* end */ |
| 16067 | }; |
| 16068 | |
| 16069 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 16070 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16071 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 16072 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16073 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16074 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16075 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16076 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16077 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16078 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16079 | { } /* end */ |
| 16080 | }; |
| 16081 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16082 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16083 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16084 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16085 | |
| 16086 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 16087 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16088 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16089 | |
| 16090 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16091 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16092 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16093 | { } /* end */ |
| 16094 | }; |
| 16095 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16096 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16097 | ALC262_HIPPO_MASTER_SWITCH, |
| 16098 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16099 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16100 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16101 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16102 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16103 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16104 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16105 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16106 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16107 | { } /* end */ |
| 16108 | }; |
| 16109 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16110 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 16111 | .ops = &snd_hda_bind_vol, |
| 16112 | .values = { |
| 16113 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16114 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 16115 | 0 |
| 16116 | }, |
| 16117 | }; |
| 16118 | |
| 16119 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 16120 | .ops = &snd_hda_bind_sw, |
| 16121 | .values = { |
| 16122 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16123 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16124 | 0 |
| 16125 | }, |
| 16126 | }; |
| 16127 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16128 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16129 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16130 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 16131 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16132 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16133 | { } /* end */ |
| 16134 | }; |
| 16135 | |
| 16136 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 16137 | .ops = &snd_hda_bind_sw, |
| 16138 | .values = { |
| 16139 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16140 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16141 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16142 | 0 |
| 16143 | }, |
| 16144 | }; |
| 16145 | |
| 16146 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 16147 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16148 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 16149 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16150 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16151 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16152 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16153 | |
| 16154 | { } /* end */ |
| 16155 | }; |
| 16156 | |
| 16157 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 16158 | .ops = &snd_hda_bind_sw, |
| 16159 | .values = { |
| 16160 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16161 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16162 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16163 | 0 |
| 16164 | }, |
| 16165 | }; |
| 16166 | |
| 16167 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 16168 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16169 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 16170 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16171 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16172 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16173 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16174 | { } /* end */ |
| 16175 | }; |
| 16176 | |
| 16177 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16178 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16179 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16180 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16181 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16182 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16183 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16184 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16185 | { } /* end */ |
| 16186 | }; |
| 16187 | |
| 16188 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 16189 | .ops = &snd_hda_bind_vol, |
| 16190 | .values = { |
| 16191 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16192 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 16193 | 0 |
| 16194 | }, |
| 16195 | }; |
| 16196 | |
| 16197 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 16198 | .ops = &snd_hda_bind_sw, |
| 16199 | .values = { |
| 16200 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16201 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 16202 | 0 |
| 16203 | }, |
| 16204 | }; |
| 16205 | |
| 16206 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 16207 | HDA_BIND_VOL("Master Playback Volume", |
| 16208 | &alc663_asus_two_bind_master_vol), |
| 16209 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16210 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16211 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16212 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16213 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16214 | { } /* end */ |
| 16215 | }; |
| 16216 | |
| 16217 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 16218 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16219 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16220 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16221 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16222 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16223 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16224 | { } /* end */ |
| 16225 | }; |
| 16226 | |
| 16227 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 16228 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16229 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16230 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16231 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16232 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16233 | |
| 16234 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16236 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16237 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16238 | { } /* end */ |
| 16239 | }; |
| 16240 | |
| 16241 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 16242 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16243 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16244 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16245 | |
| 16246 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16247 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16248 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16249 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16250 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16251 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16252 | { } /* end */ |
| 16253 | }; |
| 16254 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16255 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 16256 | .ops = &snd_hda_bind_sw, |
| 16257 | .values = { |
| 16258 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16259 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16260 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16261 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16262 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16263 | 0 |
| 16264 | }, |
| 16265 | }; |
| 16266 | |
| 16267 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 16268 | .ops = &snd_hda_bind_sw, |
| 16269 | .values = { |
| 16270 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16271 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16272 | 0 |
| 16273 | }, |
| 16274 | }; |
| 16275 | |
| 16276 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 16277 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16278 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16279 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16280 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16281 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16282 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16283 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16284 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16285 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16286 | { } /* end */ |
| 16287 | }; |
| 16288 | |
| 16289 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 16290 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16291 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16292 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16293 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16294 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16295 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16296 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16297 | { } /* end */ |
| 16298 | }; |
| 16299 | |
| 16300 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16301 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16302 | { |
| 16303 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16304 | .name = "Channel Mode", |
| 16305 | .info = alc_ch_mode_info, |
| 16306 | .get = alc_ch_mode_get, |
| 16307 | .put = alc_ch_mode_put, |
| 16308 | }, |
| 16309 | { } /* end */ |
| 16310 | }; |
| 16311 | |
| 16312 | static struct hda_verb alc662_init_verbs[] = { |
| 16313 | /* ADC: mute amp left and right */ |
| 16314 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16315 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16316 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 16317 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16318 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16319 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16320 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16321 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16322 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16323 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16325 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16326 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16327 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16328 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16329 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16330 | |
| 16331 | /* Front Pin: output 0 (0x0c) */ |
| 16332 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16333 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16334 | |
| 16335 | /* Rear Pin: output 1 (0x0d) */ |
| 16336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16337 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16338 | |
| 16339 | /* CLFE Pin: output 2 (0x0e) */ |
| 16340 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16341 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16342 | |
| 16343 | /* Mic (rear) pin: input vref at 80% */ |
| 16344 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16345 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16346 | /* Front Mic pin: input vref at 80% */ |
| 16347 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16348 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16349 | /* Line In pin: input */ |
| 16350 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16351 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16352 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16353 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16354 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16355 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16356 | /* CD pin widget for input */ |
| 16357 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16358 | |
| 16359 | /* FIXME: use matrix-type input source selection */ |
| 16360 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16361 | /* Input mixer */ |
| 16362 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16364 | |
| 16365 | /* always trun on EAPD */ |
| 16366 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16367 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16368 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16369 | { } |
| 16370 | }; |
| 16371 | |
| 16372 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16373 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16374 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16375 | {} |
| 16376 | }; |
| 16377 | |
| 16378 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16379 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16380 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16381 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16382 | }; |
| 16383 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16384 | /* Set Unsolicited Event*/ |
| 16385 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16386 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16387 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16388 | {} |
| 16389 | }; |
| 16390 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16391 | /* |
| 16392 | * generic initialization of ADC, input mixers and output mixers |
| 16393 | */ |
| 16394 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 16395 | /* |
| 16396 | * Unmute ADC and set the default input to mic-in |
| 16397 | */ |
| 16398 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16399 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16400 | |
| 16401 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 16402 | * mixer widget |
| 16403 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 16404 | * panel mic (mic 2) |
| 16405 | */ |
| 16406 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16407 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16408 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16409 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16410 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16411 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16412 | |
| 16413 | /* |
| 16414 | * Set up output mixers (0x0c - 0x0f) |
| 16415 | */ |
| 16416 | /* set vol=0 to output mixers */ |
| 16417 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16418 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16419 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16420 | |
| 16421 | /* set up input amps for analog loopback */ |
| 16422 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16423 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16425 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16426 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16427 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16428 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16429 | |
| 16430 | |
| 16431 | /* FIXME: use matrix-type input source selection */ |
| 16432 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16433 | /* Input mixer */ |
| 16434 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16435 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16436 | { } |
| 16437 | }; |
| 16438 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16439 | /* additional verbs for ALC663 */ |
| 16440 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16441 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16442 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16443 | { } |
| 16444 | }; |
| 16445 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16446 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16447 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16448 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16449 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16450 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16451 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16452 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16453 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16454 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16455 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16456 | {} |
| 16457 | }; |
| 16458 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16459 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16460 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16461 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16462 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16463 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16464 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16465 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16466 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16467 | {} |
| 16468 | }; |
| 16469 | |
| 16470 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16471 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16472 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16473 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16474 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16475 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16476 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16477 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16478 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16479 | {} |
| 16480 | }; |
| 16481 | |
| 16482 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16483 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16484 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16485 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16486 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16487 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16488 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16489 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16490 | {} |
| 16491 | }; |
| 16492 | |
| 16493 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16494 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16495 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16496 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16497 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16498 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16499 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16500 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16501 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16502 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16503 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16504 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16505 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16506 | {} |
| 16507 | }; |
| 16508 | |
| 16509 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16510 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16511 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16512 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16513 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16514 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16515 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16516 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16517 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16518 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16519 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16520 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16521 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16522 | {} |
| 16523 | }; |
| 16524 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16525 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16526 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16527 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16528 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16529 | |
| 16530 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16531 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16532 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16533 | |
| 16534 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16535 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16536 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16537 | {} |
| 16538 | }; |
| 16539 | |
| 16540 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16541 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16542 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16543 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16544 | |
| 16545 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16546 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16547 | {} |
| 16548 | }; |
| 16549 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16550 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16551 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16552 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16553 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16554 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16555 | {} |
| 16556 | }; |
| 16557 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16558 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16559 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16560 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16561 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16562 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16563 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16564 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16565 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16566 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16567 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16568 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16569 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16570 | {} |
| 16571 | }; |
| 16572 | |
| 16573 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16574 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16575 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16576 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16577 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16578 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16579 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16580 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16581 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16582 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16583 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16584 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16585 | {} |
| 16586 | }; |
| 16587 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16588 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 16589 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16590 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16591 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16592 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16593 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16594 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16595 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16596 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16597 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16598 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16599 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16600 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16601 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16602 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16603 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16604 | {} |
| 16605 | }; |
| 16606 | |
| 16607 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 16608 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16609 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16610 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16611 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16612 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16613 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16614 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16615 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16616 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16617 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16618 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16619 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16620 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16621 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16622 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16623 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16624 | {} |
| 16625 | }; |
| 16626 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16627 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16628 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16629 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16630 | { } /* end */ |
| 16631 | }; |
| 16632 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16633 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16634 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16635 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16636 | { } /* end */ |
| 16637 | }; |
| 16638 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16639 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16640 | { |
| 16641 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16642 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16643 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16644 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16645 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16646 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16647 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16648 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16649 | } |
| 16650 | |
| 16651 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16652 | { |
| 16653 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16654 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16655 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16656 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16657 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16658 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16659 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16660 | HDA_AMP_MUTE, bits); |
| 16661 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16662 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16663 | } |
| 16664 | |
| 16665 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16666 | unsigned int res) |
| 16667 | { |
| 16668 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16669 | alc662_lenovo_101e_all_automute(codec); |
| 16670 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16671 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16672 | } |
| 16673 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16674 | /* unsolicited event for HP jack sensing */ |
| 16675 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16676 | unsigned int res) |
| 16677 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16678 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16679 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16680 | else |
| 16681 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16682 | } |
| 16683 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16684 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16685 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16686 | struct alc_spec *spec = codec->spec; |
| 16687 | |
| 16688 | alc262_hippo1_setup(codec); |
| 16689 | spec->ext_mic.pin = 0x18; |
| 16690 | spec->ext_mic.mux_idx = 0; |
| 16691 | spec->int_mic.pin = 0x19; |
| 16692 | spec->int_mic.mux_idx = 1; |
| 16693 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16694 | } |
| 16695 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16696 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16697 | { |
| 16698 | alc262_hippo_automute(codec); |
| 16699 | alc_mic_automute(codec); |
| 16700 | } |
| 16701 | |
| 16702 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16703 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16704 | struct alc_spec *spec = codec->spec; |
| 16705 | |
| 16706 | spec->autocfg.hp_pins[0] = 0x14; |
| 16707 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16708 | } |
| 16709 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16710 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 16711 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16712 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16713 | { |
| 16714 | unsigned int present; |
| 16715 | unsigned char bits; |
| 16716 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16717 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16718 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16719 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16720 | AMP_IN_MUTE(0), bits); |
| 16721 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16722 | AMP_IN_MUTE(0), bits); |
| 16723 | } |
| 16724 | |
| 16725 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16726 | { |
| 16727 | unsigned int present; |
| 16728 | unsigned char bits; |
| 16729 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16730 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16731 | bits = present ? HDA_AMP_MUTE : 0; |
| 16732 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16733 | AMP_IN_MUTE(0), bits); |
| 16734 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16735 | AMP_IN_MUTE(0), bits); |
| 16736 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16737 | AMP_IN_MUTE(0), bits); |
| 16738 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16739 | AMP_IN_MUTE(0), bits); |
| 16740 | } |
| 16741 | |
| 16742 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16743 | { |
| 16744 | unsigned int present; |
| 16745 | unsigned char bits; |
| 16746 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16747 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16748 | bits = present ? HDA_AMP_MUTE : 0; |
| 16749 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16750 | AMP_IN_MUTE(0), bits); |
| 16751 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16752 | AMP_IN_MUTE(0), bits); |
| 16753 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16754 | AMP_IN_MUTE(0), bits); |
| 16755 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16756 | AMP_IN_MUTE(0), bits); |
| 16757 | } |
| 16758 | |
| 16759 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16760 | { |
| 16761 | unsigned int present; |
| 16762 | unsigned char bits; |
| 16763 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16764 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16765 | bits = present ? 0 : PIN_OUT; |
| 16766 | snd_hda_codec_write(codec, 0x14, 0, |
| 16767 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16768 | } |
| 16769 | |
| 16770 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16771 | { |
| 16772 | unsigned int present1, present2; |
| 16773 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16774 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 16775 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16776 | |
| 16777 | if (present1 || present2) { |
| 16778 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16779 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16780 | } else { |
| 16781 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16782 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16783 | } |
| 16784 | } |
| 16785 | |
| 16786 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16787 | { |
| 16788 | unsigned int present1, present2; |
| 16789 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16790 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 16791 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16792 | |
| 16793 | if (present1 || present2) { |
| 16794 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16795 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16796 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16797 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16798 | } else { |
| 16799 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16800 | AMP_IN_MUTE(0), 0); |
| 16801 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16802 | AMP_IN_MUTE(0), 0); |
| 16803 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16804 | } |
| 16805 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16806 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 16807 | { |
| 16808 | unsigned int present1, present2; |
| 16809 | |
| 16810 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16811 | AC_VERB_GET_PIN_SENSE, 0) |
| 16812 | & AC_PINSENSE_PRESENCE; |
| 16813 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 16814 | AC_VERB_GET_PIN_SENSE, 0) |
| 16815 | & AC_PINSENSE_PRESENCE; |
| 16816 | |
| 16817 | if (present1 || present2) { |
| 16818 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16819 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16820 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16821 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16822 | } else { |
| 16823 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16824 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16825 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16826 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16827 | } |
| 16828 | } |
| 16829 | |
| 16830 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 16831 | { |
| 16832 | unsigned int present1, present2; |
| 16833 | |
| 16834 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16835 | AC_VERB_GET_PIN_SENSE, 0) |
| 16836 | & AC_PINSENSE_PRESENCE; |
| 16837 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16838 | AC_VERB_GET_PIN_SENSE, 0) |
| 16839 | & AC_PINSENSE_PRESENCE; |
| 16840 | |
| 16841 | if (present1 || present2) { |
| 16842 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16843 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16844 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16845 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16846 | } else { |
| 16847 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16848 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16849 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16850 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16851 | } |
| 16852 | } |
| 16853 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16854 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16855 | unsigned int res) |
| 16856 | { |
| 16857 | switch (res >> 26) { |
| 16858 | case ALC880_HP_EVENT: |
| 16859 | alc663_m51va_speaker_automute(codec); |
| 16860 | break; |
| 16861 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16862 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16863 | break; |
| 16864 | } |
| 16865 | } |
| 16866 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16867 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 16868 | { |
| 16869 | struct alc_spec *spec = codec->spec; |
| 16870 | spec->ext_mic.pin = 0x18; |
| 16871 | spec->ext_mic.mux_idx = 0; |
| 16872 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16873 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16874 | spec->auto_mic = 1; |
| 16875 | } |
| 16876 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16877 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16878 | { |
| 16879 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16880 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16881 | } |
| 16882 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16883 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16884 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16885 | |
| 16886 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 16887 | { |
| 16888 | struct alc_spec *spec = codec->spec; |
| 16889 | spec->ext_mic.pin = 0x18; |
| 16890 | spec->ext_mic.mux_idx = 0; |
| 16891 | spec->int_mic.pin = 0x19; |
| 16892 | spec->int_mic.mux_idx = 1; |
| 16893 | spec->auto_mic = 1; |
| 16894 | } |
| 16895 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16896 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16897 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16898 | /* ***************** Mode2 ******************************/ |
| 16899 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16900 | unsigned int res) |
| 16901 | { |
| 16902 | switch (res >> 26) { |
| 16903 | case ALC880_HP_EVENT: |
| 16904 | alc662_f5z_speaker_automute(codec); |
| 16905 | break; |
| 16906 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16907 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16908 | break; |
| 16909 | } |
| 16910 | } |
| 16911 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16912 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16913 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16914 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16915 | { |
| 16916 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16917 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16918 | } |
| 16919 | /* ***************** Mode3 ******************************/ |
| 16920 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16921 | unsigned int res) |
| 16922 | { |
| 16923 | switch (res >> 26) { |
| 16924 | case ALC880_HP_EVENT: |
| 16925 | alc663_two_hp_m1_speaker_automute(codec); |
| 16926 | break; |
| 16927 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16928 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16929 | break; |
| 16930 | } |
| 16931 | } |
| 16932 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16933 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16934 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16935 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16936 | { |
| 16937 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16938 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16939 | } |
| 16940 | /* ***************** Mode4 ******************************/ |
| 16941 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16942 | unsigned int res) |
| 16943 | { |
| 16944 | switch (res >> 26) { |
| 16945 | case ALC880_HP_EVENT: |
| 16946 | alc663_21jd_two_speaker_automute(codec); |
| 16947 | break; |
| 16948 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16949 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16950 | break; |
| 16951 | } |
| 16952 | } |
| 16953 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16954 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16955 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16956 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16957 | { |
| 16958 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16959 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16960 | } |
| 16961 | /* ***************** Mode5 ******************************/ |
| 16962 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16963 | unsigned int res) |
| 16964 | { |
| 16965 | switch (res >> 26) { |
| 16966 | case ALC880_HP_EVENT: |
| 16967 | alc663_15jd_two_speaker_automute(codec); |
| 16968 | break; |
| 16969 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16970 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16971 | break; |
| 16972 | } |
| 16973 | } |
| 16974 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16975 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16976 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16977 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16978 | { |
| 16979 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16980 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16981 | } |
| 16982 | /* ***************** Mode6 ******************************/ |
| 16983 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16984 | unsigned int res) |
| 16985 | { |
| 16986 | switch (res >> 26) { |
| 16987 | case ALC880_HP_EVENT: |
| 16988 | alc663_two_hp_m2_speaker_automute(codec); |
| 16989 | break; |
| 16990 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16991 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16992 | break; |
| 16993 | } |
| 16994 | } |
| 16995 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16996 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16997 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16998 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16999 | { |
| 17000 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17001 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17002 | } |
| 17003 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17004 | /* ***************** Mode7 ******************************/ |
| 17005 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 17006 | unsigned int res) |
| 17007 | { |
| 17008 | switch (res >> 26) { |
| 17009 | case ALC880_HP_EVENT: |
| 17010 | alc663_two_hp_m7_speaker_automute(codec); |
| 17011 | break; |
| 17012 | case ALC880_MIC_EVENT: |
| 17013 | alc_mic_automute(codec); |
| 17014 | break; |
| 17015 | } |
| 17016 | } |
| 17017 | |
| 17018 | #define alc663_mode7_setup alc663_mode1_setup |
| 17019 | |
| 17020 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 17021 | { |
| 17022 | alc663_two_hp_m7_speaker_automute(codec); |
| 17023 | alc_mic_automute(codec); |
| 17024 | } |
| 17025 | |
| 17026 | /* ***************** Mode8 ******************************/ |
| 17027 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 17028 | unsigned int res) |
| 17029 | { |
| 17030 | switch (res >> 26) { |
| 17031 | case ALC880_HP_EVENT: |
| 17032 | alc663_two_hp_m8_speaker_automute(codec); |
| 17033 | break; |
| 17034 | case ALC880_MIC_EVENT: |
| 17035 | alc_mic_automute(codec); |
| 17036 | break; |
| 17037 | } |
| 17038 | } |
| 17039 | |
| 17040 | #define alc663_mode8_setup alc663_m51va_setup |
| 17041 | |
| 17042 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 17043 | { |
| 17044 | alc663_two_hp_m8_speaker_automute(codec); |
| 17045 | alc_mic_automute(codec); |
| 17046 | } |
| 17047 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17048 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 17049 | { |
| 17050 | unsigned int present; |
| 17051 | unsigned char bits; |
| 17052 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17053 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17054 | bits = present ? HDA_AMP_MUTE : 0; |
| 17055 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17056 | HDA_AMP_MUTE, bits); |
| 17057 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17058 | HDA_AMP_MUTE, bits); |
| 17059 | } |
| 17060 | |
| 17061 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 17062 | { |
| 17063 | unsigned int present; |
| 17064 | unsigned char bits; |
| 17065 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17066 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17067 | bits = present ? HDA_AMP_MUTE : 0; |
| 17068 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17069 | HDA_AMP_MUTE, bits); |
| 17070 | } |
| 17071 | |
| 17072 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 17073 | unsigned int res) |
| 17074 | { |
| 17075 | switch (res >> 26) { |
| 17076 | case ALC880_HP_EVENT: |
| 17077 | alc663_g71v_hp_automute(codec); |
| 17078 | break; |
| 17079 | case ALC880_FRONT_EVENT: |
| 17080 | alc663_g71v_front_automute(codec); |
| 17081 | break; |
| 17082 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17083 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17084 | break; |
| 17085 | } |
| 17086 | } |
| 17087 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17088 | #define alc663_g71v_setup alc663_m51va_setup |
| 17089 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17090 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 17091 | { |
| 17092 | alc663_g71v_front_automute(codec); |
| 17093 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17094 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17095 | } |
| 17096 | |
| 17097 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 17098 | unsigned int res) |
| 17099 | { |
| 17100 | switch (res >> 26) { |
| 17101 | case ALC880_HP_EVENT: |
| 17102 | alc663_m51va_speaker_automute(codec); |
| 17103 | break; |
| 17104 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17105 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17106 | break; |
| 17107 | } |
| 17108 | } |
| 17109 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17110 | #define alc663_g50v_setup alc663_m51va_setup |
| 17111 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17112 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 17113 | { |
| 17114 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17115 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17116 | } |
| 17117 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17118 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 17119 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17120 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17121 | |
| 17122 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 17123 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17124 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17125 | |
| 17126 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17127 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17128 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17129 | { } /* end */ |
| 17130 | }; |
| 17131 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17132 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 17133 | /* Master Playback automatically created from Speaker and Headphone */ |
| 17134 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17135 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17136 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17137 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17138 | |
| 17139 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17140 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17141 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 17142 | |
| 17143 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17144 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17145 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 17146 | { } /* end */ |
| 17147 | }; |
| 17148 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17149 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17150 | #define alc662_loopbacks alc880_loopbacks |
| 17151 | #endif |
| 17152 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17153 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17154 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17155 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 17156 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 17157 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 17158 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 17159 | |
| 17160 | /* |
| 17161 | * configuration and preset |
| 17162 | */ |
| 17163 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 17164 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 17165 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 17166 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 17167 | [ALC662_5ST_DIG] = "6stack-dig", |
| 17168 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 17169 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17170 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17171 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17172 | [ALC663_ASUS_M51VA] = "m51va", |
| 17173 | [ALC663_ASUS_G71V] = "g71v", |
| 17174 | [ALC663_ASUS_H13] = "h13", |
| 17175 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17176 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 17177 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 17178 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 17179 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 17180 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 17181 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17182 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 17183 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 17184 | [ALC272_DELL] = "dell", |
| 17185 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17186 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17187 | [ALC662_AUTO] = "auto", |
| 17188 | }; |
| 17189 | |
| 17190 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17191 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17192 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 17193 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17194 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 17195 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 17196 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 17197 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17198 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 17199 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17200 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 17201 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17202 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17203 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 17204 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 17205 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 17206 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 17207 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17208 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17209 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 17210 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17211 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 17212 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 17213 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 17214 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17215 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17216 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 17217 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 17218 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17219 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 17220 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 17221 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 17222 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17223 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17224 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 17225 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17226 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17227 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 17228 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 17229 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17230 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 17231 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 17232 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17233 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 17234 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 17235 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17236 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17237 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 17238 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17239 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17240 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 17241 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17242 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 17243 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 17244 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17245 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17246 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17247 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 17248 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17249 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17250 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17251 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 17252 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 17253 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame^] | 17254 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17255 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 17256 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 17257 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17258 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 17259 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17260 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 17261 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17262 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17263 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 17264 | ALC663_ASUS_H13), |
David Santinoli | 7aee674 | 2009-12-09 12:34:26 +0100 | [diff] [blame] | 17265 | SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17266 | {} |
| 17267 | }; |
| 17268 | |
| 17269 | static struct alc_config_preset alc662_presets[] = { |
| 17270 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17271 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17272 | .init_verbs = { alc662_init_verbs }, |
| 17273 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17274 | .dac_nids = alc662_dac_nids, |
| 17275 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17276 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17277 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17278 | .channel_mode = alc662_3ST_2ch_modes, |
| 17279 | .input_mux = &alc662_capture_source, |
| 17280 | }, |
| 17281 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17282 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17283 | .init_verbs = { alc662_init_verbs }, |
| 17284 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17285 | .dac_nids = alc662_dac_nids, |
| 17286 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17287 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17288 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17289 | .channel_mode = alc662_3ST_6ch_modes, |
| 17290 | .need_dac_fix = 1, |
| 17291 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17292 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17293 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17294 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17295 | .init_verbs = { alc662_init_verbs }, |
| 17296 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17297 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17298 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17299 | .channel_mode = alc662_3ST_6ch_modes, |
| 17300 | .need_dac_fix = 1, |
| 17301 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17302 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17303 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17304 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17305 | .init_verbs = { alc662_init_verbs }, |
| 17306 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17307 | .dac_nids = alc662_dac_nids, |
| 17308 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17309 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17310 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 17311 | .channel_mode = alc662_5stack_modes, |
| 17312 | .input_mux = &alc662_capture_source, |
| 17313 | }, |
| 17314 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17315 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17316 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 17317 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17318 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17319 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17320 | .channel_mode = alc662_3ST_2ch_modes, |
| 17321 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 17322 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 17323 | .init_hook = alc662_lenovo_101e_all_automute, |
| 17324 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17325 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17326 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17327 | .init_verbs = { alc662_init_verbs, |
| 17328 | alc662_eeepc_sue_init_verbs }, |
| 17329 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17330 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17331 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17332 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17333 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17334 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17335 | .init_hook = alc662_eeepc_inithook, |
| 17336 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17337 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17338 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17339 | alc662_chmode_mixer }, |
| 17340 | .init_verbs = { alc662_init_verbs, |
| 17341 | alc662_eeepc_ep20_sue_init_verbs }, |
| 17342 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17343 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17344 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17345 | .channel_mode = alc662_3ST_6ch_modes, |
| 17346 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17347 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17348 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17349 | .init_hook = alc662_eeepc_ep20_inithook, |
| 17350 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17351 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17352 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17353 | .init_verbs = { alc662_init_verbs, |
| 17354 | alc662_ecs_init_verbs }, |
| 17355 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17356 | .dac_nids = alc662_dac_nids, |
| 17357 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17358 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17359 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17360 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17361 | .init_hook = alc662_eeepc_inithook, |
| 17362 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17363 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17364 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17365 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17366 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17367 | .dac_nids = alc662_dac_nids, |
| 17368 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17369 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17370 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17371 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17372 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17373 | .init_hook = alc663_m51va_inithook, |
| 17374 | }, |
| 17375 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17376 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17377 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 17378 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17379 | .dac_nids = alc662_dac_nids, |
| 17380 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17381 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17382 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17383 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17384 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17385 | .init_hook = alc663_g71v_inithook, |
| 17386 | }, |
| 17387 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17388 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17389 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17390 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17391 | .dac_nids = alc662_dac_nids, |
| 17392 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17393 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17394 | .unsol_event = alc663_m51va_unsol_event, |
| 17395 | .init_hook = alc663_m51va_inithook, |
| 17396 | }, |
| 17397 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17398 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17399 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 17400 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17401 | .dac_nids = alc662_dac_nids, |
| 17402 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17403 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17404 | .channel_mode = alc662_3ST_6ch_modes, |
| 17405 | .input_mux = &alc663_capture_source, |
| 17406 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17407 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17408 | .init_hook = alc663_g50v_inithook, |
| 17409 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17410 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17411 | .mixers = { alc663_m51va_mixer }, |
| 17412 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17413 | .init_verbs = { alc662_init_verbs, |
| 17414 | alc663_21jd_amic_init_verbs }, |
| 17415 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17416 | .hp_nid = 0x03, |
| 17417 | .dac_nids = alc662_dac_nids, |
| 17418 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17419 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17420 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17421 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17422 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17423 | .init_hook = alc663_mode1_inithook, |
| 17424 | }, |
| 17425 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17426 | .mixers = { alc662_1bjd_mixer }, |
| 17427 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17428 | .init_verbs = { alc662_init_verbs, |
| 17429 | alc662_1bjd_amic_init_verbs }, |
| 17430 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17431 | .dac_nids = alc662_dac_nids, |
| 17432 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17433 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17434 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17435 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17436 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17437 | .init_hook = alc662_mode2_inithook, |
| 17438 | }, |
| 17439 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17440 | .mixers = { alc663_two_hp_m1_mixer }, |
| 17441 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17442 | .init_verbs = { alc662_init_verbs, |
| 17443 | alc663_two_hp_amic_m1_init_verbs }, |
| 17444 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17445 | .hp_nid = 0x03, |
| 17446 | .dac_nids = alc662_dac_nids, |
| 17447 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17448 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17449 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17450 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17451 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17452 | .init_hook = alc663_mode3_inithook, |
| 17453 | }, |
| 17454 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17455 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 17456 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17457 | .init_verbs = { alc662_init_verbs, |
| 17458 | alc663_21jd_amic_init_verbs}, |
| 17459 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17460 | .hp_nid = 0x03, |
| 17461 | .dac_nids = alc662_dac_nids, |
| 17462 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17463 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17464 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17465 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17466 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17467 | .init_hook = alc663_mode4_inithook, |
| 17468 | }, |
| 17469 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17470 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 17471 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17472 | .init_verbs = { alc662_init_verbs, |
| 17473 | alc663_15jd_amic_init_verbs }, |
| 17474 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17475 | .hp_nid = 0x03, |
| 17476 | .dac_nids = alc662_dac_nids, |
| 17477 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17478 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17479 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17480 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17481 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17482 | .init_hook = alc663_mode5_inithook, |
| 17483 | }, |
| 17484 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17485 | .mixers = { alc663_two_hp_m2_mixer }, |
| 17486 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17487 | .init_verbs = { alc662_init_verbs, |
| 17488 | alc663_two_hp_amic_m2_init_verbs }, |
| 17489 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17490 | .hp_nid = 0x03, |
| 17491 | .dac_nids = alc662_dac_nids, |
| 17492 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17493 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17494 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17495 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17496 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17497 | .init_hook = alc663_mode6_inithook, |
| 17498 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17499 | [ALC663_ASUS_MODE7] = { |
| 17500 | .mixers = { alc663_mode7_mixer }, |
| 17501 | .cap_mixer = alc662_auto_capture_mixer, |
| 17502 | .init_verbs = { alc662_init_verbs, |
| 17503 | alc663_mode7_init_verbs }, |
| 17504 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17505 | .hp_nid = 0x03, |
| 17506 | .dac_nids = alc662_dac_nids, |
| 17507 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17508 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17509 | .channel_mode = alc662_3ST_2ch_modes, |
| 17510 | .unsol_event = alc663_mode7_unsol_event, |
| 17511 | .setup = alc663_mode7_setup, |
| 17512 | .init_hook = alc663_mode7_inithook, |
| 17513 | }, |
| 17514 | [ALC663_ASUS_MODE8] = { |
| 17515 | .mixers = { alc663_mode8_mixer }, |
| 17516 | .cap_mixer = alc662_auto_capture_mixer, |
| 17517 | .init_verbs = { alc662_init_verbs, |
| 17518 | alc663_mode8_init_verbs }, |
| 17519 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17520 | .hp_nid = 0x03, |
| 17521 | .dac_nids = alc662_dac_nids, |
| 17522 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17523 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17524 | .channel_mode = alc662_3ST_2ch_modes, |
| 17525 | .unsol_event = alc663_mode8_unsol_event, |
| 17526 | .setup = alc663_mode8_setup, |
| 17527 | .init_hook = alc663_mode8_inithook, |
| 17528 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17529 | [ALC272_DELL] = { |
| 17530 | .mixers = { alc663_m51va_mixer }, |
| 17531 | .cap_mixer = alc272_auto_capture_mixer, |
| 17532 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17533 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17534 | .dac_nids = alc662_dac_nids, |
| 17535 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17536 | .adc_nids = alc272_adc_nids, |
| 17537 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17538 | .capsrc_nids = alc272_capsrc_nids, |
| 17539 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17540 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17541 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17542 | .init_hook = alc663_m51va_inithook, |
| 17543 | }, |
| 17544 | [ALC272_DELL_ZM1] = { |
| 17545 | .mixers = { alc663_m51va_mixer }, |
| 17546 | .cap_mixer = alc662_auto_capture_mixer, |
| 17547 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17548 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17549 | .dac_nids = alc662_dac_nids, |
| 17550 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17551 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17552 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17553 | .capsrc_nids = alc662_capsrc_nids, |
| 17554 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17555 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17556 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17557 | .init_hook = alc663_m51va_inithook, |
| 17558 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17559 | [ALC272_SAMSUNG_NC10] = { |
| 17560 | .mixers = { alc272_nc10_mixer }, |
| 17561 | .init_verbs = { alc662_init_verbs, |
| 17562 | alc663_21jd_amic_init_verbs }, |
| 17563 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17564 | .dac_nids = alc272_dac_nids, |
| 17565 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17566 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17567 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17568 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17569 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17570 | .init_hook = alc663_mode4_inithook, |
| 17571 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17572 | }; |
| 17573 | |
| 17574 | |
| 17575 | /* |
| 17576 | * BIOS auto configuration |
| 17577 | */ |
| 17578 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17579 | /* convert from MIX nid to DAC */ |
| 17580 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 17581 | { |
| 17582 | if (nid == 0x0f) |
| 17583 | return 0x02; |
| 17584 | else if (nid >= 0x0c && nid <= 0x0e) |
| 17585 | return nid - 0x0c + 0x02; |
| 17586 | else |
| 17587 | return 0; |
| 17588 | } |
| 17589 | |
| 17590 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 17591 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 17592 | hda_nid_t dac) |
| 17593 | { |
| 17594 | hda_nid_t mix[4]; |
| 17595 | int i, num; |
| 17596 | |
| 17597 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 17598 | for (i = 0; i < num; i++) { |
| 17599 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 17600 | return mix[i]; |
| 17601 | } |
| 17602 | return 0; |
| 17603 | } |
| 17604 | |
| 17605 | /* look for an empty DAC slot */ |
| 17606 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 17607 | { |
| 17608 | struct alc_spec *spec = codec->spec; |
| 17609 | hda_nid_t srcs[5]; |
| 17610 | int i, j, num; |
| 17611 | |
| 17612 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 17613 | if (num < 0) |
| 17614 | return 0; |
| 17615 | for (i = 0; i < num; i++) { |
| 17616 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 17617 | if (!nid) |
| 17618 | continue; |
| 17619 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 17620 | if (spec->multiout.dac_nids[j] == nid) |
| 17621 | break; |
| 17622 | if (j >= spec->multiout.num_dacs) |
| 17623 | return nid; |
| 17624 | } |
| 17625 | return 0; |
| 17626 | } |
| 17627 | |
| 17628 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 17629 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 17630 | const struct auto_pin_cfg *cfg) |
| 17631 | { |
| 17632 | struct alc_spec *spec = codec->spec; |
| 17633 | int i; |
| 17634 | hda_nid_t dac; |
| 17635 | |
| 17636 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 17637 | for (i = 0; i < cfg->line_outs; i++) { |
| 17638 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 17639 | if (!dac) |
| 17640 | continue; |
| 17641 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 17642 | } |
| 17643 | return 0; |
| 17644 | } |
| 17645 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17646 | static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17647 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17648 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17649 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17650 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 17651 | } |
| 17652 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17653 | static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17654 | hda_nid_t nid, unsigned int chs) |
| 17655 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17656 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17657 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 17658 | } |
| 17659 | |
| 17660 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 17661 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 17662 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 17663 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 17664 | |
| 17665 | /* add playback controls from the parsed DAC table */ |
| 17666 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 17667 | const struct auto_pin_cfg *cfg) |
| 17668 | { |
| 17669 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17670 | static const char *chname[4] = { |
| 17671 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17672 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17673 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17674 | int i, err; |
| 17675 | |
| 17676 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17677 | nid = spec->multiout.dac_nids[i]; |
| 17678 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17679 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17680 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 17681 | if (!mix) |
| 17682 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17683 | if (i == 2) { |
| 17684 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17685 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17686 | if (err < 0) |
| 17687 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17688 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17689 | if (err < 0) |
| 17690 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17691 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17692 | if (err < 0) |
| 17693 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17694 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17695 | if (err < 0) |
| 17696 | return err; |
| 17697 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17698 | const char *pfx; |
| 17699 | if (cfg->line_outs == 1 && |
| 17700 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17701 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17702 | pfx = "Speaker"; |
| 17703 | else |
| 17704 | pfx = "PCM"; |
| 17705 | } else |
| 17706 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17707 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17708 | if (err < 0) |
| 17709 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17710 | if (cfg->line_outs == 1 && |
| 17711 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 17712 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17713 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17714 | if (err < 0) |
| 17715 | return err; |
| 17716 | } |
| 17717 | } |
| 17718 | return 0; |
| 17719 | } |
| 17720 | |
| 17721 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17722 | /* return DAC nid if any new DAC is assigned */ |
| 17723 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17724 | const char *pfx) |
| 17725 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17726 | struct alc_spec *spec = codec->spec; |
| 17727 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17728 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17729 | |
| 17730 | if (!pin) |
| 17731 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17732 | nid = alc662_look_for_dac(codec, pin); |
| 17733 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17734 | /* the corresponding DAC is already occupied */ |
| 17735 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 17736 | return 0; /* no way */ |
| 17737 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17738 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17739 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17740 | } |
| 17741 | |
| 17742 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 17743 | if (!mix) |
| 17744 | return 0; |
| 17745 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 17746 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17747 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17748 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 17749 | if (err < 0) |
| 17750 | return err; |
| 17751 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17752 | } |
| 17753 | |
| 17754 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17755 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 17756 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17757 | |
| 17758 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17759 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17760 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17761 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17762 | int i, num; |
| 17763 | hda_nid_t srcs[4]; |
| 17764 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17765 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17766 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17767 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 17768 | if (num <= 1) |
| 17769 | return; |
| 17770 | for (i = 0; i < num; i++) { |
| 17771 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 17772 | continue; |
| 17773 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 17774 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17775 | } |
| 17776 | } |
| 17777 | |
| 17778 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17779 | { |
| 17780 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17781 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17782 | int i; |
| 17783 | |
| 17784 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17785 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 17786 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17787 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17788 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17789 | } |
| 17790 | } |
| 17791 | |
| 17792 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17793 | { |
| 17794 | struct alc_spec *spec = codec->spec; |
| 17795 | hda_nid_t pin; |
| 17796 | |
| 17797 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17798 | if (pin) |
| 17799 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 17800 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17801 | pin = spec->autocfg.speaker_pins[0]; |
| 17802 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17803 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 17804 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17805 | } |
| 17806 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17807 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17808 | |
| 17809 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17810 | { |
| 17811 | struct alc_spec *spec = codec->spec; |
| 17812 | int i; |
| 17813 | |
| 17814 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17815 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17816 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17817 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17818 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17819 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17820 | snd_hda_codec_write(codec, nid, 0, |
| 17821 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17822 | AMP_OUT_MUTE); |
| 17823 | } |
| 17824 | } |
| 17825 | } |
| 17826 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17827 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17828 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17829 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17830 | { |
| 17831 | struct alc_spec *spec = codec->spec; |
| 17832 | int err; |
| 17833 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17834 | |
| 17835 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17836 | alc662_ignore); |
| 17837 | if (err < 0) |
| 17838 | return err; |
| 17839 | if (!spec->autocfg.line_outs) |
| 17840 | return 0; /* can't find valid BIOS pin config */ |
| 17841 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17842 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17843 | if (err < 0) |
| 17844 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17845 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17846 | if (err < 0) |
| 17847 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17848 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17849 | spec->autocfg.speaker_pins[0], |
| 17850 | "Speaker"); |
| 17851 | if (err < 0) |
| 17852 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17853 | if (err) |
| 17854 | spec->multiout.extra_out_nid[0] = err; |
| 17855 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17856 | "Headphone"); |
| 17857 | if (err < 0) |
| 17858 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17859 | if (err) |
| 17860 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17861 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17862 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17863 | return err; |
| 17864 | |
| 17865 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17866 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17867 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17868 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17869 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17870 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17871 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17872 | |
| 17873 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17874 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17875 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17876 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17877 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17878 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17879 | |
| 17880 | err = alc_auto_add_mic_boost(codec); |
| 17881 | if (err < 0) |
| 17882 | return err; |
| 17883 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17884 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17885 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17886 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17887 | } |
| 17888 | |
| 17889 | /* additional initialization for auto-configuration model */ |
| 17890 | static void alc662_auto_init(struct hda_codec *codec) |
| 17891 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17892 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17893 | alc662_auto_init_multi_out(codec); |
| 17894 | alc662_auto_init_hp_out(codec); |
| 17895 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17896 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17897 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17898 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17899 | } |
| 17900 | |
| 17901 | static int patch_alc662(struct hda_codec *codec) |
| 17902 | { |
| 17903 | struct alc_spec *spec; |
| 17904 | int err, board_config; |
| 17905 | |
| 17906 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17907 | if (!spec) |
| 17908 | return -ENOMEM; |
| 17909 | |
| 17910 | codec->spec = spec; |
| 17911 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17912 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17913 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17914 | if (alc_read_coef_idx(codec, 0)==0x8020){ |
| 17915 | kfree(codec->chip_name); |
| 17916 | codec->chip_name = kstrdup("ALC661", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 17917 | if (!codec->chip_name) { |
| 17918 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17919 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 17920 | } |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17921 | } |
| 17922 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17923 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17924 | alc662_models, |
| 17925 | alc662_cfg_tbl); |
| 17926 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17927 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17928 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17929 | board_config = ALC662_AUTO; |
| 17930 | } |
| 17931 | |
| 17932 | if (board_config == ALC662_AUTO) { |
| 17933 | /* automatic parse from the BIOS config */ |
| 17934 | err = alc662_parse_auto_config(codec); |
| 17935 | if (err < 0) { |
| 17936 | alc_free(codec); |
| 17937 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17938 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17939 | printk(KERN_INFO |
| 17940 | "hda_codec: Cannot set up configuration " |
| 17941 | "from BIOS. Using base mode...\n"); |
| 17942 | board_config = ALC662_3ST_2ch_DIG; |
| 17943 | } |
| 17944 | } |
| 17945 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17946 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17947 | if (err < 0) { |
| 17948 | alc_free(codec); |
| 17949 | return err; |
| 17950 | } |
| 17951 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17952 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17953 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17954 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17955 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17956 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17957 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17958 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17959 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17960 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17961 | if (!spec->adc_nids) { |
| 17962 | spec->adc_nids = alc662_adc_nids; |
| 17963 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17964 | } |
| 17965 | if (!spec->capsrc_nids) |
| 17966 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17967 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17968 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17969 | set_capture_mixer(codec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17970 | if (codec->vendor_id == 0x10ec0662) |
| 17971 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17972 | else |
| 17973 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17974 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17975 | spec->vmaster_nid = 0x02; |
| 17976 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17977 | codec->patch_ops = alc_patch_ops; |
| 17978 | if (board_config == ALC662_AUTO) |
| 17979 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17980 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17981 | if (!spec->loopback.amplist) |
| 17982 | spec->loopback.amplist = alc662_loopbacks; |
| 17983 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17984 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17985 | |
| 17986 | return 0; |
| 17987 | } |
| 17988 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17989 | static int patch_alc888(struct hda_codec *codec) |
| 17990 | { |
| 17991 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 17992 | kfree(codec->chip_name); |
| 17993 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 17994 | if (!codec->chip_name) { |
| 17995 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17996 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 17997 | } |
| 17998 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17999 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18000 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18001 | } |
| 18002 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18003 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18004 | * patch entries |
| 18005 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18006 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18007 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18008 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18009 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 18010 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18011 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18012 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 18013 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18014 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18015 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18016 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18017 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 18018 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 18019 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18020 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18021 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18022 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 18023 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18024 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18025 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18026 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18027 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 18028 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18029 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 18030 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18031 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18032 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18033 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 18034 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18035 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18036 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18037 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18038 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18039 | {} /* terminator */ |
| 18040 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18041 | |
| 18042 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 18043 | |
| 18044 | MODULE_LICENSE("GPL"); |
| 18045 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 18046 | |
| 18047 | static struct hda_codec_preset_list realtek_list = { |
| 18048 | .preset = snd_hda_preset_realtek, |
| 18049 | .owner = THIS_MODULE, |
| 18050 | }; |
| 18051 | |
| 18052 | static int __init patch_realtek_init(void) |
| 18053 | { |
| 18054 | return snd_hda_add_codec_preset(&realtek_list); |
| 18055 | } |
| 18056 | |
| 18057 | static void __exit patch_realtek_exit(void) |
| 18058 | { |
| 18059 | snd_hda_delete_codec_preset(&realtek_list); |
| 18060 | } |
| 18061 | |
| 18062 | module_init(patch_realtek_init) |
| 18063 | module_exit(patch_realtek_exit) |