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 | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 134 | ALC269_ASUS_EEEPC_P703, |
| 135 | ALC269_ASUS_EEEPC_P901, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 136 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 137 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 138 | ALC269_AUTO, |
| 139 | ALC269_MODEL_LAST /* last tag */ |
| 140 | }; |
| 141 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 142 | /* ALC861 models */ |
| 143 | enum { |
| 144 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 145 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | ALC861_3ST_DIG, |
| 147 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 148 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 149 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 150 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 151 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 152 | ALC861_AUTO, |
| 153 | ALC861_MODEL_LAST, |
| 154 | }; |
| 155 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 156 | /* ALC861-VD models */ |
| 157 | enum { |
| 158 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 159 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 160 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 161 | ALC861VD_3ST, |
| 162 | ALC861VD_3ST_DIG, |
| 163 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 164 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 165 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 166 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 167 | ALC861VD_AUTO, |
| 168 | ALC861VD_MODEL_LAST, |
| 169 | }; |
| 170 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 171 | /* ALC662 models */ |
| 172 | enum { |
| 173 | ALC662_3ST_2ch_DIG, |
| 174 | ALC662_3ST_6ch_DIG, |
| 175 | ALC662_3ST_6ch, |
| 176 | ALC662_5ST_DIG, |
| 177 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 178 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 179 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 180 | ALC663_ASUS_M51VA, |
| 181 | ALC663_ASUS_G71V, |
| 182 | ALC663_ASUS_H13, |
| 183 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 184 | ALC662_ECS, |
| 185 | ALC663_ASUS_MODE1, |
| 186 | ALC662_ASUS_MODE2, |
| 187 | ALC663_ASUS_MODE3, |
| 188 | ALC663_ASUS_MODE4, |
| 189 | ALC663_ASUS_MODE5, |
| 190 | ALC663_ASUS_MODE6, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 191 | ALC662_AUTO, |
| 192 | ALC662_MODEL_LAST, |
| 193 | }; |
| 194 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 195 | /* ALC882 models */ |
| 196 | enum { |
| 197 | ALC882_3ST_DIG, |
| 198 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 199 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 200 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 201 | ALC882_TARGA, |
| 202 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 203 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 204 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 205 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 206 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 207 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 208 | ALC882_MODEL_LAST, |
| 209 | }; |
| 210 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 211 | /* ALC883 models */ |
| 212 | enum { |
| 213 | ALC883_3ST_2ch_DIG, |
| 214 | ALC883_3ST_6ch_DIG, |
| 215 | ALC883_3ST_6ch, |
| 216 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 217 | ALC883_TARGA_DIG, |
| 218 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 219 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 220 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 221 | ALC888_ACER_ASPIRE_4930G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 222 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 223 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 224 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 225 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 226 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 227 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 228 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 229 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 230 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 231 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 232 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 233 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 234 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 235 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 236 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 237 | ALC888_ASUS_M90V, |
| 238 | ALC888_ASUS_EEE1601, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 239 | ALC1200_ASUS_P5Q, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 240 | ALC883_AUTO, |
| 241 | ALC883_MODEL_LAST, |
| 242 | }; |
| 243 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 244 | /* styles of capture selection */ |
| 245 | enum { |
| 246 | CAPT_MUX = 0, /* only mux based */ |
| 247 | CAPT_MIX, /* only mixer based */ |
| 248 | CAPT_1MUX_MIX, /* first mux and other mixers */ |
| 249 | }; |
| 250 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 251 | /* for GPIO Poll */ |
| 252 | #define GPIO_MASK 0x03 |
| 253 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | struct alc_spec { |
| 255 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 256 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 258 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 259 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 261 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 262 | * don't forget NULL |
| 263 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 264 | */ |
| 265 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 267 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | struct hda_pcm_stream *stream_analog_playback; |
| 269 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 270 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 271 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 273 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | struct hda_pcm_stream *stream_digital_playback; |
| 275 | struct hda_pcm_stream *stream_digital_capture; |
| 276 | |
| 277 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 278 | struct hda_multi_out multiout; /* playback set-up |
| 279 | * max_channels, dacs must be set |
| 280 | * dig_out_nid and hp_nid are optional |
| 281 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 282 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 283 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 284 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | |
| 286 | /* capture */ |
| 287 | unsigned int num_adc_nids; |
| 288 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 289 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 290 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 291 | int capture_style; /* capture style (CAPT_*) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | |
| 293 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 294 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | const struct hda_input_mux *input_mux; |
| 296 | unsigned int cur_mux[3]; |
| 297 | |
| 298 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 299 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 301 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | |
| 303 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 304 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 305 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 306 | /* dynamic controls, init_verbs and input_mux */ |
| 307 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 308 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 309 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 310 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 311 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 312 | /* hooks */ |
| 313 | void (*init_hook)(struct hda_codec *codec); |
| 314 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 315 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 316 | /* for pin sensing */ |
| 317 | unsigned int sense_updated: 1; |
| 318 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 319 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 320 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 321 | /* other flags */ |
| 322 | unsigned int no_analog :1; /* digital I/O only */ |
| 323 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 324 | /* for virtual master */ |
| 325 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 326 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 327 | struct hda_loopback_check loopback; |
| 328 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 329 | |
| 330 | /* for PLL fix */ |
| 331 | hda_nid_t pll_nid; |
| 332 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 333 | |
| 334 | #ifdef SND_HDA_NEEDS_RESUME |
| 335 | #define ALC_MAX_PINS 16 |
| 336 | unsigned int num_pins; |
| 337 | hda_nid_t pin_nids[ALC_MAX_PINS]; |
| 338 | unsigned int pin_cfgs[ALC_MAX_PINS]; |
| 339 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 340 | }; |
| 341 | |
| 342 | /* |
| 343 | * configuration template - to be copied to the spec instance |
| 344 | */ |
| 345 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 346 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 347 | * with spec |
| 348 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 349 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 350 | const struct hda_verb *init_verbs[5]; |
| 351 | unsigned int num_dacs; |
| 352 | hda_nid_t *dac_nids; |
| 353 | hda_nid_t dig_out_nid; /* optional */ |
| 354 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 355 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 356 | unsigned int num_adc_nids; |
| 357 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 358 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 359 | hda_nid_t dig_in_nid; |
| 360 | unsigned int num_channel_mode; |
| 361 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 362 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 363 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 364 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 365 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 366 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 367 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 368 | struct hda_amp_list *loopbacks; |
| 369 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 370 | }; |
| 371 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | |
| 373 | /* |
| 374 | * input MUX handling |
| 375 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 376 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 377 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | { |
| 379 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 380 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 381 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 382 | if (mux_idx >= spec->num_mux_defs) |
| 383 | mux_idx = 0; |
| 384 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | } |
| 386 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 387 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 388 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | { |
| 390 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 391 | struct alc_spec *spec = codec->spec; |
| 392 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 393 | |
| 394 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 395 | return 0; |
| 396 | } |
| 397 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 398 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 399 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | { |
| 401 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 402 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 403 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 405 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 406 | hda_nid_t nid = spec->capsrc_nids ? |
| 407 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 409 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 410 | imux = &spec->input_mux[mux_idx]; |
| 411 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 412 | if (spec->capture_style && |
| 413 | !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 414 | /* Matrix-mixer style (e.g. ALC882) */ |
| 415 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 416 | unsigned int i, idx; |
| 417 | |
| 418 | idx = ucontrol->value.enumerated.item[0]; |
| 419 | if (idx >= imux->num_items) |
| 420 | idx = imux->num_items - 1; |
| 421 | if (*cur_val == idx) |
| 422 | return 0; |
| 423 | for (i = 0; i < imux->num_items; i++) { |
| 424 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 425 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 426 | imux->items[i].index, |
| 427 | HDA_AMP_MUTE, v); |
| 428 | } |
| 429 | *cur_val = idx; |
| 430 | return 1; |
| 431 | } else { |
| 432 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 433 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 434 | &spec->cur_mux[adc_idx]); |
| 435 | } |
| 436 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 437 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | /* |
| 439 | * channel mode setting |
| 440 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 441 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 442 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | { |
| 444 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 445 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 446 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 447 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | } |
| 449 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 450 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 451 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | { |
| 453 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 454 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 455 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 456 | spec->num_channel_mode, |
| 457 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | } |
| 459 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 460 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 461 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | { |
| 463 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 464 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 465 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 466 | spec->num_channel_mode, |
| 467 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 468 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 469 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 470 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | } |
| 472 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 474 | * 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] | 475 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 476 | * being part of a format specifier. Maximum allowed length of a value is |
| 477 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 478 | * |
| 479 | * Note: some retasking pin complexes seem to ignore requests for input |
| 480 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 481 | * are requested. Therefore order this list so that this behaviour will not |
| 482 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 483 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 484 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 485 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 486 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 487 | "Mic 50pc bias", "Mic 80pc bias", |
| 488 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 489 | }; |
| 490 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 491 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 492 | }; |
| 493 | /* 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] | 494 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 495 | * addition, "input" pins may or may not process the mic bias option |
| 496 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 497 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 498 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 499 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 500 | #define ALC_PIN_DIR_IN 0x00 |
| 501 | #define ALC_PIN_DIR_OUT 0x01 |
| 502 | #define ALC_PIN_DIR_INOUT 0x02 |
| 503 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 504 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 505 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 506 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 507 | * For each direction the minimum and maximum values are given. |
| 508 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 509 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 510 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 511 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 512 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 513 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 514 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 515 | }; |
| 516 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 517 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 518 | #define alc_pin_mode_n_items(_dir) \ |
| 519 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 520 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 521 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 522 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 523 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 524 | unsigned int item_num = uinfo->value.enumerated.item; |
| 525 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 526 | |
| 527 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 528 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 529 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 530 | |
| 531 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 532 | item_num = alc_pin_mode_min(dir); |
| 533 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 534 | return 0; |
| 535 | } |
| 536 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 537 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 538 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 539 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 540 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 541 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 542 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 543 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 544 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 545 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 546 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 547 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 548 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 549 | /* Find enumerated value for current pinctl setting */ |
| 550 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 551 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 553 | *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] | 554 | return 0; |
| 555 | } |
| 556 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 557 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 558 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 559 | { |
| 560 | signed int change; |
| 561 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 562 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 563 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 564 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 565 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 566 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 567 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 568 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 569 | 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] | 570 | val = alc_pin_mode_min(dir); |
| 571 | |
| 572 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 573 | if (change) { |
| 574 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 575 | snd_hda_codec_write_cache(codec, nid, 0, |
| 576 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 577 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 578 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 579 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 580 | * for the requested pin mode. Enum values of 2 or less are |
| 581 | * input modes. |
| 582 | * |
| 583 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 584 | * reduces noise slightly (particularly on input) so we'll |
| 585 | * do it. However, having both input and output buffers |
| 586 | * enabled simultaneously doesn't seem to be problematic if |
| 587 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 588 | */ |
| 589 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 590 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 591 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 592 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 593 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 594 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 595 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 596 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 597 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 598 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 599 | } |
| 600 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 601 | return change; |
| 602 | } |
| 603 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 604 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 605 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 606 | .info = alc_pin_mode_info, \ |
| 607 | .get = alc_pin_mode_get, \ |
| 608 | .put = alc_pin_mode_put, \ |
| 609 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 610 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 611 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 612 | * together using a mask with more than one bit set. This control is |
| 613 | * currently used only by the ALC260 test model. At this stage they are not |
| 614 | * needed for any "production" models. |
| 615 | */ |
| 616 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 617 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 618 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 619 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 620 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 621 | { |
| 622 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 623 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 624 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 625 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 626 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 627 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 628 | |
| 629 | *valp = (val & mask) != 0; |
| 630 | return 0; |
| 631 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 632 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 633 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 634 | { |
| 635 | signed int change; |
| 636 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 637 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 638 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 639 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 640 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 641 | AC_VERB_GET_GPIO_DATA, |
| 642 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 643 | |
| 644 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 645 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 646 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 647 | gpio_data &= ~mask; |
| 648 | else |
| 649 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 650 | snd_hda_codec_write_cache(codec, nid, 0, |
| 651 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 652 | |
| 653 | return change; |
| 654 | } |
| 655 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 656 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 657 | .info = alc_gpio_data_info, \ |
| 658 | .get = alc_gpio_data_get, \ |
| 659 | .put = alc_gpio_data_put, \ |
| 660 | .private_value = nid | (mask<<16) } |
| 661 | #endif /* CONFIG_SND_DEBUG */ |
| 662 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 663 | /* A switch control to allow the enabling of the digital IO pins on the |
| 664 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 665 | * to provide something in the test model allowing digital outputs to be |
| 666 | * identified if present. If models are found which can utilise these |
| 667 | * outputs a more complete mixer control can be devised for those models if |
| 668 | * necessary. |
| 669 | */ |
| 670 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 671 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 672 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 673 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 674 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 675 | { |
| 676 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 677 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 678 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 679 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 680 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 681 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 682 | |
| 683 | *valp = (val & mask) != 0; |
| 684 | return 0; |
| 685 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 686 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 687 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 688 | { |
| 689 | signed int change; |
| 690 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 691 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 692 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 693 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 694 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 695 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 696 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 697 | |
| 698 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 699 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 700 | if (val==0) |
| 701 | ctrl_data &= ~mask; |
| 702 | else |
| 703 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 704 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 705 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 706 | |
| 707 | return change; |
| 708 | } |
| 709 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 710 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 711 | .info = alc_spdif_ctrl_info, \ |
| 712 | .get = alc_spdif_ctrl_get, \ |
| 713 | .put = alc_spdif_ctrl_put, \ |
| 714 | .private_value = nid | (mask<<16) } |
| 715 | #endif /* CONFIG_SND_DEBUG */ |
| 716 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 717 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 718 | * Again, this is only used in the ALC26x test models to help identify when |
| 719 | * the EAPD line must be asserted for features to work. |
| 720 | */ |
| 721 | #ifdef CONFIG_SND_DEBUG |
| 722 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 723 | |
| 724 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 725 | struct snd_ctl_elem_value *ucontrol) |
| 726 | { |
| 727 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 728 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 729 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 730 | long *valp = ucontrol->value.integer.value; |
| 731 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 732 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 733 | |
| 734 | *valp = (val & mask) != 0; |
| 735 | return 0; |
| 736 | } |
| 737 | |
| 738 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 739 | struct snd_ctl_elem_value *ucontrol) |
| 740 | { |
| 741 | int change; |
| 742 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 743 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 744 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 745 | long val = *ucontrol->value.integer.value; |
| 746 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 747 | AC_VERB_GET_EAPD_BTLENABLE, |
| 748 | 0x00); |
| 749 | |
| 750 | /* Set/unset the masked control bit(s) as needed */ |
| 751 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 752 | if (!val) |
| 753 | ctrl_data &= ~mask; |
| 754 | else |
| 755 | ctrl_data |= mask; |
| 756 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 757 | ctrl_data); |
| 758 | |
| 759 | return change; |
| 760 | } |
| 761 | |
| 762 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 763 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 764 | .info = alc_eapd_ctrl_info, \ |
| 765 | .get = alc_eapd_ctrl_get, \ |
| 766 | .put = alc_eapd_ctrl_put, \ |
| 767 | .private_value = nid | (mask<<16) } |
| 768 | #endif /* CONFIG_SND_DEBUG */ |
| 769 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 770 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 771 | */ |
| 772 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 773 | { |
| 774 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 775 | return; |
| 776 | spec->mixers[spec->num_mixers++] = mix; |
| 777 | } |
| 778 | |
| 779 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 780 | { |
| 781 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 782 | return; |
| 783 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 784 | } |
| 785 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 786 | #ifdef CONFIG_PROC_FS |
| 787 | /* |
| 788 | * hook for proc |
| 789 | */ |
| 790 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 791 | struct hda_codec *codec, hda_nid_t nid) |
| 792 | { |
| 793 | int coeff; |
| 794 | |
| 795 | if (nid != 0x20) |
| 796 | return; |
| 797 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 798 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 799 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 800 | AC_VERB_GET_COEF_INDEX, 0); |
| 801 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 802 | } |
| 803 | #else |
| 804 | #define print_realtek_coef NULL |
| 805 | #endif |
| 806 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 807 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 808 | * set up from the preset table |
| 809 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 810 | static void setup_preset(struct alc_spec *spec, |
| 811 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 812 | { |
| 813 | int i; |
| 814 | |
| 815 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 816 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 817 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 818 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 819 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 820 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 821 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 822 | spec->channel_mode = preset->channel_mode; |
| 823 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 824 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 825 | |
| 826 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 827 | |
| 828 | spec->multiout.num_dacs = preset->num_dacs; |
| 829 | spec->multiout.dac_nids = preset->dac_nids; |
| 830 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 831 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 832 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 833 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 834 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 835 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 836 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 837 | spec->input_mux = preset->input_mux; |
| 838 | |
| 839 | spec->num_adc_nids = preset->num_adc_nids; |
| 840 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 841 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 842 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 843 | |
| 844 | spec->unsol_event = preset->unsol_event; |
| 845 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 846 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 847 | spec->loopback.amplist = preset->loopbacks; |
| 848 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 849 | } |
| 850 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 851 | /* Enable GPIO mask and set output */ |
| 852 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 853 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 854 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 855 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 856 | { } |
| 857 | }; |
| 858 | |
| 859 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 860 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 861 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 862 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 863 | { } |
| 864 | }; |
| 865 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 866 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 867 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 868 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 869 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 870 | { } |
| 871 | }; |
| 872 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 873 | /* |
| 874 | * Fix hardware PLL issue |
| 875 | * On some codecs, the analog PLL gating control must be off while |
| 876 | * the default value is 1. |
| 877 | */ |
| 878 | static void alc_fix_pll(struct hda_codec *codec) |
| 879 | { |
| 880 | struct alc_spec *spec = codec->spec; |
| 881 | unsigned int val; |
| 882 | |
| 883 | if (!spec->pll_nid) |
| 884 | return; |
| 885 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 886 | spec->pll_coef_idx); |
| 887 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 888 | AC_VERB_GET_PROC_COEF, 0); |
| 889 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 890 | spec->pll_coef_idx); |
| 891 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 892 | val & ~(1 << spec->pll_coef_bit)); |
| 893 | } |
| 894 | |
| 895 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 896 | unsigned int coef_idx, unsigned int coef_bit) |
| 897 | { |
| 898 | struct alc_spec *spec = codec->spec; |
| 899 | spec->pll_nid = nid; |
| 900 | spec->pll_coef_idx = coef_idx; |
| 901 | spec->pll_coef_bit = coef_bit; |
| 902 | alc_fix_pll(codec); |
| 903 | } |
| 904 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 905 | static void alc_sku_automute(struct hda_codec *codec) |
| 906 | { |
| 907 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 908 | unsigned int present; |
| 909 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 910 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 911 | |
| 912 | /* need to execute and sync at first */ |
| 913 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 914 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 915 | AC_VERB_GET_PIN_SENSE, 0); |
| 916 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 917 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 918 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 919 | } |
| 920 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 921 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 922 | static void alc_mic_automute(struct hda_codec *codec) |
| 923 | { |
| 924 | struct alc_spec *spec = codec->spec; |
| 925 | unsigned int present; |
| 926 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 927 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 928 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 929 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 930 | |
| 931 | capsrc_idx_mic = mic_nid - 0x18; |
| 932 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 933 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 934 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 935 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 936 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 937 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 938 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 939 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 940 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 941 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 942 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 943 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 944 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 945 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 946 | /* unsolicited event for HP jack sensing */ |
| 947 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 948 | { |
| 949 | if (codec->vendor_id == 0x10ec0880) |
| 950 | res >>= 28; |
| 951 | else |
| 952 | res >>= 26; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 953 | if (res == ALC880_HP_EVENT) |
| 954 | alc_sku_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 955 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 956 | if (res == ALC880_MIC_EVENT) |
| 957 | alc_mic_automute(codec); |
| 958 | } |
| 959 | |
| 960 | static void alc_inithook(struct hda_codec *codec) |
| 961 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 962 | alc_sku_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 963 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 964 | } |
| 965 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 966 | /* additional initialization for ALC888 variants */ |
| 967 | static void alc888_coef_init(struct hda_codec *codec) |
| 968 | { |
| 969 | unsigned int tmp; |
| 970 | |
| 971 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 972 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 973 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 974 | if ((tmp & 0xf0) == 2) |
| 975 | /* alc888S-VC */ |
| 976 | snd_hda_codec_read(codec, 0x20, 0, |
| 977 | AC_VERB_SET_PROC_COEF, 0x830); |
| 978 | else |
| 979 | /* alc888-VB */ |
| 980 | snd_hda_codec_read(codec, 0x20, 0, |
| 981 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 982 | } |
| 983 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 984 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 985 | * 31 ~ 16 : Manufacture ID |
| 986 | * 15 ~ 8 : SKU ID |
| 987 | * 7 ~ 0 : Assembly ID |
| 988 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 989 | */ |
| 990 | static void alc_subsystem_id(struct hda_codec *codec, |
| 991 | unsigned int porta, unsigned int porte, |
| 992 | unsigned int portd) |
| 993 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 994 | unsigned int ass, tmp, i; |
| 995 | unsigned nid; |
| 996 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 997 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 998 | ass = codec->subsystem_id & 0xffff; |
| 999 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1000 | goto do_sku; |
| 1001 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1002 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1003 | * 31~30 : port conetcivity |
| 1004 | * 29~21 : reserve |
| 1005 | * 20 : PCBEEP input |
| 1006 | * 19~16 : Check sum (15:1) |
| 1007 | * 15~1 : Custom |
| 1008 | * 0 : override |
| 1009 | */ |
| 1010 | nid = 0x1d; |
| 1011 | if (codec->vendor_id == 0x10ec0260) |
| 1012 | nid = 0x17; |
| 1013 | ass = snd_hda_codec_read(codec, nid, 0, |
| 1014 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 1015 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1016 | return; |
| 1017 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1018 | return; |
| 1019 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1020 | /* check sum */ |
| 1021 | tmp = 0; |
| 1022 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1023 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1024 | tmp++; |
| 1025 | } |
| 1026 | if (((ass >> 16) & 0xf) != tmp) |
| 1027 | return; |
| 1028 | do_sku: |
| 1029 | /* |
| 1030 | * 0 : override |
| 1031 | * 1 : Swap Jack |
| 1032 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1033 | * 3~5 : External Amplifier control |
| 1034 | * 7~6 : Reserved |
| 1035 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1036 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1037 | switch (tmp) { |
| 1038 | case 1: |
| 1039 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1040 | break; |
| 1041 | case 3: |
| 1042 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1043 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1044 | case 7: |
| 1045 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1046 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1047 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1048 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1049 | case 0x10ec0260: |
| 1050 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1051 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1052 | snd_hda_codec_write(codec, 0x10, 0, |
| 1053 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1054 | break; |
| 1055 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1056 | case 0x10ec0267: |
| 1057 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1058 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1059 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1060 | case 0x10ec0660: |
| 1061 | case 0x10ec0662: |
| 1062 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1063 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1064 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1065 | snd_hda_codec_write(codec, 0x14, 0, |
| 1066 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1067 | snd_hda_codec_write(codec, 0x15, 0, |
| 1068 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1069 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1070 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1071 | switch (codec->vendor_id) { |
| 1072 | case 0x10ec0260: |
| 1073 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1074 | AC_VERB_SET_COEF_INDEX, 7); |
| 1075 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1076 | AC_VERB_GET_PROC_COEF, 0); |
| 1077 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1078 | AC_VERB_SET_COEF_INDEX, 7); |
| 1079 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1080 | AC_VERB_SET_PROC_COEF, |
| 1081 | tmp | 0x2010); |
| 1082 | break; |
| 1083 | case 0x10ec0262: |
| 1084 | case 0x10ec0880: |
| 1085 | case 0x10ec0882: |
| 1086 | case 0x10ec0883: |
| 1087 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1088 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1089 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1090 | snd_hda_codec_write(codec, 0x20, 0, |
| 1091 | AC_VERB_SET_COEF_INDEX, 7); |
| 1092 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1093 | AC_VERB_GET_PROC_COEF, 0); |
| 1094 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1095 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1096 | snd_hda_codec_write(codec, 0x20, 0, |
| 1097 | AC_VERB_SET_PROC_COEF, |
| 1098 | tmp | 0x2010); |
| 1099 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1100 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 1101 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1102 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1103 | case 0x10ec0267: |
| 1104 | case 0x10ec0268: |
| 1105 | snd_hda_codec_write(codec, 0x20, 0, |
| 1106 | AC_VERB_SET_COEF_INDEX, 7); |
| 1107 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1108 | AC_VERB_GET_PROC_COEF, 0); |
| 1109 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1110 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1111 | snd_hda_codec_write(codec, 0x20, 0, |
| 1112 | AC_VERB_SET_PROC_COEF, |
| 1113 | tmp | 0x3000); |
| 1114 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1115 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1116 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1117 | break; |
| 1118 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1119 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1120 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1121 | * when the external headphone out jack is plugged" |
| 1122 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1123 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1124 | return; |
| 1125 | /* |
| 1126 | * 10~8 : Jack location |
| 1127 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1128 | * 14~13: Resvered |
| 1129 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1130 | * when the external headphone out jack is plugged" |
| 1131 | */ |
| 1132 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1133 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1134 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1135 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1136 | else |
| 1137 | return; |
| 1138 | } |
| 1139 | |
| 1140 | if (!spec->autocfg.hp_pins[0]) { |
| 1141 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1142 | if (tmp == 0) |
| 1143 | spec->autocfg.hp_pins[0] = porta; |
| 1144 | else if (tmp == 1) |
| 1145 | spec->autocfg.hp_pins[0] = porte; |
| 1146 | else if (tmp == 2) |
| 1147 | spec->autocfg.hp_pins[0] = portd; |
| 1148 | else |
| 1149 | return; |
| 1150 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1151 | if (spec->autocfg.hp_pins[0]) |
| 1152 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1153 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1154 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1155 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1156 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1157 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
| 1158 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) |
| 1159 | snd_hda_codec_write(codec, |
| 1160 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, |
| 1161 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1162 | AC_USRSP_EN | ALC880_MIC_EVENT); |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1163 | #endif /* disabled */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1164 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1165 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1166 | } |
| 1167 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1168 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1169 | * Fix-up pin default configurations |
| 1170 | */ |
| 1171 | |
| 1172 | struct alc_pincfg { |
| 1173 | hda_nid_t nid; |
| 1174 | u32 val; |
| 1175 | }; |
| 1176 | |
| 1177 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1178 | const struct snd_pci_quirk *quirk, |
| 1179 | const struct alc_pincfg **pinfix) |
| 1180 | { |
| 1181 | const struct alc_pincfg *cfg; |
| 1182 | |
| 1183 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1184 | if (!quirk) |
| 1185 | return; |
| 1186 | |
| 1187 | cfg = pinfix[quirk->value]; |
| 1188 | for (; cfg->nid; cfg++) { |
| 1189 | int i; |
| 1190 | u32 val = cfg->val; |
| 1191 | for (i = 0; i < 4; i++) { |
| 1192 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1193 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1194 | val & 0xff); |
| 1195 | val >>= 8; |
| 1196 | } |
| 1197 | } |
| 1198 | } |
| 1199 | |
| 1200 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1201 | * ALC888 |
| 1202 | */ |
| 1203 | |
| 1204 | /* |
| 1205 | * 2ch mode |
| 1206 | */ |
| 1207 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1208 | /* Mic-in jack as mic in */ |
| 1209 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1210 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1211 | /* Line-in jack as Line in */ |
| 1212 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1213 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1214 | /* Line-Out as Front */ |
| 1215 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1216 | { } /* end */ |
| 1217 | }; |
| 1218 | |
| 1219 | /* |
| 1220 | * 4ch mode |
| 1221 | */ |
| 1222 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1223 | /* Mic-in jack as mic in */ |
| 1224 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1225 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1226 | /* Line-in jack as Surround */ |
| 1227 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1228 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1229 | /* Line-Out as Front */ |
| 1230 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1231 | { } /* end */ |
| 1232 | }; |
| 1233 | |
| 1234 | /* |
| 1235 | * 6ch mode |
| 1236 | */ |
| 1237 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1238 | /* Mic-in jack as CLFE */ |
| 1239 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1240 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1241 | /* Line-in jack as Surround */ |
| 1242 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1243 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1244 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1245 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1246 | { } /* end */ |
| 1247 | }; |
| 1248 | |
| 1249 | /* |
| 1250 | * 8ch mode |
| 1251 | */ |
| 1252 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1253 | /* Mic-in jack as CLFE */ |
| 1254 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1255 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1256 | /* Line-in jack as Surround */ |
| 1257 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1258 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1259 | /* Line-Out as Side */ |
| 1260 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1261 | { } /* end */ |
| 1262 | }; |
| 1263 | |
| 1264 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1265 | { 2, alc888_4ST_ch2_intel_init }, |
| 1266 | { 4, alc888_4ST_ch4_intel_init }, |
| 1267 | { 6, alc888_4ST_ch6_intel_init }, |
| 1268 | { 8, alc888_4ST_ch8_intel_init }, |
| 1269 | }; |
| 1270 | |
| 1271 | /* |
| 1272 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1273 | */ |
| 1274 | |
| 1275 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1276 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1277 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1278 | /* Connect Internal HP to Front */ |
| 1279 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1280 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1281 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1282 | /* Connect Bass HP to Front */ |
| 1283 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1284 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1285 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1286 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1287 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1288 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1289 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1290 | /* Connect Mic jack to CLFE */ |
| 1291 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1292 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1293 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1294 | /* Connect Line-in jack to Surround */ |
| 1295 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1296 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1297 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1298 | /* Connect HP out jack to Front */ |
| 1299 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1300 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1301 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1302 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1303 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1304 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1305 | {} |
| 1306 | }; |
| 1307 | |
| 1308 | static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec) |
| 1309 | { |
| 1310 | unsigned int present; |
| 1311 | unsigned int bits; |
| 1312 | /* Line out presence */ |
| 1313 | present = snd_hda_codec_read(codec, 0x17, 0, |
| 1314 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1315 | /* HP out presence */ |
| 1316 | present = present || snd_hda_codec_read(codec, 0x1b, 0, |
| 1317 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 1318 | bits = present ? HDA_AMP_MUTE : 0; |
| 1319 | /* Toggle internal speakers muting */ |
| 1320 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1321 | HDA_AMP_MUTE, bits); |
| 1322 | /* Toggle internal bass muting */ |
| 1323 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1324 | HDA_AMP_MUTE, bits); |
| 1325 | } |
| 1326 | |
| 1327 | static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec, |
| 1328 | unsigned int res) |
| 1329 | { |
| 1330 | if (res >> 26 == ALC880_HP_EVENT) |
| 1331 | alc888_fujitsu_xa3530_automute(codec); |
| 1332 | } |
| 1333 | |
| 1334 | |
| 1335 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1336 | * ALC888 Acer Aspire 4930G model |
| 1337 | */ |
| 1338 | |
| 1339 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1340 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1341 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1342 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1343 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1344 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1345 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1346 | /* Connect Internal HP to front */ |
| 1347 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1348 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1349 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1350 | /* Connect HP out to front */ |
| 1351 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1352 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1353 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1354 | { } |
| 1355 | }; |
| 1356 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1357 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1358 | /* Front mic only available on one ADC */ |
| 1359 | { |
| 1360 | .num_items = 4, |
| 1361 | .items = { |
| 1362 | { "Mic", 0x0 }, |
| 1363 | { "Line", 0x2 }, |
| 1364 | { "CD", 0x4 }, |
| 1365 | { "Front Mic", 0xb }, |
| 1366 | }, |
| 1367 | }, |
| 1368 | { |
| 1369 | .num_items = 3, |
| 1370 | .items = { |
| 1371 | { "Mic", 0x0 }, |
| 1372 | { "Line", 0x2 }, |
| 1373 | { "CD", 0x4 }, |
| 1374 | }, |
| 1375 | } |
| 1376 | }; |
| 1377 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1378 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1379 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1380 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1381 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1382 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1383 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1384 | HDA_OUTPUT), |
| 1385 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1386 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1387 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1388 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1389 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1390 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1391 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1392 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1393 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1394 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1395 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1396 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1397 | { } /* end */ |
| 1398 | }; |
| 1399 | |
| 1400 | static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec) |
| 1401 | { |
| 1402 | unsigned int present; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1403 | unsigned int bits; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1404 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 1405 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1406 | bits = present ? HDA_AMP_MUTE : 0; |
| 1407 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 1408 | HDA_AMP_MUTE, bits); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1409 | } |
| 1410 | |
| 1411 | static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, |
| 1412 | unsigned int res) |
| 1413 | { |
| 1414 | if (res >> 26 == ALC880_HP_EVENT) |
| 1415 | alc888_acer_aspire_4930g_automute(codec); |
| 1416 | } |
| 1417 | |
| 1418 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1419 | * ALC880 3-stack model |
| 1420 | * |
| 1421 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1422 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1423 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1424 | */ |
| 1425 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1426 | static hda_nid_t alc880_dac_nids[4] = { |
| 1427 | /* front, rear, clfe, rear_surr */ |
| 1428 | 0x02, 0x05, 0x04, 0x03 |
| 1429 | }; |
| 1430 | |
| 1431 | static hda_nid_t alc880_adc_nids[3] = { |
| 1432 | /* ADC0-2 */ |
| 1433 | 0x07, 0x08, 0x09, |
| 1434 | }; |
| 1435 | |
| 1436 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1437 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1438 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1439 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1440 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1441 | /* ADC1-2 */ |
| 1442 | 0x08, 0x09, |
| 1443 | }; |
| 1444 | |
| 1445 | #define ALC880_DIGOUT_NID 0x06 |
| 1446 | #define ALC880_DIGIN_NID 0x0a |
| 1447 | |
| 1448 | static struct hda_input_mux alc880_capture_source = { |
| 1449 | .num_items = 4, |
| 1450 | .items = { |
| 1451 | { "Mic", 0x0 }, |
| 1452 | { "Front Mic", 0x3 }, |
| 1453 | { "Line", 0x2 }, |
| 1454 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1455 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1456 | }; |
| 1457 | |
| 1458 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1459 | /* 2ch mode */ |
| 1460 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1461 | /* set line-in to input, mute it */ |
| 1462 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1463 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1464 | /* set mic-in to input vref 80%, mute it */ |
| 1465 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1466 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1467 | { } /* end */ |
| 1468 | }; |
| 1469 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1470 | /* 6ch mode */ |
| 1471 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1472 | /* set line-in to output, unmute it */ |
| 1473 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1474 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1475 | /* set mic-in to output, unmute it */ |
| 1476 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1477 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1478 | { } /* end */ |
| 1479 | }; |
| 1480 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1481 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1482 | { 2, alc880_threestack_ch2_init }, |
| 1483 | { 6, alc880_threestack_ch6_init }, |
| 1484 | }; |
| 1485 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1486 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1487 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1488 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1489 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1490 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1491 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1492 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1493 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1494 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1495 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1496 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1497 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1498 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1499 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1500 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1501 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1502 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1503 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1504 | { |
| 1505 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1506 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1507 | .info = alc_ch_mode_info, |
| 1508 | .get = alc_ch_mode_get, |
| 1509 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1510 | }, |
| 1511 | { } /* end */ |
| 1512 | }; |
| 1513 | |
| 1514 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1515 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1516 | struct snd_ctl_elem_info *uinfo) |
| 1517 | { |
| 1518 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1519 | struct alc_spec *spec = codec->spec; |
| 1520 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1521 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1522 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1523 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1524 | HDA_INPUT); |
| 1525 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1526 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1527 | return err; |
| 1528 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1529 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1530 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1531 | unsigned int size, unsigned int __user *tlv) |
| 1532 | { |
| 1533 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1534 | struct alc_spec *spec = codec->spec; |
| 1535 | int err; |
| 1536 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1537 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1538 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1539 | HDA_INPUT); |
| 1540 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1541 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1542 | return err; |
| 1543 | } |
| 1544 | |
| 1545 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1546 | struct snd_ctl_elem_value *ucontrol); |
| 1547 | |
| 1548 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1549 | struct snd_ctl_elem_value *ucontrol, |
| 1550 | getput_call_t func) |
| 1551 | { |
| 1552 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1553 | struct alc_spec *spec = codec->spec; |
| 1554 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1555 | int err; |
| 1556 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1557 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1558 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1559 | 3, 0, HDA_INPUT); |
| 1560 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1561 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1562 | return err; |
| 1563 | } |
| 1564 | |
| 1565 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1566 | struct snd_ctl_elem_value *ucontrol) |
| 1567 | { |
| 1568 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1569 | snd_hda_mixer_amp_volume_get); |
| 1570 | } |
| 1571 | |
| 1572 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1573 | struct snd_ctl_elem_value *ucontrol) |
| 1574 | { |
| 1575 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1576 | snd_hda_mixer_amp_volume_put); |
| 1577 | } |
| 1578 | |
| 1579 | /* capture mixer elements */ |
| 1580 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1581 | |
| 1582 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1583 | struct snd_ctl_elem_value *ucontrol) |
| 1584 | { |
| 1585 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1586 | snd_hda_mixer_amp_switch_get); |
| 1587 | } |
| 1588 | |
| 1589 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1590 | struct snd_ctl_elem_value *ucontrol) |
| 1591 | { |
| 1592 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1593 | snd_hda_mixer_amp_switch_put); |
| 1594 | } |
| 1595 | |
| 1596 | #define DEFINE_CAPMIX(num) \ |
| 1597 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1598 | { \ |
| 1599 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1600 | .name = "Capture Switch", \ |
| 1601 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1602 | .count = num, \ |
| 1603 | .info = alc_cap_sw_info, \ |
| 1604 | .get = alc_cap_sw_get, \ |
| 1605 | .put = alc_cap_sw_put, \ |
| 1606 | }, \ |
| 1607 | { \ |
| 1608 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1609 | .name = "Capture Volume", \ |
| 1610 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1611 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1612 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1613 | .count = num, \ |
| 1614 | .info = alc_cap_vol_info, \ |
| 1615 | .get = alc_cap_vol_get, \ |
| 1616 | .put = alc_cap_vol_put, \ |
| 1617 | .tlv = { .c = alc_cap_vol_tlv }, \ |
| 1618 | }, \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1619 | { \ |
| 1620 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1621 | /* .name = "Capture Source", */ \ |
| 1622 | .name = "Input Source", \ |
| 1623 | .count = num, \ |
| 1624 | .info = alc_mux_enum_info, \ |
| 1625 | .get = alc_mux_enum_get, \ |
| 1626 | .put = alc_mux_enum_put, \ |
| 1627 | }, \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1628 | { } /* end */ \ |
| 1629 | } |
| 1630 | |
| 1631 | /* up to three ADCs */ |
| 1632 | DEFINE_CAPMIX(1); |
| 1633 | DEFINE_CAPMIX(2); |
| 1634 | DEFINE_CAPMIX(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1635 | |
| 1636 | |
| 1637 | /* |
| 1638 | * ALC880 5-stack model |
| 1639 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1640 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1641 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1642 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1643 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1644 | */ |
| 1645 | |
| 1646 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1647 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1648 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1649 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1650 | { } /* end */ |
| 1651 | }; |
| 1652 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1653 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1654 | /* 6ch mode */ |
| 1655 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1656 | /* set line-in to input, mute it */ |
| 1657 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1658 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1659 | { } /* end */ |
| 1660 | }; |
| 1661 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1662 | /* 8ch mode */ |
| 1663 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1664 | /* set line-in to output, unmute it */ |
| 1665 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1666 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1667 | { } /* end */ |
| 1668 | }; |
| 1669 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1670 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1671 | { 6, alc880_fivestack_ch6_init }, |
| 1672 | { 8, alc880_fivestack_ch8_init }, |
| 1673 | }; |
| 1674 | |
| 1675 | |
| 1676 | /* |
| 1677 | * ALC880 6-stack model |
| 1678 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1679 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1680 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1681 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1682 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1683 | */ |
| 1684 | |
| 1685 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1686 | /* front, rear, clfe, rear_surr */ |
| 1687 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1688 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1689 | |
| 1690 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1691 | .num_items = 4, |
| 1692 | .items = { |
| 1693 | { "Mic", 0x0 }, |
| 1694 | { "Front Mic", 0x1 }, |
| 1695 | { "Line", 0x2 }, |
| 1696 | { "CD", 0x4 }, |
| 1697 | }, |
| 1698 | }; |
| 1699 | |
| 1700 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1701 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1702 | { 8, NULL }, |
| 1703 | }; |
| 1704 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1705 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1706 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1707 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1708 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1709 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1710 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1711 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1712 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1713 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1714 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1715 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1716 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1717 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1718 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1719 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1720 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1721 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1722 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1723 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1724 | { |
| 1725 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1726 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1727 | .info = alc_ch_mode_info, |
| 1728 | .get = alc_ch_mode_get, |
| 1729 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1730 | }, |
| 1731 | { } /* end */ |
| 1732 | }; |
| 1733 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1734 | |
| 1735 | /* |
| 1736 | * ALC880 W810 model |
| 1737 | * |
| 1738 | * W810 has rear IO for: |
| 1739 | * Front (DAC 02) |
| 1740 | * Surround (DAC 03) |
| 1741 | * Center/LFE (DAC 04) |
| 1742 | * Digital out (06) |
| 1743 | * |
| 1744 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1745 | * 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] | 1746 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1747 | * There is a variable resistor to control the speaker or headphone |
| 1748 | * volume. This is a hardware-only device without a software API. |
| 1749 | * |
| 1750 | * Plugging headphones in will disable the internal speakers. This is |
| 1751 | * implemented in hardware, not via the driver using jack sense. In |
| 1752 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1753 | * disable both the speakers and headphones. |
| 1754 | * |
| 1755 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1756 | * These may not do anything useful with this driver yet, because I |
| 1757 | * haven't setup any initialization verbs for these yet... |
| 1758 | */ |
| 1759 | |
| 1760 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1761 | /* front, rear/surround, clfe */ |
| 1762 | 0x02, 0x03, 0x04 |
| 1763 | }; |
| 1764 | |
| 1765 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1766 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1767 | { 6, NULL } |
| 1768 | }; |
| 1769 | |
| 1770 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1771 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1772 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1773 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1774 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1775 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1776 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1777 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1778 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1779 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1780 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1781 | { } /* end */ |
| 1782 | }; |
| 1783 | |
| 1784 | |
| 1785 | /* |
| 1786 | * Z710V model |
| 1787 | * |
| 1788 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1789 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1790 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1791 | */ |
| 1792 | |
| 1793 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1794 | 0x02 |
| 1795 | }; |
| 1796 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1797 | |
| 1798 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1799 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1800 | { 2, NULL } |
| 1801 | }; |
| 1802 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1803 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1804 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1805 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1806 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1807 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1808 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1809 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1810 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1811 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1812 | { } /* end */ |
| 1813 | }; |
| 1814 | |
| 1815 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1816 | /* |
| 1817 | * ALC880 F1734 model |
| 1818 | * |
| 1819 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1820 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1821 | */ |
| 1822 | |
| 1823 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1824 | 0x03 |
| 1825 | }; |
| 1826 | #define ALC880_F1734_HP_DAC 0x02 |
| 1827 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1828 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1829 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1830 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1831 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1832 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1833 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1834 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1836 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1837 | { } /* end */ |
| 1838 | }; |
| 1839 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1840 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1841 | .num_items = 2, |
| 1842 | .items = { |
| 1843 | { "Mic", 0x1 }, |
| 1844 | { "CD", 0x4 }, |
| 1845 | }, |
| 1846 | }; |
| 1847 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1848 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1849 | /* |
| 1850 | * ALC880 ASUS model |
| 1851 | * |
| 1852 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1853 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1854 | * Mic = 0x18, Line = 0x1a |
| 1855 | */ |
| 1856 | |
| 1857 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1858 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1859 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1860 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1861 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1862 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1863 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1864 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1865 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1866 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1867 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1868 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1869 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1870 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1871 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1872 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1873 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1875 | { |
| 1876 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1877 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1878 | .info = alc_ch_mode_info, |
| 1879 | .get = alc_ch_mode_get, |
| 1880 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1881 | }, |
| 1882 | { } /* end */ |
| 1883 | }; |
| 1884 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1885 | /* |
| 1886 | * ALC880 ASUS W1V model |
| 1887 | * |
| 1888 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1889 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1890 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1891 | */ |
| 1892 | |
| 1893 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1894 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1895 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1896 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1897 | { } /* end */ |
| 1898 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1899 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1900 | /* TCL S700 */ |
| 1901 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1902 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1903 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1904 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1905 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1906 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1907 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1908 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1909 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1910 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1911 | { } /* end */ |
| 1912 | }; |
| 1913 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1914 | /* Uniwill */ |
| 1915 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1916 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1917 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1918 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1919 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1920 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1921 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1922 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1923 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1924 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1925 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1926 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1927 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1928 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1929 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1930 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1931 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1932 | { |
| 1933 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1934 | .name = "Channel Mode", |
| 1935 | .info = alc_ch_mode_info, |
| 1936 | .get = alc_ch_mode_get, |
| 1937 | .put = alc_ch_mode_put, |
| 1938 | }, |
| 1939 | { } /* end */ |
| 1940 | }; |
| 1941 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1942 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1943 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1944 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1945 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1946 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1948 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1949 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1950 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1951 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1952 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1953 | { } /* end */ |
| 1954 | }; |
| 1955 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1956 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1957 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1958 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1959 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1960 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1961 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1962 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1963 | { } /* end */ |
| 1964 | }; |
| 1965 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1966 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1967 | * virtual master controls |
| 1968 | */ |
| 1969 | |
| 1970 | /* |
| 1971 | * slave controls for virtual master |
| 1972 | */ |
| 1973 | static const char *alc_slave_vols[] = { |
| 1974 | "Front Playback Volume", |
| 1975 | "Surround Playback Volume", |
| 1976 | "Center Playback Volume", |
| 1977 | "LFE Playback Volume", |
| 1978 | "Side Playback Volume", |
| 1979 | "Headphone Playback Volume", |
| 1980 | "Speaker Playback Volume", |
| 1981 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1982 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 1983 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1984 | NULL, |
| 1985 | }; |
| 1986 | |
| 1987 | static const char *alc_slave_sws[] = { |
| 1988 | "Front Playback Switch", |
| 1989 | "Surround Playback Switch", |
| 1990 | "Center Playback Switch", |
| 1991 | "LFE Playback Switch", |
| 1992 | "Side Playback Switch", |
| 1993 | "Headphone Playback Switch", |
| 1994 | "Speaker Playback Switch", |
| 1995 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1996 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1997 | NULL, |
| 1998 | }; |
| 1999 | |
| 2000 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2001 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2002 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2003 | |
| 2004 | static void alc_free_kctls(struct hda_codec *codec); |
| 2005 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2006 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2007 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2008 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2009 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2010 | { } /* end */ |
| 2011 | }; |
| 2012 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2013 | static int alc_build_controls(struct hda_codec *codec) |
| 2014 | { |
| 2015 | struct alc_spec *spec = codec->spec; |
| 2016 | int err; |
| 2017 | int i; |
| 2018 | |
| 2019 | for (i = 0; i < spec->num_mixers; i++) { |
| 2020 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2021 | if (err < 0) |
| 2022 | return err; |
| 2023 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2024 | if (spec->cap_mixer) { |
| 2025 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2026 | if (err < 0) |
| 2027 | return err; |
| 2028 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2029 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2030 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2031 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2032 | if (err < 0) |
| 2033 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2034 | if (!spec->no_analog) { |
| 2035 | err = snd_hda_create_spdif_share_sw(codec, |
| 2036 | &spec->multiout); |
| 2037 | if (err < 0) |
| 2038 | return err; |
| 2039 | spec->multiout.share_spdif = 1; |
| 2040 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2041 | } |
| 2042 | if (spec->dig_in_nid) { |
| 2043 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2044 | if (err < 0) |
| 2045 | return err; |
| 2046 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2047 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2048 | /* create beep controls if needed */ |
| 2049 | if (spec->beep_amp) { |
| 2050 | struct snd_kcontrol_new *knew; |
| 2051 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2052 | struct snd_kcontrol *kctl; |
| 2053 | kctl = snd_ctl_new1(knew, codec); |
| 2054 | if (!kctl) |
| 2055 | return -ENOMEM; |
| 2056 | kctl->private_value = spec->beep_amp; |
| 2057 | err = snd_hda_ctl_add(codec, kctl); |
| 2058 | if (err < 0) |
| 2059 | return err; |
| 2060 | } |
| 2061 | } |
| 2062 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2063 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2064 | if (!spec->no_analog && |
| 2065 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2066 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2067 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2068 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2069 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2070 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2071 | if (err < 0) |
| 2072 | return err; |
| 2073 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2074 | if (!spec->no_analog && |
| 2075 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2076 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2077 | NULL, alc_slave_sws); |
| 2078 | if (err < 0) |
| 2079 | return err; |
| 2080 | } |
| 2081 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2082 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2083 | return 0; |
| 2084 | } |
| 2085 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2086 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2087 | /* |
| 2088 | * initialize the codec volumes, etc |
| 2089 | */ |
| 2090 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2091 | /* |
| 2092 | * generic initialization of ADC, input mixers and output mixers |
| 2093 | */ |
| 2094 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2095 | /* |
| 2096 | * Unmute ADC0-2 and set the default input to mic-in |
| 2097 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2098 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2099 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2100 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2101 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2102 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2103 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2104 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2105 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2106 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2107 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2108 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2109 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2110 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2111 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2118 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2119 | /* |
| 2120 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2121 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2122 | /* set vol=0 to output mixers */ |
| 2123 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2124 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2125 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2126 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2127 | /* set up input amps for analog loopback */ |
| 2128 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2130 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2131 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2132 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2133 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2134 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2135 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2136 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2137 | |
| 2138 | { } |
| 2139 | }; |
| 2140 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2141 | /* |
| 2142 | * 3-stack pin configuration: |
| 2143 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2144 | */ |
| 2145 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2146 | /* |
| 2147 | * preset connection lists of input pins |
| 2148 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2149 | */ |
| 2150 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2151 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2152 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2153 | |
| 2154 | /* |
| 2155 | * Set pin mode and muting |
| 2156 | */ |
| 2157 | /* set front pin widgets 0x14 for output */ |
| 2158 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2159 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2160 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2161 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2162 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2163 | /* Mic2 (as headphone out) for HP output */ |
| 2164 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2165 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2166 | /* Line In pin widget for input */ |
| 2167 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2168 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2169 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2170 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2171 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2172 | /* CD pin widget for input */ |
| 2173 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2174 | |
| 2175 | { } |
| 2176 | }; |
| 2177 | |
| 2178 | /* |
| 2179 | * 5-stack pin configuration: |
| 2180 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2181 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2182 | */ |
| 2183 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2184 | /* |
| 2185 | * preset connection lists of input pins |
| 2186 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2187 | */ |
| 2188 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2189 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2190 | |
| 2191 | /* |
| 2192 | * Set pin mode and muting |
| 2193 | */ |
| 2194 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2195 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2196 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2197 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2198 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2199 | /* unmute pins for output (no gain on this amp) */ |
| 2200 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2201 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2202 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2203 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2204 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2205 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2206 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2207 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2208 | /* Mic2 (as headphone out) for HP output */ |
| 2209 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2210 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2211 | /* Line In pin widget for input */ |
| 2212 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2213 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2214 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2215 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2216 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2217 | /* CD pin widget for input */ |
| 2218 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2219 | |
| 2220 | { } |
| 2221 | }; |
| 2222 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2223 | /* |
| 2224 | * W810 pin configuration: |
| 2225 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2226 | */ |
| 2227 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2228 | /* hphone/speaker input selector: front DAC */ |
| 2229 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2230 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2231 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2232 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2233 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2234 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2235 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2236 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2237 | |
| 2238 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2239 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2240 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2241 | { } |
| 2242 | }; |
| 2243 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2244 | /* |
| 2245 | * Z71V pin configuration: |
| 2246 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2247 | */ |
| 2248 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2249 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2250 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2251 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2252 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2253 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2254 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2255 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2256 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2257 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2258 | |
| 2259 | { } |
| 2260 | }; |
| 2261 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2262 | /* |
| 2263 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2264 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2265 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2266 | */ |
| 2267 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2268 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2269 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2270 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2271 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2272 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2273 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2274 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2275 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2276 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2277 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2278 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2279 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2280 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2281 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2282 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2283 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2284 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2285 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2286 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2287 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2288 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2289 | { } |
| 2290 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2291 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2292 | /* |
| 2293 | * Uniwill pin configuration: |
| 2294 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2295 | * line = 0x1a |
| 2296 | */ |
| 2297 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2298 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2299 | |
| 2300 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2301 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2302 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2303 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2304 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2305 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2306 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2307 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2310 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2311 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2312 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2313 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2314 | |
| 2315 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2316 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2317 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2318 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2319 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2320 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2321 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2322 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2323 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2324 | |
| 2325 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2326 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2327 | |
| 2328 | { } |
| 2329 | }; |
| 2330 | |
| 2331 | /* |
| 2332 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2333 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2334 | */ |
| 2335 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2336 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2337 | |
| 2338 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2339 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2340 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2341 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2342 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2343 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2344 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2345 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2346 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2347 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2349 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2350 | |
| 2351 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2352 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2353 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2354 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2355 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2356 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2357 | |
| 2358 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2359 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2360 | |
| 2361 | { } |
| 2362 | }; |
| 2363 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2364 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2365 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2366 | { } |
| 2367 | }; |
| 2368 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2369 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2370 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2371 | { |
| 2372 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2373 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2374 | |
| 2375 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2376 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2377 | bits = present ? HDA_AMP_MUTE : 0; |
| 2378 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 2379 | HDA_AMP_MUTE, bits); |
| 2380 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 2381 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2382 | } |
| 2383 | |
| 2384 | /* auto-toggle front mic */ |
| 2385 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2386 | { |
| 2387 | unsigned int present; |
| 2388 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2389 | |
| 2390 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2391 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2392 | bits = present ? HDA_AMP_MUTE : 0; |
| 2393 | 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] | 2394 | } |
| 2395 | |
| 2396 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 2397 | { |
| 2398 | alc880_uniwill_hp_automute(codec); |
| 2399 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2400 | } |
| 2401 | |
| 2402 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2403 | unsigned int res) |
| 2404 | { |
| 2405 | /* Looks like the unsol event is incompatible with the standard |
| 2406 | * definition. 4bit tag is placed at 28 bit! |
| 2407 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2408 | switch (res >> 28) { |
| 2409 | case ALC880_HP_EVENT: |
| 2410 | alc880_uniwill_hp_automute(codec); |
| 2411 | break; |
| 2412 | case ALC880_MIC_EVENT: |
| 2413 | alc880_uniwill_mic_automute(codec); |
| 2414 | break; |
| 2415 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2416 | } |
| 2417 | |
| 2418 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 2419 | { |
| 2420 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2421 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2422 | |
| 2423 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2424 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2425 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 2426 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2427 | } |
| 2428 | |
| 2429 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2430 | { |
| 2431 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2432 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2433 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2434 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2435 | present &= HDA_AMP_VOLMASK; |
| 2436 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2437 | HDA_AMP_VOLMASK, present); |
| 2438 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2439 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2440 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2441 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2442 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2443 | unsigned int res) |
| 2444 | { |
| 2445 | /* Looks like the unsol event is incompatible with the standard |
| 2446 | * definition. 4bit tag is placed at 28 bit! |
| 2447 | */ |
| 2448 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2449 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2450 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2451 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2452 | } |
| 2453 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2454 | /* |
| 2455 | * F1734 pin configuration: |
| 2456 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2457 | */ |
| 2458 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2459 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2460 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2461 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2462 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2463 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2464 | |
| 2465 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2466 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2467 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2468 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2469 | |
| 2470 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2471 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2472 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2473 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2474 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2475 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2476 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2477 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2478 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2479 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2480 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2481 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2482 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2483 | { } |
| 2484 | }; |
| 2485 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2486 | /* |
| 2487 | * ASUS pin configuration: |
| 2488 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2489 | */ |
| 2490 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2491 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2492 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2493 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2494 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2495 | |
| 2496 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2497 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2498 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2499 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2500 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2501 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2502 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2503 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2504 | |
| 2505 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2506 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2507 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2509 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2510 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2511 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2512 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2513 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2514 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2515 | { } |
| 2516 | }; |
| 2517 | |
| 2518 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2519 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2520 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2521 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2522 | /* Clevo m520g init */ |
| 2523 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2524 | /* headphone output */ |
| 2525 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2526 | /* line-out */ |
| 2527 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2528 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2529 | /* Line-in */ |
| 2530 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2531 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2532 | /* CD */ |
| 2533 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2534 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2535 | /* Mic1 (rear panel) */ |
| 2536 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2537 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2538 | /* Mic2 (front panel) */ |
| 2539 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2540 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2541 | /* headphone */ |
| 2542 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2543 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2544 | /* change to EAPD mode */ |
| 2545 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2546 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2547 | |
| 2548 | { } |
| 2549 | }; |
| 2550 | |
| 2551 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2552 | /* change to EAPD mode */ |
| 2553 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2554 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2555 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2556 | /* Headphone output */ |
| 2557 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2558 | /* Front output*/ |
| 2559 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2560 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2561 | |
| 2562 | /* Line In pin widget for input */ |
| 2563 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2564 | /* CD pin widget for input */ |
| 2565 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2566 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2567 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2568 | |
| 2569 | /* change to EAPD mode */ |
| 2570 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2571 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2572 | |
| 2573 | { } |
| 2574 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2575 | |
| 2576 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2577 | * LG m1 express dual |
| 2578 | * |
| 2579 | * Pin assignment: |
| 2580 | * Rear Line-In/Out (blue): 0x14 |
| 2581 | * Build-in Mic-In: 0x15 |
| 2582 | * Speaker-out: 0x17 |
| 2583 | * HP-Out (green): 0x1b |
| 2584 | * Mic-In/Out (red): 0x19 |
| 2585 | * SPDIF-Out: 0x1e |
| 2586 | */ |
| 2587 | |
| 2588 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2589 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2590 | 0x05, 0x02, 0x03 |
| 2591 | }; |
| 2592 | |
| 2593 | /* seems analog CD is not working */ |
| 2594 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2595 | .num_items = 3, |
| 2596 | .items = { |
| 2597 | { "Mic", 0x1 }, |
| 2598 | { "Line", 0x5 }, |
| 2599 | { "Internal Mic", 0x6 }, |
| 2600 | }, |
| 2601 | }; |
| 2602 | |
| 2603 | /* 2,4,6 channel modes */ |
| 2604 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2605 | /* set line-in and mic-in to input */ |
| 2606 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2607 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2608 | { } |
| 2609 | }; |
| 2610 | |
| 2611 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2612 | /* set line-in to out and mic-in to input */ |
| 2613 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2614 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2615 | { } |
| 2616 | }; |
| 2617 | |
| 2618 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2619 | /* set line-in and mic-in to output */ |
| 2620 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2621 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2622 | { } |
| 2623 | }; |
| 2624 | |
| 2625 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2626 | { 2, alc880_lg_ch2_init }, |
| 2627 | { 4, alc880_lg_ch4_init }, |
| 2628 | { 6, alc880_lg_ch6_init }, |
| 2629 | }; |
| 2630 | |
| 2631 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2632 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2633 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2634 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2635 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2636 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2637 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2638 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2639 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2640 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2641 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2642 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2643 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2644 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2645 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2646 | { |
| 2647 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2648 | .name = "Channel Mode", |
| 2649 | .info = alc_ch_mode_info, |
| 2650 | .get = alc_ch_mode_get, |
| 2651 | .put = alc_ch_mode_put, |
| 2652 | }, |
| 2653 | { } /* end */ |
| 2654 | }; |
| 2655 | |
| 2656 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2657 | /* set capture source to mic-in */ |
| 2658 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2659 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2660 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2661 | /* mute all amp mixer inputs */ |
| 2662 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2663 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2664 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2665 | /* line-in to input */ |
| 2666 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2667 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2668 | /* built-in mic */ |
| 2669 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2670 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2671 | /* speaker-out */ |
| 2672 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2673 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2674 | /* mic-in to input */ |
| 2675 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2676 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2677 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2678 | /* HP-out */ |
| 2679 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2680 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2681 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2682 | /* jack sense */ |
| 2683 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2684 | { } |
| 2685 | }; |
| 2686 | |
| 2687 | /* toggle speaker-output according to the hp-jack state */ |
| 2688 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2689 | { |
| 2690 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2691 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2692 | |
| 2693 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2694 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2695 | bits = present ? HDA_AMP_MUTE : 0; |
| 2696 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2697 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2698 | } |
| 2699 | |
| 2700 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2701 | { |
| 2702 | /* Looks like the unsol event is incompatible with the standard |
| 2703 | * definition. 4bit tag is placed at 28 bit! |
| 2704 | */ |
| 2705 | if ((res >> 28) == 0x01) |
| 2706 | alc880_lg_automute(codec); |
| 2707 | } |
| 2708 | |
| 2709 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2710 | * LG LW20 |
| 2711 | * |
| 2712 | * Pin assignment: |
| 2713 | * Speaker-out: 0x14 |
| 2714 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2715 | * Built-in Mic-In: 0x19 |
| 2716 | * Line-In: 0x1b |
| 2717 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2718 | * SPDIF-Out: 0x1e |
| 2719 | */ |
| 2720 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2721 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2722 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2723 | .items = { |
| 2724 | { "Mic", 0x0 }, |
| 2725 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2726 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2727 | }, |
| 2728 | }; |
| 2729 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2730 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2731 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2732 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2733 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2734 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2735 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2736 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2737 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2738 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2739 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2740 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2741 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2742 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2743 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2744 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2745 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2746 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2747 | { |
| 2748 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2749 | .name = "Channel Mode", |
| 2750 | .info = alc_ch_mode_info, |
| 2751 | .get = alc_ch_mode_get, |
| 2752 | .put = alc_ch_mode_put, |
| 2753 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2754 | { } /* end */ |
| 2755 | }; |
| 2756 | |
| 2757 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2758 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2759 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2760 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2761 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2762 | /* set capture source to mic-in */ |
| 2763 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2764 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2765 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2767 | /* speaker-out */ |
| 2768 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2769 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2770 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2771 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2772 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2773 | /* mic-in to input */ |
| 2774 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2775 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2776 | /* built-in mic */ |
| 2777 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2778 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2779 | /* jack sense */ |
| 2780 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2781 | { } |
| 2782 | }; |
| 2783 | |
| 2784 | /* toggle speaker-output according to the hp-jack state */ |
| 2785 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2786 | { |
| 2787 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2788 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2789 | |
| 2790 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2791 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2792 | bits = present ? HDA_AMP_MUTE : 0; |
| 2793 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2794 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2795 | } |
| 2796 | |
| 2797 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2798 | { |
| 2799 | /* Looks like the unsol event is incompatible with the standard |
| 2800 | * definition. 4bit tag is placed at 28 bit! |
| 2801 | */ |
| 2802 | if ((res >> 28) == 0x01) |
| 2803 | alc880_lg_lw_automute(codec); |
| 2804 | } |
| 2805 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2806 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2807 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2808 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2809 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2810 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2811 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2812 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2813 | { } /* end */ |
| 2814 | }; |
| 2815 | |
| 2816 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2817 | .num_items = 2, |
| 2818 | .items = { |
| 2819 | { "Mic", 0x0 }, |
| 2820 | { "Internal Mic", 0x1 }, |
| 2821 | }, |
| 2822 | }; |
| 2823 | |
| 2824 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2825 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2826 | |
| 2827 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2828 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2829 | |
| 2830 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2831 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2832 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2833 | /* Mic2 (as headphone out) for HP output */ |
| 2834 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2835 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2836 | /* Internal Speaker */ |
| 2837 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2838 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2839 | |
| 2840 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2841 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2842 | |
| 2843 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2844 | { } |
| 2845 | }; |
| 2846 | |
| 2847 | /* toggle speaker-output according to the hp-jack state */ |
| 2848 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2849 | { |
| 2850 | unsigned int present; |
| 2851 | unsigned char bits; |
| 2852 | |
| 2853 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2854 | AC_VERB_GET_PIN_SENSE, 0) |
| 2855 | & AC_PINSENSE_PRESENCE; |
| 2856 | bits = present ? HDA_AMP_MUTE : 0; |
| 2857 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2858 | HDA_AMP_MUTE, bits); |
| 2859 | if (present) |
| 2860 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2861 | else |
| 2862 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2863 | } |
| 2864 | |
| 2865 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2866 | unsigned int res) |
| 2867 | { |
| 2868 | /* Looks like the unsol event is incompatible with the standard |
| 2869 | * definition. 4bit tag is placed at 28 bit! |
| 2870 | */ |
| 2871 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2872 | alc880_medion_rim_automute(codec); |
| 2873 | } |
| 2874 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2875 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2876 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2877 | { 0x0b, HDA_INPUT, 0 }, |
| 2878 | { 0x0b, HDA_INPUT, 1 }, |
| 2879 | { 0x0b, HDA_INPUT, 2 }, |
| 2880 | { 0x0b, HDA_INPUT, 3 }, |
| 2881 | { 0x0b, HDA_INPUT, 4 }, |
| 2882 | { } /* end */ |
| 2883 | }; |
| 2884 | |
| 2885 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2886 | { 0x0b, HDA_INPUT, 1 }, |
| 2887 | { 0x0b, HDA_INPUT, 6 }, |
| 2888 | { 0x0b, HDA_INPUT, 7 }, |
| 2889 | { } /* end */ |
| 2890 | }; |
| 2891 | #endif |
| 2892 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2893 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2894 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2895 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2896 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2897 | static int alc_init(struct hda_codec *codec) |
| 2898 | { |
| 2899 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2900 | unsigned int i; |
| 2901 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2902 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2903 | if (codec->vendor_id == 0x10ec0888) |
| 2904 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2905 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2906 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2907 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2908 | |
| 2909 | if (spec->init_hook) |
| 2910 | spec->init_hook(codec); |
| 2911 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2912 | return 0; |
| 2913 | } |
| 2914 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2915 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2916 | { |
| 2917 | struct alc_spec *spec = codec->spec; |
| 2918 | |
| 2919 | if (spec->unsol_event) |
| 2920 | spec->unsol_event(codec, res); |
| 2921 | } |
| 2922 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2923 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2924 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2925 | { |
| 2926 | struct alc_spec *spec = codec->spec; |
| 2927 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2928 | } |
| 2929 | #endif |
| 2930 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2931 | /* |
| 2932 | * Analog playback callbacks |
| 2933 | */ |
| 2934 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2935 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2936 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2937 | { |
| 2938 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2939 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2940 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2941 | } |
| 2942 | |
| 2943 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2944 | struct hda_codec *codec, |
| 2945 | unsigned int stream_tag, |
| 2946 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2947 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2948 | { |
| 2949 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2950 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2951 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2952 | } |
| 2953 | |
| 2954 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2955 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2956 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2957 | { |
| 2958 | struct alc_spec *spec = codec->spec; |
| 2959 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2960 | } |
| 2961 | |
| 2962 | /* |
| 2963 | * Digital out |
| 2964 | */ |
| 2965 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2966 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2967 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2968 | { |
| 2969 | struct alc_spec *spec = codec->spec; |
| 2970 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2971 | } |
| 2972 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2973 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2974 | struct hda_codec *codec, |
| 2975 | unsigned int stream_tag, |
| 2976 | unsigned int format, |
| 2977 | struct snd_pcm_substream *substream) |
| 2978 | { |
| 2979 | struct alc_spec *spec = codec->spec; |
| 2980 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2981 | stream_tag, format, substream); |
| 2982 | } |
| 2983 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 2984 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2985 | struct hda_codec *codec, |
| 2986 | struct snd_pcm_substream *substream) |
| 2987 | { |
| 2988 | struct alc_spec *spec = codec->spec; |
| 2989 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 2990 | } |
| 2991 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2992 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2993 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2994 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2995 | { |
| 2996 | struct alc_spec *spec = codec->spec; |
| 2997 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2998 | } |
| 2999 | |
| 3000 | /* |
| 3001 | * Analog capture |
| 3002 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3003 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3004 | struct hda_codec *codec, |
| 3005 | unsigned int stream_tag, |
| 3006 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3007 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3008 | { |
| 3009 | struct alc_spec *spec = codec->spec; |
| 3010 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3011 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3012 | stream_tag, 0, format); |
| 3013 | return 0; |
| 3014 | } |
| 3015 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3016 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3017 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3018 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3019 | { |
| 3020 | struct alc_spec *spec = codec->spec; |
| 3021 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3022 | snd_hda_codec_cleanup_stream(codec, |
| 3023 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3024 | return 0; |
| 3025 | } |
| 3026 | |
| 3027 | |
| 3028 | /* |
| 3029 | */ |
| 3030 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3031 | .substreams = 1, |
| 3032 | .channels_min = 2, |
| 3033 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3034 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3035 | .ops = { |
| 3036 | .open = alc880_playback_pcm_open, |
| 3037 | .prepare = alc880_playback_pcm_prepare, |
| 3038 | .cleanup = alc880_playback_pcm_cleanup |
| 3039 | }, |
| 3040 | }; |
| 3041 | |
| 3042 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3043 | .substreams = 1, |
| 3044 | .channels_min = 2, |
| 3045 | .channels_max = 2, |
| 3046 | /* NID is set in alc_build_pcms */ |
| 3047 | }; |
| 3048 | |
| 3049 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3050 | .substreams = 1, |
| 3051 | .channels_min = 2, |
| 3052 | .channels_max = 2, |
| 3053 | /* NID is set in alc_build_pcms */ |
| 3054 | }; |
| 3055 | |
| 3056 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3057 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3058 | .channels_min = 2, |
| 3059 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3060 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3061 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3062 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3063 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3064 | }, |
| 3065 | }; |
| 3066 | |
| 3067 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3068 | .substreams = 1, |
| 3069 | .channels_min = 2, |
| 3070 | .channels_max = 2, |
| 3071 | /* NID is set in alc_build_pcms */ |
| 3072 | .ops = { |
| 3073 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3074 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3075 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3076 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3077 | }, |
| 3078 | }; |
| 3079 | |
| 3080 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3081 | .substreams = 1, |
| 3082 | .channels_min = 2, |
| 3083 | .channels_max = 2, |
| 3084 | /* NID is set in alc_build_pcms */ |
| 3085 | }; |
| 3086 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3087 | /* 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] | 3088 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3089 | .substreams = 0, |
| 3090 | .channels_min = 0, |
| 3091 | .channels_max = 0, |
| 3092 | }; |
| 3093 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3094 | static int alc_build_pcms(struct hda_codec *codec) |
| 3095 | { |
| 3096 | struct alc_spec *spec = codec->spec; |
| 3097 | struct hda_pcm *info = spec->pcm_rec; |
| 3098 | int i; |
| 3099 | |
| 3100 | codec->num_pcms = 1; |
| 3101 | codec->pcm_info = info; |
| 3102 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3103 | if (spec->no_analog) |
| 3104 | goto skip_analog; |
| 3105 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3106 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3107 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3108 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3109 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3110 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3111 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3112 | } |
| 3113 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3114 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3115 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3116 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3117 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3118 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3119 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3120 | if (spec->channel_mode) { |
| 3121 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3122 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3123 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3124 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3125 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3126 | } |
| 3127 | } |
| 3128 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3129 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3130 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3131 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3132 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3133 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3134 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3135 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3136 | if (spec->dig_out_type) |
| 3137 | info->pcm_type = spec->dig_out_type; |
| 3138 | else |
| 3139 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3140 | if (spec->multiout.dig_out_nid && |
| 3141 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3142 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3143 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3144 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3145 | if (spec->dig_in_nid && |
| 3146 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3147 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3148 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3149 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3150 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3151 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3152 | } |
| 3153 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3154 | if (spec->no_analog) |
| 3155 | return 0; |
| 3156 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3157 | /* If the use of more than one ADC is requested for the current |
| 3158 | * model, configure a second analog capture-only PCM. |
| 3159 | */ |
| 3160 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3161 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3162 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3163 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3164 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3165 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3166 | if (spec->alt_dac_nid) { |
| 3167 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3168 | *spec->stream_analog_alt_playback; |
| 3169 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3170 | spec->alt_dac_nid; |
| 3171 | } else { |
| 3172 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3173 | alc_pcm_null_stream; |
| 3174 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3175 | } |
| 3176 | if (spec->num_adc_nids > 1) { |
| 3177 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3178 | *spec->stream_analog_alt_capture; |
| 3179 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3180 | spec->adc_nids[1]; |
| 3181 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3182 | spec->num_adc_nids - 1; |
| 3183 | } else { |
| 3184 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3185 | alc_pcm_null_stream; |
| 3186 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3187 | } |
| 3188 | } |
| 3189 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3190 | return 0; |
| 3191 | } |
| 3192 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3193 | static void alc_free_kctls(struct hda_codec *codec) |
| 3194 | { |
| 3195 | struct alc_spec *spec = codec->spec; |
| 3196 | |
| 3197 | if (spec->kctls.list) { |
| 3198 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3199 | int i; |
| 3200 | for (i = 0; i < spec->kctls.used; i++) |
| 3201 | kfree(kctl[i].name); |
| 3202 | } |
| 3203 | snd_array_free(&spec->kctls); |
| 3204 | } |
| 3205 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3206 | static void alc_free(struct hda_codec *codec) |
| 3207 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3208 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3209 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3210 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3211 | return; |
| 3212 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3213 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3214 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3215 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3216 | } |
| 3217 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3218 | #ifdef SND_HDA_NEEDS_RESUME |
| 3219 | static void store_pin_configs(struct hda_codec *codec) |
| 3220 | { |
| 3221 | struct alc_spec *spec = codec->spec; |
| 3222 | hda_nid_t nid, end_nid; |
| 3223 | |
| 3224 | end_nid = codec->start_nid + codec->num_nodes; |
| 3225 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
| 3226 | unsigned int wid_caps = get_wcaps(codec, nid); |
| 3227 | unsigned int wid_type = |
| 3228 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 3229 | if (wid_type != AC_WID_PIN) |
| 3230 | continue; |
| 3231 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) |
| 3232 | break; |
| 3233 | spec->pin_nids[spec->num_pins] = nid; |
| 3234 | spec->pin_cfgs[spec->num_pins] = |
| 3235 | snd_hda_codec_read(codec, nid, 0, |
| 3236 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 3237 | spec->num_pins++; |
| 3238 | } |
| 3239 | } |
| 3240 | |
| 3241 | static void resume_pin_configs(struct hda_codec *codec) |
| 3242 | { |
| 3243 | struct alc_spec *spec = codec->spec; |
| 3244 | int i; |
| 3245 | |
| 3246 | for (i = 0; i < spec->num_pins; i++) { |
| 3247 | hda_nid_t pin_nid = spec->pin_nids[i]; |
| 3248 | unsigned int pin_config = spec->pin_cfgs[i]; |
| 3249 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3250 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 3251 | pin_config & 0x000000ff); |
| 3252 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3253 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 3254 | (pin_config & 0x0000ff00) >> 8); |
| 3255 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3256 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 3257 | (pin_config & 0x00ff0000) >> 16); |
| 3258 | snd_hda_codec_write(codec, pin_nid, 0, |
| 3259 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 3260 | pin_config >> 24); |
| 3261 | } |
| 3262 | } |
| 3263 | |
| 3264 | static int alc_resume(struct hda_codec *codec) |
| 3265 | { |
| 3266 | resume_pin_configs(codec); |
| 3267 | codec->patch_ops.init(codec); |
| 3268 | snd_hda_codec_resume_amp(codec); |
| 3269 | snd_hda_codec_resume_cache(codec); |
| 3270 | return 0; |
| 3271 | } |
| 3272 | #else |
| 3273 | #define store_pin_configs(codec) |
| 3274 | #endif |
| 3275 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3276 | /* |
| 3277 | */ |
| 3278 | static struct hda_codec_ops alc_patch_ops = { |
| 3279 | .build_controls = alc_build_controls, |
| 3280 | .build_pcms = alc_build_pcms, |
| 3281 | .init = alc_init, |
| 3282 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3283 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3284 | #ifdef SND_HDA_NEEDS_RESUME |
| 3285 | .resume = alc_resume, |
| 3286 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3287 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3288 | .check_power_status = alc_check_power_status, |
| 3289 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3290 | }; |
| 3291 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3292 | |
| 3293 | /* |
| 3294 | * Test configuration for debugging |
| 3295 | * |
| 3296 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3297 | * enum controls. |
| 3298 | */ |
| 3299 | #ifdef CONFIG_SND_DEBUG |
| 3300 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3301 | 0x02, 0x03, 0x04, 0x05 |
| 3302 | }; |
| 3303 | |
| 3304 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3305 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3306 | .items = { |
| 3307 | { "In-1", 0x0 }, |
| 3308 | { "In-2", 0x1 }, |
| 3309 | { "In-3", 0x2 }, |
| 3310 | { "In-4", 0x3 }, |
| 3311 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3312 | { "Front", 0x5 }, |
| 3313 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3314 | }, |
| 3315 | }; |
| 3316 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3317 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3318 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3319 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3320 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3321 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3322 | }; |
| 3323 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3324 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3325 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3326 | { |
| 3327 | static char *texts[] = { |
| 3328 | "N/A", "Line Out", "HP Out", |
| 3329 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3330 | }; |
| 3331 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3332 | uinfo->count = 1; |
| 3333 | uinfo->value.enumerated.items = 8; |
| 3334 | if (uinfo->value.enumerated.item >= 8) |
| 3335 | uinfo->value.enumerated.item = 7; |
| 3336 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3337 | return 0; |
| 3338 | } |
| 3339 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3340 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3341 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3342 | { |
| 3343 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3344 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3345 | unsigned int pin_ctl, item = 0; |
| 3346 | |
| 3347 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3348 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3349 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3350 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3351 | item = 2; |
| 3352 | else |
| 3353 | item = 1; |
| 3354 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3355 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3356 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3357 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3358 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3359 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3360 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3361 | } |
| 3362 | } |
| 3363 | ucontrol->value.enumerated.item[0] = item; |
| 3364 | return 0; |
| 3365 | } |
| 3366 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3367 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3368 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3369 | { |
| 3370 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3371 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3372 | static unsigned int ctls[] = { |
| 3373 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3374 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3375 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3376 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3377 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3378 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3379 | }; |
| 3380 | unsigned int old_ctl, new_ctl; |
| 3381 | |
| 3382 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3383 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3384 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3385 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3386 | int val; |
| 3387 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3388 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3389 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3390 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3391 | HDA_AMP_MUTE : 0; |
| 3392 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3393 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3394 | return 1; |
| 3395 | } |
| 3396 | return 0; |
| 3397 | } |
| 3398 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3399 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3400 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3401 | { |
| 3402 | static char *texts[] = { |
| 3403 | "Front", "Surround", "CLFE", "Side" |
| 3404 | }; |
| 3405 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3406 | uinfo->count = 1; |
| 3407 | uinfo->value.enumerated.items = 4; |
| 3408 | if (uinfo->value.enumerated.item >= 4) |
| 3409 | uinfo->value.enumerated.item = 3; |
| 3410 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3411 | return 0; |
| 3412 | } |
| 3413 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3414 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3415 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3416 | { |
| 3417 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3418 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3419 | unsigned int sel; |
| 3420 | |
| 3421 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3422 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3423 | return 0; |
| 3424 | } |
| 3425 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3426 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3427 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3428 | { |
| 3429 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3430 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3431 | unsigned int sel; |
| 3432 | |
| 3433 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3434 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3435 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3436 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3437 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3438 | return 1; |
| 3439 | } |
| 3440 | return 0; |
| 3441 | } |
| 3442 | |
| 3443 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3444 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3445 | .name = xname, \ |
| 3446 | .info = alc_test_pin_ctl_info, \ |
| 3447 | .get = alc_test_pin_ctl_get, \ |
| 3448 | .put = alc_test_pin_ctl_put, \ |
| 3449 | .private_value = nid \ |
| 3450 | } |
| 3451 | |
| 3452 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3453 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3454 | .name = xname, \ |
| 3455 | .info = alc_test_pin_src_info, \ |
| 3456 | .get = alc_test_pin_src_get, \ |
| 3457 | .put = alc_test_pin_src_put, \ |
| 3458 | .private_value = nid \ |
| 3459 | } |
| 3460 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3461 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3462 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3463 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3464 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3465 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3466 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3467 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3468 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3469 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3470 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3471 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3472 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3473 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3474 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3475 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3476 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3477 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3478 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3479 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3480 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3481 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3482 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3483 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3484 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3485 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3486 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3487 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3488 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3489 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3490 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3491 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3492 | { |
| 3493 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3494 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3495 | .info = alc_ch_mode_info, |
| 3496 | .get = alc_ch_mode_get, |
| 3497 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3498 | }, |
| 3499 | { } /* end */ |
| 3500 | }; |
| 3501 | |
| 3502 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3503 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3505 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3506 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3507 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3508 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3509 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3510 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3511 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3512 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3513 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3514 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3515 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3516 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3517 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3518 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3519 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3520 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3521 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3522 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3523 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3524 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3525 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3526 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3527 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3528 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3529 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3530 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3531 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3532 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3533 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3534 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3535 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3536 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3537 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3538 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3539 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3540 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3541 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3542 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3543 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3544 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3545 | /* Analog input/passthru */ |
| 3546 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3547 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3548 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3549 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3550 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3551 | { } |
| 3552 | }; |
| 3553 | #endif |
| 3554 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3555 | /* |
| 3556 | */ |
| 3557 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3558 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3559 | [ALC880_3ST] = "3stack", |
| 3560 | [ALC880_TCL_S700] = "tcl", |
| 3561 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3562 | [ALC880_CLEVO] = "clevo", |
| 3563 | [ALC880_5ST] = "5stack", |
| 3564 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3565 | [ALC880_W810] = "w810", |
| 3566 | [ALC880_Z71V] = "z71v", |
| 3567 | [ALC880_6ST] = "6stack", |
| 3568 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3569 | [ALC880_ASUS] = "asus", |
| 3570 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3571 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3572 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3573 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3574 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3575 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3576 | [ALC880_F1734] = "F1734", |
| 3577 | [ALC880_LG] = "lg", |
| 3578 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3579 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3580 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3581 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3582 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3583 | [ALC880_AUTO] = "auto", |
| 3584 | }; |
| 3585 | |
| 3586 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3587 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3588 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3589 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3590 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3591 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3592 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3593 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3594 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3595 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3596 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3597 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3598 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3599 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3600 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3601 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3602 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3603 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3604 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3605 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3606 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3607 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3608 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3609 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3610 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3611 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3612 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3613 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3614 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3615 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3616 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3617 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3618 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3619 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3620 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3621 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3622 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3623 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3624 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3625 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3626 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3627 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3628 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3629 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3630 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3631 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3632 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3633 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3634 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3635 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3636 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3637 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3638 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3639 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3640 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3641 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3642 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3643 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3644 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3645 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3646 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3647 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3648 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3649 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3650 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3651 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3652 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3653 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3654 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3655 | /* default Intel */ |
| 3656 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3657 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3658 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3659 | {} |
| 3660 | }; |
| 3661 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3662 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3663 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3664 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3665 | static struct alc_config_preset alc880_presets[] = { |
| 3666 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3667 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3668 | .init_verbs = { alc880_volume_init_verbs, |
| 3669 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3670 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3671 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3672 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3673 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3674 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3675 | .input_mux = &alc880_capture_source, |
| 3676 | }, |
| 3677 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3678 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3679 | .init_verbs = { alc880_volume_init_verbs, |
| 3680 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3681 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3682 | .dac_nids = alc880_dac_nids, |
| 3683 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3684 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3685 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3686 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3687 | .input_mux = &alc880_capture_source, |
| 3688 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3689 | [ALC880_TCL_S700] = { |
| 3690 | .mixers = { alc880_tcl_s700_mixer }, |
| 3691 | .init_verbs = { alc880_volume_init_verbs, |
| 3692 | alc880_pin_tcl_S700_init_verbs, |
| 3693 | alc880_gpio2_init_verbs }, |
| 3694 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3695 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3696 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3697 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3698 | .hp_nid = 0x03, |
| 3699 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3700 | .channel_mode = alc880_2_jack_modes, |
| 3701 | .input_mux = &alc880_capture_source, |
| 3702 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3703 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3704 | .mixers = { alc880_three_stack_mixer, |
| 3705 | alc880_five_stack_mixer}, |
| 3706 | .init_verbs = { alc880_volume_init_verbs, |
| 3707 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3708 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3709 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3710 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3711 | .channel_mode = alc880_fivestack_modes, |
| 3712 | .input_mux = &alc880_capture_source, |
| 3713 | }, |
| 3714 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3715 | .mixers = { alc880_three_stack_mixer, |
| 3716 | alc880_five_stack_mixer }, |
| 3717 | .init_verbs = { alc880_volume_init_verbs, |
| 3718 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3719 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3720 | .dac_nids = alc880_dac_nids, |
| 3721 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3722 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3723 | .channel_mode = alc880_fivestack_modes, |
| 3724 | .input_mux = &alc880_capture_source, |
| 3725 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3726 | [ALC880_6ST] = { |
| 3727 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3728 | .init_verbs = { alc880_volume_init_verbs, |
| 3729 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3730 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3731 | .dac_nids = alc880_6st_dac_nids, |
| 3732 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3733 | .channel_mode = alc880_sixstack_modes, |
| 3734 | .input_mux = &alc880_6stack_capture_source, |
| 3735 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3736 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3737 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3738 | .init_verbs = { alc880_volume_init_verbs, |
| 3739 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3740 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3741 | .dac_nids = alc880_6st_dac_nids, |
| 3742 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3743 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3744 | .channel_mode = alc880_sixstack_modes, |
| 3745 | .input_mux = &alc880_6stack_capture_source, |
| 3746 | }, |
| 3747 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3748 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3749 | .init_verbs = { alc880_volume_init_verbs, |
| 3750 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3751 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3752 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3753 | .dac_nids = alc880_w810_dac_nids, |
| 3754 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3755 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3756 | .channel_mode = alc880_w810_modes, |
| 3757 | .input_mux = &alc880_capture_source, |
| 3758 | }, |
| 3759 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3760 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3761 | .init_verbs = { alc880_volume_init_verbs, |
| 3762 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3763 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3764 | .dac_nids = alc880_z71v_dac_nids, |
| 3765 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3766 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3767 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3768 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3769 | .input_mux = &alc880_capture_source, |
| 3770 | }, |
| 3771 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3772 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3773 | .init_verbs = { alc880_volume_init_verbs, |
| 3774 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3775 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3776 | .dac_nids = alc880_f1734_dac_nids, |
| 3777 | .hp_nid = 0x02, |
| 3778 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3779 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3780 | .input_mux = &alc880_f1734_capture_source, |
| 3781 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3782 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3783 | }, |
| 3784 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3785 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3786 | .init_verbs = { alc880_volume_init_verbs, |
| 3787 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3788 | alc880_gpio1_init_verbs }, |
| 3789 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3790 | .dac_nids = alc880_asus_dac_nids, |
| 3791 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3792 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3793 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3794 | .input_mux = &alc880_capture_source, |
| 3795 | }, |
| 3796 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3797 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3798 | .init_verbs = { alc880_volume_init_verbs, |
| 3799 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3800 | alc880_gpio1_init_verbs }, |
| 3801 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3802 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3803 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3804 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3805 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3806 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3807 | .input_mux = &alc880_capture_source, |
| 3808 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3809 | [ALC880_ASUS_DIG2] = { |
| 3810 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3811 | .init_verbs = { alc880_volume_init_verbs, |
| 3812 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3813 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3814 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3815 | .dac_nids = alc880_asus_dac_nids, |
| 3816 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3817 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3818 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3819 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3820 | .input_mux = &alc880_capture_source, |
| 3821 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3822 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3823 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3824 | .init_verbs = { alc880_volume_init_verbs, |
| 3825 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3826 | alc880_gpio1_init_verbs }, |
| 3827 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3828 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3829 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3830 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3831 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3832 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3833 | .input_mux = &alc880_capture_source, |
| 3834 | }, |
| 3835 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3836 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3837 | .init_verbs = { alc880_volume_init_verbs, |
| 3838 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3839 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3840 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3841 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3842 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3843 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3844 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3845 | .input_mux = &alc880_capture_source, |
| 3846 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3847 | [ALC880_UNIWILL] = { |
| 3848 | .mixers = { alc880_uniwill_mixer }, |
| 3849 | .init_verbs = { alc880_volume_init_verbs, |
| 3850 | alc880_uniwill_init_verbs }, |
| 3851 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3852 | .dac_nids = alc880_asus_dac_nids, |
| 3853 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3854 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3855 | .channel_mode = alc880_threestack_modes, |
| 3856 | .need_dac_fix = 1, |
| 3857 | .input_mux = &alc880_capture_source, |
| 3858 | .unsol_event = alc880_uniwill_unsol_event, |
| 3859 | .init_hook = alc880_uniwill_automute, |
| 3860 | }, |
| 3861 | [ALC880_UNIWILL_P53] = { |
| 3862 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3863 | .init_verbs = { alc880_volume_init_verbs, |
| 3864 | alc880_uniwill_p53_init_verbs }, |
| 3865 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3866 | .dac_nids = alc880_asus_dac_nids, |
| 3867 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3868 | .channel_mode = alc880_threestack_modes, |
| 3869 | .input_mux = &alc880_capture_source, |
| 3870 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3871 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3872 | }, |
| 3873 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3874 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3875 | .init_verbs = { alc880_volume_init_verbs, |
| 3876 | alc880_uniwill_p53_init_verbs, |
| 3877 | alc880_beep_init_verbs }, |
| 3878 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3879 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3880 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3881 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3882 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3883 | .input_mux = &alc880_capture_source, |
| 3884 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3885 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3886 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3887 | [ALC880_CLEVO] = { |
| 3888 | .mixers = { alc880_three_stack_mixer }, |
| 3889 | .init_verbs = { alc880_volume_init_verbs, |
| 3890 | alc880_pin_clevo_init_verbs }, |
| 3891 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3892 | .dac_nids = alc880_dac_nids, |
| 3893 | .hp_nid = 0x03, |
| 3894 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3895 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3896 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3897 | .input_mux = &alc880_capture_source, |
| 3898 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3899 | [ALC880_LG] = { |
| 3900 | .mixers = { alc880_lg_mixer }, |
| 3901 | .init_verbs = { alc880_volume_init_verbs, |
| 3902 | alc880_lg_init_verbs }, |
| 3903 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3904 | .dac_nids = alc880_lg_dac_nids, |
| 3905 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3906 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3907 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3908 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3909 | .input_mux = &alc880_lg_capture_source, |
| 3910 | .unsol_event = alc880_lg_unsol_event, |
| 3911 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3912 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3913 | .loopbacks = alc880_lg_loopbacks, |
| 3914 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3915 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3916 | [ALC880_LG_LW] = { |
| 3917 | .mixers = { alc880_lg_lw_mixer }, |
| 3918 | .init_verbs = { alc880_volume_init_verbs, |
| 3919 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3920 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3921 | .dac_nids = alc880_dac_nids, |
| 3922 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3923 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3924 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3925 | .input_mux = &alc880_lg_lw_capture_source, |
| 3926 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3927 | .init_hook = alc880_lg_lw_automute, |
| 3928 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3929 | [ALC880_MEDION_RIM] = { |
| 3930 | .mixers = { alc880_medion_rim_mixer }, |
| 3931 | .init_verbs = { alc880_volume_init_verbs, |
| 3932 | alc880_medion_rim_init_verbs, |
| 3933 | alc_gpio2_init_verbs }, |
| 3934 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3935 | .dac_nids = alc880_dac_nids, |
| 3936 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3937 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3938 | .channel_mode = alc880_2_jack_modes, |
| 3939 | .input_mux = &alc880_medion_rim_capture_source, |
| 3940 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3941 | .init_hook = alc880_medion_rim_automute, |
| 3942 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3943 | #ifdef CONFIG_SND_DEBUG |
| 3944 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3945 | .mixers = { alc880_test_mixer }, |
| 3946 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3947 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3948 | .dac_nids = alc880_test_dac_nids, |
| 3949 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3950 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3951 | .channel_mode = alc880_test_modes, |
| 3952 | .input_mux = &alc880_test_capture_source, |
| 3953 | }, |
| 3954 | #endif |
| 3955 | }; |
| 3956 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3957 | /* |
| 3958 | * Automatic parse of I/O pins from the BIOS configuration |
| 3959 | */ |
| 3960 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3961 | enum { |
| 3962 | ALC_CTL_WIDGET_VOL, |
| 3963 | ALC_CTL_WIDGET_MUTE, |
| 3964 | ALC_CTL_BIND_MUTE, |
| 3965 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3966 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3967 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3968 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3969 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3970 | }; |
| 3971 | |
| 3972 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3973 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3974 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3975 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3976 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3977 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3978 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 3979 | knew = snd_array_new(&spec->kctls); |
| 3980 | if (!knew) |
| 3981 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3982 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3983 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3984 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3985 | return -ENOMEM; |
| 3986 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3987 | return 0; |
| 3988 | } |
| 3989 | |
| 3990 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3991 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3992 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3993 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3994 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3995 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3996 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3997 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3998 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3999 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4000 | #define ALC880_PIN_CD_NID 0x1c |
| 4001 | |
| 4002 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4003 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4004 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4005 | { |
| 4006 | hda_nid_t nid; |
| 4007 | int assigned[4]; |
| 4008 | int i, j; |
| 4009 | |
| 4010 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4011 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4012 | |
| 4013 | /* check the pins hardwired to audio widget */ |
| 4014 | for (i = 0; i < cfg->line_outs; i++) { |
| 4015 | nid = cfg->line_out_pins[i]; |
| 4016 | if (alc880_is_fixed_pin(nid)) { |
| 4017 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4018 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4019 | assigned[idx] = 1; |
| 4020 | } |
| 4021 | } |
| 4022 | /* left pins can be connect to any audio widget */ |
| 4023 | for (i = 0; i < cfg->line_outs; i++) { |
| 4024 | nid = cfg->line_out_pins[i]; |
| 4025 | if (alc880_is_fixed_pin(nid)) |
| 4026 | continue; |
| 4027 | /* search for an empty channel */ |
| 4028 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4029 | if (!assigned[j]) { |
| 4030 | spec->multiout.dac_nids[i] = |
| 4031 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4032 | assigned[j] = 1; |
| 4033 | break; |
| 4034 | } |
| 4035 | } |
| 4036 | } |
| 4037 | spec->multiout.num_dacs = cfg->line_outs; |
| 4038 | return 0; |
| 4039 | } |
| 4040 | |
| 4041 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4042 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4043 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4044 | { |
| 4045 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4046 | static const char *chname[4] = { |
| 4047 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4048 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4049 | hda_nid_t nid; |
| 4050 | int i, err; |
| 4051 | |
| 4052 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4053 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4054 | continue; |
| 4055 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4056 | if (i == 2) { |
| 4057 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4058 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4059 | "Center Playback Volume", |
| 4060 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4061 | HDA_OUTPUT)); |
| 4062 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4063 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4064 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4065 | "LFE Playback Volume", |
| 4066 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4067 | HDA_OUTPUT)); |
| 4068 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4069 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4070 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4071 | "Center Playback Switch", |
| 4072 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4073 | HDA_INPUT)); |
| 4074 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4075 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4076 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4077 | "LFE Playback Switch", |
| 4078 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4079 | HDA_INPUT)); |
| 4080 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4081 | return err; |
| 4082 | } else { |
| 4083 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4084 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4085 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4086 | HDA_OUTPUT)); |
| 4087 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4088 | return err; |
| 4089 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4090 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4091 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4092 | HDA_INPUT)); |
| 4093 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4094 | return err; |
| 4095 | } |
| 4096 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4097 | return 0; |
| 4098 | } |
| 4099 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4100 | /* add playback controls for speaker and HP outputs */ |
| 4101 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4102 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4103 | { |
| 4104 | hda_nid_t nid; |
| 4105 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4106 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4107 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4108 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4109 | return 0; |
| 4110 | |
| 4111 | if (alc880_is_fixed_pin(pin)) { |
| 4112 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4113 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4114 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4115 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4116 | else |
| 4117 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4118 | /* control HP volume/switch on the output mixer amp */ |
| 4119 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4120 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4121 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4122 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4123 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4124 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4125 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4126 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4127 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4128 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4129 | return err; |
| 4130 | } else if (alc880_is_multi_pin(pin)) { |
| 4131 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4132 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4133 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4134 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4135 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4136 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4137 | return err; |
| 4138 | } |
| 4139 | return 0; |
| 4140 | } |
| 4141 | |
| 4142 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4143 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4144 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4145 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4146 | { |
| 4147 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4148 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4149 | |
| 4150 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4151 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4152 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4153 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4154 | return err; |
| 4155 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4156 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4157 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4158 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4159 | return err; |
| 4160 | return 0; |
| 4161 | } |
| 4162 | |
| 4163 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4164 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4165 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4166 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4167 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4168 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4169 | |
| 4170 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4171 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4172 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4173 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4174 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4175 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4176 | if (err < 0) |
| 4177 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4178 | imux->items[imux->num_items].label = |
| 4179 | auto_pin_cfg_labels[i]; |
| 4180 | imux->items[imux->num_items].index = |
| 4181 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4182 | imux->num_items++; |
| 4183 | } |
| 4184 | } |
| 4185 | return 0; |
| 4186 | } |
| 4187 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4188 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4189 | unsigned int pin_type) |
| 4190 | { |
| 4191 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4192 | pin_type); |
| 4193 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4194 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4195 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4196 | } |
| 4197 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4198 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4199 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4200 | int dac_idx) |
| 4201 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4202 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4203 | /* need the manual connection? */ |
| 4204 | if (alc880_is_multi_pin(nid)) { |
| 4205 | struct alc_spec *spec = codec->spec; |
| 4206 | int idx = alc880_multi_pin_idx(nid); |
| 4207 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4208 | AC_VERB_SET_CONNECT_SEL, |
| 4209 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4210 | } |
| 4211 | } |
| 4212 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4213 | static int get_pin_type(int line_out_type) |
| 4214 | { |
| 4215 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4216 | return PIN_HP; |
| 4217 | else |
| 4218 | return PIN_OUT; |
| 4219 | } |
| 4220 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4221 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4222 | { |
| 4223 | struct alc_spec *spec = codec->spec; |
| 4224 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4225 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4226 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4227 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4228 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4229 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4230 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4231 | } |
| 4232 | } |
| 4233 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4234 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4235 | { |
| 4236 | struct alc_spec *spec = codec->spec; |
| 4237 | hda_nid_t pin; |
| 4238 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4239 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4240 | if (pin) /* connect to front */ |
| 4241 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4242 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4243 | if (pin) /* connect to front */ |
| 4244 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4245 | } |
| 4246 | |
| 4247 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4248 | { |
| 4249 | struct alc_spec *spec = codec->spec; |
| 4250 | int i; |
| 4251 | |
| 4252 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4253 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4254 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4255 | snd_hda_codec_write(codec, nid, 0, |
| 4256 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4257 | i <= AUTO_PIN_FRONT_MIC ? |
| 4258 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4259 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4260 | snd_hda_codec_write(codec, nid, 0, |
| 4261 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4262 | AMP_OUT_MUTE); |
| 4263 | } |
| 4264 | } |
| 4265 | } |
| 4266 | |
| 4267 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4268 | /* return 1 if successful, 0 if the proper config is not found, |
| 4269 | * or a negative error code |
| 4270 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4271 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4272 | { |
| 4273 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4274 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4275 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4276 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4277 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4278 | alc880_ignore); |
| 4279 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4280 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4281 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4282 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4283 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4284 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4285 | if (err < 0) |
| 4286 | return err; |
| 4287 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4288 | if (err < 0) |
| 4289 | return err; |
| 4290 | err = alc880_auto_create_extra_out(spec, |
| 4291 | spec->autocfg.speaker_pins[0], |
| 4292 | "Speaker"); |
| 4293 | if (err < 0) |
| 4294 | return err; |
| 4295 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4296 | "Headphone"); |
| 4297 | if (err < 0) |
| 4298 | return err; |
| 4299 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4300 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4301 | return err; |
| 4302 | |
| 4303 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4304 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4305 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4306 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4307 | hda_nid_t dig_nid; |
| 4308 | err = snd_hda_get_connections(codec, |
| 4309 | spec->autocfg.dig_out_pins[i], |
| 4310 | &dig_nid, 1); |
| 4311 | if (err < 0) |
| 4312 | continue; |
| 4313 | if (!i) |
| 4314 | spec->multiout.dig_out_nid = dig_nid; |
| 4315 | else { |
| 4316 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4317 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4318 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4319 | break; |
| 4320 | } |
| 4321 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4322 | if (spec->autocfg.dig_in_pin) |
| 4323 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4324 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4325 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4326 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4327 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4328 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4329 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4330 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4331 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4332 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4333 | store_pin_configs(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4334 | return 1; |
| 4335 | } |
| 4336 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4337 | /* additional initialization for auto-configuration model */ |
| 4338 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4339 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4340 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4341 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4342 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4343 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4344 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4345 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4346 | } |
| 4347 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4348 | static void set_capture_mixer(struct alc_spec *spec) |
| 4349 | { |
| 4350 | static struct snd_kcontrol_new *caps[3] = { |
| 4351 | alc_capture_mixer1, |
| 4352 | alc_capture_mixer2, |
| 4353 | alc_capture_mixer3, |
| 4354 | }; |
Takashi Iwai | 30d72e9 | 2008-11-27 15:25:34 +0100 | [diff] [blame] | 4355 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4356 | spec->cap_mixer = caps[spec->num_adc_nids - 1]; |
| 4357 | } |
| 4358 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4359 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4360 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4361 | |
| 4362 | /* |
| 4363 | * OK, here we have finally the patch for ALC880 |
| 4364 | */ |
| 4365 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4366 | static int patch_alc880(struct hda_codec *codec) |
| 4367 | { |
| 4368 | struct alc_spec *spec; |
| 4369 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4370 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4371 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4372 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4373 | if (spec == NULL) |
| 4374 | return -ENOMEM; |
| 4375 | |
| 4376 | codec->spec = spec; |
| 4377 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4378 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4379 | alc880_models, |
| 4380 | alc880_cfg_tbl); |
| 4381 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4382 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 4383 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4384 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4385 | } |
| 4386 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4387 | if (board_config == ALC880_AUTO) { |
| 4388 | /* automatic parse from the BIOS config */ |
| 4389 | err = alc880_parse_auto_config(codec); |
| 4390 | if (err < 0) { |
| 4391 | alc_free(codec); |
| 4392 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4393 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4394 | printk(KERN_INFO |
| 4395 | "hda_codec: Cannot set up configuration " |
| 4396 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4397 | board_config = ALC880_3ST; |
| 4398 | } |
| 4399 | } |
| 4400 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4401 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4402 | if (err < 0) { |
| 4403 | alc_free(codec); |
| 4404 | return err; |
| 4405 | } |
| 4406 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4407 | if (board_config != ALC880_AUTO) |
| 4408 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4409 | |
| 4410 | spec->stream_name_analog = "ALC880 Analog"; |
| 4411 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4412 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4413 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4414 | |
| 4415 | spec->stream_name_digital = "ALC880 Digital"; |
| 4416 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4417 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4418 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4419 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4420 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4421 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4422 | /* get type */ |
| 4423 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4424 | if (wcap != AC_WID_AUD_IN) { |
| 4425 | spec->adc_nids = alc880_adc_nids_alt; |
| 4426 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4427 | } else { |
| 4428 | spec->adc_nids = alc880_adc_nids; |
| 4429 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4430 | } |
| 4431 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4432 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4433 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4434 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4435 | spec->vmaster_nid = 0x0c; |
| 4436 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4437 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4438 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4439 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4440 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4441 | if (!spec->loopback.amplist) |
| 4442 | spec->loopback.amplist = alc880_loopbacks; |
| 4443 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4444 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4445 | |
| 4446 | return 0; |
| 4447 | } |
| 4448 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4449 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4450 | /* |
| 4451 | * ALC260 support |
| 4452 | */ |
| 4453 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4454 | static hda_nid_t alc260_dac_nids[1] = { |
| 4455 | /* front */ |
| 4456 | 0x02, |
| 4457 | }; |
| 4458 | |
| 4459 | static hda_nid_t alc260_adc_nids[1] = { |
| 4460 | /* ADC0 */ |
| 4461 | 0x04, |
| 4462 | }; |
| 4463 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4464 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4465 | /* ADC1 */ |
| 4466 | 0x05, |
| 4467 | }; |
| 4468 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4469 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4470 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4471 | */ |
| 4472 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4473 | /* ADC0, ADC1 */ |
| 4474 | 0x04, 0x05 |
| 4475 | }; |
| 4476 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4477 | #define ALC260_DIGOUT_NID 0x03 |
| 4478 | #define ALC260_DIGIN_NID 0x06 |
| 4479 | |
| 4480 | static struct hda_input_mux alc260_capture_source = { |
| 4481 | .num_items = 4, |
| 4482 | .items = { |
| 4483 | { "Mic", 0x0 }, |
| 4484 | { "Front Mic", 0x1 }, |
| 4485 | { "Line", 0x2 }, |
| 4486 | { "CD", 0x4 }, |
| 4487 | }, |
| 4488 | }; |
| 4489 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4490 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4491 | * headphone jack and the internal CD lines since these are the only pins at |
| 4492 | * which audio can appear. For flexibility, also allow the option of |
| 4493 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4494 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4495 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4496 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4497 | { |
| 4498 | .num_items = 3, |
| 4499 | .items = { |
| 4500 | { "Mic/Line", 0x0 }, |
| 4501 | { "CD", 0x4 }, |
| 4502 | { "Headphone", 0x2 }, |
| 4503 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4504 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4505 | { |
| 4506 | .num_items = 4, |
| 4507 | .items = { |
| 4508 | { "Mic/Line", 0x0 }, |
| 4509 | { "CD", 0x4 }, |
| 4510 | { "Headphone", 0x2 }, |
| 4511 | { "Mixer", 0x5 }, |
| 4512 | }, |
| 4513 | }, |
| 4514 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4515 | }; |
| 4516 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4517 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4518 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4519 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4520 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4521 | { |
| 4522 | .num_items = 4, |
| 4523 | .items = { |
| 4524 | { "Mic", 0x0 }, |
| 4525 | { "Line", 0x2 }, |
| 4526 | { "CD", 0x4 }, |
| 4527 | { "Headphone", 0x5 }, |
| 4528 | }, |
| 4529 | }, |
| 4530 | { |
| 4531 | .num_items = 5, |
| 4532 | .items = { |
| 4533 | { "Mic", 0x0 }, |
| 4534 | { "Line", 0x2 }, |
| 4535 | { "CD", 0x4 }, |
| 4536 | { "Headphone", 0x6 }, |
| 4537 | { "Mixer", 0x5 }, |
| 4538 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4539 | }, |
| 4540 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame^] | 4541 | |
| 4542 | /* Maxdata Favorit 100XS */ |
| 4543 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4544 | { |
| 4545 | .num_items = 2, |
| 4546 | .items = { |
| 4547 | { "Line/Mic", 0x0 }, |
| 4548 | { "CD", 0x4 }, |
| 4549 | }, |
| 4550 | }, |
| 4551 | { |
| 4552 | .num_items = 3, |
| 4553 | .items = { |
| 4554 | { "Line/Mic", 0x0 }, |
| 4555 | { "CD", 0x4 }, |
| 4556 | { "Mixer", 0x5 }, |
| 4557 | }, |
| 4558 | }, |
| 4559 | }; |
| 4560 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4561 | /* |
| 4562 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4563 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4564 | * element which allows changing the channel mode, so the verb list is |
| 4565 | * never used. |
| 4566 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4567 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4568 | { 2, NULL }, |
| 4569 | }; |
| 4570 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4571 | |
| 4572 | /* Mixer combinations |
| 4573 | * |
| 4574 | * basic: base_output + input + pc_beep + capture |
| 4575 | * HP: base_output + input + capture_alt |
| 4576 | * HP_3013: hp_3013 + input + capture |
| 4577 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4578 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4579 | */ |
| 4580 | |
| 4581 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4582 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4583 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4584 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4585 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4586 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4587 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4588 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4589 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4590 | |
| 4591 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4592 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4593 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4594 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4595 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4596 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4597 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4598 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4599 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4600 | { } /* end */ |
| 4601 | }; |
| 4602 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4603 | /* update HP, line and mono out pins according to the master switch */ |
| 4604 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4605 | hda_nid_t hp, hda_nid_t line, |
| 4606 | hda_nid_t mono) |
| 4607 | { |
| 4608 | struct alc_spec *spec = codec->spec; |
| 4609 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4610 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4611 | 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] | 4612 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4613 | 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] | 4614 | val); |
| 4615 | /* mono (speaker) depending on the HP jack sense */ |
| 4616 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4617 | 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] | 4618 | val); |
| 4619 | } |
| 4620 | |
| 4621 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4622 | struct snd_ctl_elem_value *ucontrol) |
| 4623 | { |
| 4624 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4625 | struct alc_spec *spec = codec->spec; |
| 4626 | *ucontrol->value.integer.value = spec->master_sw; |
| 4627 | return 0; |
| 4628 | } |
| 4629 | |
| 4630 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4631 | struct snd_ctl_elem_value *ucontrol) |
| 4632 | { |
| 4633 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4634 | struct alc_spec *spec = codec->spec; |
| 4635 | int val = !!*ucontrol->value.integer.value; |
| 4636 | hda_nid_t hp, line, mono; |
| 4637 | |
| 4638 | if (val == spec->master_sw) |
| 4639 | return 0; |
| 4640 | spec->master_sw = val; |
| 4641 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4642 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4643 | mono = kcontrol->private_value & 0xff; |
| 4644 | alc260_hp_master_update(codec, hp, line, mono); |
| 4645 | return 1; |
| 4646 | } |
| 4647 | |
| 4648 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4649 | { |
| 4650 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4651 | .name = "Master Playback Switch", |
| 4652 | .info = snd_ctl_boolean_mono_info, |
| 4653 | .get = alc260_hp_master_sw_get, |
| 4654 | .put = alc260_hp_master_sw_put, |
| 4655 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4656 | }, |
| 4657 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4658 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4659 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4660 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4661 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4662 | HDA_OUTPUT), |
| 4663 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4664 | { } /* end */ |
| 4665 | }; |
| 4666 | |
| 4667 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4668 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4669 | {}, |
| 4670 | }; |
| 4671 | |
| 4672 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4673 | { |
| 4674 | struct alc_spec *spec = codec->spec; |
| 4675 | unsigned int present; |
| 4676 | |
| 4677 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4678 | AC_VERB_GET_PIN_SENSE, 0); |
| 4679 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4680 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4681 | } |
| 4682 | |
| 4683 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4684 | { |
| 4685 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4686 | alc260_hp_automute(codec); |
| 4687 | } |
| 4688 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4689 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4690 | { |
| 4691 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4692 | .name = "Master Playback Switch", |
| 4693 | .info = snd_ctl_boolean_mono_info, |
| 4694 | .get = alc260_hp_master_sw_get, |
| 4695 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4696 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4697 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4698 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4699 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4700 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4701 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4702 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4703 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4704 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4705 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4706 | { } /* end */ |
| 4707 | }; |
| 4708 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4709 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4710 | .ops = &snd_hda_bind_vol, |
| 4711 | .values = { |
| 4712 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4713 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4714 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4715 | 0 |
| 4716 | }, |
| 4717 | }; |
| 4718 | |
| 4719 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4720 | .ops = &snd_hda_bind_sw, |
| 4721 | .values = { |
| 4722 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4723 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4724 | 0 |
| 4725 | }, |
| 4726 | }; |
| 4727 | |
| 4728 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4729 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4730 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4731 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4732 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4733 | { } /* end */ |
| 4734 | }; |
| 4735 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4736 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4737 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4738 | {}, |
| 4739 | }; |
| 4740 | |
| 4741 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4742 | { |
| 4743 | struct alc_spec *spec = codec->spec; |
| 4744 | unsigned int present; |
| 4745 | |
| 4746 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4747 | AC_VERB_GET_PIN_SENSE, 0); |
| 4748 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4749 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4750 | } |
| 4751 | |
| 4752 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4753 | unsigned int res) |
| 4754 | { |
| 4755 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4756 | alc260_hp_3013_automute(codec); |
| 4757 | } |
| 4758 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4759 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4760 | { |
| 4761 | unsigned int present, bits; |
| 4762 | |
| 4763 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4764 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4765 | |
| 4766 | bits = present ? 0 : PIN_OUT; |
| 4767 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4768 | bits); |
| 4769 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4770 | bits); |
| 4771 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4772 | bits); |
| 4773 | } |
| 4774 | |
| 4775 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4776 | unsigned int res) |
| 4777 | { |
| 4778 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4779 | alc260_hp_3012_automute(codec); |
| 4780 | } |
| 4781 | |
| 4782 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4783 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4784 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4785 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4786 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4787 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4788 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4789 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4790 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4791 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4792 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4793 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4794 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4795 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4796 | { } /* end */ |
| 4797 | }; |
| 4798 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4799 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4800 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4801 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4802 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4803 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4804 | * revisions available in early 2006. Therefore for now allow the |
| 4805 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4806 | * that the lack of mic bias for this NID is intentional we could change the |
| 4807 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4808 | * |
| 4809 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4810 | * don't appear to make the mic bias available from the "line" jack, even |
| 4811 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4812 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4813 | * and the output jack. If this turns out to be the case for all such |
| 4814 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4815 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4816 | * |
| 4817 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4818 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4819 | * controls for such models. On models without a "mono speaker" the control |
| 4820 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4821 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4822 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4823 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4824 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4825 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4826 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4827 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4828 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4829 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4830 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4831 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4832 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4833 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4834 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4835 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4836 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4837 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4838 | { } /* end */ |
| 4839 | }; |
| 4840 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame^] | 4841 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 4842 | */ |
| 4843 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 4844 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4845 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 4846 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4847 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4848 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4849 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4850 | { } /* end */ |
| 4851 | }; |
| 4852 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4853 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4854 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4855 | */ |
| 4856 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4857 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4858 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4859 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4860 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4861 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4862 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4863 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4864 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4865 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4866 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4867 | { } /* end */ |
| 4868 | }; |
| 4869 | |
| 4870 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4871 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4872 | */ |
| 4873 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4874 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4875 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4876 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4877 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4878 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4879 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4880 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4881 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4882 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4883 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4884 | { } /* end */ |
| 4885 | }; |
| 4886 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4887 | /* |
| 4888 | * initialization verbs |
| 4889 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4890 | static struct hda_verb alc260_init_verbs[] = { |
| 4891 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4892 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4893 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4894 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4895 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4896 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4897 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4898 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4899 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4900 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4901 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4902 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4903 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4904 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4905 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4906 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4907 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4908 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4909 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4910 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4911 | /* set connection select to line in (default select for this ADC) */ |
| 4912 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4913 | /* mute capture amp left and right */ |
| 4914 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4915 | /* set connection select to line in (default select for this ADC) */ |
| 4916 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4917 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4918 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4919 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4920 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4921 | /* set vol=0 HP mixer amp left and right */ |
| 4922 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4923 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4924 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4925 | /* set vol=0 Mono mixer amp left and right */ |
| 4926 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4927 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4928 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4929 | /* unmute LINE-2 out pin */ |
| 4930 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4931 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4932 | * Line In 2 = 0x03 |
| 4933 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4934 | /* mute analog inputs */ |
| 4935 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4936 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4937 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4938 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4939 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4940 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4941 | /* mute Front out path */ |
| 4942 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4943 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4944 | /* mute Headphone out path */ |
| 4945 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4946 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4947 | /* mute Mono out path */ |
| 4948 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4949 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4950 | { } |
| 4951 | }; |
| 4952 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4953 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4954 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4955 | /* Headphone and output */ |
| 4956 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4957 | /* mono output */ |
| 4958 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4959 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4960 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4961 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4962 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4963 | /* Line In pin widget for input */ |
| 4964 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4965 | /* Line-2 pin widget for output */ |
| 4966 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4967 | /* CD pin widget for input */ |
| 4968 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4969 | /* unmute amp left and right */ |
| 4970 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4971 | /* set connection select to line in (default select for this ADC) */ |
| 4972 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4973 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4974 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4975 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4976 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4977 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4978 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4979 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4980 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4981 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4982 | * Line In 2 = 0x03 |
| 4983 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4984 | /* mute analog inputs */ |
| 4985 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4986 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4987 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4988 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4989 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4990 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4991 | /* Unmute Front out path */ |
| 4992 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4993 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4994 | /* Unmute Headphone out path */ |
| 4995 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4996 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4997 | /* Unmute Mono out path */ |
| 4998 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4999 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5000 | { } |
| 5001 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5002 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5003 | |
| 5004 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5005 | /* Line out and output */ |
| 5006 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5007 | /* mono output */ |
| 5008 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5009 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5010 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5011 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5012 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5013 | /* Line In pin widget for input */ |
| 5014 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5015 | /* Headphone pin widget for output */ |
| 5016 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5017 | /* CD pin widget for input */ |
| 5018 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5019 | /* unmute amp left and right */ |
| 5020 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5021 | /* set connection select to line in (default select for this ADC) */ |
| 5022 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5023 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5024 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5025 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5026 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5027 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5028 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5029 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5030 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5031 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5032 | * Line In 2 = 0x03 |
| 5033 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5034 | /* mute analog inputs */ |
| 5035 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5036 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5037 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5038 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5039 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5040 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5041 | /* Unmute Front out path */ |
| 5042 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5043 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5044 | /* Unmute Headphone out path */ |
| 5045 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5046 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5047 | /* Unmute Mono out path */ |
| 5048 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5049 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5050 | { } |
| 5051 | }; |
| 5052 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5053 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5054 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5055 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5056 | */ |
| 5057 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5058 | /* Disable all GPIOs */ |
| 5059 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5060 | /* Internal speaker is connected to headphone pin */ |
| 5061 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5062 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5063 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5064 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5065 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5066 | /* Ensure all other unused pins are disabled and muted. */ |
| 5067 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5068 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5069 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5070 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5071 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5072 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5073 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5074 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5075 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5076 | /* Disable digital (SPDIF) pins */ |
| 5077 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5078 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5079 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5080 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5081 | * when acting as an output. |
| 5082 | */ |
| 5083 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5084 | |
| 5085 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5086 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5087 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5088 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5089 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5090 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5091 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5092 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5093 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5094 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5095 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5096 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5097 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5098 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5099 | * If the pin mode is changed by the user the pin mode control will |
| 5100 | * take care of enabling the pin's input/output buffers as needed. |
| 5101 | * Therefore there's no need to enable the input buffer at this |
| 5102 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5103 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5104 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5105 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5106 | * mixer ctrl) |
| 5107 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5108 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5109 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5110 | /* Mute capture amp left and right */ |
| 5111 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5112 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5113 | * in (on mic1 pin) |
| 5114 | */ |
| 5115 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5116 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5117 | /* Do the same for the second ADC: mute capture input amp and |
| 5118 | * set ADC connection to line in (on mic1 pin) |
| 5119 | */ |
| 5120 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5121 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5122 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5123 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5124 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5125 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5126 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5127 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5131 | {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] | 5132 | |
| 5133 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5134 | }; |
| 5135 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5136 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5137 | * similar laptops (adapted from Fujitsu init verbs). |
| 5138 | */ |
| 5139 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5140 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5141 | * the headphone jack. Turn this on and rely on the standard mute |
| 5142 | * methods whenever the user wants to turn these outputs off. |
| 5143 | */ |
| 5144 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5145 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5146 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5147 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5148 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5149 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5150 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5151 | /* Line In jack is connected to Line1 pin */ |
| 5152 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5153 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5154 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5155 | /* Ensure all other unused pins are disabled and muted. */ |
| 5156 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5157 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5158 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5159 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5160 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5161 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5162 | /* Disable digital (SPDIF) pins */ |
| 5163 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5164 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5165 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5166 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5167 | * bus when acting as outputs. |
| 5168 | */ |
| 5169 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5170 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5171 | |
| 5172 | /* Start with output sum widgets muted and their output gains at min */ |
| 5173 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5174 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5175 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5176 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5177 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5178 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5179 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5180 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5181 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5182 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5183 | /* Unmute Line-out pin widget amp left and right |
| 5184 | * (no equiv mixer ctrl) |
| 5185 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5186 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5187 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5188 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5189 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5190 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5191 | * will take care of enabling the pin's input/output buffers as needed. |
| 5192 | * Therefore there's no need to enable the input buffer at this |
| 5193 | * stage. |
| 5194 | */ |
| 5195 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5196 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5197 | |
| 5198 | /* Mute capture amp left and right */ |
| 5199 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5200 | /* Set ADC connection select to match default mixer setting - mic |
| 5201 | * (on mic1 pin) |
| 5202 | */ |
| 5203 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5204 | |
| 5205 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5206 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5207 | */ |
| 5208 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5209 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5210 | |
| 5211 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5212 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5213 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5214 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5215 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5216 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5217 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5218 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5219 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5220 | |
| 5221 | { } |
| 5222 | }; |
| 5223 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame^] | 5224 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5225 | * (adapted from Acer init verbs). |
| 5226 | */ |
| 5227 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5228 | /* GPIO 0 enables the output jack. |
| 5229 | * Turn this on and rely on the standard mute |
| 5230 | * methods whenever the user wants to turn these outputs off. |
| 5231 | */ |
| 5232 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5233 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5234 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5235 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5236 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5237 | /* Ensure all other unused pins are disabled and muted. */ |
| 5238 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5239 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5240 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5241 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5242 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5243 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5244 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5245 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5246 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5247 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5248 | /* Disable digital (SPDIF) pins */ |
| 5249 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5250 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5251 | |
| 5252 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5253 | * bus when acting as outputs. |
| 5254 | */ |
| 5255 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5256 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5257 | |
| 5258 | /* Start with output sum widgets muted and their output gains at min */ |
| 5259 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5260 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5261 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5262 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5263 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5264 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5265 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5266 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5267 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5268 | |
| 5269 | /* Unmute Line-out pin widget amp left and right |
| 5270 | * (no equiv mixer ctrl) |
| 5271 | */ |
| 5272 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5273 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5274 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5275 | * will take care of enabling the pin's input/output buffers as needed. |
| 5276 | * Therefore there's no need to enable the input buffer at this |
| 5277 | * stage. |
| 5278 | */ |
| 5279 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5280 | |
| 5281 | /* Mute capture amp left and right */ |
| 5282 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5283 | /* Set ADC connection select to match default mixer setting - mic |
| 5284 | * (on mic1 pin) |
| 5285 | */ |
| 5286 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5287 | |
| 5288 | /* Do similar with the second ADC: mute capture input amp and |
| 5289 | * set ADC connection to mic to match ALSA's default state. |
| 5290 | */ |
| 5291 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5292 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5293 | |
| 5294 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5295 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5296 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5297 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5298 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5299 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5300 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5301 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5302 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5303 | |
| 5304 | { } |
| 5305 | }; |
| 5306 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5307 | static struct hda_verb alc260_will_verbs[] = { |
| 5308 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5309 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5310 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5311 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5312 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5313 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5314 | {} |
| 5315 | }; |
| 5316 | |
| 5317 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5318 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5319 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5320 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5321 | |
| 5322 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5323 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5324 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5325 | |
| 5326 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5327 | {} |
| 5328 | }; |
| 5329 | |
| 5330 | /* toggle speaker-output according to the hp-jack state */ |
| 5331 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5332 | { |
| 5333 | unsigned int present; |
| 5334 | |
| 5335 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5336 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5337 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5338 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5339 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5340 | AC_VERB_SET_GPIO_DATA, 1); |
| 5341 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5342 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5343 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5344 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5345 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5346 | AC_VERB_SET_GPIO_DATA, 0); |
| 5347 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5348 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5349 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5350 | } |
| 5351 | } |
| 5352 | |
| 5353 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5354 | unsigned int res) |
| 5355 | { |
| 5356 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5357 | alc260_replacer_672v_automute(codec); |
| 5358 | } |
| 5359 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5360 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5361 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5362 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5363 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5364 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5365 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5366 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5367 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5368 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5369 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5370 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5371 | {} |
| 5372 | }; |
| 5373 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5374 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5375 | * configuration. |
| 5376 | */ |
| 5377 | #ifdef CONFIG_SND_DEBUG |
| 5378 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5379 | 0x02, |
| 5380 | }; |
| 5381 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5382 | 0x04, 0x05, |
| 5383 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5384 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5385 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5386 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5387 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5388 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5389 | { |
| 5390 | .num_items = 7, |
| 5391 | .items = { |
| 5392 | { "MIC1 pin", 0x0 }, |
| 5393 | { "MIC2 pin", 0x1 }, |
| 5394 | { "LINE1 pin", 0x2 }, |
| 5395 | { "LINE2 pin", 0x3 }, |
| 5396 | { "CD pin", 0x4 }, |
| 5397 | { "LINE-OUT pin", 0x5 }, |
| 5398 | { "HP-OUT pin", 0x6 }, |
| 5399 | }, |
| 5400 | }, |
| 5401 | { |
| 5402 | .num_items = 8, |
| 5403 | .items = { |
| 5404 | { "MIC1 pin", 0x0 }, |
| 5405 | { "MIC2 pin", 0x1 }, |
| 5406 | { "LINE1 pin", 0x2 }, |
| 5407 | { "LINE2 pin", 0x3 }, |
| 5408 | { "CD pin", 0x4 }, |
| 5409 | { "Mixer", 0x5 }, |
| 5410 | { "LINE-OUT pin", 0x6 }, |
| 5411 | { "HP-OUT pin", 0x7 }, |
| 5412 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5413 | }, |
| 5414 | }; |
| 5415 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5416 | /* Output driver widgets */ |
| 5417 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5418 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5419 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5420 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5421 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5422 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5423 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5424 | /* Modes for retasking pin widgets |
| 5425 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5426 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5427 | * mention this restriction. At this stage it's not clear whether |
| 5428 | * this behaviour is intentional or is a hardware bug in chip |
| 5429 | * revisions available at least up until early 2006. Therefore for |
| 5430 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5431 | * choices, but if it turns out that the lack of mic bias for these |
| 5432 | * NIDs is intentional we could change their modes from |
| 5433 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5434 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5435 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5436 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5437 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5438 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5439 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5440 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5441 | |
| 5442 | /* Loopback mixer controls */ |
| 5443 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5444 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5445 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5446 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5447 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5448 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5449 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5450 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5451 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5452 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5453 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5454 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5455 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5456 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5457 | |
| 5458 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5459 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5460 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5461 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5462 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5463 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5464 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5465 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5466 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5467 | */ |
| 5468 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5469 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5470 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5471 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5472 | * this output to turn on an external amplifier. |
| 5473 | */ |
| 5474 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5475 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5476 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5477 | { } /* end */ |
| 5478 | }; |
| 5479 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5480 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5481 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5482 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5483 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5484 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5485 | /* Enable retasking pins as output, initially without power amp */ |
| 5486 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5487 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5488 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5489 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5490 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5491 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5492 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5493 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5494 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5495 | * payload also sets the generation to 0, output to be in "consumer" |
| 5496 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5497 | * control. |
| 5498 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5499 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5500 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5501 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5502 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5503 | * OUT1 sum bus when acting as an output. |
| 5504 | */ |
| 5505 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5506 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5507 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5508 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5509 | |
| 5510 | /* Start with output sum widgets muted and their output gains at min */ |
| 5511 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5512 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5513 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5514 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5515 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5516 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5517 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5518 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5519 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5520 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5521 | /* Unmute retasking pin widget output buffers since the default |
| 5522 | * state appears to be output. As the pin mode is changed by the |
| 5523 | * user the pin mode control will take care of enabling the pin's |
| 5524 | * input/output buffers as needed. |
| 5525 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5526 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5527 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5528 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5529 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5530 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5531 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5532 | /* Also unmute the mono-out pin widget */ |
| 5533 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5534 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5535 | /* Mute capture amp left and right */ |
| 5536 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5537 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5538 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5539 | */ |
| 5540 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5541 | |
| 5542 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5543 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5544 | */ |
| 5545 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5546 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5547 | |
| 5548 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5552 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5553 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5554 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5555 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5556 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5557 | |
| 5558 | { } |
| 5559 | }; |
| 5560 | #endif |
| 5561 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5562 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5563 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5564 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5565 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5566 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5567 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5568 | /* |
| 5569 | * for BIOS auto-configuration |
| 5570 | */ |
| 5571 | |
| 5572 | 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] | 5573 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5574 | { |
| 5575 | hda_nid_t nid_vol; |
| 5576 | unsigned long vol_val, sw_val; |
| 5577 | char name[32]; |
| 5578 | int err; |
| 5579 | |
| 5580 | if (nid >= 0x0f && nid < 0x11) { |
| 5581 | nid_vol = nid - 0x7; |
| 5582 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5583 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5584 | } else if (nid == 0x11) { |
| 5585 | nid_vol = nid - 0x7; |
| 5586 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5587 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5588 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5589 | nid_vol = 0x08; |
| 5590 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5591 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5592 | } else |
| 5593 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5594 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5595 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5596 | /* first control for the volume widget */ |
| 5597 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5598 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5599 | if (err < 0) |
| 5600 | return err; |
| 5601 | *vol_bits |= (1 << nid_vol); |
| 5602 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5603 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5604 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5605 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5606 | return err; |
| 5607 | return 1; |
| 5608 | } |
| 5609 | |
| 5610 | /* add playback controls from the parsed DAC table */ |
| 5611 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5612 | const struct auto_pin_cfg *cfg) |
| 5613 | { |
| 5614 | hda_nid_t nid; |
| 5615 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5616 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5617 | |
| 5618 | spec->multiout.num_dacs = 1; |
| 5619 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5620 | spec->multiout.dac_nids[0] = 0x02; |
| 5621 | |
| 5622 | nid = cfg->line_out_pins[0]; |
| 5623 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5624 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5625 | if (err < 0) |
| 5626 | return err; |
| 5627 | } |
| 5628 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5629 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5630 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5631 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5632 | if (err < 0) |
| 5633 | return err; |
| 5634 | } |
| 5635 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5636 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5637 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5638 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5639 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5640 | if (err < 0) |
| 5641 | return err; |
| 5642 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5643 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5644 | } |
| 5645 | |
| 5646 | /* create playback/capture controls for input pins */ |
| 5647 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5648 | const struct auto_pin_cfg *cfg) |
| 5649 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5650 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5651 | int i, err, idx; |
| 5652 | |
| 5653 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5654 | if (cfg->input_pins[i] >= 0x12) { |
| 5655 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5656 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5657 | auto_pin_cfg_labels[i], idx, |
| 5658 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5659 | if (err < 0) |
| 5660 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5661 | imux->items[imux->num_items].label = |
| 5662 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5663 | imux->items[imux->num_items].index = idx; |
| 5664 | imux->num_items++; |
| 5665 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5666 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5667 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5668 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5669 | auto_pin_cfg_labels[i], idx, |
| 5670 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5671 | if (err < 0) |
| 5672 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5673 | imux->items[imux->num_items].label = |
| 5674 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5675 | imux->items[imux->num_items].index = idx; |
| 5676 | imux->num_items++; |
| 5677 | } |
| 5678 | } |
| 5679 | return 0; |
| 5680 | } |
| 5681 | |
| 5682 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5683 | hda_nid_t nid, int pin_type, |
| 5684 | int sel_idx) |
| 5685 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5686 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5687 | /* need the manual connection? */ |
| 5688 | if (nid >= 0x12) { |
| 5689 | int idx = nid - 0x12; |
| 5690 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5691 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5692 | } |
| 5693 | } |
| 5694 | |
| 5695 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5696 | { |
| 5697 | struct alc_spec *spec = codec->spec; |
| 5698 | hda_nid_t nid; |
| 5699 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5700 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5701 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5702 | if (nid) { |
| 5703 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5704 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5705 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5706 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5707 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5708 | if (nid) |
| 5709 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5710 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5711 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5712 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5713 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5714 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5715 | |
| 5716 | #define ALC260_PIN_CD_NID 0x16 |
| 5717 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5718 | { |
| 5719 | struct alc_spec *spec = codec->spec; |
| 5720 | int i; |
| 5721 | |
| 5722 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5723 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5724 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5725 | snd_hda_codec_write(codec, nid, 0, |
| 5726 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5727 | i <= AUTO_PIN_FRONT_MIC ? |
| 5728 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5729 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5730 | snd_hda_codec_write(codec, nid, 0, |
| 5731 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5732 | AMP_OUT_MUTE); |
| 5733 | } |
| 5734 | } |
| 5735 | } |
| 5736 | |
| 5737 | /* |
| 5738 | * generic initialization of ADC, input mixers and output mixers |
| 5739 | */ |
| 5740 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5741 | /* |
| 5742 | * Unmute ADC0-1 and set the default input to mic-in |
| 5743 | */ |
| 5744 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5745 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5746 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5747 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5748 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5749 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5750 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5751 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5752 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5753 | */ |
| 5754 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5755 | /* mute analog inputs */ |
| 5756 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5757 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5758 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5759 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5760 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5761 | |
| 5762 | /* |
| 5763 | * Set up output mixers (0x08 - 0x0a) |
| 5764 | */ |
| 5765 | /* set vol=0 to output mixers */ |
| 5766 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5767 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5768 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5769 | /* set up input amps for analog loopback */ |
| 5770 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5771 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5772 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5773 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5774 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5775 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5776 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5777 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5778 | { } |
| 5779 | }; |
| 5780 | |
| 5781 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5782 | { |
| 5783 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5784 | int err; |
| 5785 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5786 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5787 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5788 | alc260_ignore); |
| 5789 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5790 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5791 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5792 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5793 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5794 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5795 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5796 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5797 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5798 | return err; |
| 5799 | |
| 5800 | spec->multiout.max_channels = 2; |
| 5801 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5802 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5803 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5804 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5805 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5806 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5807 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5808 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5809 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5810 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5811 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 5812 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5813 | return 1; |
| 5814 | } |
| 5815 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5816 | /* additional initialization for auto-configuration model */ |
| 5817 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5818 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5819 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5820 | alc260_auto_init_multi_out(codec); |
| 5821 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5822 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5823 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5824 | } |
| 5825 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5826 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5827 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5828 | { 0x07, HDA_INPUT, 0 }, |
| 5829 | { 0x07, HDA_INPUT, 1 }, |
| 5830 | { 0x07, HDA_INPUT, 2 }, |
| 5831 | { 0x07, HDA_INPUT, 3 }, |
| 5832 | { 0x07, HDA_INPUT, 4 }, |
| 5833 | { } /* end */ |
| 5834 | }; |
| 5835 | #endif |
| 5836 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5837 | /* |
| 5838 | * ALC260 configurations |
| 5839 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5840 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5841 | [ALC260_BASIC] = "basic", |
| 5842 | [ALC260_HP] = "hp", |
| 5843 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5844 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5845 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5846 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5847 | [ALC260_WILL] = "will", |
| 5848 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame^] | 5849 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5850 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5851 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5852 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5853 | [ALC260_AUTO] = "auto", |
| 5854 | }; |
| 5855 | |
| 5856 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5857 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5858 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame^] | 5859 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5860 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5861 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5862 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5863 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5864 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5865 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5866 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5867 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5868 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5869 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5870 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5871 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5872 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5873 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5874 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5875 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5876 | {} |
| 5877 | }; |
| 5878 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5879 | static struct alc_config_preset alc260_presets[] = { |
| 5880 | [ALC260_BASIC] = { |
| 5881 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5882 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5883 | .init_verbs = { alc260_init_verbs }, |
| 5884 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5885 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5886 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5887 | .adc_nids = alc260_adc_nids, |
| 5888 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5889 | .channel_mode = alc260_modes, |
| 5890 | .input_mux = &alc260_capture_source, |
| 5891 | }, |
| 5892 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5893 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5894 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5895 | .init_verbs = { alc260_init_verbs, |
| 5896 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5897 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5898 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5899 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5900 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5901 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5902 | .channel_mode = alc260_modes, |
| 5903 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5904 | .unsol_event = alc260_hp_unsol_event, |
| 5905 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5906 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5907 | [ALC260_HP_DC7600] = { |
| 5908 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5909 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5910 | .init_verbs = { alc260_init_verbs, |
| 5911 | alc260_hp_dc7600_verbs }, |
| 5912 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5913 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5914 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5915 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5916 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5917 | .channel_mode = alc260_modes, |
| 5918 | .input_mux = &alc260_capture_source, |
| 5919 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5920 | .init_hook = alc260_hp_3012_automute, |
| 5921 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5922 | [ALC260_HP_3013] = { |
| 5923 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5924 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5925 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5926 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5927 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5928 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5929 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5930 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5931 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5932 | .channel_mode = alc260_modes, |
| 5933 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5934 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5935 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5936 | }, |
| 5937 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5938 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5939 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5940 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5941 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5942 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5943 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5944 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5945 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5946 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5947 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5948 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5949 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5950 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5951 | .init_verbs = { alc260_acer_init_verbs }, |
| 5952 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5953 | .dac_nids = alc260_dac_nids, |
| 5954 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5955 | .adc_nids = alc260_dual_adc_nids, |
| 5956 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5957 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5958 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5959 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5960 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame^] | 5961 | [ALC260_FAVORIT100] = { |
| 5962 | .mixers = { alc260_favorit100_mixer }, |
| 5963 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 5964 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5965 | .dac_nids = alc260_dac_nids, |
| 5966 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5967 | .adc_nids = alc260_dual_adc_nids, |
| 5968 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5969 | .channel_mode = alc260_modes, |
| 5970 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 5971 | .input_mux = alc260_favorit100_capture_sources, |
| 5972 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5973 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5974 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5975 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5976 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5977 | .dac_nids = alc260_dac_nids, |
| 5978 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5979 | .adc_nids = alc260_adc_nids, |
| 5980 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5981 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5982 | .channel_mode = alc260_modes, |
| 5983 | .input_mux = &alc260_capture_source, |
| 5984 | }, |
| 5985 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5986 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5987 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5988 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5989 | .dac_nids = alc260_dac_nids, |
| 5990 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5991 | .adc_nids = alc260_adc_nids, |
| 5992 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5993 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5994 | .channel_mode = alc260_modes, |
| 5995 | .input_mux = &alc260_capture_source, |
| 5996 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5997 | .init_hook = alc260_replacer_672v_automute, |
| 5998 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5999 | #ifdef CONFIG_SND_DEBUG |
| 6000 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6001 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6002 | .init_verbs = { alc260_test_init_verbs }, |
| 6003 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6004 | .dac_nids = alc260_test_dac_nids, |
| 6005 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6006 | .adc_nids = alc260_test_adc_nids, |
| 6007 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6008 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6009 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6010 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6011 | }, |
| 6012 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6013 | }; |
| 6014 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6015 | static int patch_alc260(struct hda_codec *codec) |
| 6016 | { |
| 6017 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6018 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6019 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6020 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6021 | if (spec == NULL) |
| 6022 | return -ENOMEM; |
| 6023 | |
| 6024 | codec->spec = spec; |
| 6025 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6026 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6027 | alc260_models, |
| 6028 | alc260_cfg_tbl); |
| 6029 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6030 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 6031 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6032 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6033 | } |
| 6034 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6035 | if (board_config == ALC260_AUTO) { |
| 6036 | /* automatic parse from the BIOS config */ |
| 6037 | err = alc260_parse_auto_config(codec); |
| 6038 | if (err < 0) { |
| 6039 | alc_free(codec); |
| 6040 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6041 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6042 | printk(KERN_INFO |
| 6043 | "hda_codec: Cannot set up configuration " |
| 6044 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6045 | board_config = ALC260_BASIC; |
| 6046 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6047 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6048 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6049 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6050 | if (err < 0) { |
| 6051 | alc_free(codec); |
| 6052 | return err; |
| 6053 | } |
| 6054 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6055 | if (board_config != ALC260_AUTO) |
| 6056 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6057 | |
| 6058 | spec->stream_name_analog = "ALC260 Analog"; |
| 6059 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6060 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6061 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6062 | spec->stream_name_digital = "ALC260 Digital"; |
| 6063 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6064 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6065 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6066 | if (!spec->adc_nids && spec->input_mux) { |
| 6067 | /* check whether NID 0x04 is valid */ |
| 6068 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 6069 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 6070 | /* get type */ |
| 6071 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6072 | spec->adc_nids = alc260_adc_nids_alt; |
| 6073 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6074 | } else { |
| 6075 | spec->adc_nids = alc260_adc_nids; |
| 6076 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6077 | } |
| 6078 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6079 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6080 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6081 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6082 | spec->vmaster_nid = 0x08; |
| 6083 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6084 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6085 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6086 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6087 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6088 | if (!spec->loopback.amplist) |
| 6089 | spec->loopback.amplist = alc260_loopbacks; |
| 6090 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6091 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6092 | |
| 6093 | return 0; |
| 6094 | } |
| 6095 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6096 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6097 | /* |
| 6098 | * ALC882 support |
| 6099 | * |
| 6100 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6101 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6102 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6103 | * 6-channel independent captures. |
| 6104 | * |
| 6105 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6106 | * driver yet). |
| 6107 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6108 | #define ALC882_DIGOUT_NID 0x06 |
| 6109 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6110 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6111 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6112 | { 8, NULL } |
| 6113 | }; |
| 6114 | |
| 6115 | static hda_nid_t alc882_dac_nids[4] = { |
| 6116 | /* front, rear, clfe, rear_surr */ |
| 6117 | 0x02, 0x03, 0x04, 0x05 |
| 6118 | }; |
| 6119 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6120 | /* identical with ALC880 */ |
| 6121 | #define alc882_adc_nids alc880_adc_nids |
| 6122 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6123 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6124 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6125 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 6126 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6127 | /* input MUX */ |
| 6128 | /* FIXME: should be a matrix-type input source selection */ |
| 6129 | |
| 6130 | static struct hda_input_mux alc882_capture_source = { |
| 6131 | .num_items = 4, |
| 6132 | .items = { |
| 6133 | { "Mic", 0x0 }, |
| 6134 | { "Front Mic", 0x1 }, |
| 6135 | { "Line", 0x2 }, |
| 6136 | { "CD", 0x4 }, |
| 6137 | }, |
| 6138 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6139 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6140 | * 2ch mode |
| 6141 | */ |
| 6142 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6143 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6144 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6145 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6146 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6147 | { } /* end */ |
| 6148 | }; |
| 6149 | |
| 6150 | /* |
| 6151 | * 6ch mode |
| 6152 | */ |
| 6153 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6154 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6155 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6156 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6157 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6158 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6159 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6160 | { } /* end */ |
| 6161 | }; |
| 6162 | |
| 6163 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 6164 | { 2, alc882_3ST_ch2_init }, |
| 6165 | { 6, alc882_3ST_ch6_init }, |
| 6166 | }; |
| 6167 | |
| 6168 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6169 | * 6ch mode |
| 6170 | */ |
| 6171 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6172 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6173 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6174 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6175 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6176 | { } /* end */ |
| 6177 | }; |
| 6178 | |
| 6179 | /* |
| 6180 | * 8ch mode |
| 6181 | */ |
| 6182 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6183 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6184 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6185 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6186 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6187 | { } /* end */ |
| 6188 | }; |
| 6189 | |
| 6190 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6191 | { 6, alc882_sixstack_ch6_init }, |
| 6192 | { 8, alc882_sixstack_ch8_init }, |
| 6193 | }; |
| 6194 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6195 | /* |
| 6196 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 6197 | */ |
| 6198 | |
| 6199 | /* |
| 6200 | * 2ch mode |
| 6201 | */ |
| 6202 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6203 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6204 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6205 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6206 | { } /* end */ |
| 6207 | }; |
| 6208 | |
| 6209 | /* |
| 6210 | * 6ch mode |
| 6211 | */ |
| 6212 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6213 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6214 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6215 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6216 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6217 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6218 | { } /* end */ |
| 6219 | }; |
| 6220 | |
| 6221 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6222 | { 2, alc885_mbp_ch2_init }, |
| 6223 | { 6, alc885_mbp_ch6_init }, |
| 6224 | }; |
| 6225 | |
| 6226 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6227 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6228 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6229 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6230 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6231 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6232 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6233 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6234 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6235 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6236 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6237 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6238 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6239 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6240 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6241 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6242 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6243 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6244 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6245 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6246 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6247 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6248 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6249 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6250 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6251 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6252 | { } /* end */ |
| 6253 | }; |
| 6254 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6255 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6256 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6257 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6258 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6259 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6260 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6261 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6263 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6264 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6265 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6266 | { } /* end */ |
| 6267 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6268 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6269 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6270 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6271 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6272 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6273 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6274 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6275 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6276 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6277 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6278 | { } /* end */ |
| 6279 | }; |
| 6280 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6281 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6282 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6283 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6284 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6285 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6286 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6287 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6288 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6289 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6290 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6291 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6292 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6293 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6294 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6295 | { } /* end */ |
| 6296 | }; |
| 6297 | |
| 6298 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6299 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6300 | */ |
| 6301 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6302 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6303 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6304 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6305 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6306 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6307 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6308 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6309 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6310 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6311 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6312 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6313 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6314 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6315 | { } /* end */ |
| 6316 | }; |
| 6317 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6318 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6319 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6320 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6321 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6322 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6323 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6324 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6325 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6326 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6327 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6328 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6329 | { } /* end */ |
| 6330 | }; |
| 6331 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6332 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6333 | { |
| 6334 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6335 | .name = "Channel Mode", |
| 6336 | .info = alc_ch_mode_info, |
| 6337 | .get = alc_ch_mode_get, |
| 6338 | .put = alc_ch_mode_put, |
| 6339 | }, |
| 6340 | { } /* end */ |
| 6341 | }; |
| 6342 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6343 | static struct hda_verb alc882_init_verbs[] = { |
| 6344 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6345 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6346 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6347 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6348 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6349 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6350 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6351 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6352 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6353 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6354 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6355 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6356 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6357 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6358 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6359 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6360 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6361 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6362 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6363 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6364 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6365 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6366 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6367 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6368 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6369 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6370 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6371 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6372 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6373 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6374 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6375 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6376 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6377 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6378 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6379 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6380 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6381 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6382 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6383 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6384 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6385 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6386 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6387 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6388 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6389 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6390 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6391 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6392 | |
| 6393 | /* FIXME: use matrix-type input source selection */ |
| 6394 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6395 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6396 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6397 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6398 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6399 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6400 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6401 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6402 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6403 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6404 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6405 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6406 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6407 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6408 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6409 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6410 | /* ADC1: mute amp left and right */ |
| 6411 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6412 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6413 | /* ADC2: mute amp left and right */ |
| 6414 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6415 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6416 | /* ADC3: mute amp left and right */ |
| 6417 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6418 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6419 | |
| 6420 | { } |
| 6421 | }; |
| 6422 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6423 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6424 | /* change to EAPD mode */ |
| 6425 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6426 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6427 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6428 | }; |
| 6429 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6430 | /* Mac Pro test */ |
| 6431 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6432 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6433 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6434 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6435 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6436 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6437 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6438 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6439 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6440 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6441 | { } /* end */ |
| 6442 | }; |
| 6443 | |
| 6444 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6445 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6446 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6447 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6448 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6449 | /* Front Pin: output 0 (0x0c) */ |
| 6450 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6451 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6452 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6453 | /* Front Mic pin: input vref at 80% */ |
| 6454 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6455 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6456 | /* Speaker: output */ |
| 6457 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6458 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6459 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6460 | /* Headphone output (output 0 - 0x0c) */ |
| 6461 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6462 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6463 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6464 | |
| 6465 | /* FIXME: use matrix-type input source selection */ |
| 6466 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6467 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6468 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6469 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6470 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6471 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6472 | /* Input mixer2 */ |
| 6473 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6474 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6475 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6476 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6477 | /* Input mixer3 */ |
| 6478 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6479 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6480 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6481 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6482 | /* ADC1: mute amp left and right */ |
| 6483 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6484 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6485 | /* ADC2: mute amp left and right */ |
| 6486 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6487 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6488 | /* ADC3: mute amp left and right */ |
| 6489 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6490 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6491 | |
| 6492 | { } |
| 6493 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6494 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6495 | /* Macbook Pro rev3 */ |
| 6496 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6497 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6498 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6499 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6500 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6501 | /* Rear mixer */ |
| 6502 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6503 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6504 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6505 | /* Front Pin: output 0 (0x0c) */ |
| 6506 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6507 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6508 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6509 | /* HP Pin: output 0 (0x0d) */ |
| 6510 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6511 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6512 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6513 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6514 | /* Mic (rear) pin: input vref at 80% */ |
| 6515 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6516 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6517 | /* Front Mic pin: input vref at 80% */ |
| 6518 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6519 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6520 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6521 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6522 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6523 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6524 | |
| 6525 | /* FIXME: use matrix-type input source selection */ |
| 6526 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6527 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6528 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6529 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6530 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6531 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6532 | /* Input mixer2 */ |
| 6533 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6534 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6535 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6536 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6537 | /* Input mixer3 */ |
| 6538 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6539 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6540 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6541 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6542 | /* ADC1: mute amp left and right */ |
| 6543 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6544 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6545 | /* ADC2: mute amp left and right */ |
| 6546 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6547 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6548 | /* ADC3: mute amp left and right */ |
| 6549 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6550 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6551 | |
| 6552 | { } |
| 6553 | }; |
| 6554 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6555 | /* iMac 24 mixer. */ |
| 6556 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6557 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6558 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6559 | { } /* end */ |
| 6560 | }; |
| 6561 | |
| 6562 | /* iMac 24 init verbs. */ |
| 6563 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6564 | /* Internal speakers: output 0 (0x0c) */ |
| 6565 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6566 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6567 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6568 | /* Internal speakers: output 0 (0x0c) */ |
| 6569 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6570 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6571 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6572 | /* Headphone: output 0 (0x0c) */ |
| 6573 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6574 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6575 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6576 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6577 | /* Front Mic: input vref at 80% */ |
| 6578 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6579 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6580 | { } |
| 6581 | }; |
| 6582 | |
| 6583 | /* Toggle speaker-output according to the hp-jack state */ |
| 6584 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 6585 | { |
| 6586 | unsigned int present; |
| 6587 | |
| 6588 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6589 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6590 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 6591 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6592 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 6593 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6594 | } |
| 6595 | |
| 6596 | /* Processes unsolicited events. */ |
| 6597 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6598 | unsigned int res) |
| 6599 | { |
| 6600 | /* Headphone insertion or removal. */ |
| 6601 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6602 | alc885_imac24_automute(codec); |
| 6603 | } |
| 6604 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6605 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6606 | { |
| 6607 | unsigned int present; |
| 6608 | |
| 6609 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6610 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6611 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6612 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6613 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6614 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6615 | |
| 6616 | } |
| 6617 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6618 | unsigned int res) |
| 6619 | { |
| 6620 | /* Headphone insertion or removal. */ |
| 6621 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6622 | alc885_mbp3_automute(codec); |
| 6623 | } |
| 6624 | |
| 6625 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6626 | static struct hda_verb alc882_targa_verbs[] = { |
| 6627 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6628 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6629 | |
| 6630 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6631 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6632 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6633 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6634 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6635 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6636 | |
| 6637 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6638 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6639 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6640 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6641 | { } /* end */ |
| 6642 | }; |
| 6643 | |
| 6644 | /* toggle speaker-output according to the hp-jack state */ |
| 6645 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6646 | { |
| 6647 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6648 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6649 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6650 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6651 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6652 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6653 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6654 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6655 | } |
| 6656 | |
| 6657 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6658 | { |
| 6659 | /* Looks like the unsol event is incompatible with the standard |
| 6660 | * definition. 4bit tag is placed at 26 bit! |
| 6661 | */ |
| 6662 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6663 | alc882_targa_automute(codec); |
| 6664 | } |
| 6665 | } |
| 6666 | |
| 6667 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6668 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6669 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6670 | |
| 6671 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6672 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6673 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6674 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6675 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6676 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6677 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6678 | |
| 6679 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6680 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6681 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6682 | { } /* end */ |
| 6683 | }; |
| 6684 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6685 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6686 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6687 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6688 | |
| 6689 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6690 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6691 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6692 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6693 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6694 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6695 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6696 | |
| 6697 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6698 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6699 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6700 | { } /* end */ |
| 6701 | }; |
| 6702 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6703 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6704 | { |
| 6705 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6706 | |
| 6707 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6708 | AC_VERB_GET_GPIO_DATA, 0); |
| 6709 | |
| 6710 | if (!muted) |
| 6711 | gpiostate |= (1 << pin); |
| 6712 | else |
| 6713 | gpiostate &= ~(1 << pin); |
| 6714 | |
| 6715 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6716 | AC_VERB_GET_GPIO_MASK, 0); |
| 6717 | gpiomask |= (1 << pin); |
| 6718 | |
| 6719 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6720 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6721 | gpiodir |= (1 << pin); |
| 6722 | |
| 6723 | |
| 6724 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6725 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6726 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6727 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6728 | |
| 6729 | msleep(1); |
| 6730 | |
| 6731 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6732 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6733 | } |
| 6734 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6735 | /* set up GPIO at initialization */ |
| 6736 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6737 | { |
| 6738 | alc882_gpio_mute(codec, 0, 0); |
| 6739 | alc882_gpio_mute(codec, 1, 0); |
| 6740 | } |
| 6741 | |
| 6742 | /* set up GPIO and update auto-muting at initialization */ |
| 6743 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6744 | { |
| 6745 | alc885_macpro_init_hook(codec); |
| 6746 | alc885_imac24_automute(codec); |
| 6747 | } |
| 6748 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6749 | /* |
| 6750 | * generic initialization of ADC, input mixers and output mixers |
| 6751 | */ |
| 6752 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6753 | /* |
| 6754 | * Unmute ADC0-2 and set the default input to mic-in |
| 6755 | */ |
| 6756 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6757 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6758 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6759 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6760 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6761 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6762 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6763 | /* 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] | 6764 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6765 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6766 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6767 | */ |
| 6768 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6769 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6770 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6771 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6772 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6773 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6774 | |
| 6775 | /* |
| 6776 | * Set up output mixers (0x0c - 0x0f) |
| 6777 | */ |
| 6778 | /* set vol=0 to output mixers */ |
| 6779 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6780 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6781 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6782 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6783 | /* set up input amps for analog loopback */ |
| 6784 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6785 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6786 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6787 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6788 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6789 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6790 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6791 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6792 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6793 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6794 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6795 | |
| 6796 | /* FIXME: use matrix-type input source selection */ |
| 6797 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6798 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6799 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6800 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6801 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6802 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6803 | /* Input mixer2 */ |
| 6804 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6805 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6806 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6807 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6808 | /* Input mixer3 */ |
| 6809 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6810 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6811 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6812 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6813 | |
| 6814 | { } |
| 6815 | }; |
| 6816 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6817 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6818 | #define alc882_loopbacks alc880_loopbacks |
| 6819 | #endif |
| 6820 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6821 | /* pcm configuration: identiacal with ALC880 */ |
| 6822 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6823 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6824 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6825 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6826 | |
| 6827 | /* |
| 6828 | * configuration and preset |
| 6829 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6830 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6831 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6832 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6833 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6834 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6835 | [ALC882_TARGA] = "targa", |
| 6836 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6837 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6838 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6839 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6840 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6841 | [ALC882_AUTO] = "auto", |
| 6842 | }; |
| 6843 | |
| 6844 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6845 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6846 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6847 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6848 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6849 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6850 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6851 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6852 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6853 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6854 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6855 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6856 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6857 | {} |
| 6858 | }; |
| 6859 | |
| 6860 | static struct alc_config_preset alc882_presets[] = { |
| 6861 | [ALC882_3ST_DIG] = { |
| 6862 | .mixers = { alc882_base_mixer }, |
| 6863 | .init_verbs = { alc882_init_verbs }, |
| 6864 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6865 | .dac_nids = alc882_dac_nids, |
| 6866 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6867 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6868 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6869 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6870 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6871 | .input_mux = &alc882_capture_source, |
| 6872 | }, |
| 6873 | [ALC882_6ST_DIG] = { |
| 6874 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6875 | .init_verbs = { alc882_init_verbs }, |
| 6876 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6877 | .dac_nids = alc882_dac_nids, |
| 6878 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6879 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6880 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6881 | .channel_mode = alc882_sixstack_modes, |
| 6882 | .input_mux = &alc882_capture_source, |
| 6883 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6884 | [ALC882_ARIMA] = { |
| 6885 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6886 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6887 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6888 | .dac_nids = alc882_dac_nids, |
| 6889 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6890 | .channel_mode = alc882_sixstack_modes, |
| 6891 | .input_mux = &alc882_capture_source, |
| 6892 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6893 | [ALC882_W2JC] = { |
| 6894 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6895 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6896 | alc880_gpio1_init_verbs }, |
| 6897 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6898 | .dac_nids = alc882_dac_nids, |
| 6899 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6900 | .channel_mode = alc880_threestack_modes, |
| 6901 | .need_dac_fix = 1, |
| 6902 | .input_mux = &alc882_capture_source, |
| 6903 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6904 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6905 | [ALC885_MBP3] = { |
| 6906 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6907 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6908 | alc880_gpio1_init_verbs }, |
| 6909 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6910 | .dac_nids = alc882_dac_nids, |
| 6911 | .channel_mode = alc885_mbp_6ch_modes, |
| 6912 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6913 | .input_mux = &alc882_capture_source, |
| 6914 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6915 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6916 | .unsol_event = alc885_mbp3_unsol_event, |
| 6917 | .init_hook = alc885_mbp3_automute, |
| 6918 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6919 | [ALC885_MACPRO] = { |
| 6920 | .mixers = { alc882_macpro_mixer }, |
| 6921 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6922 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6923 | .dac_nids = alc882_dac_nids, |
| 6924 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6925 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6926 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6927 | .channel_mode = alc882_ch_modes, |
| 6928 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6929 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6930 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6931 | [ALC885_IMAC24] = { |
| 6932 | .mixers = { alc885_imac24_mixer }, |
| 6933 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6934 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6935 | .dac_nids = alc882_dac_nids, |
| 6936 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6937 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6938 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6939 | .channel_mode = alc882_ch_modes, |
| 6940 | .input_mux = &alc882_capture_source, |
| 6941 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6942 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6943 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6944 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6945 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6946 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6947 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6948 | .dac_nids = alc882_dac_nids, |
| 6949 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6950 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6951 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6952 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6953 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6954 | .channel_mode = alc882_3ST_6ch_modes, |
| 6955 | .need_dac_fix = 1, |
| 6956 | .input_mux = &alc882_capture_source, |
| 6957 | .unsol_event = alc882_targa_unsol_event, |
| 6958 | .init_hook = alc882_targa_automute, |
| 6959 | }, |
| 6960 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6961 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6962 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6963 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6964 | .dac_nids = alc882_dac_nids, |
| 6965 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6966 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6967 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6968 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6969 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6970 | .channel_mode = alc882_3ST_6ch_modes, |
| 6971 | .need_dac_fix = 1, |
| 6972 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6973 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6974 | [ALC882_ASUS_A7M] = { |
| 6975 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6976 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6977 | alc880_gpio1_init_verbs, |
| 6978 | alc882_asus_a7m_verbs }, |
| 6979 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6980 | .dac_nids = alc882_dac_nids, |
| 6981 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6982 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6983 | .channel_mode = alc880_threestack_modes, |
| 6984 | .need_dac_fix = 1, |
| 6985 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6986 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6987 | }; |
| 6988 | |
| 6989 | |
| 6990 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6991 | * Pin config fixes |
| 6992 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6993 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6994 | PINFIX_ABIT_AW9D_MAX |
| 6995 | }; |
| 6996 | |
| 6997 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6998 | { 0x15, 0x01080104 }, /* side */ |
| 6999 | { 0x16, 0x01011012 }, /* rear */ |
| 7000 | { 0x17, 0x01016011 }, /* clfe */ |
| 7001 | { } |
| 7002 | }; |
| 7003 | |
| 7004 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 7005 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 7006 | }; |
| 7007 | |
| 7008 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 7009 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 7010 | {} |
| 7011 | }; |
| 7012 | |
| 7013 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7014 | * BIOS auto configuration |
| 7015 | */ |
| 7016 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7017 | hda_nid_t nid, int pin_type, |
| 7018 | int dac_idx) |
| 7019 | { |
| 7020 | /* set as output */ |
| 7021 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7022 | int idx; |
| 7023 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7024 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7025 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7026 | idx = 4; |
| 7027 | else |
| 7028 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7029 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7030 | |
| 7031 | } |
| 7032 | |
| 7033 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 7034 | { |
| 7035 | struct alc_spec *spec = codec->spec; |
| 7036 | int i; |
| 7037 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7038 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7039 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7040 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7041 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7042 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7043 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7044 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7045 | } |
| 7046 | } |
| 7047 | |
| 7048 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 7049 | { |
| 7050 | struct alc_spec *spec = codec->spec; |
| 7051 | hda_nid_t pin; |
| 7052 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7053 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7054 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7055 | /* use dac 0 */ |
| 7056 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7057 | pin = spec->autocfg.speaker_pins[0]; |
| 7058 | if (pin) |
| 7059 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7060 | } |
| 7061 | |
| 7062 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7063 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 7064 | |
| 7065 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 7066 | { |
| 7067 | struct alc_spec *spec = codec->spec; |
| 7068 | int i; |
| 7069 | |
| 7070 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7071 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7072 | unsigned int vref; |
| 7073 | if (!nid) |
| 7074 | continue; |
| 7075 | vref = PIN_IN; |
| 7076 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 7077 | unsigned int pincap; |
| 7078 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 7079 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7080 | AC_PINCAP_VREF_80) |
| 7081 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7082 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 7083 | snd_hda_codec_write(codec, nid, 0, |
| 7084 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 7085 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 7086 | snd_hda_codec_write(codec, nid, 0, |
| 7087 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7088 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7089 | } |
| 7090 | } |
| 7091 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7092 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 7093 | { |
| 7094 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7095 | int c; |
| 7096 | |
| 7097 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 7098 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 7099 | hda_nid_t nid = spec->capsrc_nids[c]; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7100 | unsigned int mux_idx; |
| 7101 | const struct hda_input_mux *imux; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7102 | int conns, mute, idx, item; |
| 7103 | |
| 7104 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 7105 | ARRAY_SIZE(conn_list)); |
| 7106 | if (conns < 0) |
| 7107 | continue; |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7108 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 7109 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7110 | for (idx = 0; idx < conns; idx++) { |
| 7111 | /* if the current connection is the selected one, |
| 7112 | * unmute it as default - otherwise mute it |
| 7113 | */ |
| 7114 | mute = AMP_IN_MUTE(idx); |
| 7115 | for (item = 0; item < imux->num_items; item++) { |
| 7116 | if (imux->items[item].index == idx) { |
| 7117 | if (spec->cur_mux[c] == item) |
| 7118 | mute = AMP_IN_UNMUTE(idx); |
| 7119 | break; |
| 7120 | } |
| 7121 | } |
Herton Ronaldo Krzesinski | b98b7b3 | 2009-01-29 13:18:31 -0200 | [diff] [blame] | 7122 | /* check if we have a selector or mixer |
| 7123 | * we could check for the widget type instead, but |
| 7124 | * just check for Amp-In presence (in case of mixer |
| 7125 | * without amp-in there is something wrong, this |
| 7126 | * function shouldn't be used or capsrc nid is wrong) |
| 7127 | */ |
| 7128 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
| 7129 | snd_hda_codec_write(codec, nid, 0, |
| 7130 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7131 | mute); |
| 7132 | else if (mute != AMP_IN_MUTE(idx)) |
| 7133 | snd_hda_codec_write(codec, nid, 0, |
| 7134 | AC_VERB_SET_CONNECT_SEL, |
| 7135 | idx); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7136 | } |
| 7137 | } |
| 7138 | } |
| 7139 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7140 | /* add mic boosts if needed */ |
| 7141 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 7142 | { |
| 7143 | struct alc_spec *spec = codec->spec; |
| 7144 | int err; |
| 7145 | hda_nid_t nid; |
| 7146 | |
| 7147 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7148 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7149 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7150 | "Mic Boost", |
| 7151 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7152 | if (err < 0) |
| 7153 | return err; |
| 7154 | } |
| 7155 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 7156 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7157 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 7158 | "Front Mic Boost", |
| 7159 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 7160 | if (err < 0) |
| 7161 | return err; |
| 7162 | } |
| 7163 | return 0; |
| 7164 | } |
| 7165 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7166 | /* almost identical with ALC880 parser... */ |
| 7167 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 7168 | { |
| 7169 | struct alc_spec *spec = codec->spec; |
| 7170 | int err = alc880_parse_auto_config(codec); |
| 7171 | |
| 7172 | if (err < 0) |
| 7173 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7174 | else if (!err) |
| 7175 | return 0; /* no config found */ |
| 7176 | |
| 7177 | err = alc_auto_add_mic_boost(codec); |
| 7178 | if (err < 0) |
| 7179 | return err; |
| 7180 | |
| 7181 | /* hack - override the init verbs */ |
| 7182 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 7183 | |
| 7184 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7185 | } |
| 7186 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7187 | /* additional initialization for auto-configuration model */ |
| 7188 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7189 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7190 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7191 | alc882_auto_init_multi_out(codec); |
| 7192 | alc882_auto_init_hp_out(codec); |
| 7193 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 7194 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7195 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7196 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7197 | } |
| 7198 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7199 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 7200 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7201 | static int patch_alc882(struct hda_codec *codec) |
| 7202 | { |
| 7203 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7204 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7205 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7206 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7207 | if (spec == NULL) |
| 7208 | return -ENOMEM; |
| 7209 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7210 | codec->spec = spec; |
| 7211 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7212 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 7213 | alc882_models, |
| 7214 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7215 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7216 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7217 | /* Pick up systems that don't supply PCI SSID */ |
| 7218 | switch (codec->subsystem_id) { |
| 7219 | case 0x106b0c00: /* Mac Pro */ |
| 7220 | board_config = ALC885_MACPRO; |
| 7221 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7222 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 7223 | case 0x106b2800: /* AppleTV */ |
Mark Eggleston | 3077e44 | 2009-01-31 17:57:54 +0100 | [diff] [blame] | 7224 | case 0x106b3e00: /* iMac 24 Aluminium */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7225 | board_config = ALC885_IMAC24; |
| 7226 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7227 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 7228 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7229 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 7230 | case 0x106b3600: /* Macbook 3.1 */ |
Luke Yelavich | 2a88464 | 2009-01-28 15:58:38 +1100 | [diff] [blame] | 7231 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7232 | board_config = ALC885_MBP3; |
| 7233 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7234 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7235 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 7236 | if (codec->revision_id == 0x100101 || |
| 7237 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 7238 | alc_free(codec); |
| 7239 | return patch_alc883(codec); |
| 7240 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 7241 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 7242 | "trying auto-probe from BIOS...\n"); |
| 7243 | board_config = ALC882_AUTO; |
| 7244 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7245 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7246 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 7247 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 7248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7249 | if (board_config == ALC882_AUTO) { |
| 7250 | /* automatic parse from the BIOS config */ |
| 7251 | err = alc882_parse_auto_config(codec); |
| 7252 | if (err < 0) { |
| 7253 | alc_free(codec); |
| 7254 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7255 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7256 | printk(KERN_INFO |
| 7257 | "hda_codec: Cannot set up configuration " |
| 7258 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7259 | board_config = ALC882_3ST_DIG; |
| 7260 | } |
| 7261 | } |
| 7262 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7263 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7264 | if (err < 0) { |
| 7265 | alc_free(codec); |
| 7266 | return err; |
| 7267 | } |
| 7268 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7269 | if (board_config != ALC882_AUTO) |
| 7270 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7271 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 7272 | if (codec->vendor_id == 0x10ec0885) { |
| 7273 | spec->stream_name_analog = "ALC885 Analog"; |
| 7274 | spec->stream_name_digital = "ALC885 Digital"; |
| 7275 | } else { |
| 7276 | spec->stream_name_analog = "ALC882 Analog"; |
| 7277 | spec->stream_name_digital = "ALC882 Digital"; |
| 7278 | } |
| 7279 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7280 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 7281 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7282 | /* FIXME: setup DAC5 */ |
| 7283 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 7284 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7285 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7286 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 7287 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7288 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7289 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7290 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7291 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7292 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7293 | /* get type */ |
| 7294 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7295 | if (wcap != AC_WID_AUD_IN) { |
| 7296 | spec->adc_nids = alc882_adc_nids_alt; |
| 7297 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7298 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7299 | } else { |
| 7300 | spec->adc_nids = alc882_adc_nids; |
| 7301 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7302 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7303 | } |
| 7304 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7305 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7306 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7307 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7308 | spec->vmaster_nid = 0x0c; |
| 7309 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7310 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7311 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7312 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7313 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7314 | if (!spec->loopback.amplist) |
| 7315 | spec->loopback.amplist = alc882_loopbacks; |
| 7316 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 7317 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7318 | |
| 7319 | return 0; |
| 7320 | } |
| 7321 | |
| 7322 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7323 | * ALC883 support |
| 7324 | * |
| 7325 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 7326 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7327 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7328 | * 6-channel independent captures. |
| 7329 | * |
| 7330 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7331 | * driver yet). |
| 7332 | */ |
| 7333 | #define ALC883_DIGOUT_NID 0x06 |
| 7334 | #define ALC883_DIGIN_NID 0x0a |
| 7335 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 7336 | #define ALC1200_DIGOUT_NID 0x10 |
| 7337 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7338 | static hda_nid_t alc883_dac_nids[4] = { |
| 7339 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7340 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7341 | }; |
| 7342 | |
| 7343 | static hda_nid_t alc883_adc_nids[2] = { |
| 7344 | /* ADC1-2 */ |
| 7345 | 0x08, 0x09, |
| 7346 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7347 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7348 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 7349 | /* ADC1 */ |
| 7350 | 0x08, |
| 7351 | }; |
| 7352 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7353 | static hda_nid_t alc883_adc_nids_rev[2] = { |
| 7354 | /* ADC2-1 */ |
| 7355 | 0x09, 0x08 |
| 7356 | }; |
| 7357 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7358 | #define alc889_adc_nids alc880_adc_nids |
| 7359 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7360 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 7361 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 7362 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7363 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7364 | #define alc889_capsrc_nids alc882_capsrc_nids |
| 7365 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7366 | /* input MUX */ |
| 7367 | /* FIXME: should be a matrix-type input source selection */ |
| 7368 | |
| 7369 | static struct hda_input_mux alc883_capture_source = { |
| 7370 | .num_items = 4, |
| 7371 | .items = { |
| 7372 | { "Mic", 0x0 }, |
| 7373 | { "Front Mic", 0x1 }, |
| 7374 | { "Line", 0x2 }, |
| 7375 | { "CD", 0x4 }, |
| 7376 | }, |
| 7377 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7378 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7379 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7380 | .num_items = 4, |
| 7381 | .items = { |
| 7382 | { "Mic", 0x1 }, |
| 7383 | { "Front Mic", 0x0 }, |
| 7384 | { "Line", 0x2 }, |
| 7385 | { "CD", 0x4 }, |
| 7386 | }, |
| 7387 | }; |
| 7388 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7389 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7390 | .num_items = 2, |
| 7391 | .items = { |
| 7392 | { "Mic", 0x1 }, |
| 7393 | { "Line", 0x2 }, |
| 7394 | }, |
| 7395 | }; |
| 7396 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7397 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7398 | .num_items = 4, |
| 7399 | .items = { |
| 7400 | { "Mic", 0x0 }, |
| 7401 | { "iMic", 0x1 }, |
| 7402 | { "Line", 0x2 }, |
| 7403 | { "CD", 0x4 }, |
| 7404 | }, |
| 7405 | }; |
| 7406 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7407 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7408 | .num_items = 2, |
| 7409 | .items = { |
| 7410 | { "Mic", 0x0 }, |
| 7411 | { "Int Mic", 0x1 }, |
| 7412 | }, |
| 7413 | }; |
| 7414 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7415 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7416 | .num_items = 3, |
| 7417 | .items = { |
| 7418 | { "Mic", 0x0 }, |
| 7419 | { "Front Mic", 0x1 }, |
| 7420 | { "Line", 0x4 }, |
| 7421 | }, |
| 7422 | }; |
| 7423 | |
| 7424 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7425 | .num_items = 2, |
| 7426 | .items = { |
| 7427 | { "Mic", 0x0 }, |
| 7428 | { "Line", 0x2 }, |
| 7429 | }, |
| 7430 | }; |
| 7431 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7432 | /* |
| 7433 | * 2ch mode |
| 7434 | */ |
| 7435 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7436 | { 2, NULL } |
| 7437 | }; |
| 7438 | |
| 7439 | /* |
| 7440 | * 2ch mode |
| 7441 | */ |
| 7442 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 7443 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7444 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7445 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7446 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7447 | { } /* end */ |
| 7448 | }; |
| 7449 | |
| 7450 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7451 | * 4ch mode |
| 7452 | */ |
| 7453 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 7454 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7455 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7456 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7457 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7458 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7459 | { } /* end */ |
| 7460 | }; |
| 7461 | |
| 7462 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7463 | * 6ch mode |
| 7464 | */ |
| 7465 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 7466 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7467 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7468 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7469 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7470 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7471 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7472 | { } /* end */ |
| 7473 | }; |
| 7474 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7475 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7476 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7477 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7478 | { 6, alc883_3ST_ch6_init }, |
| 7479 | }; |
| 7480 | |
| 7481 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7482 | * 2ch mode |
| 7483 | */ |
| 7484 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7485 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7486 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7487 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7488 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7489 | { } /* end */ |
| 7490 | }; |
| 7491 | |
| 7492 | /* |
| 7493 | * 4ch mode |
| 7494 | */ |
| 7495 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7496 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7497 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7498 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7499 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7500 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7501 | { } /* end */ |
| 7502 | }; |
| 7503 | |
| 7504 | /* |
| 7505 | * 6ch mode |
| 7506 | */ |
| 7507 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7508 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7509 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7510 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7511 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7512 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7513 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7514 | { } /* end */ |
| 7515 | }; |
| 7516 | |
| 7517 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7518 | { 2, alc883_3ST_ch2_intel_init }, |
| 7519 | { 4, alc883_3ST_ch4_intel_init }, |
| 7520 | { 6, alc883_3ST_ch6_intel_init }, |
| 7521 | }; |
| 7522 | |
| 7523 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7524 | * 6ch mode |
| 7525 | */ |
| 7526 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7527 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7528 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7529 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7530 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7531 | { } /* end */ |
| 7532 | }; |
| 7533 | |
| 7534 | /* |
| 7535 | * 8ch mode |
| 7536 | */ |
| 7537 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7538 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7539 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7540 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7541 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7542 | { } /* end */ |
| 7543 | }; |
| 7544 | |
| 7545 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7546 | { 6, alc883_sixstack_ch6_init }, |
| 7547 | { 8, alc883_sixstack_ch8_init }, |
| 7548 | }; |
| 7549 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7550 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7551 | /* eanable EAPD on medion laptop */ |
| 7552 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7553 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7554 | { } |
| 7555 | }; |
| 7556 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7557 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7558 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7559 | */ |
| 7560 | |
| 7561 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7562 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7563 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7564 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7565 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7566 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7567 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7568 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7569 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7570 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7571 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7572 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7573 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7574 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7575 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7576 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7577 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7578 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7580 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7581 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7582 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7583 | { } /* end */ |
| 7584 | }; |
| 7585 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7586 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7587 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7588 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7589 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7590 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7591 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7592 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7593 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7594 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7595 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7596 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7597 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7598 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7599 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7600 | { } /* end */ |
| 7601 | }; |
| 7602 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7603 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7604 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7605 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7606 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7607 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7608 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7609 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7610 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7611 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7612 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7613 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7614 | { } /* end */ |
| 7615 | }; |
| 7616 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7617 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7618 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7619 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7620 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7621 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7622 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7623 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7624 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7625 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7626 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7627 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7628 | { } /* end */ |
| 7629 | }; |
| 7630 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7631 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7632 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7633 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7634 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7635 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7636 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7637 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7638 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7639 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7640 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7641 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7642 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7643 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7644 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7645 | { } /* end */ |
| 7646 | }; |
| 7647 | |
| 7648 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7649 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7650 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7651 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7652 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7653 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7654 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7655 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7656 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7657 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7658 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7659 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7660 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7661 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7662 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7663 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7664 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7665 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7666 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7667 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7668 | { } /* end */ |
| 7669 | }; |
| 7670 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7671 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7672 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7673 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7674 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7675 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7676 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7677 | HDA_OUTPUT), |
| 7678 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7679 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7680 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7681 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7682 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7683 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7684 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7685 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7686 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7687 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7688 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7689 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7690 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7691 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7692 | { } /* end */ |
| 7693 | }; |
| 7694 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7695 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7696 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7697 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7698 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7699 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7700 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7701 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7702 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7703 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7704 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7705 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7706 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7707 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7708 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7709 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7710 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7711 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7712 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7713 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7714 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7715 | { } /* end */ |
| 7716 | }; |
| 7717 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7718 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7719 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7720 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7721 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7722 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7723 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7724 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7725 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7726 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7727 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7728 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7729 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7730 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7731 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7732 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7733 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7734 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7735 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7736 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7737 | |
| 7738 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7739 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7740 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7741 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7742 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7743 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7744 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7745 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7746 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7747 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7748 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7749 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7750 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7751 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7752 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7753 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7754 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7755 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7756 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7757 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7758 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7759 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7760 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7761 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7762 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7763 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7764 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7765 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7766 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7767 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7768 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7769 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7770 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7771 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7772 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7773 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7774 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7775 | { } /* end */ |
| 7776 | }; |
| 7777 | |
| 7778 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7779 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7780 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7781 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7782 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7783 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7784 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7785 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7786 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7787 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7788 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7789 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7790 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7791 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7792 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7793 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7794 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7795 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7796 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7797 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7798 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7800 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7801 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7802 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7803 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7804 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7805 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7806 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7807 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7808 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7809 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7810 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7811 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7812 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7813 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7814 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7815 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7816 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7817 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7818 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7819 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7820 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7821 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7822 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7823 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7824 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7825 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7826 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7827 | { } /* end */ |
| 7828 | }; |
| 7829 | |
| 7830 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7831 | .ops = &snd_hda_bind_vol, |
| 7832 | .values = { |
| 7833 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7834 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7835 | 0 |
| 7836 | }, |
| 7837 | }; |
| 7838 | |
| 7839 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7840 | .ops = &snd_hda_bind_sw, |
| 7841 | .values = { |
| 7842 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7843 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7844 | 0 |
| 7845 | }, |
| 7846 | }; |
| 7847 | |
| 7848 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7849 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7850 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7851 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7852 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7853 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7854 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7855 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7856 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7857 | { } /* end */ |
| 7858 | }; |
| 7859 | |
| 7860 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7861 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7862 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7863 | { |
| 7864 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7865 | /* .name = "Capture Source", */ |
| 7866 | .name = "Input Source", |
| 7867 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7868 | .info = alc_mux_enum_info, |
| 7869 | .get = alc_mux_enum_get, |
| 7870 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7871 | }, |
| 7872 | { } /* end */ |
| 7873 | }; |
| 7874 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7875 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7876 | { |
| 7877 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7878 | .name = "Channel Mode", |
| 7879 | .info = alc_ch_mode_info, |
| 7880 | .get = alc_ch_mode_get, |
| 7881 | .put = alc_ch_mode_put, |
| 7882 | }, |
| 7883 | { } /* end */ |
| 7884 | }; |
| 7885 | |
| 7886 | static struct hda_verb alc883_init_verbs[] = { |
| 7887 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7888 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7889 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7890 | /* ADC2: mute amp left and right */ |
| 7891 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7892 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7893 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7894 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7895 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7896 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7897 | /* Rear mixer */ |
| 7898 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7899 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7900 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7901 | /* CLFE mixer */ |
| 7902 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7903 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7904 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7905 | /* Side mixer */ |
| 7906 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7907 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7908 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7909 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7910 | /* mute analog input loopbacks */ |
| 7911 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7912 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7913 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7914 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7915 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7916 | |
| 7917 | /* Front Pin: output 0 (0x0c) */ |
| 7918 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7919 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7920 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7921 | /* Rear Pin: output 1 (0x0d) */ |
| 7922 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7923 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7924 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7925 | /* CLFE Pin: output 2 (0x0e) */ |
| 7926 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7927 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7928 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7929 | /* Side Pin: output 3 (0x0f) */ |
| 7930 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7931 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7932 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7933 | /* Mic (rear) pin: input vref at 80% */ |
| 7934 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7935 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7936 | /* Front Mic pin: input vref at 80% */ |
| 7937 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7938 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7939 | /* Line In pin: input */ |
| 7940 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7941 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7942 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7943 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7944 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7945 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7946 | /* CD pin widget for input */ |
| 7947 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7948 | |
| 7949 | /* FIXME: use matrix-type input source selection */ |
| 7950 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7951 | /* Input mixer2 */ |
| 7952 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7953 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7954 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7955 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7956 | /* Input mixer3 */ |
| 7957 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7958 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7959 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7960 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7961 | { } |
| 7962 | }; |
| 7963 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7964 | /* toggle speaker-output according to the hp-jack state */ |
| 7965 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7966 | { |
| 7967 | unsigned int present; |
| 7968 | |
| 7969 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7970 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7971 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7972 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7973 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7974 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7975 | } |
| 7976 | |
| 7977 | /* auto-toggle front mic */ |
| 7978 | /* |
| 7979 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7980 | { |
| 7981 | unsigned int present; |
| 7982 | unsigned char bits; |
| 7983 | |
| 7984 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7985 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7986 | bits = present ? HDA_AMP_MUTE : 0; |
| 7987 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7988 | } |
| 7989 | */ |
| 7990 | |
| 7991 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7992 | { |
| 7993 | alc883_mitac_hp_automute(codec); |
| 7994 | /* alc883_mitac_mic_automute(codec); */ |
| 7995 | } |
| 7996 | |
| 7997 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7998 | unsigned int res) |
| 7999 | { |
| 8000 | switch (res >> 26) { |
| 8001 | case ALC880_HP_EVENT: |
| 8002 | alc883_mitac_hp_automute(codec); |
| 8003 | break; |
| 8004 | case ALC880_MIC_EVENT: |
| 8005 | /* alc883_mitac_mic_automute(codec); */ |
| 8006 | break; |
| 8007 | } |
| 8008 | } |
| 8009 | |
| 8010 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8011 | /* HP */ |
| 8012 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8013 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8014 | /* Subwoofer */ |
| 8015 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8016 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8017 | |
| 8018 | /* enable unsolicited event */ |
| 8019 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8020 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8021 | |
| 8022 | { } /* end */ |
| 8023 | }; |
| 8024 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8025 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8026 | /* HP */ |
| 8027 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8029 | /* Int speaker */ |
| 8030 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8031 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8032 | |
| 8033 | /* enable unsolicited event */ |
| 8034 | {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] | 8035 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8036 | |
| 8037 | { } /* end */ |
| 8038 | }; |
| 8039 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8040 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8041 | /* HP */ |
| 8042 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8043 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8044 | /* Subwoofer */ |
| 8045 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8046 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8047 | |
| 8048 | /* enable unsolicited event */ |
| 8049 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8050 | |
| 8051 | { } /* end */ |
| 8052 | }; |
| 8053 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8054 | static struct hda_verb alc883_tagra_verbs[] = { |
| 8055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8056 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8057 | |
| 8058 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8059 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8060 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8061 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8062 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8063 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8064 | |
| 8065 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8066 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 8067 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 8068 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8069 | |
| 8070 | { } /* end */ |
| 8071 | }; |
| 8072 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8073 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8074 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8075 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8076 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8077 | { } /* end */ |
| 8078 | }; |
| 8079 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8080 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8081 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8082 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8083 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8084 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8085 | { } /* end */ |
| 8086 | }; |
| 8087 | |
| 8088 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8089 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8090 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8091 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8092 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8093 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8094 | { } /* end */ |
| 8095 | }; |
| 8096 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8097 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8098 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8099 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8100 | |
| 8101 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8102 | |
| 8103 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8104 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8105 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8106 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8107 | { } /* end */ |
| 8108 | }; |
| 8109 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8110 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8111 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8112 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8113 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8114 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8115 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8116 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8117 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8118 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8119 | { } /* end */ |
| 8120 | }; |
| 8121 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8122 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8123 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8124 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8125 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8126 | { } |
| 8127 | }; |
| 8128 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8129 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8130 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8131 | { } |
| 8132 | }; |
| 8133 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8134 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8135 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8136 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8137 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8138 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8139 | { } |
| 8140 | }; |
| 8141 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8142 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8143 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8144 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8145 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8146 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8147 | { } |
| 8148 | }; |
| 8149 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8150 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 8151 | { 2, alc888_3st_hp_2ch_init }, |
| 8152 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8153 | }; |
| 8154 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8155 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8156 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8157 | { |
| 8158 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8159 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8160 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8161 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8162 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8163 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8164 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8165 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8166 | } |
| 8167 | |
| 8168 | /* toggle RCA according to the front-jack state */ |
| 8169 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8170 | { |
| 8171 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8172 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8173 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8174 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8175 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8176 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8177 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8178 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8179 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8180 | unsigned int res) |
| 8181 | { |
| 8182 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8183 | alc888_lenovo_ms7195_front_automute(codec); |
| 8184 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8185 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8186 | } |
| 8187 | |
| 8188 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8189 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8190 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8191 | |
| 8192 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8193 | |
| 8194 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8195 | { } /* end */ |
| 8196 | }; |
| 8197 | |
| 8198 | /* toggle speaker-output according to the hp-jack state */ |
| 8199 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 8200 | { |
| 8201 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8202 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8203 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8204 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8205 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8206 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8207 | } |
| 8208 | |
| 8209 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 8210 | unsigned int res) |
| 8211 | { |
| 8212 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8213 | alc883_medion_md2_automute(codec); |
| 8214 | } |
| 8215 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8216 | /* toggle speaker-output according to the hp-jack state */ |
| 8217 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 8218 | { |
| 8219 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8220 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8221 | |
| 8222 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8223 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8224 | bits = present ? HDA_AMP_MUTE : 0; |
| 8225 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8226 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8227 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 8228 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8229 | } |
| 8230 | |
| 8231 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8232 | { |
| 8233 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8234 | alc883_tagra_automute(codec); |
| 8235 | } |
| 8236 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8237 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8238 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8239 | { |
| 8240 | unsigned int present; |
| 8241 | unsigned char bits; |
| 8242 | |
| 8243 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8244 | & AC_PINSENSE_PRESENCE; |
| 8245 | bits = present ? HDA_AMP_MUTE : 0; |
| 8246 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8247 | HDA_AMP_MUTE, bits); |
| 8248 | } |
| 8249 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8250 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8251 | { |
| 8252 | unsigned int present; |
| 8253 | |
| 8254 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8255 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8256 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8257 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8258 | } |
| 8259 | |
| 8260 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 8261 | { |
| 8262 | alc883_clevo_m720_hp_automute(codec); |
| 8263 | alc883_clevo_m720_mic_automute(codec); |
| 8264 | } |
| 8265 | |
| 8266 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8267 | unsigned int res) |
| 8268 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8269 | switch (res >> 26) { |
| 8270 | case ALC880_HP_EVENT: |
| 8271 | alc883_clevo_m720_hp_automute(codec); |
| 8272 | break; |
| 8273 | case ALC880_MIC_EVENT: |
| 8274 | alc883_clevo_m720_mic_automute(codec); |
| 8275 | break; |
| 8276 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8277 | } |
| 8278 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8279 | /* toggle speaker-output according to the hp-jack state */ |
| 8280 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 8281 | { |
| 8282 | unsigned int present; |
| 8283 | unsigned char bits; |
| 8284 | |
| 8285 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8286 | & AC_PINSENSE_PRESENCE; |
| 8287 | bits = present ? HDA_AMP_MUTE : 0; |
| 8288 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8289 | HDA_AMP_MUTE, bits); |
| 8290 | } |
| 8291 | |
| 8292 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 8293 | unsigned int res) |
| 8294 | { |
| 8295 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8296 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 8297 | } |
| 8298 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8299 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 8300 | { |
| 8301 | unsigned int present; |
| 8302 | unsigned char bits; |
| 8303 | |
| 8304 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8305 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8306 | bits = present ? 0x80 : 0; |
| 8307 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8308 | 0x80, bits); |
| 8309 | } |
| 8310 | |
| 8311 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 8312 | unsigned int res) |
| 8313 | { |
| 8314 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8315 | alc883_haier_w66_automute(codec); |
| 8316 | } |
| 8317 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8318 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8319 | { |
| 8320 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8321 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8322 | |
| 8323 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8324 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8325 | bits = present ? HDA_AMP_MUTE : 0; |
| 8326 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8327 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8328 | } |
| 8329 | |
| 8330 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8331 | { |
| 8332 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8333 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8334 | |
| 8335 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8336 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8337 | bits = present ? HDA_AMP_MUTE : 0; |
| 8338 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8339 | HDA_AMP_MUTE, bits); |
| 8340 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8341 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8342 | } |
| 8343 | |
| 8344 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8345 | unsigned int res) |
| 8346 | { |
| 8347 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8348 | alc883_lenovo_101e_all_automute(codec); |
| 8349 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8350 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8351 | } |
| 8352 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8353 | /* toggle speaker-output according to the hp-jack state */ |
| 8354 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 8355 | { |
| 8356 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8357 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8358 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8359 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8360 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8361 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8362 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8363 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8364 | } |
| 8365 | |
| 8366 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 8367 | unsigned int res) |
| 8368 | { |
| 8369 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8370 | alc883_acer_aspire_automute(codec); |
| 8371 | } |
| 8372 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8373 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8374 | /* HP Pin: output 0 (0x0c) */ |
| 8375 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8376 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8377 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8378 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8379 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8380 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8381 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8382 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8383 | /* eanable EAPD on medion laptop */ |
| 8384 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8385 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8386 | /* enable unsolicited event */ |
| 8387 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8388 | { } |
| 8389 | }; |
| 8390 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8391 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 8392 | { |
| 8393 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8394 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8395 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8396 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8397 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8398 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8399 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8400 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8401 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8402 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8403 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8404 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8405 | } |
| 8406 | |
| 8407 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 8408 | unsigned int res) |
| 8409 | { |
| 8410 | switch (res >> 26) { |
| 8411 | case ALC880_HP_EVENT: |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 8412 | /* printk(KERN_DEBUG "hp_event\n"); */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8413 | alc888_6st_dell_front_automute(codec); |
| 8414 | break; |
| 8415 | } |
| 8416 | } |
| 8417 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8418 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 8419 | { |
| 8420 | unsigned int mute; |
| 8421 | unsigned int present; |
| 8422 | |
| 8423 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8424 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8425 | AC_VERB_GET_PIN_SENSE, 0); |
| 8426 | present = (present & 0x80000000) != 0; |
| 8427 | if (present) { |
| 8428 | /* mute internal speaker */ |
| 8429 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8430 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8431 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8432 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8433 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8434 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8435 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8436 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8437 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8438 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8439 | } else { |
| 8440 | /* unmute internal speaker if necessary */ |
| 8441 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8442 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8443 | HDA_AMP_MUTE, mute); |
| 8444 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8445 | HDA_AMP_MUTE, mute); |
| 8446 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8447 | HDA_AMP_MUTE, mute); |
| 8448 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 8449 | HDA_AMP_MUTE, mute); |
| 8450 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 8451 | HDA_AMP_MUTE, mute); |
| 8452 | } |
| 8453 | } |
| 8454 | |
| 8455 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 8456 | unsigned int res) |
| 8457 | { |
| 8458 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8459 | alc888_lenovo_sky_front_automute(codec); |
| 8460 | } |
| 8461 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8462 | /* |
| 8463 | * generic initialization of ADC, input mixers and output mixers |
| 8464 | */ |
| 8465 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8466 | /* |
| 8467 | * Unmute ADC0-2 and set the default input to mic-in |
| 8468 | */ |
| 8469 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8470 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8471 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8472 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8473 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8474 | /* 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] | 8475 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8476 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8477 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8478 | */ |
| 8479 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8480 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8481 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8482 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8483 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8484 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8485 | |
| 8486 | /* |
| 8487 | * Set up output mixers (0x0c - 0x0f) |
| 8488 | */ |
| 8489 | /* set vol=0 to output mixers */ |
| 8490 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8491 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8492 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8493 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8494 | /* set up input amps for analog loopback */ |
| 8495 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8496 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8497 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8498 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8499 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8500 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8501 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8502 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8503 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8504 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8505 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8506 | |
| 8507 | /* FIXME: use matrix-type input source selection */ |
| 8508 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8509 | /* Input mixer1 */ |
| 8510 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8511 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8512 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8513 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8514 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8515 | /* Input mixer2 */ |
| 8516 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8517 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8518 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8519 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8520 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8521 | |
| 8522 | { } |
| 8523 | }; |
| 8524 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8525 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8526 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8527 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8528 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8529 | /* enable unsolicited event */ |
| 8530 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8531 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8532 | { } /* end */ |
| 8533 | }; |
| 8534 | |
| 8535 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8536 | { |
| 8537 | unsigned int present; |
| 8538 | |
| 8539 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8540 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8541 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8542 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8543 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8544 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8545 | } |
| 8546 | |
| 8547 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8548 | { |
| 8549 | unsigned int present; |
| 8550 | unsigned char bits; |
| 8551 | |
| 8552 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8553 | AC_VERB_GET_PIN_SENSE, 0) |
| 8554 | & AC_PINSENSE_PRESENCE; |
| 8555 | bits = present ? 0 : PIN_OUT; |
| 8556 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8557 | bits); |
| 8558 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8559 | bits); |
| 8560 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8561 | bits); |
| 8562 | } |
| 8563 | |
| 8564 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8565 | unsigned int res) |
| 8566 | { |
| 8567 | switch (res >> 26) { |
| 8568 | case ALC880_HP_EVENT: |
| 8569 | alc883_M90V_speaker_automute(codec); |
| 8570 | break; |
| 8571 | case ALC880_MIC_EVENT: |
| 8572 | alc883_nb_mic_automute(codec); |
| 8573 | break; |
| 8574 | } |
| 8575 | } |
| 8576 | |
| 8577 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8578 | { |
| 8579 | alc883_M90V_speaker_automute(codec); |
| 8580 | alc883_nb_mic_automute(codec); |
| 8581 | } |
| 8582 | |
| 8583 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8584 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8585 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8586 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8587 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8588 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8589 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8590 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8591 | /* enable unsolicited event */ |
| 8592 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8593 | { } /* end */ |
| 8594 | }; |
| 8595 | |
| 8596 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8597 | { |
| 8598 | unsigned int present; |
| 8599 | unsigned char bits; |
| 8600 | |
| 8601 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8602 | AC_VERB_GET_PIN_SENSE, 0) |
| 8603 | & AC_PINSENSE_PRESENCE; |
| 8604 | bits = present ? 0 : PIN_OUT; |
| 8605 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8606 | bits); |
| 8607 | } |
| 8608 | |
| 8609 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8610 | unsigned int res) |
| 8611 | { |
| 8612 | switch (res >> 26) { |
| 8613 | case ALC880_HP_EVENT: |
| 8614 | alc883_eee1601_speaker_automute(codec); |
| 8615 | break; |
| 8616 | } |
| 8617 | } |
| 8618 | |
| 8619 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8620 | { |
| 8621 | alc883_eee1601_speaker_automute(codec); |
| 8622 | } |
| 8623 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8624 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8625 | #define alc883_loopbacks alc880_loopbacks |
| 8626 | #endif |
| 8627 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8628 | /* pcm configuration: identiacal with ALC880 */ |
| 8629 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8630 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8631 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8632 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8633 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8634 | |
| 8635 | /* |
| 8636 | * configuration and preset |
| 8637 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8638 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8639 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8640 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8641 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8642 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8643 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8644 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8645 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8646 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8647 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8648 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8649 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8650 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8651 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8652 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8653 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8654 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8655 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8656 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8657 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8658 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8659 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8660 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8661 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8662 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8663 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8664 | [ALC883_AUTO] = "auto", |
| 8665 | }; |
| 8666 | |
| 8667 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8668 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8669 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8670 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8671 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8672 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8673 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8674 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8675 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8676 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8677 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | b3bdb30 | 2009-02-18 13:16:26 +0100 | [diff] [blame] | 8678 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), |
Takashi Iwai | 9468350 | 2009-02-13 09:31:20 +0100 | [diff] [blame] | 8679 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8680 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 8681 | ALC888_ACER_ASPIRE_4930G), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8682 | /* default Acer */ |
| 8683 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8684 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8685 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8686 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8687 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8688 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8689 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8690 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8691 | 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] | 8692 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8693 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8694 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8695 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8696 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8697 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8698 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8699 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8700 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8701 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8702 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8703 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8704 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8705 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8706 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8707 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8708 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8709 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8710 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8711 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8712 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8713 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8714 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8715 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8716 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8717 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8718 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8719 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8720 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8721 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8722 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8723 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8724 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8725 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8726 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8727 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8728 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8729 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8730 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8731 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8732 | SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", |
| 8733 | ALC883_FUJITSU_PI2515), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8734 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8735 | SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", |
| 8736 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8737 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8738 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8739 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8740 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8741 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8742 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8743 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8744 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8745 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8746 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8747 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8748 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 8749 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8750 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8751 | {} |
| 8752 | }; |
| 8753 | |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 8754 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8755 | ALC883_DIGOUT_NID, 0, |
| 8756 | }; |
| 8757 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8758 | static struct alc_config_preset alc883_presets[] = { |
| 8759 | [ALC883_3ST_2ch_DIG] = { |
| 8760 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8761 | .init_verbs = { alc883_init_verbs }, |
| 8762 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8763 | .dac_nids = alc883_dac_nids, |
| 8764 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8765 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8766 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8767 | .channel_mode = alc883_3ST_2ch_modes, |
| 8768 | .input_mux = &alc883_capture_source, |
| 8769 | }, |
| 8770 | [ALC883_3ST_6ch_DIG] = { |
| 8771 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8772 | .init_verbs = { alc883_init_verbs }, |
| 8773 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8774 | .dac_nids = alc883_dac_nids, |
| 8775 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8776 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8777 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8778 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8779 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8780 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8781 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8782 | [ALC883_3ST_6ch] = { |
| 8783 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8784 | .init_verbs = { alc883_init_verbs }, |
| 8785 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8786 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8787 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8788 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8789 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8790 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8791 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8792 | [ALC883_3ST_6ch_INTEL] = { |
| 8793 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8794 | .init_verbs = { alc883_init_verbs }, |
| 8795 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8796 | .dac_nids = alc883_dac_nids, |
| 8797 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8798 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8799 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8800 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8801 | .need_dac_fix = 1, |
| 8802 | .input_mux = &alc883_3stack_6ch_intel, |
| 8803 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8804 | [ALC883_6ST_DIG] = { |
| 8805 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8806 | .init_verbs = { alc883_init_verbs }, |
| 8807 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8808 | .dac_nids = alc883_dac_nids, |
| 8809 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8810 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8811 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8812 | .channel_mode = alc883_sixstack_modes, |
| 8813 | .input_mux = &alc883_capture_source, |
| 8814 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8815 | [ALC883_TARGA_DIG] = { |
| 8816 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8817 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8818 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8819 | .dac_nids = alc883_dac_nids, |
| 8820 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8821 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8822 | .channel_mode = alc883_3ST_6ch_modes, |
| 8823 | .need_dac_fix = 1, |
| 8824 | .input_mux = &alc883_capture_source, |
| 8825 | .unsol_event = alc883_tagra_unsol_event, |
| 8826 | .init_hook = alc883_tagra_automute, |
| 8827 | }, |
| 8828 | [ALC883_TARGA_2ch_DIG] = { |
| 8829 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8830 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8831 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8832 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8833 | .adc_nids = alc883_adc_nids_alt, |
| 8834 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8835 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8836 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8837 | .channel_mode = alc883_3ST_2ch_modes, |
| 8838 | .input_mux = &alc883_capture_source, |
| 8839 | .unsol_event = alc883_tagra_unsol_event, |
| 8840 | .init_hook = alc883_tagra_automute, |
| 8841 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8842 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8843 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8844 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8845 | * and the headphone jack. Turn this on and rely on the |
| 8846 | * standard mute methods whenever the user wants to turn |
| 8847 | * these outputs off. |
| 8848 | */ |
| 8849 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8850 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8851 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8852 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8853 | .channel_mode = alc883_3ST_2ch_modes, |
| 8854 | .input_mux = &alc883_capture_source, |
| 8855 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8856 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8857 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8858 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8859 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8860 | .dac_nids = alc883_dac_nids, |
| 8861 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8862 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8863 | .channel_mode = alc883_3ST_2ch_modes, |
| 8864 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8865 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8866 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8867 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8868 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8869 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8870 | alc883_chmode_mixer }, |
| 8871 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8872 | alc888_acer_aspire_4930g_verbs }, |
| 8873 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8874 | .dac_nids = alc883_dac_nids, |
| 8875 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8876 | .adc_nids = alc883_adc_nids_rev, |
| 8877 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8878 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8879 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8880 | .channel_mode = alc883_3ST_6ch_modes, |
| 8881 | .need_dac_fix = 1, |
| 8882 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8883 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8884 | .input_mux = alc888_2_capture_sources, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8885 | .unsol_event = alc888_acer_aspire_4930g_unsol_event, |
| 8886 | .init_hook = alc888_acer_aspire_4930g_automute, |
| 8887 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8888 | [ALC883_MEDION] = { |
| 8889 | .mixers = { alc883_fivestack_mixer, |
| 8890 | alc883_chmode_mixer }, |
| 8891 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8892 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8893 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8894 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8895 | .adc_nids = alc883_adc_nids_alt, |
| 8896 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8897 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8898 | .channel_mode = alc883_sixstack_modes, |
| 8899 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8900 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8901 | [ALC883_MEDION_MD2] = { |
| 8902 | .mixers = { alc883_medion_md2_mixer}, |
| 8903 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8904 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8905 | .dac_nids = alc883_dac_nids, |
| 8906 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8907 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8908 | .channel_mode = alc883_3ST_2ch_modes, |
| 8909 | .input_mux = &alc883_capture_source, |
| 8910 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8911 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8912 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8913 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8914 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8915 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8916 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8917 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8918 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8919 | .channel_mode = alc883_3ST_2ch_modes, |
| 8920 | .input_mux = &alc883_capture_source, |
| 8921 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8922 | [ALC883_CLEVO_M720] = { |
| 8923 | .mixers = { alc883_clevo_m720_mixer }, |
| 8924 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8925 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8926 | .dac_nids = alc883_dac_nids, |
| 8927 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8928 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8929 | .channel_mode = alc883_3ST_2ch_modes, |
| 8930 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8931 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8932 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8933 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8934 | [ALC883_LENOVO_101E_2ch] = { |
| 8935 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8936 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8937 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8938 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8939 | .adc_nids = alc883_adc_nids_alt, |
| 8940 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8941 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8942 | .channel_mode = alc883_3ST_2ch_modes, |
| 8943 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8944 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8945 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8946 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8947 | [ALC883_LENOVO_NB0763] = { |
| 8948 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8949 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8950 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8951 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8952 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8953 | .channel_mode = alc883_3ST_2ch_modes, |
| 8954 | .need_dac_fix = 1, |
| 8955 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8956 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8957 | .init_hook = alc883_medion_md2_automute, |
| 8958 | }, |
| 8959 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8960 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8961 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8962 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8963 | .dac_nids = alc883_dac_nids, |
| 8964 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8965 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8966 | .channel_mode = alc883_3ST_6ch_modes, |
| 8967 | .need_dac_fix = 1, |
| 8968 | .input_mux = &alc883_capture_source, |
| 8969 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8970 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8971 | }, |
| 8972 | [ALC883_HAIER_W66] = { |
| 8973 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8974 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8975 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8976 | .dac_nids = alc883_dac_nids, |
| 8977 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8978 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8979 | .channel_mode = alc883_3ST_2ch_modes, |
| 8980 | .input_mux = &alc883_capture_source, |
| 8981 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8982 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8983 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8984 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8985 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8986 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8987 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8988 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8989 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8990 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8991 | .need_dac_fix = 1, |
| 8992 | .input_mux = &alc883_capture_source, |
| 8993 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8994 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8995 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8996 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8997 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8998 | .dac_nids = alc883_dac_nids, |
| 8999 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9000 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9001 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9002 | .channel_mode = alc883_sixstack_modes, |
| 9003 | .input_mux = &alc883_capture_source, |
| 9004 | .unsol_event = alc888_6st_dell_unsol_event, |
| 9005 | .init_hook = alc888_6st_dell_front_automute, |
| 9006 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9007 | [ALC883_MITAC] = { |
| 9008 | .mixers = { alc883_mitac_mixer }, |
| 9009 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9010 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9011 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9012 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9013 | .channel_mode = alc883_3ST_2ch_modes, |
| 9014 | .input_mux = &alc883_capture_source, |
| 9015 | .unsol_event = alc883_mitac_unsol_event, |
| 9016 | .init_hook = alc883_mitac_automute, |
| 9017 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9018 | [ALC883_FUJITSU_PI2515] = { |
| 9019 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9020 | .init_verbs = { alc883_init_verbs, |
| 9021 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9022 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9023 | .dac_nids = alc883_dac_nids, |
| 9024 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9025 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9026 | .channel_mode = alc883_3ST_2ch_modes, |
| 9027 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9028 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 9029 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 9030 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9031 | [ALC888_FUJITSU_XA3530] = { |
| 9032 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9033 | .init_verbs = { alc883_init_verbs, |
| 9034 | alc888_fujitsu_xa3530_verbs }, |
| 9035 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9036 | .dac_nids = alc883_dac_nids, |
| 9037 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9038 | .adc_nids = alc883_adc_nids_rev, |
| 9039 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9040 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9041 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9042 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9043 | .num_mux_defs = |
| 9044 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9045 | .input_mux = alc888_2_capture_sources, |
| 9046 | .unsol_event = alc888_fujitsu_xa3530_unsol_event, |
| 9047 | .init_hook = alc888_fujitsu_xa3530_automute, |
| 9048 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9049 | [ALC888_LENOVO_SKY] = { |
| 9050 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9051 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9052 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9053 | .dac_nids = alc883_dac_nids, |
| 9054 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9055 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9056 | .channel_mode = alc883_sixstack_modes, |
| 9057 | .need_dac_fix = 1, |
| 9058 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 9059 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 9060 | .init_hook = alc888_lenovo_sky_front_automute, |
| 9061 | }, |
| 9062 | [ALC888_ASUS_M90V] = { |
| 9063 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9064 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9065 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9066 | .dac_nids = alc883_dac_nids, |
| 9067 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9068 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9069 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9070 | .channel_mode = alc883_3ST_6ch_modes, |
| 9071 | .need_dac_fix = 1, |
| 9072 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9073 | .unsol_event = alc883_mode2_unsol_event, |
| 9074 | .init_hook = alc883_mode2_inithook, |
| 9075 | }, |
| 9076 | [ALC888_ASUS_EEE1601] = { |
| 9077 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9078 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9079 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9080 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9081 | .dac_nids = alc883_dac_nids, |
| 9082 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9083 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9084 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9085 | .channel_mode = alc883_3ST_2ch_modes, |
| 9086 | .need_dac_fix = 1, |
| 9087 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 9088 | .unsol_event = alc883_eee1601_unsol_event, |
| 9089 | .init_hook = alc883_eee1601_inithook, |
| 9090 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9091 | [ALC1200_ASUS_P5Q] = { |
| 9092 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9093 | .init_verbs = { alc883_init_verbs }, |
| 9094 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9095 | .dac_nids = alc883_dac_nids, |
| 9096 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9097 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9098 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9099 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9100 | .channel_mode = alc883_sixstack_modes, |
| 9101 | .input_mux = &alc883_capture_source, |
| 9102 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9103 | }; |
| 9104 | |
| 9105 | |
| 9106 | /* |
| 9107 | * BIOS auto configuration |
| 9108 | */ |
| 9109 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 9110 | hda_nid_t nid, int pin_type, |
| 9111 | int dac_idx) |
| 9112 | { |
| 9113 | /* set as output */ |
| 9114 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9115 | int idx; |
| 9116 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9117 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9118 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9119 | idx = 4; |
| 9120 | else |
| 9121 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9122 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9123 | |
| 9124 | } |
| 9125 | |
| 9126 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 9127 | { |
| 9128 | struct alc_spec *spec = codec->spec; |
| 9129 | int i; |
| 9130 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9131 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9132 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9133 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9134 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9135 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9136 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9137 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9138 | } |
| 9139 | } |
| 9140 | |
| 9141 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 9142 | { |
| 9143 | struct alc_spec *spec = codec->spec; |
| 9144 | hda_nid_t pin; |
| 9145 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9146 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9147 | if (pin) /* connect to front */ |
| 9148 | /* use dac 0 */ |
| 9149 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9150 | pin = spec->autocfg.speaker_pins[0]; |
| 9151 | if (pin) |
| 9152 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9153 | } |
| 9154 | |
| 9155 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 9156 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 9157 | |
| 9158 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 9159 | { |
| 9160 | struct alc_spec *spec = codec->spec; |
| 9161 | int i; |
| 9162 | |
| 9163 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9164 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 9165 | if (alc883_is_input_pin(nid)) { |
| 9166 | snd_hda_codec_write(codec, nid, 0, |
| 9167 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9168 | (i <= AUTO_PIN_FRONT_MIC ? |
| 9169 | PIN_VREF80 : PIN_IN)); |
| 9170 | if (nid != ALC883_PIN_CD_NID) |
| 9171 | snd_hda_codec_write(codec, nid, 0, |
| 9172 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9173 | AMP_OUT_MUTE); |
| 9174 | } |
| 9175 | } |
| 9176 | } |
| 9177 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9178 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 9179 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9180 | /* almost identical with ALC880 parser... */ |
| 9181 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 9182 | { |
| 9183 | struct alc_spec *spec = codec->spec; |
| 9184 | int err = alc880_parse_auto_config(codec); |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9185 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 9186 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9187 | |
| 9188 | if (err < 0) |
| 9189 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9190 | else if (!err) |
| 9191 | return 0; /* no config found */ |
| 9192 | |
| 9193 | err = alc_auto_add_mic_boost(codec); |
| 9194 | if (err < 0) |
| 9195 | return err; |
| 9196 | |
| 9197 | /* hack - override the init verbs */ |
| 9198 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9199 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9200 | /* setup input_mux for ALC889 */ |
| 9201 | if (codec->vendor_id == 0x10ec0889) { |
| 9202 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9203 | * because it's under 0x18 |
| 9204 | */ |
| 9205 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9206 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9207 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9208 | for (i = 1; i < 3; i++) |
| 9209 | memcpy(&spec->private_imux[i], |
| 9210 | &spec->private_imux[0], |
| 9211 | sizeof(spec->private_imux[0])); |
| 9212 | imux->items[imux->num_items].label = "Int DMic"; |
| 9213 | imux->items[imux->num_items].index = 0x0b; |
| 9214 | imux->num_items++; |
| 9215 | spec->num_mux_defs = 3; |
| 9216 | spec->input_mux = spec->private_imux; |
| 9217 | } |
| 9218 | } |
| 9219 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9220 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9221 | } |
| 9222 | |
| 9223 | /* additional initialization for auto-configuration model */ |
| 9224 | static void alc883_auto_init(struct hda_codec *codec) |
| 9225 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9226 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9227 | alc883_auto_init_multi_out(codec); |
| 9228 | alc883_auto_init_hp_out(codec); |
| 9229 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 9230 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9231 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9232 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9233 | } |
| 9234 | |
| 9235 | static int patch_alc883(struct hda_codec *codec) |
| 9236 | { |
| 9237 | struct alc_spec *spec; |
| 9238 | int err, board_config; |
| 9239 | |
| 9240 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9241 | if (spec == NULL) |
| 9242 | return -ENOMEM; |
| 9243 | |
| 9244 | codec->spec = spec; |
| 9245 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9246 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9247 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9248 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 9249 | alc883_models, |
| 9250 | alc883_cfg_tbl); |
| 9251 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9252 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 9253 | "trying auto-probe from BIOS...\n"); |
| 9254 | board_config = ALC883_AUTO; |
| 9255 | } |
| 9256 | |
| 9257 | if (board_config == ALC883_AUTO) { |
| 9258 | /* automatic parse from the BIOS config */ |
| 9259 | err = alc883_parse_auto_config(codec); |
| 9260 | if (err < 0) { |
| 9261 | alc_free(codec); |
| 9262 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9263 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9264 | printk(KERN_INFO |
| 9265 | "hda_codec: Cannot set up configuration " |
| 9266 | "from BIOS. Using base mode...\n"); |
| 9267 | board_config = ALC883_3ST_2ch_DIG; |
| 9268 | } |
| 9269 | } |
| 9270 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9271 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9272 | if (err < 0) { |
| 9273 | alc_free(codec); |
| 9274 | return err; |
| 9275 | } |
| 9276 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9277 | if (board_config != ALC883_AUTO) |
| 9278 | setup_preset(spec, &alc883_presets[board_config]); |
| 9279 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9280 | switch (codec->vendor_id) { |
| 9281 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 9282 | if (codec->revision_id == 0x100101) { |
| 9283 | spec->stream_name_analog = "ALC1200 Analog"; |
| 9284 | spec->stream_name_digital = "ALC1200 Digital"; |
| 9285 | } else { |
| 9286 | spec->stream_name_analog = "ALC888 Analog"; |
| 9287 | spec->stream_name_digital = "ALC888 Digital"; |
| 9288 | } |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9289 | if (!spec->num_adc_nids) { |
| 9290 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9291 | spec->adc_nids = alc883_adc_nids; |
| 9292 | } |
| 9293 | if (!spec->capsrc_nids) |
| 9294 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9295 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9296 | break; |
| 9297 | case 0x10ec0889: |
| 9298 | spec->stream_name_analog = "ALC889 Analog"; |
| 9299 | spec->stream_name_digital = "ALC889 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9300 | if (!spec->num_adc_nids) { |
| 9301 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); |
| 9302 | spec->adc_nids = alc889_adc_nids; |
| 9303 | } |
| 9304 | if (!spec->capsrc_nids) |
| 9305 | spec->capsrc_nids = alc889_capsrc_nids; |
| 9306 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style |
| 9307 | capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9308 | break; |
| 9309 | default: |
| 9310 | spec->stream_name_analog = "ALC883 Analog"; |
| 9311 | spec->stream_name_digital = "ALC883 Digital"; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9312 | if (!spec->num_adc_nids) { |
| 9313 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 9314 | spec->adc_nids = alc883_adc_nids; |
| 9315 | } |
| 9316 | if (!spec->capsrc_nids) |
| 9317 | spec->capsrc_nids = alc883_capsrc_nids; |
| 9318 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9319 | break; |
| 9320 | } |
| 9321 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9322 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 9323 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9324 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9325 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9326 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 9327 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 9328 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9329 | if (!spec->cap_mixer) |
| 9330 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9331 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9332 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9333 | spec->vmaster_nid = 0x0c; |
| 9334 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9335 | codec->patch_ops = alc_patch_ops; |
| 9336 | if (board_config == ALC883_AUTO) |
| 9337 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 9338 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9339 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9340 | if (!spec->loopback.amplist) |
| 9341 | spec->loopback.amplist = alc883_loopbacks; |
| 9342 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9343 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9344 | |
| 9345 | return 0; |
| 9346 | } |
| 9347 | |
| 9348 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9349 | * ALC262 support |
| 9350 | */ |
| 9351 | |
| 9352 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9353 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9354 | |
| 9355 | #define alc262_dac_nids alc260_dac_nids |
| 9356 | #define alc262_adc_nids alc882_adc_nids |
| 9357 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9358 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9359 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9360 | |
| 9361 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9362 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9363 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9364 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9365 | /* ADC0 */ |
| 9366 | 0x09 |
| 9367 | }; |
| 9368 | |
| 9369 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9370 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9371 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9372 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9373 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9374 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9375 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9376 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9377 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9379 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9380 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9381 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9382 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9383 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9384 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9385 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9386 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9387 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9388 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9389 | }; |
| 9390 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9391 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9392 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9393 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9394 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9395 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9396 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9397 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9398 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9399 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9400 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9401 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9402 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9403 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9404 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 9405 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9406 | { } /* end */ |
| 9407 | }; |
| 9408 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9409 | /* update HP, line and mono-out pins according to the master switch */ |
| 9410 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9411 | { |
| 9412 | struct alc_spec *spec = codec->spec; |
| 9413 | int val = spec->master_sw; |
| 9414 | |
| 9415 | /* HP & line-out */ |
| 9416 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9417 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9418 | val ? PIN_HP : 0); |
| 9419 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9420 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9421 | val ? PIN_HP : 0); |
| 9422 | /* mono (speaker) depending on the HP jack sense */ |
| 9423 | val = val && !spec->jack_present; |
| 9424 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9425 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9426 | val ? PIN_OUT : 0); |
| 9427 | } |
| 9428 | |
| 9429 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9430 | { |
| 9431 | struct alc_spec *spec = codec->spec; |
| 9432 | unsigned int presence; |
| 9433 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9434 | AC_VERB_GET_PIN_SENSE, 0); |
| 9435 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9436 | alc262_hp_master_update(codec); |
| 9437 | } |
| 9438 | |
| 9439 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9440 | { |
| 9441 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9442 | return; |
| 9443 | alc262_hp_bpc_automute(codec); |
| 9444 | } |
| 9445 | |
| 9446 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9447 | { |
| 9448 | struct alc_spec *spec = codec->spec; |
| 9449 | unsigned int presence; |
| 9450 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9451 | AC_VERB_GET_PIN_SENSE, 0); |
| 9452 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9453 | alc262_hp_master_update(codec); |
| 9454 | } |
| 9455 | |
| 9456 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9457 | unsigned int res) |
| 9458 | { |
| 9459 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9460 | return; |
| 9461 | alc262_hp_wildwest_automute(codec); |
| 9462 | } |
| 9463 | |
| 9464 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 9465 | struct snd_ctl_elem_value *ucontrol) |
| 9466 | { |
| 9467 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9468 | struct alc_spec *spec = codec->spec; |
| 9469 | *ucontrol->value.integer.value = spec->master_sw; |
| 9470 | return 0; |
| 9471 | } |
| 9472 | |
| 9473 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9474 | struct snd_ctl_elem_value *ucontrol) |
| 9475 | { |
| 9476 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9477 | struct alc_spec *spec = codec->spec; |
| 9478 | int val = !!*ucontrol->value.integer.value; |
| 9479 | |
| 9480 | if (val == spec->master_sw) |
| 9481 | return 0; |
| 9482 | spec->master_sw = val; |
| 9483 | alc262_hp_master_update(codec); |
| 9484 | return 1; |
| 9485 | } |
| 9486 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9487 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9488 | { |
| 9489 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9490 | .name = "Master Playback Switch", |
| 9491 | .info = snd_ctl_boolean_mono_info, |
| 9492 | .get = alc262_hp_master_sw_get, |
| 9493 | .put = alc262_hp_master_sw_put, |
| 9494 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9495 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9496 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9497 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9498 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9499 | HDA_OUTPUT), |
| 9500 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9501 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9502 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9503 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9504 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9505 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9506 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9507 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9508 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9509 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9510 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9511 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9512 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9513 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9514 | { } /* end */ |
| 9515 | }; |
| 9516 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9517 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9518 | { |
| 9519 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9520 | .name = "Master Playback Switch", |
| 9521 | .info = snd_ctl_boolean_mono_info, |
| 9522 | .get = alc262_hp_master_sw_get, |
| 9523 | .put = alc262_hp_master_sw_put, |
| 9524 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9525 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9526 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9527 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9528 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9529 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9530 | HDA_OUTPUT), |
| 9531 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9532 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9533 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9534 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9535 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9536 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9537 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9538 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9539 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9540 | { } /* end */ |
| 9541 | }; |
| 9542 | |
| 9543 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9544 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9545 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9546 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9547 | { } /* end */ |
| 9548 | }; |
| 9549 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9550 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9551 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 9552 | { |
| 9553 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9554 | |
| 9555 | if (force || !spec->sense_updated) { |
| 9556 | unsigned int present; |
| 9557 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9558 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9559 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9560 | spec->sense_updated = 1; |
| 9561 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 9562 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 9563 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9564 | } |
| 9565 | |
| 9566 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9567 | unsigned int res) |
| 9568 | { |
| 9569 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9570 | return; |
| 9571 | alc262_hp_t5735_automute(codec, 1); |
| 9572 | } |
| 9573 | |
| 9574 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9575 | { |
| 9576 | alc262_hp_t5735_automute(codec, 1); |
| 9577 | } |
| 9578 | |
| 9579 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9580 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9581 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9582 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9583 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9584 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9585 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9586 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9587 | { } /* end */ |
| 9588 | }; |
| 9589 | |
| 9590 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9591 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9592 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9593 | |
| 9594 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9595 | { } |
| 9596 | }; |
| 9597 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9598 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9599 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9600 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9601 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9602 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9603 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9604 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9605 | { } /* end */ |
| 9606 | }; |
| 9607 | |
| 9608 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9609 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9610 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9611 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9612 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9613 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9614 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9615 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9616 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9617 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9618 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9619 | {} |
| 9620 | }; |
| 9621 | |
| 9622 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9623 | .num_items = 1, |
| 9624 | .items = { |
| 9625 | { "Line", 0x1 }, |
| 9626 | }, |
| 9627 | }; |
| 9628 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9629 | /* bind hp and internal speaker mute (with plug check) */ |
| 9630 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9631 | struct snd_ctl_elem_value *ucontrol) |
| 9632 | { |
| 9633 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9634 | long *valp = ucontrol->value.integer.value; |
| 9635 | int change; |
| 9636 | |
| 9637 | /* change hp mute */ |
| 9638 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9639 | HDA_AMP_MUTE, |
| 9640 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9641 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9642 | HDA_AMP_MUTE, |
| 9643 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9644 | if (change) { |
| 9645 | /* change speaker according to HP jack state */ |
| 9646 | struct alc_spec *spec = codec->spec; |
| 9647 | unsigned int mute; |
| 9648 | if (spec->jack_present) |
| 9649 | mute = HDA_AMP_MUTE; |
| 9650 | else |
| 9651 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9652 | HDA_OUTPUT, 0); |
| 9653 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9654 | HDA_AMP_MUTE, mute); |
| 9655 | } |
| 9656 | return change; |
| 9657 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9658 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9659 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9660 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9661 | { |
| 9662 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9663 | .name = "Master Playback Switch", |
| 9664 | .info = snd_hda_mixer_amp_switch_info, |
| 9665 | .get = snd_hda_mixer_amp_switch_get, |
| 9666 | .put = alc262_sony_master_sw_put, |
| 9667 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9668 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9669 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9670 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9671 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9672 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9673 | { } /* end */ |
| 9674 | }; |
| 9675 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9676 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9677 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9678 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9679 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9680 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9681 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9682 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9683 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9684 | { } /* end */ |
| 9685 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9686 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9687 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9688 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9689 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9690 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9691 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9692 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9693 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9694 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9695 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9696 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9697 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9698 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9699 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9700 | { } /* end */ |
| 9701 | }; |
| 9702 | |
| 9703 | static struct hda_verb alc262_tyan_verbs[] = { |
| 9704 | /* Headphone automute */ |
| 9705 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9706 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9707 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9708 | |
| 9709 | /* P11 AUX_IN, white 4-pin connector */ |
| 9710 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9711 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 9712 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 9713 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 9714 | |
| 9715 | {} |
| 9716 | }; |
| 9717 | |
| 9718 | /* unsolicited event for HP jack sensing */ |
| 9719 | static void alc262_tyan_automute(struct hda_codec *codec) |
| 9720 | { |
| 9721 | unsigned int mute; |
| 9722 | unsigned int present; |
| 9723 | |
| 9724 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9725 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9726 | AC_VERB_GET_PIN_SENSE, 0); |
| 9727 | present = (present & 0x80000000) != 0; |
| 9728 | if (present) { |
| 9729 | /* mute line output on ATX panel */ |
| 9730 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9731 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9732 | } else { |
| 9733 | /* unmute line output if necessary */ |
| 9734 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9735 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9736 | HDA_AMP_MUTE, mute); |
| 9737 | } |
| 9738 | } |
| 9739 | |
| 9740 | static void alc262_tyan_unsol_event(struct hda_codec *codec, |
| 9741 | unsigned int res) |
| 9742 | { |
| 9743 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9744 | return; |
| 9745 | alc262_tyan_automute(codec); |
| 9746 | } |
| 9747 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9748 | #define alc262_capture_mixer alc882_capture_mixer |
| 9749 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9750 | |
| 9751 | /* |
| 9752 | * generic initialization of ADC, input mixers and output mixers |
| 9753 | */ |
| 9754 | static struct hda_verb alc262_init_verbs[] = { |
| 9755 | /* |
| 9756 | * Unmute ADC0-2 and set the default input to mic-in |
| 9757 | */ |
| 9758 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9759 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9760 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9761 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9762 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9763 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9764 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9765 | /* 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] | 9766 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9767 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9768 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9769 | */ |
| 9770 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9771 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9772 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9773 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9774 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9775 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9776 | |
| 9777 | /* |
| 9778 | * Set up output mixers (0x0c - 0x0e) |
| 9779 | */ |
| 9780 | /* set vol=0 to output mixers */ |
| 9781 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9782 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9783 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9784 | /* set up input amps for analog loopback */ |
| 9785 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9786 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9787 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9788 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9789 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9790 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9791 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9792 | |
| 9793 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9794 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9795 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9796 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9797 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9798 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9799 | |
| 9800 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9801 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9802 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9803 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9804 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9805 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9806 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9807 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9808 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9809 | /* FIXME: use matrix-type input source selection */ |
| 9810 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9811 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9812 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9813 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9814 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9815 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9816 | /* Input mixer2 */ |
| 9817 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9818 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9819 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9820 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9821 | /* Input mixer3 */ |
| 9822 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9823 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9824 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9825 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9826 | |
| 9827 | { } |
| 9828 | }; |
| 9829 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9830 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9831 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9832 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9833 | { } |
| 9834 | }; |
| 9835 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9836 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9837 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9838 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9839 | {} |
| 9840 | }; |
| 9841 | |
| 9842 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9843 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9844 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9845 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9846 | |
| 9847 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9848 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9849 | {} |
| 9850 | }; |
| 9851 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9852 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9853 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9854 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9855 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9856 | |
| 9857 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9858 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9859 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9860 | }; |
| 9861 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9862 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9863 | .num_items = 2, |
| 9864 | .items = { |
| 9865 | { "Int DMic", 0x9 }, |
| 9866 | { "Mic", 0x0 }, |
| 9867 | }, |
| 9868 | }; |
| 9869 | |
| 9870 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9871 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9872 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9873 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9874 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9875 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9876 | { } /* end */ |
| 9877 | }; |
| 9878 | |
| 9879 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9880 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9881 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9882 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9883 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9884 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9885 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9886 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9887 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9888 | {} |
| 9889 | }; |
| 9890 | |
| 9891 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9892 | { |
| 9893 | unsigned int present; |
| 9894 | |
| 9895 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9896 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9897 | snd_hda_codec_write(codec, 0x22, 0, |
| 9898 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9899 | } |
| 9900 | |
| 9901 | /* toggle speaker-output according to the hp-jack state */ |
| 9902 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9903 | { |
| 9904 | unsigned int present; |
| 9905 | unsigned char bits; |
| 9906 | |
| 9907 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9908 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9909 | bits = present ? 0 : PIN_OUT; |
| 9910 | snd_hda_codec_write(codec, 0x14, 0, |
| 9911 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9912 | } |
| 9913 | |
| 9914 | |
| 9915 | |
| 9916 | /* unsolicited event for HP jack sensing */ |
| 9917 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9918 | unsigned int res) |
| 9919 | { |
| 9920 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9921 | alc262_toshiba_s06_speaker_automute(codec); |
| 9922 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9923 | alc262_dmic_automute(codec); |
| 9924 | |
| 9925 | } |
| 9926 | |
| 9927 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9928 | { |
| 9929 | alc262_toshiba_s06_speaker_automute(codec); |
| 9930 | alc262_dmic_automute(codec); |
| 9931 | } |
| 9932 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9933 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9934 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9935 | { |
| 9936 | struct alc_spec *spec = codec->spec; |
| 9937 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9938 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9939 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9940 | /* need to execute and sync at first */ |
| 9941 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9942 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9943 | AC_VERB_GET_PIN_SENSE, 0); |
| 9944 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9945 | if (spec->jack_present) { |
| 9946 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9947 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9948 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9949 | } else { |
| 9950 | /* unmute internal speaker if necessary */ |
| 9951 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9952 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9953 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9954 | } |
| 9955 | } |
| 9956 | |
| 9957 | /* unsolicited event for HP jack sensing */ |
| 9958 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9959 | unsigned int res) |
| 9960 | { |
| 9961 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9962 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9963 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9964 | } |
| 9965 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9966 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9967 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9968 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9969 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9970 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9971 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9972 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9973 | AC_VERB_GET_PIN_SENSE, 0); |
| 9974 | present = (present & 0x80000000) != 0; |
| 9975 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9976 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9977 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9978 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9979 | } else { |
| 9980 | /* unmute internal speaker if necessary */ |
| 9981 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9982 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9983 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9984 | } |
| 9985 | } |
| 9986 | |
| 9987 | /* unsolicited event for HP jack sensing */ |
| 9988 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9989 | unsigned int res) |
| 9990 | { |
| 9991 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9992 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9993 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9994 | } |
| 9995 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9996 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9997 | * nec model |
| 9998 | * 0x15 = headphone |
| 9999 | * 0x16 = internal speaker |
| 10000 | * 0x18 = external mic |
| 10001 | */ |
| 10002 | |
| 10003 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10004 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10005 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10006 | |
| 10007 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10008 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10009 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10010 | |
| 10011 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10012 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10013 | { } /* end */ |
| 10014 | }; |
| 10015 | |
| 10016 | static struct hda_verb alc262_nec_verbs[] = { |
| 10017 | /* Unmute Speaker */ |
| 10018 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10019 | |
| 10020 | /* Headphone */ |
| 10021 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10022 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10023 | |
| 10024 | /* External mic to headphone */ |
| 10025 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10026 | /* External mic to speaker */ |
| 10027 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10028 | {} |
| 10029 | }; |
| 10030 | |
| 10031 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10032 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10033 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10034 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10035 | */ |
| 10036 | |
| 10037 | #define ALC_HP_EVENT 0x37 |
| 10038 | |
| 10039 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10040 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10041 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10042 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10043 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10044 | {} |
| 10045 | }; |
| 10046 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10047 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10048 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10049 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10050 | {} |
| 10051 | }; |
| 10052 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10053 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10054 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10055 | .items = { |
| 10056 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10057 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10058 | { "CD", 0x4 }, |
| 10059 | }, |
| 10060 | }; |
| 10061 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10062 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10063 | .num_items = 5, |
| 10064 | .items = { |
| 10065 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10066 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10067 | { "Line", 0x2 }, |
| 10068 | { "CD", 0x4 }, |
| 10069 | { "AUX IN", 0x6 }, |
| 10070 | }, |
| 10071 | }; |
| 10072 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10073 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10074 | .num_items = 4, |
| 10075 | .items = { |
| 10076 | { "Mic", 0x0 }, |
| 10077 | { "Front Mic", 0x2 }, |
| 10078 | { "Line", 0x1 }, |
| 10079 | { "CD", 0x4 }, |
| 10080 | }, |
| 10081 | }; |
| 10082 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10083 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10084 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10085 | { |
| 10086 | struct alc_spec *spec = codec->spec; |
| 10087 | unsigned int mute; |
| 10088 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10089 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10090 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10091 | /* need to execute and sync at first */ |
| 10092 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10093 | /* check laptop HP jack */ |
| 10094 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10095 | AC_VERB_GET_PIN_SENSE, 0); |
| 10096 | /* need to execute and sync at first */ |
| 10097 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10098 | /* check docking HP jack */ |
| 10099 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10100 | AC_VERB_GET_PIN_SENSE, 0); |
| 10101 | if (present & AC_PINSENSE_PRESENCE) |
| 10102 | spec->jack_present = 1; |
| 10103 | else |
| 10104 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10105 | spec->sense_updated = 1; |
| 10106 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10107 | /* unmute internal speaker only if both HPs are unplugged and |
| 10108 | * master switch is on |
| 10109 | */ |
| 10110 | if (spec->jack_present) |
| 10111 | mute = HDA_AMP_MUTE; |
| 10112 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10113 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10114 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10115 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10116 | } |
| 10117 | |
| 10118 | /* unsolicited event for HP jack sensing */ |
| 10119 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10120 | unsigned int res) |
| 10121 | { |
| 10122 | if ((res >> 26) != ALC_HP_EVENT) |
| 10123 | return; |
| 10124 | alc262_fujitsu_automute(codec, 1); |
| 10125 | } |
| 10126 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10127 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10128 | { |
| 10129 | alc262_fujitsu_automute(codec, 1); |
| 10130 | } |
| 10131 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10132 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10133 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10134 | .ops = &snd_hda_bind_vol, |
| 10135 | .values = { |
| 10136 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10137 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10138 | 0 |
| 10139 | }, |
| 10140 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10141 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10142 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10143 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10144 | { |
| 10145 | struct alc_spec *spec = codec->spec; |
| 10146 | unsigned int mute; |
| 10147 | |
| 10148 | if (force || !spec->sense_updated) { |
| 10149 | unsigned int present_int_hp; |
| 10150 | /* need to execute and sync at first */ |
| 10151 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10152 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10153 | AC_VERB_GET_PIN_SENSE, 0); |
| 10154 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10155 | spec->sense_updated = 1; |
| 10156 | } |
| 10157 | if (spec->jack_present) { |
| 10158 | /* mute internal speaker */ |
| 10159 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10160 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10161 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10162 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10163 | } else { |
| 10164 | /* unmute internal speaker if necessary */ |
| 10165 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10166 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10167 | HDA_AMP_MUTE, mute); |
| 10168 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10169 | HDA_AMP_MUTE, mute); |
| 10170 | } |
| 10171 | } |
| 10172 | |
| 10173 | /* unsolicited event for HP jack sensing */ |
| 10174 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10175 | unsigned int res) |
| 10176 | { |
| 10177 | if ((res >> 26) != ALC_HP_EVENT) |
| 10178 | return; |
| 10179 | alc262_lenovo_3000_automute(codec, 1); |
| 10180 | } |
| 10181 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10182 | /* bind hp and internal speaker mute (with plug check) */ |
| 10183 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10184 | struct snd_ctl_elem_value *ucontrol) |
| 10185 | { |
| 10186 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10187 | long *valp = ucontrol->value.integer.value; |
| 10188 | int change; |
| 10189 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10190 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10191 | HDA_AMP_MUTE, |
| 10192 | valp ? 0 : HDA_AMP_MUTE); |
| 10193 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10194 | HDA_AMP_MUTE, |
| 10195 | valp ? 0 : HDA_AMP_MUTE); |
| 10196 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10197 | if (change) |
| 10198 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10199 | return change; |
| 10200 | } |
| 10201 | |
| 10202 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10203 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10204 | { |
| 10205 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10206 | .name = "Master Playback Switch", |
| 10207 | .info = snd_hda_mixer_amp_switch_info, |
| 10208 | .get = snd_hda_mixer_amp_switch_get, |
| 10209 | .put = alc262_fujitsu_master_sw_put, |
| 10210 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10211 | }, |
| 10212 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10213 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10214 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10217 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10218 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10219 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10220 | { } /* end */ |
| 10221 | }; |
| 10222 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10223 | /* bind hp and internal speaker mute (with plug check) */ |
| 10224 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10225 | struct snd_ctl_elem_value *ucontrol) |
| 10226 | { |
| 10227 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10228 | long *valp = ucontrol->value.integer.value; |
| 10229 | int change; |
| 10230 | |
| 10231 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10232 | HDA_AMP_MUTE, |
| 10233 | valp ? 0 : HDA_AMP_MUTE); |
| 10234 | |
| 10235 | if (change) |
| 10236 | alc262_lenovo_3000_automute(codec, 0); |
| 10237 | return change; |
| 10238 | } |
| 10239 | |
| 10240 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10241 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10242 | { |
| 10243 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10244 | .name = "Master Playback Switch", |
| 10245 | .info = snd_hda_mixer_amp_switch_info, |
| 10246 | .get = snd_hda_mixer_amp_switch_get, |
| 10247 | .put = alc262_lenovo_3000_master_sw_put, |
| 10248 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10249 | }, |
| 10250 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10251 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10252 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10254 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10255 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10256 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10257 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10258 | { } /* end */ |
| 10259 | }; |
| 10260 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10261 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10262 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10263 | { |
| 10264 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10265 | .name = "Master Playback Switch", |
| 10266 | .info = snd_hda_mixer_amp_switch_info, |
| 10267 | .get = snd_hda_mixer_amp_switch_get, |
| 10268 | .put = alc262_sony_master_sw_put, |
| 10269 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 10270 | }, |
| 10271 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10272 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10273 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10274 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10275 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10276 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10277 | { } /* end */ |
| 10278 | }; |
| 10279 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10280 | /* additional init verbs for Benq laptops */ |
| 10281 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10282 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10283 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10284 | {} |
| 10285 | }; |
| 10286 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10287 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10288 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10289 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10290 | |
| 10291 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10292 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10293 | {} |
| 10294 | }; |
| 10295 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10296 | /* Samsung Q1 Ultra Vista model setup */ |
| 10297 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10298 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10299 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10300 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10301 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10302 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10303 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10304 | { } /* end */ |
| 10305 | }; |
| 10306 | |
| 10307 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10308 | /* output mixer */ |
| 10309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10310 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10311 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10312 | /* speaker */ |
| 10313 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10314 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10315 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10316 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10317 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10318 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10319 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10320 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10321 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10322 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10323 | /* internal mic */ |
| 10324 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10326 | /* ADC, choose mic */ |
| 10327 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10328 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10329 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10330 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10331 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10332 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10333 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10334 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10335 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10336 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10337 | {} |
| 10338 | }; |
| 10339 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10340 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10341 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10342 | { |
| 10343 | struct alc_spec *spec = codec->spec; |
| 10344 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10345 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10346 | mute = 0; |
| 10347 | /* auto-mute only when HP is used as HP */ |
| 10348 | if (!spec->cur_mux[0]) { |
| 10349 | unsigned int present; |
| 10350 | /* need to execute and sync at first */ |
| 10351 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10352 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10353 | AC_VERB_GET_PIN_SENSE, 0); |
| 10354 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10355 | if (spec->jack_present) |
| 10356 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10357 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10358 | /* mute/unmute internal speaker */ |
| 10359 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10360 | HDA_AMP_MUTE, mute); |
| 10361 | /* mute/unmute HP */ |
| 10362 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10363 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10364 | } |
| 10365 | |
| 10366 | /* unsolicited event for HP jack sensing */ |
| 10367 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10368 | unsigned int res) |
| 10369 | { |
| 10370 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10371 | return; |
| 10372 | alc262_ultra_automute(codec); |
| 10373 | } |
| 10374 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10375 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10376 | .num_items = 2, |
| 10377 | .items = { |
| 10378 | { "Mic", 0x1 }, |
| 10379 | { "Headphone", 0x7 }, |
| 10380 | }, |
| 10381 | }; |
| 10382 | |
| 10383 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10384 | struct snd_ctl_elem_value *ucontrol) |
| 10385 | { |
| 10386 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10387 | struct alc_spec *spec = codec->spec; |
| 10388 | int ret; |
| 10389 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10390 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10391 | if (!ret) |
| 10392 | return 0; |
| 10393 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10394 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10395 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10396 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10397 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10398 | return ret; |
| 10399 | } |
| 10400 | |
| 10401 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10402 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10403 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10404 | { |
| 10405 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10406 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10407 | .info = alc_mux_enum_info, |
| 10408 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10409 | .put = alc262_ultra_mux_enum_put, |
| 10410 | }, |
| 10411 | { } /* end */ |
| 10412 | }; |
| 10413 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10414 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10415 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10416 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10417 | { |
| 10418 | hda_nid_t nid; |
| 10419 | int err; |
| 10420 | |
| 10421 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10422 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10423 | spec->multiout.dac_nids[0] = 2; |
| 10424 | |
| 10425 | nid = cfg->line_out_pins[0]; |
| 10426 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10427 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10428 | "Front Playback Volume", |
| 10429 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10430 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10431 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10432 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10433 | "Front Playback Switch", |
| 10434 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10435 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10436 | return err; |
| 10437 | } |
| 10438 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10439 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10440 | if (nid) { |
| 10441 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10442 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10443 | "Speaker Playback Volume", |
| 10444 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10445 | HDA_OUTPUT)); |
| 10446 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10447 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10448 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10449 | "Speaker Playback Switch", |
| 10450 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10451 | HDA_OUTPUT)); |
| 10452 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10453 | return err; |
| 10454 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10455 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10456 | "Speaker Playback Switch", |
| 10457 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10458 | HDA_OUTPUT)); |
| 10459 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10460 | return err; |
| 10461 | } |
| 10462 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10463 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10464 | if (nid) { |
| 10465 | /* spec->multiout.hp_nid = 2; */ |
| 10466 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10467 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10468 | "Headphone Playback Volume", |
| 10469 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10470 | HDA_OUTPUT)); |
| 10471 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10472 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10473 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10474 | "Headphone Playback Switch", |
| 10475 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10476 | HDA_OUTPUT)); |
| 10477 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10478 | return err; |
| 10479 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10480 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10481 | "Headphone Playback Switch", |
| 10482 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10483 | HDA_OUTPUT)); |
| 10484 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10485 | return err; |
| 10486 | } |
| 10487 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10488 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10489 | } |
| 10490 | |
| 10491 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10492 | #define alc262_auto_create_analog_input_ctls \ |
| 10493 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10494 | |
| 10495 | /* |
| 10496 | * generic initialization of ADC, input mixers and output mixers |
| 10497 | */ |
| 10498 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10499 | /* |
| 10500 | * Unmute ADC0-2 and set the default input to mic-in |
| 10501 | */ |
| 10502 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10504 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10505 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10506 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10507 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10508 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10509 | /* 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] | 10510 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10511 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10512 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10513 | */ |
| 10514 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10515 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10516 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10517 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10520 | |
| 10521 | /* |
| 10522 | * Set up output mixers (0x0c - 0x0f) |
| 10523 | */ |
| 10524 | /* set vol=0 to output mixers */ |
| 10525 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10526 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10527 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10528 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10529 | /* set up input amps for analog loopback */ |
| 10530 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10531 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10532 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10533 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10534 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10535 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10536 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10537 | |
| 10538 | /* FIXME: use matrix-type input source selection */ |
| 10539 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10540 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10541 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10542 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10543 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10544 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10545 | /* Input mixer2 */ |
| 10546 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10547 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10548 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10549 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10550 | /* Input mixer3 */ |
| 10551 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10552 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10553 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10554 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10555 | |
| 10556 | { } |
| 10557 | }; |
| 10558 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10559 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10560 | /* |
| 10561 | * Unmute ADC0-2 and set the default input to mic-in |
| 10562 | */ |
| 10563 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10564 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10565 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10566 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10567 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10568 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10569 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10570 | /* 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] | 10571 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10572 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10573 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10574 | */ |
| 10575 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10576 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10577 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10578 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10579 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10580 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10581 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10582 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10583 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10584 | /* |
| 10585 | * Set up output mixers (0x0c - 0x0e) |
| 10586 | */ |
| 10587 | /* set vol=0 to output mixers */ |
| 10588 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10589 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10590 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10591 | |
| 10592 | /* set up input amps for analog loopback */ |
| 10593 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10594 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10595 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10596 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10597 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10598 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10599 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10600 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10601 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10602 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10603 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10604 | |
| 10605 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10606 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10607 | |
| 10608 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10609 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10610 | |
| 10611 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10612 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10613 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10614 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10615 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10616 | |
| 10617 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10618 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10619 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10620 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10621 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10622 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10623 | |
| 10624 | |
| 10625 | /* FIXME: use matrix-type input source selection */ |
| 10626 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10627 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10628 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10629 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10630 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10631 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10632 | /* Input mixer2 */ |
| 10633 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10634 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10635 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10636 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10637 | /* Input mixer3 */ |
| 10638 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10639 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10640 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10641 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10642 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10643 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10644 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10645 | { } |
| 10646 | }; |
| 10647 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10648 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10649 | /* |
| 10650 | * Unmute ADC0-2 and set the default input to mic-in |
| 10651 | */ |
| 10652 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10653 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10654 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10655 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10656 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10657 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10658 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10659 | /* 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] | 10660 | * mixer widget |
| 10661 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10662 | * panel mic (mic 2) |
| 10663 | */ |
| 10664 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10665 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10666 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10667 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10668 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10669 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10670 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10671 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10672 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10673 | /* |
| 10674 | * Set up output mixers (0x0c - 0x0e) |
| 10675 | */ |
| 10676 | /* set vol=0 to output mixers */ |
| 10677 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10678 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10679 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10680 | |
| 10681 | /* set up input amps for analog loopback */ |
| 10682 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10683 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10684 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10685 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10686 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10687 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10688 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10689 | |
| 10690 | |
| 10691 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10692 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10693 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10694 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10695 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10696 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10697 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10698 | |
| 10699 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10700 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10701 | |
| 10702 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10703 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10704 | |
| 10705 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10706 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10707 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10708 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10709 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10710 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10711 | |
| 10712 | /* FIXME: use matrix-type input source selection */ |
| 10713 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10714 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10715 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10716 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10717 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10718 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10719 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10720 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10721 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10722 | /* Input mixer2 */ |
| 10723 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10724 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10725 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10726 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10727 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10728 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10729 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10730 | /* Input mixer3 */ |
| 10731 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10732 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10733 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10734 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10735 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10736 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10737 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10738 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10739 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10740 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10741 | { } |
| 10742 | }; |
| 10743 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10744 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10745 | |
| 10746 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10747 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10748 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10749 | |
| 10750 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10751 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10752 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10753 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10754 | |
| 10755 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10756 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10757 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10758 | {} |
| 10759 | }; |
| 10760 | |
| 10761 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10762 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10763 | #define alc262_loopbacks alc880_loopbacks |
| 10764 | #endif |
| 10765 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10766 | /* pcm configuration: identiacal with ALC880 */ |
| 10767 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10768 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10769 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10770 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10771 | |
| 10772 | /* |
| 10773 | * BIOS auto configuration |
| 10774 | */ |
| 10775 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10776 | { |
| 10777 | struct alc_spec *spec = codec->spec; |
| 10778 | int err; |
| 10779 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10780 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10781 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10782 | alc262_ignore); |
| 10783 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10784 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10785 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10786 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10787 | spec->multiout.max_channels = 2; |
| 10788 | spec->no_analog = 1; |
| 10789 | goto dig_only; |
| 10790 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10791 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10792 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10793 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10794 | if (err < 0) |
| 10795 | return err; |
| 10796 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10797 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10798 | return err; |
| 10799 | |
| 10800 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10801 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10802 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10803 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10804 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10805 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10806 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10807 | if (spec->autocfg.dig_in_pin) |
| 10808 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10809 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10810 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10811 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10812 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10813 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10814 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10815 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10816 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10817 | err = alc_auto_add_mic_boost(codec); |
| 10818 | if (err < 0) |
| 10819 | return err; |
| 10820 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 10821 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10822 | return 1; |
| 10823 | } |
| 10824 | |
| 10825 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10826 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10827 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10828 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10829 | |
| 10830 | |
| 10831 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10832 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10833 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10834 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10835 | alc262_auto_init_multi_out(codec); |
| 10836 | alc262_auto_init_hp_out(codec); |
| 10837 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10838 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10839 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10840 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10841 | } |
| 10842 | |
| 10843 | /* |
| 10844 | * configuration and preset |
| 10845 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10846 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10847 | [ALC262_BASIC] = "basic", |
| 10848 | [ALC262_HIPPO] = "hippo", |
| 10849 | [ALC262_HIPPO_1] = "hippo_1", |
| 10850 | [ALC262_FUJITSU] = "fujitsu", |
| 10851 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10852 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10853 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10854 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10855 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10856 | [ALC262_BENQ_T31] = "benq-t31", |
| 10857 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10858 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10859 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10860 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10861 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10862 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10863 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10864 | [ALC262_AUTO] = "auto", |
| 10865 | }; |
| 10866 | |
| 10867 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10868 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10869 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10870 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 10871 | ALC262_HP_BPC), |
| 10872 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 10873 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10874 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10875 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10876 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10877 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10878 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10879 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10880 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10881 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10882 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10883 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10884 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10885 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10886 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10887 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10888 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10889 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10890 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10891 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10892 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | 57a5ef4 | 2008-11-28 14:46:28 +0100 | [diff] [blame] | 10893 | SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN", |
| 10894 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10895 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10896 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10897 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10898 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10899 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10900 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10901 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 10902 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 10903 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10904 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10905 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10906 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10907 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10908 | {} |
| 10909 | }; |
| 10910 | |
| 10911 | static struct alc_config_preset alc262_presets[] = { |
| 10912 | [ALC262_BASIC] = { |
| 10913 | .mixers = { alc262_base_mixer }, |
| 10914 | .init_verbs = { alc262_init_verbs }, |
| 10915 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10916 | .dac_nids = alc262_dac_nids, |
| 10917 | .hp_nid = 0x03, |
| 10918 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10919 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10920 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10921 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10922 | [ALC262_HIPPO] = { |
| 10923 | .mixers = { alc262_base_mixer }, |
| 10924 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10925 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10926 | .dac_nids = alc262_dac_nids, |
| 10927 | .hp_nid = 0x03, |
| 10928 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10929 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10930 | .channel_mode = alc262_modes, |
| 10931 | .input_mux = &alc262_capture_source, |
| 10932 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10933 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10934 | }, |
| 10935 | [ALC262_HIPPO_1] = { |
| 10936 | .mixers = { alc262_hippo1_mixer }, |
| 10937 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10938 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10939 | .dac_nids = alc262_dac_nids, |
| 10940 | .hp_nid = 0x02, |
| 10941 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10942 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10943 | .channel_mode = alc262_modes, |
| 10944 | .input_mux = &alc262_capture_source, |
| 10945 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10946 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10947 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10948 | [ALC262_FUJITSU] = { |
| 10949 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10950 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10951 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10952 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10953 | .dac_nids = alc262_dac_nids, |
| 10954 | .hp_nid = 0x03, |
| 10955 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10956 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10957 | .channel_mode = alc262_modes, |
| 10958 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10959 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10960 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10961 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10962 | [ALC262_HP_BPC] = { |
| 10963 | .mixers = { alc262_HP_BPC_mixer }, |
| 10964 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10965 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10966 | .dac_nids = alc262_dac_nids, |
| 10967 | .hp_nid = 0x03, |
| 10968 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10969 | .channel_mode = alc262_modes, |
| 10970 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10971 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10972 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10973 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10974 | [ALC262_HP_BPC_D7000_WF] = { |
| 10975 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10976 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10977 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10978 | .dac_nids = alc262_dac_nids, |
| 10979 | .hp_nid = 0x03, |
| 10980 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10981 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10982 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10983 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10984 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10985 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10986 | [ALC262_HP_BPC_D7000_WL] = { |
| 10987 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10988 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10989 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10990 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10991 | .dac_nids = alc262_dac_nids, |
| 10992 | .hp_nid = 0x03, |
| 10993 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10994 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10995 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10996 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10997 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10998 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10999 | [ALC262_HP_TC_T5735] = { |
| 11000 | .mixers = { alc262_hp_t5735_mixer }, |
| 11001 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11002 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11003 | .dac_nids = alc262_dac_nids, |
| 11004 | .hp_nid = 0x03, |
| 11005 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11006 | .channel_mode = alc262_modes, |
| 11007 | .input_mux = &alc262_capture_source, |
| 11008 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 11009 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11010 | }, |
| 11011 | [ALC262_HP_RP5700] = { |
| 11012 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11013 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11014 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11015 | .dac_nids = alc262_dac_nids, |
| 11016 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11017 | .channel_mode = alc262_modes, |
| 11018 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11019 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11020 | [ALC262_BENQ_ED8] = { |
| 11021 | .mixers = { alc262_base_mixer }, |
| 11022 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11023 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11024 | .dac_nids = alc262_dac_nids, |
| 11025 | .hp_nid = 0x03, |
| 11026 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11027 | .channel_mode = alc262_modes, |
| 11028 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11029 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11030 | [ALC262_SONY_ASSAMD] = { |
| 11031 | .mixers = { alc262_sony_mixer }, |
| 11032 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11033 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11034 | .dac_nids = alc262_dac_nids, |
| 11035 | .hp_nid = 0x02, |
| 11036 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11037 | .channel_mode = alc262_modes, |
| 11038 | .input_mux = &alc262_capture_source, |
| 11039 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11040 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11041 | }, |
| 11042 | [ALC262_BENQ_T31] = { |
| 11043 | .mixers = { alc262_benq_t31_mixer }, |
| 11044 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11045 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11046 | .dac_nids = alc262_dac_nids, |
| 11047 | .hp_nid = 0x03, |
| 11048 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11049 | .channel_mode = alc262_modes, |
| 11050 | .input_mux = &alc262_capture_source, |
| 11051 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11052 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11053 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11054 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11055 | .mixers = { alc262_ultra_mixer }, |
| 11056 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11057 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11058 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11059 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11060 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11061 | .channel_mode = alc262_modes, |
| 11062 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11063 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11064 | .capsrc_nids = alc262_capsrc_nids, |
| 11065 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11066 | .unsol_event = alc262_ultra_unsol_event, |
| 11067 | .init_hook = alc262_ultra_automute, |
| 11068 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11069 | [ALC262_LENOVO_3000] = { |
| 11070 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11071 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11072 | alc262_lenovo_3000_unsol_verbs }, |
| 11073 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11074 | .dac_nids = alc262_dac_nids, |
| 11075 | .hp_nid = 0x03, |
| 11076 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11077 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11078 | .channel_mode = alc262_modes, |
| 11079 | .input_mux = &alc262_fujitsu_capture_source, |
| 11080 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11081 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11082 | [ALC262_NEC] = { |
| 11083 | .mixers = { alc262_nec_mixer }, |
| 11084 | .init_verbs = { alc262_nec_verbs }, |
| 11085 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11086 | .dac_nids = alc262_dac_nids, |
| 11087 | .hp_nid = 0x03, |
| 11088 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11089 | .channel_mode = alc262_modes, |
| 11090 | .input_mux = &alc262_capture_source, |
| 11091 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11092 | [ALC262_TOSHIBA_S06] = { |
| 11093 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11094 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11095 | alc262_eapd_verbs }, |
| 11096 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11097 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11098 | .dac_nids = alc262_dac_nids, |
| 11099 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 11100 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11101 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11102 | .channel_mode = alc262_modes, |
| 11103 | .input_mux = &alc262_dmic_capture_source, |
| 11104 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11105 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11106 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11107 | [ALC262_TOSHIBA_RX1] = { |
| 11108 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11109 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11110 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11111 | .dac_nids = alc262_dac_nids, |
| 11112 | .hp_nid = 0x03, |
| 11113 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11114 | .channel_mode = alc262_modes, |
| 11115 | .input_mux = &alc262_capture_source, |
| 11116 | .unsol_event = alc262_hippo_unsol_event, |
| 11117 | .init_hook = alc262_hippo_automute, |
| 11118 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11119 | [ALC262_TYAN] = { |
| 11120 | .mixers = { alc262_tyan_mixer }, |
| 11121 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11122 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11123 | .dac_nids = alc262_dac_nids, |
| 11124 | .hp_nid = 0x02, |
| 11125 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11126 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11127 | .channel_mode = alc262_modes, |
| 11128 | .input_mux = &alc262_capture_source, |
| 11129 | .unsol_event = alc262_tyan_unsol_event, |
| 11130 | .init_hook = alc262_tyan_automute, |
| 11131 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11132 | }; |
| 11133 | |
| 11134 | static int patch_alc262(struct hda_codec *codec) |
| 11135 | { |
| 11136 | struct alc_spec *spec; |
| 11137 | int board_config; |
| 11138 | int err; |
| 11139 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11140 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11141 | if (spec == NULL) |
| 11142 | return -ENOMEM; |
| 11143 | |
| 11144 | codec->spec = spec; |
| 11145 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11146 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11147 | * under-run |
| 11148 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11149 | { |
| 11150 | int tmp; |
| 11151 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11152 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11153 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11154 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11155 | } |
| 11156 | #endif |
| 11157 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11158 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11159 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11160 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11161 | alc262_models, |
| 11162 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11163 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11164 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11165 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 11166 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11167 | board_config = ALC262_AUTO; |
| 11168 | } |
| 11169 | |
| 11170 | if (board_config == ALC262_AUTO) { |
| 11171 | /* automatic parse from the BIOS config */ |
| 11172 | err = alc262_parse_auto_config(codec); |
| 11173 | if (err < 0) { |
| 11174 | alc_free(codec); |
| 11175 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11176 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11177 | printk(KERN_INFO |
| 11178 | "hda_codec: Cannot set up configuration " |
| 11179 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11180 | board_config = ALC262_BASIC; |
| 11181 | } |
| 11182 | } |
| 11183 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11184 | if (!spec->no_analog) { |
| 11185 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11186 | if (err < 0) { |
| 11187 | alc_free(codec); |
| 11188 | return err; |
| 11189 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11190 | } |
| 11191 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11192 | if (board_config != ALC262_AUTO) |
| 11193 | setup_preset(spec, &alc262_presets[board_config]); |
| 11194 | |
| 11195 | spec->stream_name_analog = "ALC262 Analog"; |
| 11196 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11197 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11198 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11199 | spec->stream_name_digital = "ALC262 Digital"; |
| 11200 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11201 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11202 | |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11203 | spec->capture_style = CAPT_MIX; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11204 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11205 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11206 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11207 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11208 | /* get type */ |
| 11209 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11210 | if (wcap != AC_WID_AUD_IN) { |
| 11211 | spec->adc_nids = alc262_adc_nids_alt; |
| 11212 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11213 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11214 | } else { |
| 11215 | spec->adc_nids = alc262_adc_nids; |
| 11216 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11217 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11218 | } |
| 11219 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11220 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11221 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11222 | if (!spec->no_analog) |
| 11223 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11224 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11225 | spec->vmaster_nid = 0x0c; |
| 11226 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11227 | codec->patch_ops = alc_patch_ops; |
| 11228 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11229 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11230 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11231 | if (!spec->loopback.amplist) |
| 11232 | spec->loopback.amplist = alc262_loopbacks; |
| 11233 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11234 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11235 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11236 | return 0; |
| 11237 | } |
| 11238 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11239 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11240 | * ALC268 channel source setting (2 channel) |
| 11241 | */ |
| 11242 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11243 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11244 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11245 | static hda_nid_t alc268_dac_nids[2] = { |
| 11246 | /* front, hp */ |
| 11247 | 0x02, 0x03 |
| 11248 | }; |
| 11249 | |
| 11250 | static hda_nid_t alc268_adc_nids[2] = { |
| 11251 | /* ADC0-1 */ |
| 11252 | 0x08, 0x07 |
| 11253 | }; |
| 11254 | |
| 11255 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11256 | /* ADC0 */ |
| 11257 | 0x08 |
| 11258 | }; |
| 11259 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11260 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11261 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11262 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11263 | /* output mixer control */ |
| 11264 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11265 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11266 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11267 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11268 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11269 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11270 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11271 | { } |
| 11272 | }; |
| 11273 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11274 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11275 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11276 | .ops = &snd_hda_bind_sw, |
| 11277 | .values = { |
| 11278 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11279 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11280 | 0 |
| 11281 | }, |
| 11282 | }; |
| 11283 | |
| 11284 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11285 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11286 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11287 | { } |
| 11288 | }; |
| 11289 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11290 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11291 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11292 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11293 | { } |
| 11294 | }; |
| 11295 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11296 | /* Toshiba specific */ |
| 11297 | #define alc268_toshiba_automute alc262_hippo_automute |
| 11298 | |
| 11299 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11300 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11301 | { } /* end */ |
| 11302 | }; |
| 11303 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11304 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11305 | .num_items = 2, |
| 11306 | .items = { |
| 11307 | { "i-Mic", 0x6 }, |
| 11308 | { "E-Mic", 0x0 }, |
| 11309 | }, |
| 11310 | }; |
| 11311 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11312 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11313 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11314 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11315 | .ops = &snd_hda_bind_vol, |
| 11316 | .values = { |
| 11317 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11318 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11319 | 0 |
| 11320 | }, |
| 11321 | }; |
| 11322 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11323 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11324 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11325 | { |
| 11326 | struct alc_spec *spec = codec->spec; |
| 11327 | unsigned int mute; |
| 11328 | |
| 11329 | if (force || !spec->sense_updated) { |
| 11330 | unsigned int present; |
| 11331 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11332 | AC_VERB_GET_PIN_SENSE, 0); |
| 11333 | spec->jack_present = (present & 0x80000000) != 0; |
| 11334 | spec->sense_updated = 1; |
| 11335 | } |
| 11336 | if (spec->jack_present) |
| 11337 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11338 | else /* unmute internal speaker if necessary */ |
| 11339 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11340 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11341 | HDA_AMP_MUTE, mute); |
| 11342 | } |
| 11343 | |
| 11344 | |
| 11345 | /* bind hp and internal speaker mute (with plug check) */ |
| 11346 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11347 | struct snd_ctl_elem_value *ucontrol) |
| 11348 | { |
| 11349 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11350 | long *valp = ucontrol->value.integer.value; |
| 11351 | int change; |
| 11352 | |
| 11353 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11354 | HDA_AMP_MUTE, |
| 11355 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11356 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11357 | HDA_AMP_MUTE, |
| 11358 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11359 | if (change) |
| 11360 | alc268_acer_automute(codec, 0); |
| 11361 | return change; |
| 11362 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11363 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11364 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11365 | /* output mixer control */ |
| 11366 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11367 | { |
| 11368 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11369 | .name = "Master Playback Switch", |
| 11370 | .info = snd_hda_mixer_amp_switch_info, |
| 11371 | .get = snd_hda_mixer_amp_switch_get, |
| 11372 | .put = alc268_acer_master_sw_put, |
| 11373 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11374 | }, |
| 11375 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11376 | { } |
| 11377 | }; |
| 11378 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11379 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11380 | /* output mixer control */ |
| 11381 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11382 | { |
| 11383 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11384 | .name = "Master Playback Switch", |
| 11385 | .info = snd_hda_mixer_amp_switch_info, |
| 11386 | .get = snd_hda_mixer_amp_switch_get, |
| 11387 | .put = alc268_acer_master_sw_put, |
| 11388 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11389 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11390 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11391 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11392 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11393 | { } |
| 11394 | }; |
| 11395 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11396 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11397 | /* output mixer control */ |
| 11398 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11399 | { |
| 11400 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11401 | .name = "Master Playback Switch", |
| 11402 | .info = snd_hda_mixer_amp_switch_info, |
| 11403 | .get = snd_hda_mixer_amp_switch_get, |
| 11404 | .put = alc268_acer_master_sw_put, |
| 11405 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11406 | }, |
| 11407 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11408 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11409 | { } |
| 11410 | }; |
| 11411 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11412 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11413 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11414 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11415 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11416 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11417 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11418 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11419 | { } |
| 11420 | }; |
| 11421 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11422 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11423 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11424 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11425 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11426 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11427 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11428 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11429 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11430 | { } |
| 11431 | }; |
| 11432 | |
| 11433 | /* unsolicited event for HP jack sensing */ |
| 11434 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 11435 | unsigned int res) |
| 11436 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11437 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11438 | return; |
| 11439 | alc268_toshiba_automute(codec); |
| 11440 | } |
| 11441 | |
| 11442 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11443 | unsigned int res) |
| 11444 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11445 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11446 | return; |
| 11447 | alc268_acer_automute(codec, 1); |
| 11448 | } |
| 11449 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11450 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11451 | { |
| 11452 | alc268_acer_automute(codec, 1); |
| 11453 | } |
| 11454 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11455 | /* toggle speaker-output according to the hp-jack state */ |
| 11456 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11457 | { |
| 11458 | unsigned int present; |
| 11459 | unsigned char bits; |
| 11460 | |
| 11461 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11462 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11463 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11464 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11465 | AMP_IN_MUTE(0), bits); |
| 11466 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11467 | AMP_IN_MUTE(0), bits); |
| 11468 | } |
| 11469 | |
| 11470 | |
| 11471 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11472 | { |
| 11473 | unsigned int present; |
| 11474 | |
| 11475 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11476 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11477 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11478 | present ? 0x0 : 0x6); |
| 11479 | } |
| 11480 | |
| 11481 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11482 | unsigned int res) |
| 11483 | { |
| 11484 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11485 | alc268_aspire_one_speaker_automute(codec); |
| 11486 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11487 | alc268_acer_mic_automute(codec); |
| 11488 | } |
| 11489 | |
| 11490 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11491 | { |
| 11492 | alc268_aspire_one_speaker_automute(codec); |
| 11493 | alc268_acer_mic_automute(codec); |
| 11494 | } |
| 11495 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11496 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11497 | /* output mixer control */ |
| 11498 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11499 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11500 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11501 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11502 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11503 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11504 | { } |
| 11505 | }; |
| 11506 | |
| 11507 | static struct hda_verb alc268_dell_verbs[] = { |
| 11508 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11509 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11510 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11511 | { } |
| 11512 | }; |
| 11513 | |
| 11514 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11515 | static void alc268_dell_automute(struct hda_codec *codec) |
| 11516 | { |
| 11517 | unsigned int present; |
| 11518 | unsigned int mute; |
| 11519 | |
| 11520 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 11521 | if (present & 0x80000000) |
| 11522 | mute = HDA_AMP_MUTE; |
| 11523 | else |
| 11524 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 11525 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11526 | HDA_AMP_MUTE, mute); |
| 11527 | } |
| 11528 | |
| 11529 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 11530 | unsigned int res) |
| 11531 | { |
| 11532 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11533 | return; |
| 11534 | alc268_dell_automute(codec); |
| 11535 | } |
| 11536 | |
| 11537 | #define alc268_dell_init_hook alc268_dell_automute |
| 11538 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11539 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11540 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11541 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11542 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11543 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11544 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11545 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11546 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11547 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11548 | { } |
| 11549 | }; |
| 11550 | |
| 11551 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11552 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11553 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11554 | { } |
| 11555 | }; |
| 11556 | |
| 11557 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 11558 | { |
| 11559 | unsigned int present; |
| 11560 | |
| 11561 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 11562 | & AC_PINSENSE_PRESENCE; |
| 11563 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11564 | present ? 0 : PIN_OUT); |
| 11565 | } |
| 11566 | |
| 11567 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11568 | { |
| 11569 | unsigned int present; |
| 11570 | |
| 11571 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11572 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11573 | snd_hda_codec_write(codec, 0x23, 0, |
| 11574 | AC_VERB_SET_CONNECT_SEL, |
| 11575 | present ? 0x00 : 0x01); |
| 11576 | } |
| 11577 | |
| 11578 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 11579 | { |
| 11580 | alc267_quanta_il1_hp_automute(codec); |
| 11581 | alc267_quanta_il1_mic_automute(codec); |
| 11582 | } |
| 11583 | |
| 11584 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11585 | unsigned int res) |
| 11586 | { |
| 11587 | switch (res >> 26) { |
| 11588 | case ALC880_HP_EVENT: |
| 11589 | alc267_quanta_il1_hp_automute(codec); |
| 11590 | break; |
| 11591 | case ALC880_MIC_EVENT: |
| 11592 | alc267_quanta_il1_mic_automute(codec); |
| 11593 | break; |
| 11594 | } |
| 11595 | } |
| 11596 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11597 | /* |
| 11598 | * generic initialization of ADC, input mixers and output mixers |
| 11599 | */ |
| 11600 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11601 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11602 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11603 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11604 | |
| 11605 | /* |
| 11606 | * Set up output mixers (0x0c - 0x0e) |
| 11607 | */ |
| 11608 | /* set vol=0 to output mixers */ |
| 11609 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11610 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11611 | |
| 11612 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11613 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11614 | |
| 11615 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11616 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11617 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11618 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11619 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11620 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11621 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11622 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11623 | |
| 11624 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11625 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11626 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11627 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11628 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11629 | |
| 11630 | /* set PCBEEP vol = 0, mute connections */ |
| 11631 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11632 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11633 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11634 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11635 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11636 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11637 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11638 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11639 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11640 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11641 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11642 | { } |
| 11643 | }; |
| 11644 | |
| 11645 | /* |
| 11646 | * generic initialization of ADC, input mixers and output mixers |
| 11647 | */ |
| 11648 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11649 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11650 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11651 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11652 | |
| 11653 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11654 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11655 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11656 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11657 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11658 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11659 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11660 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11661 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11662 | |
| 11663 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11664 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11665 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11666 | /* set PCBEEP vol = 0, mute connections */ |
| 11667 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11668 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11669 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11670 | |
| 11671 | { } |
| 11672 | }; |
| 11673 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11674 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11675 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11676 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11677 | { |
| 11678 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11679 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11680 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11681 | */ |
| 11682 | /* .name = "Capture Source", */ |
| 11683 | .name = "Input Source", |
| 11684 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11685 | .info = alc_mux_enum_info, |
| 11686 | .get = alc_mux_enum_get, |
| 11687 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11688 | }, |
| 11689 | { } /* end */ |
| 11690 | }; |
| 11691 | |
| 11692 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11693 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11694 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11695 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11696 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11697 | { |
| 11698 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11699 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11700 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11701 | */ |
| 11702 | /* .name = "Capture Source", */ |
| 11703 | .name = "Input Source", |
| 11704 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11705 | .info = alc_mux_enum_info, |
| 11706 | .get = alc_mux_enum_get, |
| 11707 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11708 | }, |
| 11709 | { } /* end */ |
| 11710 | }; |
| 11711 | |
| 11712 | static struct hda_input_mux alc268_capture_source = { |
| 11713 | .num_items = 4, |
| 11714 | .items = { |
| 11715 | { "Mic", 0x0 }, |
| 11716 | { "Front Mic", 0x1 }, |
| 11717 | { "Line", 0x2 }, |
| 11718 | { "CD", 0x3 }, |
| 11719 | }, |
| 11720 | }; |
| 11721 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11722 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11723 | .num_items = 3, |
| 11724 | .items = { |
| 11725 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11726 | { "Internal Mic", 0x1 }, |
| 11727 | { "Line", 0x2 }, |
| 11728 | }, |
| 11729 | }; |
| 11730 | |
| 11731 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11732 | .num_items = 3, |
| 11733 | .items = { |
| 11734 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11735 | { "Internal Mic", 0x6 }, |
| 11736 | { "Line", 0x2 }, |
| 11737 | }, |
| 11738 | }; |
| 11739 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11740 | #ifdef CONFIG_SND_DEBUG |
| 11741 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11742 | /* Volume widgets */ |
| 11743 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11744 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11745 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11746 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11747 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11748 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11749 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11750 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11751 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11752 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11753 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11754 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11755 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11756 | /* The below appears problematic on some hardwares */ |
| 11757 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11758 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11759 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11760 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11761 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11762 | |
| 11763 | /* Modes for retasking pin widgets */ |
| 11764 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11765 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11766 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11767 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11768 | |
| 11769 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11770 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11771 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11772 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11773 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11774 | |
| 11775 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11776 | * The ALC268 does not have an SPDIF input. |
| 11777 | */ |
| 11778 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11779 | |
| 11780 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11781 | * this output to turn on an external amplifier. |
| 11782 | */ |
| 11783 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11784 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11785 | |
| 11786 | { } /* end */ |
| 11787 | }; |
| 11788 | #endif |
| 11789 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11790 | /* create input playback/capture controls for the given pin */ |
| 11791 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11792 | const char *ctlname, int idx) |
| 11793 | { |
| 11794 | char name[32]; |
| 11795 | int err; |
| 11796 | |
| 11797 | sprintf(name, "%s Playback Volume", ctlname); |
| 11798 | if (nid == 0x14) { |
| 11799 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11800 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11801 | HDA_OUTPUT)); |
| 11802 | if (err < 0) |
| 11803 | return err; |
| 11804 | } else if (nid == 0x15) { |
| 11805 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11806 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11807 | HDA_OUTPUT)); |
| 11808 | if (err < 0) |
| 11809 | return err; |
| 11810 | } else |
| 11811 | return -1; |
| 11812 | sprintf(name, "%s Playback Switch", ctlname); |
| 11813 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11814 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11815 | if (err < 0) |
| 11816 | return err; |
| 11817 | return 0; |
| 11818 | } |
| 11819 | |
| 11820 | /* add playback controls from the parsed DAC table */ |
| 11821 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11822 | const struct auto_pin_cfg *cfg) |
| 11823 | { |
| 11824 | hda_nid_t nid; |
| 11825 | int err; |
| 11826 | |
| 11827 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11828 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11829 | spec->multiout.dac_nids[0] = 2; |
| 11830 | spec->multiout.dac_nids[1] = 3; |
| 11831 | |
| 11832 | nid = cfg->line_out_pins[0]; |
| 11833 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11834 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11835 | |
| 11836 | nid = cfg->speaker_pins[0]; |
| 11837 | if (nid == 0x1d) { |
| 11838 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11839 | "Speaker Playback Volume", |
| 11840 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11841 | if (err < 0) |
| 11842 | return err; |
| 11843 | } |
| 11844 | nid = cfg->hp_pins[0]; |
| 11845 | if (nid) |
| 11846 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11847 | |
| 11848 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11849 | if (nid == 0x16) { |
| 11850 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11851 | "Mono Playback Switch", |
| 11852 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11853 | if (err < 0) |
| 11854 | return err; |
| 11855 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11856 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11857 | } |
| 11858 | |
| 11859 | /* create playback/capture controls for input pins */ |
| 11860 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11861 | const struct auto_pin_cfg *cfg) |
| 11862 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11863 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11864 | int i, idx1; |
| 11865 | |
| 11866 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11867 | switch(cfg->input_pins[i]) { |
| 11868 | case 0x18: |
| 11869 | idx1 = 0; /* Mic 1 */ |
| 11870 | break; |
| 11871 | case 0x19: |
| 11872 | idx1 = 1; /* Mic 2 */ |
| 11873 | break; |
| 11874 | case 0x1a: |
| 11875 | idx1 = 2; /* Line In */ |
| 11876 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11877 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11878 | idx1 = 3; /* CD */ |
| 11879 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11880 | case 0x12: |
| 11881 | case 0x13: |
| 11882 | idx1 = 6; /* digital mics */ |
| 11883 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11884 | default: |
| 11885 | continue; |
| 11886 | } |
| 11887 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11888 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11889 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11890 | } |
| 11891 | return 0; |
| 11892 | } |
| 11893 | |
| 11894 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11895 | { |
| 11896 | struct alc_spec *spec = codec->spec; |
| 11897 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11898 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11899 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11900 | unsigned int dac_vol1, dac_vol2; |
| 11901 | |
| 11902 | if (speaker_nid) { |
| 11903 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11904 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11905 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11906 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11907 | AMP_IN_UNMUTE(1)); |
| 11908 | snd_hda_codec_write(codec, 0x10, 0, |
| 11909 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11910 | AMP_IN_UNMUTE(1)); |
| 11911 | } else { |
| 11912 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11913 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11914 | snd_hda_codec_write(codec, 0x10, 0, |
| 11915 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11916 | } |
| 11917 | |
| 11918 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11919 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11920 | dac_vol2 = AMP_OUT_ZERO; |
| 11921 | else if (line_nid == 0x15) |
| 11922 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11923 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11924 | dac_vol2 = AMP_OUT_ZERO; |
| 11925 | else if (hp_nid == 0x15) |
| 11926 | dac_vol1 = AMP_OUT_ZERO; |
| 11927 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11928 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11929 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11930 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11931 | |
| 11932 | snd_hda_codec_write(codec, 0x02, 0, |
| 11933 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11934 | snd_hda_codec_write(codec, 0x03, 0, |
| 11935 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11936 | } |
| 11937 | |
| 11938 | /* pcm configuration: identiacal with ALC880 */ |
| 11939 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11940 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11941 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11942 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11943 | |
| 11944 | /* |
| 11945 | * BIOS auto configuration |
| 11946 | */ |
| 11947 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11948 | { |
| 11949 | struct alc_spec *spec = codec->spec; |
| 11950 | int err; |
| 11951 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11952 | |
| 11953 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11954 | alc268_ignore); |
| 11955 | if (err < 0) |
| 11956 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11957 | if (!spec->autocfg.line_outs) { |
| 11958 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 11959 | spec->multiout.max_channels = 2; |
| 11960 | spec->no_analog = 1; |
| 11961 | goto dig_only; |
| 11962 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11963 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11964 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11965 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11966 | if (err < 0) |
| 11967 | return err; |
| 11968 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11969 | if (err < 0) |
| 11970 | return err; |
| 11971 | |
| 11972 | spec->multiout.max_channels = 2; |
| 11973 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11974 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11975 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11976 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11977 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11978 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 11979 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11980 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11981 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11982 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11983 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11984 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11985 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11986 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11987 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11988 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11989 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11990 | err = alc_auto_add_mic_boost(codec); |
| 11991 | if (err < 0) |
| 11992 | return err; |
| 11993 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 11994 | store_pin_configs(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11995 | return 1; |
| 11996 | } |
| 11997 | |
| 11998 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11999 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12000 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12001 | |
| 12002 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12003 | static void alc268_auto_init(struct hda_codec *codec) |
| 12004 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12005 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12006 | alc268_auto_init_multi_out(codec); |
| 12007 | alc268_auto_init_hp_out(codec); |
| 12008 | alc268_auto_init_mono_speaker_out(codec); |
| 12009 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12010 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12011 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12012 | } |
| 12013 | |
| 12014 | /* |
| 12015 | * configuration and preset |
| 12016 | */ |
| 12017 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12018 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12019 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12020 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12021 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12022 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12023 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12024 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12025 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12026 | #ifdef CONFIG_SND_DEBUG |
| 12027 | [ALC268_TEST] = "test", |
| 12028 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12029 | [ALC268_AUTO] = "auto", |
| 12030 | }; |
| 12031 | |
| 12032 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12033 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12034 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12035 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12036 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12037 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12038 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12039 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12040 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12041 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12042 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12043 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12044 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 12045 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 12046 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12047 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12048 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12049 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12050 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12051 | {} |
| 12052 | }; |
| 12053 | |
| 12054 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12055 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12056 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12057 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12058 | alc267_quanta_il1_verbs }, |
| 12059 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12060 | .dac_nids = alc268_dac_nids, |
| 12061 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12062 | .adc_nids = alc268_adc_nids_alt, |
| 12063 | .hp_nid = 0x03, |
| 12064 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12065 | .channel_mode = alc268_modes, |
| 12066 | .input_mux = &alc268_capture_source, |
| 12067 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 12068 | .init_hook = alc267_quanta_il1_automute, |
| 12069 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12070 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12071 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12072 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12073 | .init_verbs = { alc268_base_init_verbs }, |
| 12074 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12075 | .dac_nids = alc268_dac_nids, |
| 12076 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12077 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12078 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12079 | .hp_nid = 0x03, |
| 12080 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12081 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12082 | .channel_mode = alc268_modes, |
| 12083 | .input_mux = &alc268_capture_source, |
| 12084 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12085 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12086 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12087 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12088 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12089 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12090 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12091 | .dac_nids = alc268_dac_nids, |
| 12092 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12093 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12094 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12095 | .hp_nid = 0x03, |
| 12096 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12097 | .channel_mode = alc268_modes, |
| 12098 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12099 | .unsol_event = alc268_toshiba_unsol_event, |
| 12100 | .init_hook = alc268_toshiba_automute, |
| 12101 | }, |
| 12102 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12103 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12104 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12105 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12106 | alc268_acer_verbs }, |
| 12107 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12108 | .dac_nids = alc268_dac_nids, |
| 12109 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12110 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12111 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12112 | .hp_nid = 0x02, |
| 12113 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12114 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12115 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12116 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12117 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12118 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12119 | [ALC268_ACER_DMIC] = { |
| 12120 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12121 | alc268_beep_mixer }, |
| 12122 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12123 | alc268_acer_verbs }, |
| 12124 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12125 | .dac_nids = alc268_dac_nids, |
| 12126 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12127 | .adc_nids = alc268_adc_nids_alt, |
| 12128 | .capsrc_nids = alc268_capsrc_nids, |
| 12129 | .hp_nid = 0x02, |
| 12130 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12131 | .channel_mode = alc268_modes, |
| 12132 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12133 | .unsol_event = alc268_acer_unsol_event, |
| 12134 | .init_hook = alc268_acer_init_hook, |
| 12135 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12136 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12137 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12138 | alc268_beep_mixer, |
| 12139 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12140 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12141 | alc268_acer_aspire_one_verbs }, |
| 12142 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12143 | .dac_nids = alc268_dac_nids, |
| 12144 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12145 | .adc_nids = alc268_adc_nids_alt, |
| 12146 | .capsrc_nids = alc268_capsrc_nids, |
| 12147 | .hp_nid = 0x03, |
| 12148 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12149 | .channel_mode = alc268_modes, |
| 12150 | .input_mux = &alc268_acer_lc_capture_source, |
| 12151 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12152 | .init_hook = alc268_acer_lc_init_hook, |
| 12153 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12154 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12155 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12156 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12157 | alc268_dell_verbs }, |
| 12158 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12159 | .dac_nids = alc268_dac_nids, |
| 12160 | .hp_nid = 0x02, |
| 12161 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12162 | .channel_mode = alc268_modes, |
| 12163 | .unsol_event = alc268_dell_unsol_event, |
| 12164 | .init_hook = alc268_dell_init_hook, |
| 12165 | .input_mux = &alc268_capture_source, |
| 12166 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12167 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12168 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12169 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12170 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12171 | alc268_toshiba_verbs }, |
| 12172 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12173 | .dac_nids = alc268_dac_nids, |
| 12174 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12175 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12176 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12177 | .hp_nid = 0x03, |
| 12178 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12179 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12180 | .channel_mode = alc268_modes, |
| 12181 | .input_mux = &alc268_capture_source, |
| 12182 | .unsol_event = alc268_toshiba_unsol_event, |
| 12183 | .init_hook = alc268_toshiba_automute |
| 12184 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12185 | #ifdef CONFIG_SND_DEBUG |
| 12186 | [ALC268_TEST] = { |
| 12187 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12188 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12189 | alc268_volume_init_verbs }, |
| 12190 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12191 | .dac_nids = alc268_dac_nids, |
| 12192 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12193 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12194 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12195 | .hp_nid = 0x03, |
| 12196 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12197 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12198 | .channel_mode = alc268_modes, |
| 12199 | .input_mux = &alc268_capture_source, |
| 12200 | }, |
| 12201 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12202 | }; |
| 12203 | |
| 12204 | static int patch_alc268(struct hda_codec *codec) |
| 12205 | { |
| 12206 | struct alc_spec *spec; |
| 12207 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12208 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12209 | |
| 12210 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12211 | if (spec == NULL) |
| 12212 | return -ENOMEM; |
| 12213 | |
| 12214 | codec->spec = spec; |
| 12215 | |
| 12216 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12217 | alc268_models, |
| 12218 | alc268_cfg_tbl); |
| 12219 | |
| 12220 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 12221 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 12222 | "trying auto-probe from BIOS...\n"); |
| 12223 | board_config = ALC268_AUTO; |
| 12224 | } |
| 12225 | |
| 12226 | if (board_config == ALC268_AUTO) { |
| 12227 | /* automatic parse from the BIOS config */ |
| 12228 | err = alc268_parse_auto_config(codec); |
| 12229 | if (err < 0) { |
| 12230 | alc_free(codec); |
| 12231 | return err; |
| 12232 | } else if (!err) { |
| 12233 | printk(KERN_INFO |
| 12234 | "hda_codec: Cannot set up configuration " |
| 12235 | "from BIOS. Using base mode...\n"); |
| 12236 | board_config = ALC268_3ST; |
| 12237 | } |
| 12238 | } |
| 12239 | |
| 12240 | if (board_config != ALC268_AUTO) |
| 12241 | setup_preset(spec, &alc268_presets[board_config]); |
| 12242 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 12243 | if (codec->vendor_id == 0x10ec0267) { |
| 12244 | spec->stream_name_analog = "ALC267 Analog"; |
| 12245 | spec->stream_name_digital = "ALC267 Digital"; |
| 12246 | } else { |
| 12247 | spec->stream_name_analog = "ALC268 Analog"; |
| 12248 | spec->stream_name_digital = "ALC268 Digital"; |
| 12249 | } |
| 12250 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12251 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12252 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12253 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12254 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12255 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12256 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12257 | has_beep = 0; |
| 12258 | for (i = 0; i < spec->num_mixers; i++) { |
| 12259 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12260 | has_beep = 1; |
| 12261 | break; |
| 12262 | } |
| 12263 | } |
| 12264 | |
| 12265 | if (has_beep) { |
| 12266 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12267 | if (err < 0) { |
| 12268 | alc_free(codec); |
| 12269 | return err; |
| 12270 | } |
| 12271 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12272 | /* override the amp caps for beep generator */ |
| 12273 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12274 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12275 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12276 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12277 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12278 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12279 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12280 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12281 | /* check whether NID 0x07 is valid */ |
| 12282 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12283 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12284 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12285 | /* get type */ |
| 12286 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12287 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12288 | spec->adc_nids = alc268_adc_nids_alt; |
| 12289 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12290 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12291 | } else { |
| 12292 | spec->adc_nids = alc268_adc_nids; |
| 12293 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12294 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12295 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12296 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12297 | /* set default input source */ |
| 12298 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12299 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12300 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12301 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12302 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12303 | |
| 12304 | spec->vmaster_nid = 0x02; |
| 12305 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12306 | codec->patch_ops = alc_patch_ops; |
| 12307 | if (board_config == ALC268_AUTO) |
| 12308 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12309 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12310 | codec->proc_widget_hook = print_realtek_coef; |
| 12311 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12312 | return 0; |
| 12313 | } |
| 12314 | |
| 12315 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12316 | * ALC269 channel source setting (2 channel) |
| 12317 | */ |
| 12318 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12319 | |
| 12320 | #define alc269_dac_nids alc260_dac_nids |
| 12321 | |
| 12322 | static hda_nid_t alc269_adc_nids[1] = { |
| 12323 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12324 | 0x08, |
| 12325 | }; |
| 12326 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12327 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12328 | 0x23, |
| 12329 | }; |
| 12330 | |
| 12331 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12332 | * not a mux! |
| 12333 | */ |
| 12334 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12335 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12336 | .num_items = 2, |
| 12337 | .items = { |
| 12338 | { "i-Mic", 0x5 }, |
| 12339 | { "e-Mic", 0x0 }, |
| 12340 | }, |
| 12341 | }; |
| 12342 | |
| 12343 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12344 | .num_items = 2, |
| 12345 | .items = { |
| 12346 | { "i-Mic", 0x1 }, |
| 12347 | { "e-Mic", 0x0 }, |
| 12348 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12349 | }; |
| 12350 | |
| 12351 | #define alc269_modes alc260_modes |
| 12352 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12353 | |
| 12354 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12355 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12356 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12357 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12358 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12359 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12360 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12361 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12362 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12363 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12364 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12365 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12366 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12367 | { } /* end */ |
| 12368 | }; |
| 12369 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12370 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12371 | /* output mixer control */ |
| 12372 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12373 | { |
| 12374 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12375 | .name = "Master Playback Switch", |
| 12376 | .info = snd_hda_mixer_amp_switch_info, |
| 12377 | .get = snd_hda_mixer_amp_switch_get, |
| 12378 | .put = alc268_acer_master_sw_put, |
| 12379 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12380 | }, |
| 12381 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12382 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12383 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12384 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12385 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12386 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12387 | { } |
| 12388 | }; |
| 12389 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12390 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12391 | /* output mixer control */ |
| 12392 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12393 | { |
| 12394 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12395 | .name = "Master Playback Switch", |
| 12396 | .info = snd_hda_mixer_amp_switch_info, |
| 12397 | .get = snd_hda_mixer_amp_switch_get, |
| 12398 | .put = alc268_acer_master_sw_put, |
| 12399 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12400 | }, |
| 12401 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12402 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12403 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12404 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12405 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12406 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12407 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12408 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12409 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12410 | { } |
| 12411 | }; |
| 12412 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12413 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 12414 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 12415 | .ops = &snd_hda_bind_vol, |
| 12416 | .values = { |
| 12417 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12418 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12419 | 0 |
| 12420 | }, |
| 12421 | }; |
| 12422 | |
| 12423 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 12424 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12425 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 12426 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12427 | { } /* end */ |
| 12428 | }; |
| 12429 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12430 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12431 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12432 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12433 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12434 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12435 | { } /* end */ |
| 12436 | }; |
| 12437 | |
| 12438 | /* FSC amilo */ |
| 12439 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 12440 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12441 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12442 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12443 | { } /* end */ |
| 12444 | }; |
| 12445 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12446 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12447 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12448 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12449 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12450 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12451 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12452 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12453 | { } |
| 12454 | }; |
| 12455 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12456 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12457 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12458 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12459 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12460 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12461 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12462 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12463 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12464 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12465 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12466 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12467 | { } |
| 12468 | }; |
| 12469 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12470 | /* toggle speaker-output according to the hp-jack state */ |
| 12471 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12472 | { |
| 12473 | unsigned int present; |
| 12474 | unsigned char bits; |
| 12475 | |
| 12476 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12477 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12478 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12479 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12480 | AMP_IN_MUTE(0), bits); |
| 12481 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12482 | AMP_IN_MUTE(0), bits); |
| 12483 | |
| 12484 | snd_hda_codec_write(codec, 0x20, 0, |
| 12485 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12486 | snd_hda_codec_write(codec, 0x20, 0, |
| 12487 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12488 | |
| 12489 | snd_hda_codec_write(codec, 0x20, 0, |
| 12490 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12491 | snd_hda_codec_write(codec, 0x20, 0, |
| 12492 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12493 | } |
| 12494 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12495 | /* toggle speaker-output according to the hp-jacks state */ |
| 12496 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12497 | { |
| 12498 | unsigned int present; |
| 12499 | unsigned char bits; |
| 12500 | |
| 12501 | /* Check laptop headphone socket */ |
| 12502 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12503 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12504 | |
| 12505 | /* Check port replicator headphone socket */ |
| 12506 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12507 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12508 | |
| 12509 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12510 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12511 | AMP_IN_MUTE(0), bits); |
| 12512 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12513 | AMP_IN_MUTE(0), bits); |
| 12514 | |
| 12515 | snd_hda_codec_write(codec, 0x20, 0, |
| 12516 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12517 | snd_hda_codec_write(codec, 0x20, 0, |
| 12518 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12519 | |
| 12520 | snd_hda_codec_write(codec, 0x20, 0, |
| 12521 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12522 | snd_hda_codec_write(codec, 0x20, 0, |
| 12523 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12524 | } |
| 12525 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12526 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12527 | { |
| 12528 | unsigned int present; |
| 12529 | |
| 12530 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12531 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12532 | snd_hda_codec_write(codec, 0x23, 0, |
| 12533 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12534 | } |
| 12535 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12536 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12537 | { |
| 12538 | unsigned int present_laptop; |
| 12539 | unsigned int present_dock; |
| 12540 | |
| 12541 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12542 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12543 | |
| 12544 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12545 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12546 | |
| 12547 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12548 | if (present_dock) |
| 12549 | snd_hda_codec_write(codec, 0x23, 0, |
| 12550 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12551 | if (present_laptop) |
| 12552 | snd_hda_codec_write(codec, 0x23, 0, |
| 12553 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12554 | if (!present_dock && !present_laptop) |
| 12555 | snd_hda_codec_write(codec, 0x23, 0, |
| 12556 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12557 | } |
| 12558 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12559 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12560 | unsigned int res) |
| 12561 | { |
| 12562 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12563 | alc269_quanta_fl1_speaker_automute(codec); |
| 12564 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12565 | alc269_quanta_fl1_mic_automute(codec); |
| 12566 | } |
| 12567 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12568 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12569 | unsigned int res) |
| 12570 | { |
| 12571 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12572 | alc269_lifebook_speaker_automute(codec); |
| 12573 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12574 | alc269_lifebook_mic_autoswitch(codec); |
| 12575 | } |
| 12576 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12577 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12578 | { |
| 12579 | alc269_quanta_fl1_speaker_automute(codec); |
| 12580 | alc269_quanta_fl1_mic_automute(codec); |
| 12581 | } |
| 12582 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12583 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12584 | { |
| 12585 | alc269_lifebook_speaker_automute(codec); |
| 12586 | alc269_lifebook_mic_autoswitch(codec); |
| 12587 | } |
| 12588 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12589 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12590 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12591 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12592 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12593 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12594 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12595 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12596 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12597 | {} |
| 12598 | }; |
| 12599 | |
| 12600 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12601 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12602 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12603 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12604 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12605 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12606 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12607 | {} |
| 12608 | }; |
| 12609 | |
| 12610 | /* toggle speaker-output according to the hp-jack state */ |
| 12611 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12612 | { |
| 12613 | unsigned int present; |
| 12614 | unsigned char bits; |
| 12615 | |
| 12616 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12617 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12618 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12619 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12620 | AMP_IN_MUTE(0), bits); |
| 12621 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12622 | AMP_IN_MUTE(0), bits); |
| 12623 | } |
| 12624 | |
| 12625 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12626 | { |
| 12627 | unsigned int present; |
| 12628 | |
| 12629 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12630 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12631 | snd_hda_codec_write(codec, 0x23, 0, |
| 12632 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12633 | } |
| 12634 | |
| 12635 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12636 | { |
| 12637 | unsigned int present; |
| 12638 | |
| 12639 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12640 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12641 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12642 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12643 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12644 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12645 | } |
| 12646 | |
| 12647 | /* unsolicited event for HP jack sensing */ |
| 12648 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12649 | unsigned int res) |
| 12650 | { |
| 12651 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12652 | alc269_speaker_automute(codec); |
| 12653 | |
| 12654 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12655 | alc269_eeepc_dmic_automute(codec); |
| 12656 | } |
| 12657 | |
| 12658 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12659 | { |
| 12660 | alc269_speaker_automute(codec); |
| 12661 | alc269_eeepc_dmic_automute(codec); |
| 12662 | } |
| 12663 | |
| 12664 | /* unsolicited event for HP jack sensing */ |
| 12665 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12666 | unsigned int res) |
| 12667 | { |
| 12668 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12669 | alc269_speaker_automute(codec); |
| 12670 | |
| 12671 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12672 | alc269_eeepc_amic_automute(codec); |
| 12673 | } |
| 12674 | |
| 12675 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12676 | { |
| 12677 | alc269_speaker_automute(codec); |
| 12678 | alc269_eeepc_amic_automute(codec); |
| 12679 | } |
| 12680 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12681 | /* |
| 12682 | * generic initialization of ADC, input mixers and output mixers |
| 12683 | */ |
| 12684 | static struct hda_verb alc269_init_verbs[] = { |
| 12685 | /* |
| 12686 | * Unmute ADC0 and set the default input to mic-in |
| 12687 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12688 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12689 | |
| 12690 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12691 | * analog-loopback mixer widget |
| 12692 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12693 | * front panel mic (mic 2) |
| 12694 | */ |
| 12695 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12696 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12697 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12698 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12699 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12700 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12701 | |
| 12702 | /* |
| 12703 | * Set up output mixers (0x0c - 0x0e) |
| 12704 | */ |
| 12705 | /* set vol=0 to output mixers */ |
| 12706 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12707 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12708 | |
| 12709 | /* set up input amps for analog loopback */ |
| 12710 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12711 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12712 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12713 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12714 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12715 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12716 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12717 | |
| 12718 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12719 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12720 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12721 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12722 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12723 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12724 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12725 | |
| 12726 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12727 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12728 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12729 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12730 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12731 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12732 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12733 | |
| 12734 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12735 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12736 | |
| 12737 | /* FIXME: use matrix-type input source selection */ |
| 12738 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12739 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12740 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12741 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12742 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12743 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12744 | |
| 12745 | /* set EAPD */ |
| 12746 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12747 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12748 | { } |
| 12749 | }; |
| 12750 | |
| 12751 | /* add playback controls from the parsed DAC table */ |
| 12752 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12753 | const struct auto_pin_cfg *cfg) |
| 12754 | { |
| 12755 | hda_nid_t nid; |
| 12756 | int err; |
| 12757 | |
| 12758 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12759 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12760 | spec->multiout.dac_nids[0] = 2; |
| 12761 | |
| 12762 | nid = cfg->line_out_pins[0]; |
| 12763 | if (nid) { |
| 12764 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12765 | "Front Playback Volume", |
| 12766 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12767 | if (err < 0) |
| 12768 | return err; |
| 12769 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12770 | "Front Playback Switch", |
| 12771 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12772 | if (err < 0) |
| 12773 | return err; |
| 12774 | } |
| 12775 | |
| 12776 | nid = cfg->speaker_pins[0]; |
| 12777 | if (nid) { |
| 12778 | if (!cfg->line_out_pins[0]) { |
| 12779 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12780 | "Speaker Playback Volume", |
| 12781 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12782 | HDA_OUTPUT)); |
| 12783 | if (err < 0) |
| 12784 | return err; |
| 12785 | } |
| 12786 | if (nid == 0x16) { |
| 12787 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12788 | "Speaker Playback Switch", |
| 12789 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12790 | HDA_OUTPUT)); |
| 12791 | if (err < 0) |
| 12792 | return err; |
| 12793 | } else { |
| 12794 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12795 | "Speaker Playback Switch", |
| 12796 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12797 | HDA_OUTPUT)); |
| 12798 | if (err < 0) |
| 12799 | return err; |
| 12800 | } |
| 12801 | } |
| 12802 | nid = cfg->hp_pins[0]; |
| 12803 | if (nid) { |
| 12804 | /* spec->multiout.hp_nid = 2; */ |
| 12805 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12806 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12807 | "Headphone Playback Volume", |
| 12808 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12809 | HDA_OUTPUT)); |
| 12810 | if (err < 0) |
| 12811 | return err; |
| 12812 | } |
| 12813 | if (nid == 0x16) { |
| 12814 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12815 | "Headphone Playback Switch", |
| 12816 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12817 | HDA_OUTPUT)); |
| 12818 | if (err < 0) |
| 12819 | return err; |
| 12820 | } else { |
| 12821 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12822 | "Headphone Playback Switch", |
| 12823 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12824 | HDA_OUTPUT)); |
| 12825 | if (err < 0) |
| 12826 | return err; |
| 12827 | } |
| 12828 | } |
| 12829 | return 0; |
| 12830 | } |
| 12831 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12832 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12833 | const struct auto_pin_cfg *cfg) |
| 12834 | { |
| 12835 | int err; |
| 12836 | |
| 12837 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12838 | if (err < 0) |
| 12839 | return err; |
| 12840 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12841 | * because it's under 0x18 |
| 12842 | */ |
| 12843 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12844 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12845 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12846 | imux->items[imux->num_items].label = "Int Mic"; |
| 12847 | imux->items[imux->num_items].index = 0x05; |
| 12848 | imux->num_items++; |
| 12849 | } |
| 12850 | return 0; |
| 12851 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12852 | |
| 12853 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12854 | #define alc269_loopbacks alc880_loopbacks |
| 12855 | #endif |
| 12856 | |
| 12857 | /* pcm configuration: identiacal with ALC880 */ |
| 12858 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12859 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12860 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12861 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12862 | |
| 12863 | /* |
| 12864 | * BIOS auto configuration |
| 12865 | */ |
| 12866 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12867 | { |
| 12868 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 12869 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12870 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12871 | |
| 12872 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12873 | alc269_ignore); |
| 12874 | if (err < 0) |
| 12875 | return err; |
| 12876 | |
| 12877 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12878 | if (err < 0) |
| 12879 | return err; |
| 12880 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12881 | if (err < 0) |
| 12882 | return err; |
| 12883 | |
| 12884 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12885 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12886 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12887 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12888 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12889 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12890 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12891 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12892 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12893 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12894 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12895 | /* set default input source */ |
| 12896 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12897 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12898 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12899 | |
| 12900 | err = alc_auto_add_mic_boost(codec); |
| 12901 | if (err < 0) |
| 12902 | return err; |
| 12903 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12904 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12905 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12906 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 12907 | store_pin_configs(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12908 | return 1; |
| 12909 | } |
| 12910 | |
| 12911 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12912 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12913 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12914 | |
| 12915 | |
| 12916 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12917 | static void alc269_auto_init(struct hda_codec *codec) |
| 12918 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12919 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12920 | alc269_auto_init_multi_out(codec); |
| 12921 | alc269_auto_init_hp_out(codec); |
| 12922 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12923 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12924 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12925 | } |
| 12926 | |
| 12927 | /* |
| 12928 | * configuration and preset |
| 12929 | */ |
| 12930 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12931 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12932 | [ALC269_QUANTA_FL1] = "quanta", |
| 12933 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12934 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12935 | [ALC269_FUJITSU] = "fujitsu", |
| 12936 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12937 | }; |
| 12938 | |
| 12939 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12940 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12941 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12942 | ALC269_ASUS_EEEPC_P703), |
| 12943 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12944 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12945 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12946 | ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12947 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12948 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12949 | {} |
| 12950 | }; |
| 12951 | |
| 12952 | static struct alc_config_preset alc269_presets[] = { |
| 12953 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12954 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12955 | .init_verbs = { alc269_init_verbs }, |
| 12956 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12957 | .dac_nids = alc269_dac_nids, |
| 12958 | .hp_nid = 0x03, |
| 12959 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12960 | .channel_mode = alc269_modes, |
| 12961 | .input_mux = &alc269_capture_source, |
| 12962 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12963 | [ALC269_QUANTA_FL1] = { |
| 12964 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12965 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12966 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12967 | .dac_nids = alc269_dac_nids, |
| 12968 | .hp_nid = 0x03, |
| 12969 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12970 | .channel_mode = alc269_modes, |
| 12971 | .input_mux = &alc269_capture_source, |
| 12972 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12973 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12974 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12975 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12976 | .mixers = { alc269_eeepc_mixer }, |
| 12977 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12978 | .init_verbs = { alc269_init_verbs, |
| 12979 | alc269_eeepc_amic_init_verbs }, |
| 12980 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12981 | .dac_nids = alc269_dac_nids, |
| 12982 | .hp_nid = 0x03, |
| 12983 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12984 | .channel_mode = alc269_modes, |
| 12985 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12986 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12987 | .init_hook = alc269_eeepc_amic_inithook, |
| 12988 | }, |
| 12989 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12990 | .mixers = { alc269_eeepc_mixer }, |
| 12991 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12992 | .init_verbs = { alc269_init_verbs, |
| 12993 | alc269_eeepc_dmic_init_verbs }, |
| 12994 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12995 | .dac_nids = alc269_dac_nids, |
| 12996 | .hp_nid = 0x03, |
| 12997 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12998 | .channel_mode = alc269_modes, |
| 12999 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13000 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13001 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13002 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13003 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13004 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13005 | .cap_mixer = alc269_epc_capture_mixer, |
| 13006 | .init_verbs = { alc269_init_verbs, |
| 13007 | alc269_eeepc_dmic_init_verbs }, |
| 13008 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13009 | .dac_nids = alc269_dac_nids, |
| 13010 | .hp_nid = 0x03, |
| 13011 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13012 | .channel_mode = alc269_modes, |
| 13013 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13014 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13015 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13016 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13017 | [ALC269_LIFEBOOK] = { |
| 13018 | .mixers = { alc269_lifebook_mixer }, |
| 13019 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13020 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13021 | .dac_nids = alc269_dac_nids, |
| 13022 | .hp_nid = 0x03, |
| 13023 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13024 | .channel_mode = alc269_modes, |
| 13025 | .input_mux = &alc269_capture_source, |
| 13026 | .unsol_event = alc269_lifebook_unsol_event, |
| 13027 | .init_hook = alc269_lifebook_init_hook, |
| 13028 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13029 | }; |
| 13030 | |
| 13031 | static int patch_alc269(struct hda_codec *codec) |
| 13032 | { |
| 13033 | struct alc_spec *spec; |
| 13034 | int board_config; |
| 13035 | int err; |
| 13036 | |
| 13037 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13038 | if (spec == NULL) |
| 13039 | return -ENOMEM; |
| 13040 | |
| 13041 | codec->spec = spec; |
| 13042 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13043 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13044 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13045 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13046 | alc269_models, |
| 13047 | alc269_cfg_tbl); |
| 13048 | |
| 13049 | if (board_config < 0) { |
| 13050 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 13051 | "trying auto-probe from BIOS...\n"); |
| 13052 | board_config = ALC269_AUTO; |
| 13053 | } |
| 13054 | |
| 13055 | if (board_config == ALC269_AUTO) { |
| 13056 | /* automatic parse from the BIOS config */ |
| 13057 | err = alc269_parse_auto_config(codec); |
| 13058 | if (err < 0) { |
| 13059 | alc_free(codec); |
| 13060 | return err; |
| 13061 | } else if (!err) { |
| 13062 | printk(KERN_INFO |
| 13063 | "hda_codec: Cannot set up configuration " |
| 13064 | "from BIOS. Using base mode...\n"); |
| 13065 | board_config = ALC269_BASIC; |
| 13066 | } |
| 13067 | } |
| 13068 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13069 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13070 | if (err < 0) { |
| 13071 | alc_free(codec); |
| 13072 | return err; |
| 13073 | } |
| 13074 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13075 | if (board_config != ALC269_AUTO) |
| 13076 | setup_preset(spec, &alc269_presets[board_config]); |
| 13077 | |
| 13078 | spec->stream_name_analog = "ALC269 Analog"; |
| 13079 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13080 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13081 | |
| 13082 | spec->stream_name_digital = "ALC269 Digital"; |
| 13083 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13084 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13085 | |
| 13086 | spec->adc_nids = alc269_adc_nids; |
| 13087 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13088 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13089 | if (!spec->cap_mixer) |
| 13090 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13091 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13092 | |
| 13093 | codec->patch_ops = alc_patch_ops; |
| 13094 | if (board_config == ALC269_AUTO) |
| 13095 | spec->init_hook = alc269_auto_init; |
| 13096 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13097 | if (!spec->loopback.amplist) |
| 13098 | spec->loopback.amplist = alc269_loopbacks; |
| 13099 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13100 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13101 | |
| 13102 | return 0; |
| 13103 | } |
| 13104 | |
| 13105 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13106 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13107 | */ |
| 13108 | |
| 13109 | /* |
| 13110 | * set the path ways for 2 channel output |
| 13111 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13112 | */ |
| 13113 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13114 | /* set pin widget 1Ah (line in) for input */ |
| 13115 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13116 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13117 | * the vref |
| 13118 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13119 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13120 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13121 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13122 | #if 0 |
| 13123 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13124 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13125 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13126 | { } /* end */ |
| 13127 | }; |
| 13128 | /* |
| 13129 | * 6ch mode |
| 13130 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13131 | */ |
| 13132 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13133 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13134 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13135 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13136 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13137 | |
| 13138 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13139 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13140 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13141 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13142 | #if 0 |
| 13143 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13144 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13145 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13146 | { } /* end */ |
| 13147 | }; |
| 13148 | |
| 13149 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13150 | { 2, alc861_threestack_ch2_init }, |
| 13151 | { 6, alc861_threestack_ch6_init }, |
| 13152 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13153 | /* Set mic1 as input and unmute the mixer */ |
| 13154 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13155 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13156 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13157 | { } /* end */ |
| 13158 | }; |
| 13159 | /* Set mic1 as output and mute mixer */ |
| 13160 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13161 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13162 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13163 | { } /* end */ |
| 13164 | }; |
| 13165 | |
| 13166 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13167 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13168 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13169 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13170 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13171 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13172 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13173 | /* set pin widget 1Ah (line in) for input */ |
| 13174 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13175 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13176 | * the vref |
| 13177 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13178 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13179 | |
| 13180 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13181 | #if 0 |
| 13182 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13183 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13184 | #endif |
| 13185 | { } /* end */ |
| 13186 | }; |
| 13187 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13188 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13189 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13190 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13191 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13192 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13193 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13194 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13195 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13196 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13197 | |
| 13198 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13199 | #if 0 |
| 13200 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13201 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13202 | #endif |
| 13203 | { } /* end */ |
| 13204 | }; |
| 13205 | |
| 13206 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13207 | { 2, alc861_asus_ch2_init }, |
| 13208 | { 6, alc861_asus_ch6_init }, |
| 13209 | }; |
| 13210 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13211 | /* patch-ALC861 */ |
| 13212 | |
| 13213 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13214 | /* output mixer control */ |
| 13215 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13216 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13217 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13218 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13219 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13220 | |
| 13221 | /*Input mixer control */ |
| 13222 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13223 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13224 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13225 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13226 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13227 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13228 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13229 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13230 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13231 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13232 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13233 | { } /* end */ |
| 13234 | }; |
| 13235 | |
| 13236 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13237 | /* output mixer control */ |
| 13238 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13239 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13240 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13241 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13242 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13243 | |
| 13244 | /* Input mixer control */ |
| 13245 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13246 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13247 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13248 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13249 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13250 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13251 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13252 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13253 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13254 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13255 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13256 | { |
| 13257 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13258 | .name = "Channel Mode", |
| 13259 | .info = alc_ch_mode_info, |
| 13260 | .get = alc_ch_mode_get, |
| 13261 | .put = alc_ch_mode_put, |
| 13262 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13263 | }, |
| 13264 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13265 | }; |
| 13266 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13267 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13268 | /* output mixer control */ |
| 13269 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13270 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13271 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13272 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13273 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13274 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13275 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13276 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13277 | /* output mixer control */ |
| 13278 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13279 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13280 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13281 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13282 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13283 | |
| 13284 | /* Input mixer control */ |
| 13285 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13286 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13287 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13288 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13289 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13290 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13291 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13292 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13293 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13294 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13295 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13296 | { |
| 13297 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13298 | .name = "Channel Mode", |
| 13299 | .info = alc_ch_mode_info, |
| 13300 | .get = alc_ch_mode_get, |
| 13301 | .put = alc_ch_mode_put, |
| 13302 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13303 | }, |
| 13304 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13305 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13306 | |
| 13307 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13308 | /* output mixer control */ |
| 13309 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13310 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13311 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13312 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13313 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13314 | |
| 13315 | /* Input mixer control */ |
| 13316 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13317 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13318 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13319 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13320 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13321 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13322 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13323 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13324 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13325 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13326 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13327 | { |
| 13328 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13329 | .name = "Channel Mode", |
| 13330 | .info = alc_ch_mode_info, |
| 13331 | .get = alc_ch_mode_get, |
| 13332 | .put = alc_ch_mode_put, |
| 13333 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13334 | }, |
| 13335 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13336 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13337 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13338 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13339 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13340 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13341 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13342 | { } |
| 13343 | }; |
| 13344 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13345 | /* |
| 13346 | * generic initialization of ADC, input mixers and output mixers |
| 13347 | */ |
| 13348 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13349 | /* |
| 13350 | * Unmute ADC0 and set the default input to mic-in |
| 13351 | */ |
| 13352 | /* port-A for surround (rear panel) */ |
| 13353 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13354 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13355 | /* port-B for mic-in (rear panel) with vref */ |
| 13356 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13357 | /* port-C for line-in (rear panel) */ |
| 13358 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13359 | /* port-D for Front */ |
| 13360 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13361 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13362 | /* port-E for HP out (front panel) */ |
| 13363 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13364 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13365 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13366 | /* port-F for mic-in (front panel) with vref */ |
| 13367 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13368 | /* port-G for CLFE (rear panel) */ |
| 13369 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13370 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13371 | /* port-H for side (rear panel) */ |
| 13372 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13373 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13374 | /* CD-in */ |
| 13375 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13376 | /* route front mic to ADC1*/ |
| 13377 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13378 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13379 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13380 | /* Unmute DAC0~3 & spdif out*/ |
| 13381 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13382 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13383 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13384 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13385 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13386 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13387 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13388 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13389 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13390 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13391 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13392 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13393 | /* Unmute Stereo Mixer 15 */ |
| 13394 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13395 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13396 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13397 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13398 | |
| 13399 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13400 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13401 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13402 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13403 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13404 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13405 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13406 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13407 | /* hp used DAC 3 (Front) */ |
| 13408 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13409 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13410 | |
| 13411 | { } |
| 13412 | }; |
| 13413 | |
| 13414 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13415 | /* |
| 13416 | * Unmute ADC0 and set the default input to mic-in |
| 13417 | */ |
| 13418 | /* port-A for surround (rear panel) */ |
| 13419 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13420 | /* port-B for mic-in (rear panel) with vref */ |
| 13421 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13422 | /* port-C for line-in (rear panel) */ |
| 13423 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13424 | /* port-D for Front */ |
| 13425 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13426 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13427 | /* port-E for HP out (front panel) */ |
| 13428 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13429 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13430 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13431 | /* port-F for mic-in (front panel) with vref */ |
| 13432 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13433 | /* port-G for CLFE (rear panel) */ |
| 13434 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13435 | /* port-H for side (rear panel) */ |
| 13436 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13437 | /* CD-in */ |
| 13438 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13439 | /* route front mic to ADC1*/ |
| 13440 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13441 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13442 | /* Unmute DAC0~3 & spdif out*/ |
| 13443 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13444 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13445 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13446 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13447 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13448 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13449 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13450 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13451 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13452 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13453 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13454 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13455 | /* Unmute Stereo Mixer 15 */ |
| 13456 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13457 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13458 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13459 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13460 | |
| 13461 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13462 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13463 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13464 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13465 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13466 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13467 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13468 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13469 | /* hp used DAC 3 (Front) */ |
| 13470 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13471 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13472 | { } |
| 13473 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13474 | |
| 13475 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13476 | /* |
| 13477 | * Unmute ADC0 and set the default input to mic-in |
| 13478 | */ |
| 13479 | /* port-A for surround (rear panel) */ |
| 13480 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13481 | /* port-B for mic-in (rear panel) with vref */ |
| 13482 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13483 | /* port-C for line-in (rear panel) */ |
| 13484 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13485 | /* port-D for Front */ |
| 13486 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13487 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13488 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13489 | /* this has to be set to VREF80 */ |
| 13490 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13491 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13492 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13493 | /* port-F for mic-in (front panel) with vref */ |
| 13494 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13495 | /* port-G for CLFE (rear panel) */ |
| 13496 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13497 | /* port-H for side (rear panel) */ |
| 13498 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13499 | /* CD-in */ |
| 13500 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13501 | /* route front mic to ADC1*/ |
| 13502 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13503 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13504 | /* Unmute DAC0~3 & spdif out*/ |
| 13505 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13506 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13507 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13508 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13509 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13510 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13511 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13512 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13513 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13514 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13515 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13516 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13517 | /* Unmute Stereo Mixer 15 */ |
| 13518 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13519 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13521 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13522 | |
| 13523 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13524 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13525 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13526 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13527 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13528 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13529 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13530 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13531 | /* hp used DAC 3 (Front) */ |
| 13532 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13533 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13534 | { } |
| 13535 | }; |
| 13536 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13537 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13538 | /* |
| 13539 | * Unmute ADC0 and set the default input to mic-in |
| 13540 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13541 | /* port-A for surround (rear panel) |
| 13542 | * according to codec#0 this is the HP jack |
| 13543 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13544 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13545 | /* route front PCM to HP */ |
| 13546 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13547 | /* port-B for mic-in (rear panel) with vref */ |
| 13548 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13549 | /* port-C for line-in (rear panel) */ |
| 13550 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13551 | /* port-D for Front */ |
| 13552 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13553 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13554 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13555 | /* this has to be set to VREF80 */ |
| 13556 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13557 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13558 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13559 | /* port-F for mic-in (front panel) with vref */ |
| 13560 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13561 | /* port-G for CLFE (rear panel) */ |
| 13562 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13563 | /* port-H for side (rear panel) */ |
| 13564 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13565 | /* CD-in */ |
| 13566 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13567 | /* route front mic to ADC1*/ |
| 13568 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13569 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13570 | /* Unmute DAC0~3 & spdif out*/ |
| 13571 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13572 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13573 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13574 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13575 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13576 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13577 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13578 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13579 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13580 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13581 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13582 | /* Unmute Stereo Mixer 15 */ |
| 13583 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13584 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13585 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13586 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13587 | |
| 13588 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13589 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13590 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13591 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13592 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13593 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13594 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13595 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13596 | /* hp used DAC 3 (Front) */ |
| 13597 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13598 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13599 | { } |
| 13600 | }; |
| 13601 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13602 | /* additional init verbs for ASUS laptops */ |
| 13603 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13604 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13605 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13606 | { } |
| 13607 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13608 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13609 | /* |
| 13610 | * generic initialization of ADC, input mixers and output mixers |
| 13611 | */ |
| 13612 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13613 | /* |
| 13614 | * Unmute ADC0 and set the default input to mic-in |
| 13615 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13616 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13617 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13618 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13619 | /* Unmute DAC0~3 & spdif out*/ |
| 13620 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13621 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13622 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13623 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13624 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13625 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13626 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13627 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13628 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13629 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13630 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13631 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13632 | /* Unmute Stereo Mixer 15 */ |
| 13633 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13634 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13635 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13636 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13637 | |
| 13638 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13639 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13640 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13641 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13642 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13643 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13644 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13645 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13646 | |
| 13647 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13648 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13649 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13650 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13651 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13652 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13653 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13654 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13655 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13656 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13657 | |
| 13658 | { } |
| 13659 | }; |
| 13660 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13661 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13662 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13663 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13664 | { } |
| 13665 | }; |
| 13666 | |
| 13667 | /* toggle speaker-output according to the hp-jack state */ |
| 13668 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13669 | { |
| 13670 | unsigned int present; |
| 13671 | |
| 13672 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13673 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13674 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13675 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13676 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13677 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13678 | } |
| 13679 | |
| 13680 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13681 | unsigned int res) |
| 13682 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13683 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13684 | alc861_toshiba_automute(codec); |
| 13685 | } |
| 13686 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13687 | /* pcm configuration: identiacal with ALC880 */ |
| 13688 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13689 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13690 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13691 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13692 | |
| 13693 | |
| 13694 | #define ALC861_DIGOUT_NID 0x07 |
| 13695 | |
| 13696 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13697 | { 8, NULL } |
| 13698 | }; |
| 13699 | |
| 13700 | static hda_nid_t alc861_dac_nids[4] = { |
| 13701 | /* front, surround, clfe, side */ |
| 13702 | 0x03, 0x06, 0x05, 0x04 |
| 13703 | }; |
| 13704 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13705 | static hda_nid_t alc660_dac_nids[3] = { |
| 13706 | /* front, clfe, surround */ |
| 13707 | 0x03, 0x05, 0x06 |
| 13708 | }; |
| 13709 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13710 | static hda_nid_t alc861_adc_nids[1] = { |
| 13711 | /* ADC0-2 */ |
| 13712 | 0x08, |
| 13713 | }; |
| 13714 | |
| 13715 | static struct hda_input_mux alc861_capture_source = { |
| 13716 | .num_items = 5, |
| 13717 | .items = { |
| 13718 | { "Mic", 0x0 }, |
| 13719 | { "Front Mic", 0x3 }, |
| 13720 | { "Line", 0x1 }, |
| 13721 | { "CD", 0x4 }, |
| 13722 | { "Mixer", 0x5 }, |
| 13723 | }, |
| 13724 | }; |
| 13725 | |
| 13726 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13727 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13728 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13729 | { |
| 13730 | int i; |
| 13731 | hda_nid_t nid; |
| 13732 | |
| 13733 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13734 | for (i = 0; i < cfg->line_outs; i++) { |
| 13735 | nid = cfg->line_out_pins[i]; |
| 13736 | if (nid) { |
| 13737 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13738 | continue; |
| 13739 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13740 | } |
| 13741 | } |
| 13742 | spec->multiout.num_dacs = cfg->line_outs; |
| 13743 | return 0; |
| 13744 | } |
| 13745 | |
| 13746 | /* add playback controls from the parsed DAC table */ |
| 13747 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13748 | const struct auto_pin_cfg *cfg) |
| 13749 | { |
| 13750 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13751 | static const char *chname[4] = { |
| 13752 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13753 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13754 | hda_nid_t nid; |
| 13755 | int i, idx, err; |
| 13756 | |
| 13757 | for (i = 0; i < cfg->line_outs; i++) { |
| 13758 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13759 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13760 | continue; |
| 13761 | if (nid == 0x05) { |
| 13762 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13763 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13764 | "Center Playback Switch", |
| 13765 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13766 | HDA_OUTPUT)); |
| 13767 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13768 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13769 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13770 | "LFE Playback Switch", |
| 13771 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13772 | HDA_OUTPUT)); |
| 13773 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13774 | return err; |
| 13775 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13776 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13777 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13778 | if (nid == alc861_dac_nids[idx]) |
| 13779 | break; |
| 13780 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13781 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13782 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13783 | HDA_OUTPUT)); |
| 13784 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13785 | return err; |
| 13786 | } |
| 13787 | } |
| 13788 | return 0; |
| 13789 | } |
| 13790 | |
| 13791 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13792 | { |
| 13793 | int err; |
| 13794 | hda_nid_t nid; |
| 13795 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13796 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13797 | return 0; |
| 13798 | |
| 13799 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13800 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13801 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13802 | "Headphone Playback Switch", |
| 13803 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13804 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13805 | return err; |
| 13806 | spec->multiout.hp_nid = nid; |
| 13807 | } |
| 13808 | return 0; |
| 13809 | } |
| 13810 | |
| 13811 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13812 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13813 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13814 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13815 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13816 | int i, err, idx, idx1; |
| 13817 | |
| 13818 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13819 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13820 | case 0x0c: |
| 13821 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13822 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13823 | break; |
| 13824 | case 0x0f: |
| 13825 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13826 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13827 | break; |
| 13828 | case 0x0d: |
| 13829 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13830 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13831 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13832 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13833 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13834 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13835 | break; |
| 13836 | case 0x11: |
| 13837 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13838 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13839 | break; |
| 13840 | default: |
| 13841 | continue; |
| 13842 | } |
| 13843 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13844 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13845 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13846 | if (err < 0) |
| 13847 | return err; |
| 13848 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13849 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13850 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13851 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13852 | } |
| 13853 | return 0; |
| 13854 | } |
| 13855 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13856 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13857 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13858 | int pin_type, int dac_idx) |
| 13859 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13860 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13861 | pin_type); |
| 13862 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13863 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13864 | } |
| 13865 | |
| 13866 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13867 | { |
| 13868 | struct alc_spec *spec = codec->spec; |
| 13869 | int i; |
| 13870 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13871 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13872 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13873 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13874 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13875 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13876 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13877 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13878 | } |
| 13879 | } |
| 13880 | |
| 13881 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13882 | { |
| 13883 | struct alc_spec *spec = codec->spec; |
| 13884 | hda_nid_t pin; |
| 13885 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13886 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13887 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13888 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13889 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13890 | pin = spec->autocfg.speaker_pins[0]; |
| 13891 | if (pin) |
| 13892 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13893 | } |
| 13894 | |
| 13895 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13896 | { |
| 13897 | struct alc_spec *spec = codec->spec; |
| 13898 | int i; |
| 13899 | |
| 13900 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13901 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13902 | if (nid >= 0x0c && nid <= 0x11) { |
| 13903 | snd_hda_codec_write(codec, nid, 0, |
| 13904 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13905 | i <= AUTO_PIN_FRONT_MIC ? |
| 13906 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13907 | } |
| 13908 | } |
| 13909 | } |
| 13910 | |
| 13911 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13912 | /* return 1 if successful, 0 if the proper config is not found, |
| 13913 | * or a negative error code |
| 13914 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13915 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13916 | { |
| 13917 | struct alc_spec *spec = codec->spec; |
| 13918 | int err; |
| 13919 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13920 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13921 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13922 | alc861_ignore); |
| 13923 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13924 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13925 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13926 | return 0; /* can't find valid BIOS pin config */ |
| 13927 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13928 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13929 | if (err < 0) |
| 13930 | return err; |
| 13931 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13932 | if (err < 0) |
| 13933 | return err; |
| 13934 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13935 | if (err < 0) |
| 13936 | return err; |
| 13937 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13938 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13939 | return err; |
| 13940 | |
| 13941 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13942 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13943 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13944 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13945 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13946 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13947 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13948 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13949 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13950 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13951 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13952 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13953 | |
| 13954 | spec->adc_nids = alc861_adc_nids; |
| 13955 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13956 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13957 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 13958 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13959 | return 1; |
| 13960 | } |
| 13961 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13962 | /* additional initialization for auto-configuration model */ |
| 13963 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13964 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13965 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13966 | alc861_auto_init_multi_out(codec); |
| 13967 | alc861_auto_init_hp_out(codec); |
| 13968 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13969 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13970 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13971 | } |
| 13972 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13973 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13974 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13975 | { 0x15, HDA_INPUT, 0 }, |
| 13976 | { 0x15, HDA_INPUT, 1 }, |
| 13977 | { 0x15, HDA_INPUT, 2 }, |
| 13978 | { 0x15, HDA_INPUT, 3 }, |
| 13979 | { } /* end */ |
| 13980 | }; |
| 13981 | #endif |
| 13982 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13983 | |
| 13984 | /* |
| 13985 | * configuration and preset |
| 13986 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13987 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13988 | [ALC861_3ST] = "3stack", |
| 13989 | [ALC660_3ST] = "3stack-660", |
| 13990 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13991 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13992 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 13993 | [ALC861_TOSHIBA] = "toshiba", |
| 13994 | [ALC861_ASUS] = "asus", |
| 13995 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 13996 | [ALC861_AUTO] = "auto", |
| 13997 | }; |
| 13998 | |
| 13999 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14000 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14001 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14002 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14003 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14004 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14005 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14006 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14007 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14008 | * Any other models that need this preset? |
| 14009 | */ |
| 14010 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14011 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14012 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14013 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14014 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14015 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14016 | /* FIXME: the below seems conflict */ |
| 14017 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14018 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14019 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14020 | {} |
| 14021 | }; |
| 14022 | |
| 14023 | static struct alc_config_preset alc861_presets[] = { |
| 14024 | [ALC861_3ST] = { |
| 14025 | .mixers = { alc861_3ST_mixer }, |
| 14026 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14027 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14028 | .dac_nids = alc861_dac_nids, |
| 14029 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14030 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14031 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14032 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14033 | .adc_nids = alc861_adc_nids, |
| 14034 | .input_mux = &alc861_capture_source, |
| 14035 | }, |
| 14036 | [ALC861_3ST_DIG] = { |
| 14037 | .mixers = { alc861_base_mixer }, |
| 14038 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14039 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14040 | .dac_nids = alc861_dac_nids, |
| 14041 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14042 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14043 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14044 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14045 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14046 | .adc_nids = alc861_adc_nids, |
| 14047 | .input_mux = &alc861_capture_source, |
| 14048 | }, |
| 14049 | [ALC861_6ST_DIG] = { |
| 14050 | .mixers = { alc861_base_mixer }, |
| 14051 | .init_verbs = { alc861_base_init_verbs }, |
| 14052 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14053 | .dac_nids = alc861_dac_nids, |
| 14054 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14055 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14056 | .channel_mode = alc861_8ch_modes, |
| 14057 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14058 | .adc_nids = alc861_adc_nids, |
| 14059 | .input_mux = &alc861_capture_source, |
| 14060 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14061 | [ALC660_3ST] = { |
| 14062 | .mixers = { alc861_3ST_mixer }, |
| 14063 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14064 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14065 | .dac_nids = alc660_dac_nids, |
| 14066 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14067 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14068 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14069 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14070 | .adc_nids = alc861_adc_nids, |
| 14071 | .input_mux = &alc861_capture_source, |
| 14072 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14073 | [ALC861_UNIWILL_M31] = { |
| 14074 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14075 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14076 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14077 | .dac_nids = alc861_dac_nids, |
| 14078 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14079 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14080 | .channel_mode = alc861_uniwill_m31_modes, |
| 14081 | .need_dac_fix = 1, |
| 14082 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14083 | .adc_nids = alc861_adc_nids, |
| 14084 | .input_mux = &alc861_capture_source, |
| 14085 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14086 | [ALC861_TOSHIBA] = { |
| 14087 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14088 | .init_verbs = { alc861_base_init_verbs, |
| 14089 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14090 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14091 | .dac_nids = alc861_dac_nids, |
| 14092 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14093 | .channel_mode = alc883_3ST_2ch_modes, |
| 14094 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14095 | .adc_nids = alc861_adc_nids, |
| 14096 | .input_mux = &alc861_capture_source, |
| 14097 | .unsol_event = alc861_toshiba_unsol_event, |
| 14098 | .init_hook = alc861_toshiba_automute, |
| 14099 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14100 | [ALC861_ASUS] = { |
| 14101 | .mixers = { alc861_asus_mixer }, |
| 14102 | .init_verbs = { alc861_asus_init_verbs }, |
| 14103 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14104 | .dac_nids = alc861_dac_nids, |
| 14105 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14106 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14107 | .channel_mode = alc861_asus_modes, |
| 14108 | .need_dac_fix = 1, |
| 14109 | .hp_nid = 0x06, |
| 14110 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14111 | .adc_nids = alc861_adc_nids, |
| 14112 | .input_mux = &alc861_capture_source, |
| 14113 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14114 | [ALC861_ASUS_LAPTOP] = { |
| 14115 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14116 | .init_verbs = { alc861_asus_init_verbs, |
| 14117 | alc861_asus_laptop_init_verbs }, |
| 14118 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14119 | .dac_nids = alc861_dac_nids, |
| 14120 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14121 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14122 | .channel_mode = alc883_3ST_2ch_modes, |
| 14123 | .need_dac_fix = 1, |
| 14124 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14125 | .adc_nids = alc861_adc_nids, |
| 14126 | .input_mux = &alc861_capture_source, |
| 14127 | }, |
| 14128 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14129 | |
| 14130 | |
| 14131 | static int patch_alc861(struct hda_codec *codec) |
| 14132 | { |
| 14133 | struct alc_spec *spec; |
| 14134 | int board_config; |
| 14135 | int err; |
| 14136 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14137 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14138 | if (spec == NULL) |
| 14139 | return -ENOMEM; |
| 14140 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14141 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14142 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14143 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14144 | alc861_models, |
| 14145 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14146 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14147 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14148 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 14149 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14150 | board_config = ALC861_AUTO; |
| 14151 | } |
| 14152 | |
| 14153 | if (board_config == ALC861_AUTO) { |
| 14154 | /* automatic parse from the BIOS config */ |
| 14155 | err = alc861_parse_auto_config(codec); |
| 14156 | if (err < 0) { |
| 14157 | alc_free(codec); |
| 14158 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14159 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14160 | printk(KERN_INFO |
| 14161 | "hda_codec: Cannot set up configuration " |
| 14162 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14163 | board_config = ALC861_3ST_DIG; |
| 14164 | } |
| 14165 | } |
| 14166 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14167 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14168 | if (err < 0) { |
| 14169 | alc_free(codec); |
| 14170 | return err; |
| 14171 | } |
| 14172 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14173 | if (board_config != ALC861_AUTO) |
| 14174 | setup_preset(spec, &alc861_presets[board_config]); |
| 14175 | |
| 14176 | spec->stream_name_analog = "ALC861 Analog"; |
| 14177 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14178 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14179 | |
| 14180 | spec->stream_name_digital = "ALC861 Digital"; |
| 14181 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14182 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14183 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14184 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14185 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14186 | spec->vmaster_nid = 0x03; |
| 14187 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14188 | codec->patch_ops = alc_patch_ops; |
| 14189 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14190 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14191 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14192 | if (!spec->loopback.amplist) |
| 14193 | spec->loopback.amplist = alc861_loopbacks; |
| 14194 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14195 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14196 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14197 | return 0; |
| 14198 | } |
| 14199 | |
| 14200 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14201 | * ALC861-VD support |
| 14202 | * |
| 14203 | * Based on ALC882 |
| 14204 | * |
| 14205 | * In addition, an independent DAC |
| 14206 | */ |
| 14207 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14208 | |
| 14209 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14210 | /* front, surr, clfe, side surr */ |
| 14211 | 0x02, 0x03, 0x04, 0x05 |
| 14212 | }; |
| 14213 | |
| 14214 | /* dac_nids for ALC660vd are in a different order - according to |
| 14215 | * Realtek's driver. |
| 14216 | * This should probably tesult in a different mixer for 6stack models |
| 14217 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14218 | * - and it is the same as in 861vd. |
| 14219 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14220 | */ |
| 14221 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14222 | /* front, rear, clfe, rear_surr */ |
| 14223 | 0x02, 0x04, 0x03 |
| 14224 | }; |
| 14225 | |
| 14226 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14227 | /* ADC0 */ |
| 14228 | 0x09, |
| 14229 | }; |
| 14230 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14231 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14232 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14233 | /* input MUX */ |
| 14234 | /* FIXME: should be a matrix-type input source selection */ |
| 14235 | static struct hda_input_mux alc861vd_capture_source = { |
| 14236 | .num_items = 4, |
| 14237 | .items = { |
| 14238 | { "Mic", 0x0 }, |
| 14239 | { "Front Mic", 0x1 }, |
| 14240 | { "Line", 0x2 }, |
| 14241 | { "CD", 0x4 }, |
| 14242 | }, |
| 14243 | }; |
| 14244 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14245 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14246 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14247 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14248 | { "Ext Mic", 0x0 }, |
| 14249 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14250 | }, |
| 14251 | }; |
| 14252 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14253 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14254 | .num_items = 2, |
| 14255 | .items = { |
| 14256 | { "Front Mic", 0x0 }, |
| 14257 | { "ATAPI Mic", 0x1 }, |
| 14258 | }, |
| 14259 | }; |
| 14260 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14261 | /* |
| 14262 | * 2ch mode |
| 14263 | */ |
| 14264 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14265 | { 2, NULL } |
| 14266 | }; |
| 14267 | |
| 14268 | /* |
| 14269 | * 6ch mode |
| 14270 | */ |
| 14271 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14272 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14273 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14274 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14275 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14276 | { } /* end */ |
| 14277 | }; |
| 14278 | |
| 14279 | /* |
| 14280 | * 8ch mode |
| 14281 | */ |
| 14282 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14283 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14284 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14285 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14286 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14287 | { } /* end */ |
| 14288 | }; |
| 14289 | |
| 14290 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14291 | { 6, alc861vd_6stack_ch6_init }, |
| 14292 | { 8, alc861vd_6stack_ch8_init }, |
| 14293 | }; |
| 14294 | |
| 14295 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14296 | { |
| 14297 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14298 | .name = "Channel Mode", |
| 14299 | .info = alc_ch_mode_info, |
| 14300 | .get = alc_ch_mode_get, |
| 14301 | .put = alc_ch_mode_put, |
| 14302 | }, |
| 14303 | { } /* end */ |
| 14304 | }; |
| 14305 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14306 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14307 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14308 | */ |
| 14309 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14310 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14311 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14312 | |
| 14313 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14314 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14315 | |
| 14316 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14317 | HDA_OUTPUT), |
| 14318 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14319 | HDA_OUTPUT), |
| 14320 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14321 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14322 | |
| 14323 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14324 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14325 | |
| 14326 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14327 | |
| 14328 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14329 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14330 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14331 | |
| 14332 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14333 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14334 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14335 | |
| 14336 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14337 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14338 | |
| 14339 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14340 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14341 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14342 | { } /* end */ |
| 14343 | }; |
| 14344 | |
| 14345 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14346 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14347 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14348 | |
| 14349 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14350 | |
| 14351 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14352 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14353 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14354 | |
| 14355 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14356 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14357 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14358 | |
| 14359 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14360 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14361 | |
| 14362 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14363 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14364 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14365 | { } /* end */ |
| 14366 | }; |
| 14367 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14368 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14369 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14370 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14371 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14372 | |
| 14373 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14374 | |
| 14375 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14376 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14377 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14378 | |
| 14379 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14380 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14381 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14382 | |
| 14383 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14384 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14385 | |
| 14386 | { } /* end */ |
| 14387 | }; |
| 14388 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14389 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14390 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14391 | */ |
| 14392 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14393 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14394 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14395 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14396 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14397 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14398 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14399 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14400 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14401 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14402 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14403 | { } /* end */ |
| 14404 | }; |
| 14405 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14406 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14407 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14408 | */ |
| 14409 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14410 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14411 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14412 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14413 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14414 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14415 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14416 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14417 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14418 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14419 | { } /* end */ |
| 14420 | }; |
| 14421 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14422 | /* |
| 14423 | * generic initialization of ADC, input mixers and output mixers |
| 14424 | */ |
| 14425 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14426 | /* |
| 14427 | * Unmute ADC0 and set the default input to mic-in |
| 14428 | */ |
| 14429 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14430 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14431 | |
| 14432 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14433 | * the analog-loopback mixer widget |
| 14434 | */ |
| 14435 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14436 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14437 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14438 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14439 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14440 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14441 | |
| 14442 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14443 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14444 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14445 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14446 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14447 | |
| 14448 | /* |
| 14449 | * Set up output mixers (0x02 - 0x05) |
| 14450 | */ |
| 14451 | /* set vol=0 to output mixers */ |
| 14452 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14453 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14454 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14455 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14456 | |
| 14457 | /* set up input amps for analog loopback */ |
| 14458 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14459 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14460 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14461 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14462 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14463 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14464 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14465 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14466 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14467 | |
| 14468 | { } |
| 14469 | }; |
| 14470 | |
| 14471 | /* |
| 14472 | * 3-stack pin configuration: |
| 14473 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14474 | */ |
| 14475 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14476 | /* |
| 14477 | * Set pin mode and muting |
| 14478 | */ |
| 14479 | /* set front pin widgets 0x14 for output */ |
| 14480 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14481 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14482 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14483 | |
| 14484 | /* Mic (rear) pin: input vref at 80% */ |
| 14485 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14486 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14487 | /* Front Mic pin: input vref at 80% */ |
| 14488 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14489 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14490 | /* Line In pin: input */ |
| 14491 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14492 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14493 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14494 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14495 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14496 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14497 | /* CD pin widget for input */ |
| 14498 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14499 | |
| 14500 | { } |
| 14501 | }; |
| 14502 | |
| 14503 | /* |
| 14504 | * 6-stack pin configuration: |
| 14505 | */ |
| 14506 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14507 | /* |
| 14508 | * Set pin mode and muting |
| 14509 | */ |
| 14510 | /* set front pin widgets 0x14 for output */ |
| 14511 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14512 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14513 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14514 | |
| 14515 | /* Rear Pin: output 1 (0x0d) */ |
| 14516 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14517 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14518 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14519 | /* CLFE Pin: output 2 (0x0e) */ |
| 14520 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14521 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14522 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14523 | /* Side Pin: output 3 (0x0f) */ |
| 14524 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14525 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14526 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14527 | |
| 14528 | /* Mic (rear) pin: input vref at 80% */ |
| 14529 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14530 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14531 | /* Front Mic pin: input vref at 80% */ |
| 14532 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14533 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14534 | /* Line In pin: input */ |
| 14535 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14536 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14537 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14538 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14539 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14540 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14541 | /* CD pin widget for input */ |
| 14542 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14543 | |
| 14544 | { } |
| 14545 | }; |
| 14546 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14547 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14548 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14549 | { } |
| 14550 | }; |
| 14551 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14552 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14553 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14554 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14555 | { } |
| 14556 | }; |
| 14557 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14558 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14559 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14560 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14561 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14562 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14563 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14564 | {} |
| 14565 | }; |
| 14566 | |
| 14567 | /* toggle speaker-output according to the hp-jack state */ |
| 14568 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 14569 | { |
| 14570 | unsigned int present; |
| 14571 | unsigned char bits; |
| 14572 | |
| 14573 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14574 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14575 | bits = present ? HDA_AMP_MUTE : 0; |
| 14576 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14577 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14578 | } |
| 14579 | |
| 14580 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14581 | { |
| 14582 | unsigned int present; |
| 14583 | unsigned char bits; |
| 14584 | |
| 14585 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14586 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14587 | bits = present ? HDA_AMP_MUTE : 0; |
| 14588 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14589 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14590 | } |
| 14591 | |
| 14592 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 14593 | { |
| 14594 | alc861vd_lenovo_hp_automute(codec); |
| 14595 | alc861vd_lenovo_mic_automute(codec); |
| 14596 | } |
| 14597 | |
| 14598 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14599 | unsigned int res) |
| 14600 | { |
| 14601 | switch (res >> 26) { |
| 14602 | case ALC880_HP_EVENT: |
| 14603 | alc861vd_lenovo_hp_automute(codec); |
| 14604 | break; |
| 14605 | case ALC880_MIC_EVENT: |
| 14606 | alc861vd_lenovo_mic_automute(codec); |
| 14607 | break; |
| 14608 | } |
| 14609 | } |
| 14610 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14611 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14612 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14613 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14614 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14615 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14616 | |
| 14617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14618 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14620 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14621 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14622 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14623 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14624 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14625 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14626 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14627 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14628 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14629 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14630 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14631 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14632 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14633 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14634 | |
| 14635 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14636 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14637 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14638 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14639 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14640 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14641 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14642 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14643 | |
| 14644 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14645 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14646 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14647 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14648 | |
| 14649 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14650 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14651 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14652 | |
| 14653 | { } /* end */ |
| 14654 | }; |
| 14655 | |
| 14656 | /* toggle speaker-output according to the hp-jack state */ |
| 14657 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 14658 | { |
| 14659 | unsigned int present; |
| 14660 | |
| 14661 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14662 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14663 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14664 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14665 | } |
| 14666 | |
| 14667 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 14668 | { |
| 14669 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14670 | alc861vd_dallas_automute(codec); |
| 14671 | } |
| 14672 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14673 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14674 | #define alc861vd_loopbacks alc880_loopbacks |
| 14675 | #endif |
| 14676 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14677 | /* pcm configuration: identiacal with ALC880 */ |
| 14678 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14679 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14680 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14681 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14682 | |
| 14683 | /* |
| 14684 | * configuration and preset |
| 14685 | */ |
| 14686 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14687 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14688 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14689 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14690 | [ALC861VD_3ST] = "3stack", |
| 14691 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14692 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14693 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14694 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14695 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14696 | [ALC861VD_AUTO] = "auto", |
| 14697 | }; |
| 14698 | |
| 14699 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14700 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14701 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14702 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14703 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14704 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14705 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14706 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14707 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14708 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14709 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14710 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14711 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14712 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 14713 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14714 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14715 | {} |
| 14716 | }; |
| 14717 | |
| 14718 | static struct alc_config_preset alc861vd_presets[] = { |
| 14719 | [ALC660VD_3ST] = { |
| 14720 | .mixers = { alc861vd_3st_mixer }, |
| 14721 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14722 | alc861vd_3stack_init_verbs }, |
| 14723 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14724 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14725 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14726 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14727 | .input_mux = &alc861vd_capture_source, |
| 14728 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14729 | [ALC660VD_3ST_DIG] = { |
| 14730 | .mixers = { alc861vd_3st_mixer }, |
| 14731 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14732 | alc861vd_3stack_init_verbs }, |
| 14733 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14734 | .dac_nids = alc660vd_dac_nids, |
| 14735 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14736 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14737 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14738 | .input_mux = &alc861vd_capture_source, |
| 14739 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14740 | [ALC861VD_3ST] = { |
| 14741 | .mixers = { alc861vd_3st_mixer }, |
| 14742 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14743 | alc861vd_3stack_init_verbs }, |
| 14744 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14745 | .dac_nids = alc861vd_dac_nids, |
| 14746 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14747 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14748 | .input_mux = &alc861vd_capture_source, |
| 14749 | }, |
| 14750 | [ALC861VD_3ST_DIG] = { |
| 14751 | .mixers = { alc861vd_3st_mixer }, |
| 14752 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14753 | alc861vd_3stack_init_verbs }, |
| 14754 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14755 | .dac_nids = alc861vd_dac_nids, |
| 14756 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14757 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14758 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14759 | .input_mux = &alc861vd_capture_source, |
| 14760 | }, |
| 14761 | [ALC861VD_6ST_DIG] = { |
| 14762 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14763 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14764 | alc861vd_6stack_init_verbs }, |
| 14765 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14766 | .dac_nids = alc861vd_dac_nids, |
| 14767 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14768 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14769 | .channel_mode = alc861vd_6stack_modes, |
| 14770 | .input_mux = &alc861vd_capture_source, |
| 14771 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14772 | [ALC861VD_LENOVO] = { |
| 14773 | .mixers = { alc861vd_lenovo_mixer }, |
| 14774 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14775 | alc861vd_3stack_init_verbs, |
| 14776 | alc861vd_eapd_verbs, |
| 14777 | alc861vd_lenovo_unsol_verbs }, |
| 14778 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14779 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14780 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14781 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14782 | .input_mux = &alc861vd_capture_source, |
| 14783 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14784 | .init_hook = alc861vd_lenovo_automute, |
| 14785 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14786 | [ALC861VD_DALLAS] = { |
| 14787 | .mixers = { alc861vd_dallas_mixer }, |
| 14788 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14789 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14790 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14791 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14792 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14793 | .input_mux = &alc861vd_dallas_capture_source, |
| 14794 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14795 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14796 | }, |
| 14797 | [ALC861VD_HP] = { |
| 14798 | .mixers = { alc861vd_hp_mixer }, |
| 14799 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14800 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14801 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14802 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14803 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14804 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14805 | .input_mux = &alc861vd_hp_capture_source, |
| 14806 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14807 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14808 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14809 | [ALC660VD_ASUS_V1S] = { |
| 14810 | .mixers = { alc861vd_lenovo_mixer }, |
| 14811 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14812 | alc861vd_3stack_init_verbs, |
| 14813 | alc861vd_eapd_verbs, |
| 14814 | alc861vd_lenovo_unsol_verbs }, |
| 14815 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14816 | .dac_nids = alc660vd_dac_nids, |
| 14817 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14818 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14819 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14820 | .input_mux = &alc861vd_capture_source, |
| 14821 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14822 | .init_hook = alc861vd_lenovo_automute, |
| 14823 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14824 | }; |
| 14825 | |
| 14826 | /* |
| 14827 | * BIOS auto configuration |
| 14828 | */ |
| 14829 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14830 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14831 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14832 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14833 | } |
| 14834 | |
| 14835 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14836 | { |
| 14837 | struct alc_spec *spec = codec->spec; |
| 14838 | int i; |
| 14839 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14840 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14841 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14842 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14843 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14844 | if (nid) |
| 14845 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14846 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14847 | } |
| 14848 | } |
| 14849 | |
| 14850 | |
| 14851 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14852 | { |
| 14853 | struct alc_spec *spec = codec->spec; |
| 14854 | hda_nid_t pin; |
| 14855 | |
| 14856 | pin = spec->autocfg.hp_pins[0]; |
| 14857 | if (pin) /* connect to front and use dac 0 */ |
| 14858 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14859 | pin = spec->autocfg.speaker_pins[0]; |
| 14860 | if (pin) |
| 14861 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14862 | } |
| 14863 | |
| 14864 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14865 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14866 | |
| 14867 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14868 | { |
| 14869 | struct alc_spec *spec = codec->spec; |
| 14870 | int i; |
| 14871 | |
| 14872 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14873 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14874 | if (alc861vd_is_input_pin(nid)) { |
| 14875 | snd_hda_codec_write(codec, nid, 0, |
| 14876 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14877 | i <= AUTO_PIN_FRONT_MIC ? |
| 14878 | PIN_VREF80 : PIN_IN); |
| 14879 | if (nid != ALC861VD_PIN_CD_NID) |
| 14880 | snd_hda_codec_write(codec, nid, 0, |
| 14881 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14882 | AMP_OUT_MUTE); |
| 14883 | } |
| 14884 | } |
| 14885 | } |
| 14886 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14887 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14888 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14889 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14890 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14891 | |
| 14892 | /* add playback controls from the parsed DAC table */ |
| 14893 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14894 | * different NIDs for mute/unmute switch and volume control */ |
| 14895 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14896 | const struct auto_pin_cfg *cfg) |
| 14897 | { |
| 14898 | char name[32]; |
| 14899 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14900 | hda_nid_t nid_v, nid_s; |
| 14901 | int i, err; |
| 14902 | |
| 14903 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14904 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14905 | continue; |
| 14906 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14907 | alc880_dac_to_idx( |
| 14908 | spec->multiout.dac_nids[i])); |
| 14909 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14910 | alc880_dac_to_idx( |
| 14911 | spec->multiout.dac_nids[i])); |
| 14912 | |
| 14913 | if (i == 2) { |
| 14914 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14915 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14916 | "Center Playback Volume", |
| 14917 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14918 | HDA_OUTPUT)); |
| 14919 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14920 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14921 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14922 | "LFE Playback Volume", |
| 14923 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14924 | HDA_OUTPUT)); |
| 14925 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14926 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14927 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14928 | "Center Playback Switch", |
| 14929 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14930 | HDA_INPUT)); |
| 14931 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14932 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14933 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14934 | "LFE Playback Switch", |
| 14935 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14936 | HDA_INPUT)); |
| 14937 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14938 | return err; |
| 14939 | } else { |
| 14940 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14941 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14942 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14943 | HDA_OUTPUT)); |
| 14944 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14945 | return err; |
| 14946 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14947 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14948 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14949 | HDA_INPUT)); |
| 14950 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14951 | return err; |
| 14952 | } |
| 14953 | } |
| 14954 | return 0; |
| 14955 | } |
| 14956 | |
| 14957 | /* add playback controls for speaker and HP outputs */ |
| 14958 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14959 | * different NIDs for mute/unmute switch and volume control */ |
| 14960 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14961 | hda_nid_t pin, const char *pfx) |
| 14962 | { |
| 14963 | hda_nid_t nid_v, nid_s; |
| 14964 | int err; |
| 14965 | char name[32]; |
| 14966 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14967 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14968 | return 0; |
| 14969 | |
| 14970 | if (alc880_is_fixed_pin(pin)) { |
| 14971 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14972 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14973 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14974 | spec->multiout.hp_nid = nid_v; |
| 14975 | else |
| 14976 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14977 | /* control HP volume/switch on the output mixer amp */ |
| 14978 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14979 | alc880_fixed_pin_idx(pin)); |
| 14980 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14981 | alc880_fixed_pin_idx(pin)); |
| 14982 | |
| 14983 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14984 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14985 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14986 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14987 | return err; |
| 14988 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14989 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14990 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14991 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14992 | return err; |
| 14993 | } else if (alc880_is_multi_pin(pin)) { |
| 14994 | /* set manual connection */ |
| 14995 | /* we have only a switch on HP-out PIN */ |
| 14996 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14997 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14998 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14999 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15000 | return err; |
| 15001 | } |
| 15002 | return 0; |
| 15003 | } |
| 15004 | |
| 15005 | /* parse the BIOS configuration and set up the alc_spec |
| 15006 | * return 1 if successful, 0 if the proper config is not found, |
| 15007 | * or a negative error code |
| 15008 | * Based on ALC880 version - had to change it to override |
| 15009 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15010 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15011 | { |
| 15012 | struct alc_spec *spec = codec->spec; |
| 15013 | int err; |
| 15014 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15015 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15016 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15017 | alc861vd_ignore); |
| 15018 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15019 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15020 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15021 | return 0; /* can't find valid BIOS pin config */ |
| 15022 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15023 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15024 | if (err < 0) |
| 15025 | return err; |
| 15026 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15027 | if (err < 0) |
| 15028 | return err; |
| 15029 | err = alc861vd_auto_create_extra_out(spec, |
| 15030 | spec->autocfg.speaker_pins[0], |
| 15031 | "Speaker"); |
| 15032 | if (err < 0) |
| 15033 | return err; |
| 15034 | err = alc861vd_auto_create_extra_out(spec, |
| 15035 | spec->autocfg.hp_pins[0], |
| 15036 | "Headphone"); |
| 15037 | if (err < 0) |
| 15038 | return err; |
| 15039 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15040 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15041 | return err; |
| 15042 | |
| 15043 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15044 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15045 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15046 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15047 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15048 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15049 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15050 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15051 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15052 | |
| 15053 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15054 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15055 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15056 | err = alc_auto_add_mic_boost(codec); |
| 15057 | if (err < 0) |
| 15058 | return err; |
| 15059 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 15060 | store_pin_configs(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15061 | return 1; |
| 15062 | } |
| 15063 | |
| 15064 | /* additional initialization for auto-configuration model */ |
| 15065 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15066 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15067 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15068 | alc861vd_auto_init_multi_out(codec); |
| 15069 | alc861vd_auto_init_hp_out(codec); |
| 15070 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15071 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15072 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15073 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15074 | } |
| 15075 | |
| 15076 | static int patch_alc861vd(struct hda_codec *codec) |
| 15077 | { |
| 15078 | struct alc_spec *spec; |
| 15079 | int err, board_config; |
| 15080 | |
| 15081 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15082 | if (spec == NULL) |
| 15083 | return -ENOMEM; |
| 15084 | |
| 15085 | codec->spec = spec; |
| 15086 | |
| 15087 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15088 | alc861vd_models, |
| 15089 | alc861vd_cfg_tbl); |
| 15090 | |
| 15091 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 15092 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 15093 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 15094 | board_config = ALC861VD_AUTO; |
| 15095 | } |
| 15096 | |
| 15097 | if (board_config == ALC861VD_AUTO) { |
| 15098 | /* automatic parse from the BIOS config */ |
| 15099 | err = alc861vd_parse_auto_config(codec); |
| 15100 | if (err < 0) { |
| 15101 | alc_free(codec); |
| 15102 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15103 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15104 | printk(KERN_INFO |
| 15105 | "hda_codec: Cannot set up configuration " |
| 15106 | "from BIOS. Using base mode...\n"); |
| 15107 | board_config = ALC861VD_3ST; |
| 15108 | } |
| 15109 | } |
| 15110 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15111 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15112 | if (err < 0) { |
| 15113 | alc_free(codec); |
| 15114 | return err; |
| 15115 | } |
| 15116 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15117 | if (board_config != ALC861VD_AUTO) |
| 15118 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15119 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15120 | if (codec->vendor_id == 0x10ec0660) { |
| 15121 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 15122 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15123 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15124 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15125 | } else { |
| 15126 | spec->stream_name_analog = "ALC861VD Analog"; |
| 15127 | spec->stream_name_digital = "ALC861VD Digital"; |
| 15128 | } |
| 15129 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15130 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15131 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15132 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15133 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15134 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15135 | |
| 15136 | spec->adc_nids = alc861vd_adc_nids; |
| 15137 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15138 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15139 | spec->capture_style = CAPT_MIX; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15140 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15141 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15142 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15143 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15144 | spec->vmaster_nid = 0x02; |
| 15145 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15146 | codec->patch_ops = alc_patch_ops; |
| 15147 | |
| 15148 | if (board_config == ALC861VD_AUTO) |
| 15149 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15150 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15151 | if (!spec->loopback.amplist) |
| 15152 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15153 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15154 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15155 | |
| 15156 | return 0; |
| 15157 | } |
| 15158 | |
| 15159 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15160 | * ALC662 support |
| 15161 | * |
| 15162 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15163 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15164 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15165 | * 6-channel independent captures. |
| 15166 | * |
| 15167 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15168 | * driver yet). |
| 15169 | */ |
| 15170 | #define ALC662_DIGOUT_NID 0x06 |
| 15171 | #define ALC662_DIGIN_NID 0x0a |
| 15172 | |
| 15173 | static hda_nid_t alc662_dac_nids[4] = { |
| 15174 | /* front, rear, clfe, rear_surr */ |
| 15175 | 0x02, 0x03, 0x04 |
| 15176 | }; |
| 15177 | |
| 15178 | static hda_nid_t alc662_adc_nids[1] = { |
| 15179 | /* ADC1-2 */ |
| 15180 | 0x09, |
| 15181 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15182 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15183 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15184 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15185 | /* input MUX */ |
| 15186 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15187 | static struct hda_input_mux alc662_capture_source = { |
| 15188 | .num_items = 4, |
| 15189 | .items = { |
| 15190 | { "Mic", 0x0 }, |
| 15191 | { "Front Mic", 0x1 }, |
| 15192 | { "Line", 0x2 }, |
| 15193 | { "CD", 0x4 }, |
| 15194 | }, |
| 15195 | }; |
| 15196 | |
| 15197 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15198 | .num_items = 2, |
| 15199 | .items = { |
| 15200 | { "Mic", 0x1 }, |
| 15201 | { "Line", 0x2 }, |
| 15202 | }, |
| 15203 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15204 | |
| 15205 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15206 | .num_items = 2, |
| 15207 | .items = { |
| 15208 | { "i-Mic", 0x1 }, |
| 15209 | { "e-Mic", 0x0 }, |
| 15210 | }, |
| 15211 | }; |
| 15212 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15213 | static struct hda_input_mux alc663_capture_source = { |
| 15214 | .num_items = 3, |
| 15215 | .items = { |
| 15216 | { "Mic", 0x0 }, |
| 15217 | { "Front Mic", 0x1 }, |
| 15218 | { "Line", 0x2 }, |
| 15219 | }, |
| 15220 | }; |
| 15221 | |
| 15222 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15223 | .num_items = 2, |
| 15224 | .items = { |
| 15225 | { "Ext-Mic", 0x0 }, |
| 15226 | { "D-Mic", 0x9 }, |
| 15227 | }, |
| 15228 | }; |
| 15229 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15230 | /* |
| 15231 | * 2ch mode |
| 15232 | */ |
| 15233 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15234 | { 2, NULL } |
| 15235 | }; |
| 15236 | |
| 15237 | /* |
| 15238 | * 2ch mode |
| 15239 | */ |
| 15240 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15241 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15242 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15243 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15244 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15245 | { } /* end */ |
| 15246 | }; |
| 15247 | |
| 15248 | /* |
| 15249 | * 6ch mode |
| 15250 | */ |
| 15251 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15252 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15253 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15254 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15255 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15256 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15257 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15258 | { } /* end */ |
| 15259 | }; |
| 15260 | |
| 15261 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15262 | { 2, alc662_3ST_ch2_init }, |
| 15263 | { 6, alc662_3ST_ch6_init }, |
| 15264 | }; |
| 15265 | |
| 15266 | /* |
| 15267 | * 2ch mode |
| 15268 | */ |
| 15269 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15270 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15271 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15272 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15273 | { } /* end */ |
| 15274 | }; |
| 15275 | |
| 15276 | /* |
| 15277 | * 6ch mode |
| 15278 | */ |
| 15279 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15280 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15281 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15282 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15283 | { } /* end */ |
| 15284 | }; |
| 15285 | |
| 15286 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15287 | { 2, alc662_sixstack_ch6_init }, |
| 15288 | { 6, alc662_sixstack_ch8_init }, |
| 15289 | }; |
| 15290 | |
| 15291 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15292 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15293 | */ |
| 15294 | |
| 15295 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15296 | /* output mixer control */ |
| 15297 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15298 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15299 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15300 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15301 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15302 | 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] | 15303 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15304 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15305 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15306 | |
| 15307 | /*Input mixer control */ |
| 15308 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15309 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15310 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15311 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15312 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15313 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15314 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15315 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15316 | { } /* end */ |
| 15317 | }; |
| 15318 | |
| 15319 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15320 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15321 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15322 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15323 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15324 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15325 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15326 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15327 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15328 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15329 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15330 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15331 | { } /* end */ |
| 15332 | }; |
| 15333 | |
| 15334 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15335 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15336 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15337 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15338 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15339 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15340 | 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] | 15341 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15342 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15343 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15344 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15345 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15346 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15347 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15348 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15349 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15350 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15351 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15352 | { } /* end */ |
| 15353 | }; |
| 15354 | |
| 15355 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15356 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15357 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15358 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15359 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15360 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15361 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15362 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15363 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15364 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15365 | { } /* end */ |
| 15366 | }; |
| 15367 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15368 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15369 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15370 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 15371 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15372 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15373 | |
| 15374 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15375 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15376 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15377 | |
| 15378 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15379 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15380 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15381 | { } /* end */ |
| 15382 | }; |
| 15383 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15384 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 15385 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15386 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15387 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15388 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 15389 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15390 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 15391 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 15392 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15393 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15394 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15395 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15396 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15397 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15398 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15399 | { } /* end */ |
| 15400 | }; |
| 15401 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15402 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15403 | .ops = &snd_hda_bind_vol, |
| 15404 | .values = { |
| 15405 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15406 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15407 | 0 |
| 15408 | }, |
| 15409 | }; |
| 15410 | |
| 15411 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15412 | .ops = &snd_hda_bind_sw, |
| 15413 | .values = { |
| 15414 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15415 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15416 | 0 |
| 15417 | }, |
| 15418 | }; |
| 15419 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15420 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15421 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15422 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15423 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15424 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15425 | { } /* end */ |
| 15426 | }; |
| 15427 | |
| 15428 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15429 | .ops = &snd_hda_bind_sw, |
| 15430 | .values = { |
| 15431 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15432 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15433 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15434 | 0 |
| 15435 | }, |
| 15436 | }; |
| 15437 | |
| 15438 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15439 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15440 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15441 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15442 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15443 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15444 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15445 | |
| 15446 | { } /* end */ |
| 15447 | }; |
| 15448 | |
| 15449 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15450 | .ops = &snd_hda_bind_sw, |
| 15451 | .values = { |
| 15452 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15453 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15454 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15455 | 0 |
| 15456 | }, |
| 15457 | }; |
| 15458 | |
| 15459 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15460 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15461 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15462 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15463 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15464 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15465 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15466 | { } /* end */ |
| 15467 | }; |
| 15468 | |
| 15469 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15470 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15471 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15472 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15473 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15474 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15475 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15476 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15477 | { } /* end */ |
| 15478 | }; |
| 15479 | |
| 15480 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15481 | .ops = &snd_hda_bind_vol, |
| 15482 | .values = { |
| 15483 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15484 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15485 | 0 |
| 15486 | }, |
| 15487 | }; |
| 15488 | |
| 15489 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15490 | .ops = &snd_hda_bind_sw, |
| 15491 | .values = { |
| 15492 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15493 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15494 | 0 |
| 15495 | }, |
| 15496 | }; |
| 15497 | |
| 15498 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15499 | HDA_BIND_VOL("Master Playback Volume", |
| 15500 | &alc663_asus_two_bind_master_vol), |
| 15501 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15502 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15503 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15504 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15505 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15506 | { } /* end */ |
| 15507 | }; |
| 15508 | |
| 15509 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15510 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15511 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15512 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15513 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15514 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15515 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15516 | { } /* end */ |
| 15517 | }; |
| 15518 | |
| 15519 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15520 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15521 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15522 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15523 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15524 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15525 | |
| 15526 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15527 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15528 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15529 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15530 | { } /* end */ |
| 15531 | }; |
| 15532 | |
| 15533 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15534 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15535 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15536 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15537 | |
| 15538 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15539 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15540 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15541 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15542 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15543 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15544 | { } /* end */ |
| 15545 | }; |
| 15546 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15547 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15548 | { |
| 15549 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15550 | .name = "Channel Mode", |
| 15551 | .info = alc_ch_mode_info, |
| 15552 | .get = alc_ch_mode_get, |
| 15553 | .put = alc_ch_mode_put, |
| 15554 | }, |
| 15555 | { } /* end */ |
| 15556 | }; |
| 15557 | |
| 15558 | static struct hda_verb alc662_init_verbs[] = { |
| 15559 | /* ADC: mute amp left and right */ |
| 15560 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15561 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15562 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15563 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15565 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15566 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15569 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15570 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15571 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15572 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15573 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15574 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15575 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15576 | |
| 15577 | /* Front Pin: output 0 (0x0c) */ |
| 15578 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15579 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15580 | |
| 15581 | /* Rear Pin: output 1 (0x0d) */ |
| 15582 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15583 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15584 | |
| 15585 | /* CLFE Pin: output 2 (0x0e) */ |
| 15586 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15587 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15588 | |
| 15589 | /* Mic (rear) pin: input vref at 80% */ |
| 15590 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15591 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15592 | /* Front Mic pin: input vref at 80% */ |
| 15593 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15594 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15595 | /* Line In pin: input */ |
| 15596 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15597 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15598 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15599 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15600 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15601 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15602 | /* CD pin widget for input */ |
| 15603 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15604 | |
| 15605 | /* FIXME: use matrix-type input source selection */ |
| 15606 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15607 | /* Input mixer */ |
| 15608 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15609 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15610 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15611 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15612 | |
| 15613 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15614 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15615 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15616 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15617 | |
| 15618 | /* always trun on EAPD */ |
| 15619 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15620 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15621 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15622 | { } |
| 15623 | }; |
| 15624 | |
| 15625 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15626 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15627 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15628 | {} |
| 15629 | }; |
| 15630 | |
| 15631 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15632 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15633 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15634 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15635 | }; |
| 15636 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15637 | /* Set Unsolicited Event*/ |
| 15638 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15639 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15640 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15641 | {} |
| 15642 | }; |
| 15643 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15644 | /* |
| 15645 | * generic initialization of ADC, input mixers and output mixers |
| 15646 | */ |
| 15647 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15648 | /* |
| 15649 | * Unmute ADC and set the default input to mic-in |
| 15650 | */ |
| 15651 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15652 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15653 | |
| 15654 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15655 | * mixer widget |
| 15656 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15657 | * panel mic (mic 2) |
| 15658 | */ |
| 15659 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15660 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15661 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15662 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15663 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15664 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15665 | |
| 15666 | /* |
| 15667 | * Set up output mixers (0x0c - 0x0f) |
| 15668 | */ |
| 15669 | /* set vol=0 to output mixers */ |
| 15670 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15671 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15672 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15673 | |
| 15674 | /* set up input amps for analog loopback */ |
| 15675 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15676 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15677 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15678 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15679 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15680 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15681 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15682 | |
| 15683 | |
| 15684 | /* FIXME: use matrix-type input source selection */ |
| 15685 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15686 | /* Input mixer */ |
| 15687 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15688 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15689 | { } |
| 15690 | }; |
| 15691 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15692 | /* additional verbs for ALC663 */ |
| 15693 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15694 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15695 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15696 | { } |
| 15697 | }; |
| 15698 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15699 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15700 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15701 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15702 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15703 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15704 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15705 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15706 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15707 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15708 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15709 | {} |
| 15710 | }; |
| 15711 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15712 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15713 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15714 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15715 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15716 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15717 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15718 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15719 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15720 | {} |
| 15721 | }; |
| 15722 | |
| 15723 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15724 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15725 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15726 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15727 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15730 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15731 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15732 | {} |
| 15733 | }; |
| 15734 | |
| 15735 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15736 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15737 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15738 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15739 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15740 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15741 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15742 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15743 | {} |
| 15744 | }; |
| 15745 | |
| 15746 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15747 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15748 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15749 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15750 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15751 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15752 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15753 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15754 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15755 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15756 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15757 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15758 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15759 | {} |
| 15760 | }; |
| 15761 | |
| 15762 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15763 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15764 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15765 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15766 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15767 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15768 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15769 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15770 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15771 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15772 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15773 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15774 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15775 | {} |
| 15776 | }; |
| 15777 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15778 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15779 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15780 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15781 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15782 | |
| 15783 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15784 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15785 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15786 | |
| 15787 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15788 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15789 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15790 | {} |
| 15791 | }; |
| 15792 | |
| 15793 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15794 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15795 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15796 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15797 | |
| 15798 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15799 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15800 | {} |
| 15801 | }; |
| 15802 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15803 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15804 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15805 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15806 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15807 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15808 | {} |
| 15809 | }; |
| 15810 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15811 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15812 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15813 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15814 | { } /* end */ |
| 15815 | }; |
| 15816 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15817 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15818 | { |
| 15819 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15820 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15821 | |
| 15822 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15823 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15824 | bits = present ? HDA_AMP_MUTE : 0; |
| 15825 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15826 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15827 | } |
| 15828 | |
| 15829 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15830 | { |
| 15831 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15832 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15833 | |
| 15834 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15835 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15836 | bits = present ? HDA_AMP_MUTE : 0; |
| 15837 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15838 | HDA_AMP_MUTE, bits); |
| 15839 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15840 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15841 | } |
| 15842 | |
| 15843 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15844 | unsigned int res) |
| 15845 | { |
| 15846 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15847 | alc662_lenovo_101e_all_automute(codec); |
| 15848 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15849 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15850 | } |
| 15851 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15852 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15853 | { |
| 15854 | unsigned int present; |
| 15855 | |
| 15856 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15857 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15858 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15859 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15860 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15861 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15862 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15863 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15864 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15865 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15866 | } |
| 15867 | |
| 15868 | /* unsolicited event for HP jack sensing */ |
| 15869 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15870 | unsigned int res) |
| 15871 | { |
| 15872 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15873 | alc262_hippo1_automute( codec ); |
| 15874 | |
| 15875 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15876 | alc662_eeepc_mic_automute(codec); |
| 15877 | } |
| 15878 | |
| 15879 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15880 | { |
| 15881 | alc262_hippo1_automute( codec ); |
| 15882 | alc662_eeepc_mic_automute(codec); |
| 15883 | } |
| 15884 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15885 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 15886 | { |
| 15887 | unsigned int mute; |
| 15888 | unsigned int present; |
| 15889 | |
| 15890 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 15891 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15892 | AC_VERB_GET_PIN_SENSE, 0); |
| 15893 | present = (present & 0x80000000) != 0; |
| 15894 | if (present) { |
| 15895 | /* mute internal speaker */ |
| 15896 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15897 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15898 | } else { |
| 15899 | /* unmute internal speaker if necessary */ |
| 15900 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 15901 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15902 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15903 | } |
| 15904 | } |
| 15905 | |
| 15906 | /* unsolicited event for HP jack sensing */ |
| 15907 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 15908 | unsigned int res) |
| 15909 | { |
| 15910 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15911 | alc662_eeepc_ep20_automute(codec); |
| 15912 | } |
| 15913 | |
| 15914 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15915 | { |
| 15916 | alc662_eeepc_ep20_automute(codec); |
| 15917 | } |
| 15918 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15919 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15920 | { |
| 15921 | unsigned int present; |
| 15922 | unsigned char bits; |
| 15923 | |
| 15924 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15925 | AC_VERB_GET_PIN_SENSE, 0) |
| 15926 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15927 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15928 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15929 | AMP_IN_MUTE(0), bits); |
| 15930 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15931 | AMP_IN_MUTE(0), bits); |
| 15932 | } |
| 15933 | |
| 15934 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15935 | { |
| 15936 | unsigned int present; |
| 15937 | unsigned char bits; |
| 15938 | |
| 15939 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15940 | AC_VERB_GET_PIN_SENSE, 0) |
| 15941 | & AC_PINSENSE_PRESENCE; |
| 15942 | bits = present ? HDA_AMP_MUTE : 0; |
| 15943 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15944 | AMP_IN_MUTE(0), bits); |
| 15945 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15946 | AMP_IN_MUTE(0), bits); |
| 15947 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15948 | AMP_IN_MUTE(0), bits); |
| 15949 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15950 | AMP_IN_MUTE(0), bits); |
| 15951 | } |
| 15952 | |
| 15953 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15954 | { |
| 15955 | unsigned int present; |
| 15956 | unsigned char bits; |
| 15957 | |
| 15958 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15959 | AC_VERB_GET_PIN_SENSE, 0) |
| 15960 | & AC_PINSENSE_PRESENCE; |
| 15961 | bits = present ? HDA_AMP_MUTE : 0; |
| 15962 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15963 | AMP_IN_MUTE(0), bits); |
| 15964 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15965 | AMP_IN_MUTE(0), bits); |
| 15966 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15967 | AMP_IN_MUTE(0), bits); |
| 15968 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15969 | AMP_IN_MUTE(0), bits); |
| 15970 | } |
| 15971 | |
| 15972 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15973 | { |
| 15974 | unsigned int present; |
| 15975 | unsigned char bits; |
| 15976 | |
| 15977 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15978 | AC_VERB_GET_PIN_SENSE, 0) |
| 15979 | & AC_PINSENSE_PRESENCE; |
| 15980 | bits = present ? 0 : PIN_OUT; |
| 15981 | snd_hda_codec_write(codec, 0x14, 0, |
| 15982 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15983 | } |
| 15984 | |
| 15985 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15986 | { |
| 15987 | unsigned int present1, present2; |
| 15988 | |
| 15989 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15990 | AC_VERB_GET_PIN_SENSE, 0) |
| 15991 | & AC_PINSENSE_PRESENCE; |
| 15992 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15993 | AC_VERB_GET_PIN_SENSE, 0) |
| 15994 | & AC_PINSENSE_PRESENCE; |
| 15995 | |
| 15996 | if (present1 || present2) { |
| 15997 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15998 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 15999 | } else { |
| 16000 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16001 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16002 | } |
| 16003 | } |
| 16004 | |
| 16005 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16006 | { |
| 16007 | unsigned int present1, present2; |
| 16008 | |
| 16009 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16010 | AC_VERB_GET_PIN_SENSE, 0) |
| 16011 | & AC_PINSENSE_PRESENCE; |
| 16012 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16013 | AC_VERB_GET_PIN_SENSE, 0) |
| 16014 | & AC_PINSENSE_PRESENCE; |
| 16015 | |
| 16016 | if (present1 || present2) { |
| 16017 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16018 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16019 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16020 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16021 | } else { |
| 16022 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16023 | AMP_IN_MUTE(0), 0); |
| 16024 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16025 | AMP_IN_MUTE(0), 0); |
| 16026 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16027 | } |
| 16028 | |
| 16029 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16030 | { |
| 16031 | unsigned int present; |
| 16032 | |
| 16033 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16034 | AC_VERB_GET_PIN_SENSE, 0) |
| 16035 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16036 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16037 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16038 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16039 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16040 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16041 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16042 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16043 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16044 | } |
| 16045 | |
| 16046 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16047 | unsigned int res) |
| 16048 | { |
| 16049 | switch (res >> 26) { |
| 16050 | case ALC880_HP_EVENT: |
| 16051 | alc663_m51va_speaker_automute(codec); |
| 16052 | break; |
| 16053 | case ALC880_MIC_EVENT: |
| 16054 | alc663_m51va_mic_automute(codec); |
| 16055 | break; |
| 16056 | } |
| 16057 | } |
| 16058 | |
| 16059 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16060 | { |
| 16061 | alc663_m51va_speaker_automute(codec); |
| 16062 | alc663_m51va_mic_automute(codec); |
| 16063 | } |
| 16064 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16065 | /* ***************** Mode1 ******************************/ |
| 16066 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16067 | unsigned int res) |
| 16068 | { |
| 16069 | switch (res >> 26) { |
| 16070 | case ALC880_HP_EVENT: |
| 16071 | alc663_m51va_speaker_automute(codec); |
| 16072 | break; |
| 16073 | case ALC880_MIC_EVENT: |
| 16074 | alc662_eeepc_mic_automute(codec); |
| 16075 | break; |
| 16076 | } |
| 16077 | } |
| 16078 | |
| 16079 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16080 | { |
| 16081 | alc663_m51va_speaker_automute(codec); |
| 16082 | alc662_eeepc_mic_automute(codec); |
| 16083 | } |
| 16084 | /* ***************** Mode2 ******************************/ |
| 16085 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16086 | unsigned int res) |
| 16087 | { |
| 16088 | switch (res >> 26) { |
| 16089 | case ALC880_HP_EVENT: |
| 16090 | alc662_f5z_speaker_automute(codec); |
| 16091 | break; |
| 16092 | case ALC880_MIC_EVENT: |
| 16093 | alc662_eeepc_mic_automute(codec); |
| 16094 | break; |
| 16095 | } |
| 16096 | } |
| 16097 | |
| 16098 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16099 | { |
| 16100 | alc662_f5z_speaker_automute(codec); |
| 16101 | alc662_eeepc_mic_automute(codec); |
| 16102 | } |
| 16103 | /* ***************** Mode3 ******************************/ |
| 16104 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16105 | unsigned int res) |
| 16106 | { |
| 16107 | switch (res >> 26) { |
| 16108 | case ALC880_HP_EVENT: |
| 16109 | alc663_two_hp_m1_speaker_automute(codec); |
| 16110 | break; |
| 16111 | case ALC880_MIC_EVENT: |
| 16112 | alc662_eeepc_mic_automute(codec); |
| 16113 | break; |
| 16114 | } |
| 16115 | } |
| 16116 | |
| 16117 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16118 | { |
| 16119 | alc663_two_hp_m1_speaker_automute(codec); |
| 16120 | alc662_eeepc_mic_automute(codec); |
| 16121 | } |
| 16122 | /* ***************** Mode4 ******************************/ |
| 16123 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16124 | unsigned int res) |
| 16125 | { |
| 16126 | switch (res >> 26) { |
| 16127 | case ALC880_HP_EVENT: |
| 16128 | alc663_21jd_two_speaker_automute(codec); |
| 16129 | break; |
| 16130 | case ALC880_MIC_EVENT: |
| 16131 | alc662_eeepc_mic_automute(codec); |
| 16132 | break; |
| 16133 | } |
| 16134 | } |
| 16135 | |
| 16136 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16137 | { |
| 16138 | alc663_21jd_two_speaker_automute(codec); |
| 16139 | alc662_eeepc_mic_automute(codec); |
| 16140 | } |
| 16141 | /* ***************** Mode5 ******************************/ |
| 16142 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16143 | unsigned int res) |
| 16144 | { |
| 16145 | switch (res >> 26) { |
| 16146 | case ALC880_HP_EVENT: |
| 16147 | alc663_15jd_two_speaker_automute(codec); |
| 16148 | break; |
| 16149 | case ALC880_MIC_EVENT: |
| 16150 | alc662_eeepc_mic_automute(codec); |
| 16151 | break; |
| 16152 | } |
| 16153 | } |
| 16154 | |
| 16155 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16156 | { |
| 16157 | alc663_15jd_two_speaker_automute(codec); |
| 16158 | alc662_eeepc_mic_automute(codec); |
| 16159 | } |
| 16160 | /* ***************** Mode6 ******************************/ |
| 16161 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16162 | unsigned int res) |
| 16163 | { |
| 16164 | switch (res >> 26) { |
| 16165 | case ALC880_HP_EVENT: |
| 16166 | alc663_two_hp_m2_speaker_automute(codec); |
| 16167 | break; |
| 16168 | case ALC880_MIC_EVENT: |
| 16169 | alc662_eeepc_mic_automute(codec); |
| 16170 | break; |
| 16171 | } |
| 16172 | } |
| 16173 | |
| 16174 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16175 | { |
| 16176 | alc663_two_hp_m2_speaker_automute(codec); |
| 16177 | alc662_eeepc_mic_automute(codec); |
| 16178 | } |
| 16179 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16180 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16181 | { |
| 16182 | unsigned int present; |
| 16183 | unsigned char bits; |
| 16184 | |
| 16185 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16186 | AC_VERB_GET_PIN_SENSE, 0) |
| 16187 | & AC_PINSENSE_PRESENCE; |
| 16188 | bits = present ? HDA_AMP_MUTE : 0; |
| 16189 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16190 | HDA_AMP_MUTE, bits); |
| 16191 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16192 | HDA_AMP_MUTE, bits); |
| 16193 | } |
| 16194 | |
| 16195 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16196 | { |
| 16197 | unsigned int present; |
| 16198 | unsigned char bits; |
| 16199 | |
| 16200 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16201 | AC_VERB_GET_PIN_SENSE, 0) |
| 16202 | & AC_PINSENSE_PRESENCE; |
| 16203 | bits = present ? HDA_AMP_MUTE : 0; |
| 16204 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16205 | HDA_AMP_MUTE, bits); |
| 16206 | } |
| 16207 | |
| 16208 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16209 | unsigned int res) |
| 16210 | { |
| 16211 | switch (res >> 26) { |
| 16212 | case ALC880_HP_EVENT: |
| 16213 | alc663_g71v_hp_automute(codec); |
| 16214 | break; |
| 16215 | case ALC880_FRONT_EVENT: |
| 16216 | alc663_g71v_front_automute(codec); |
| 16217 | break; |
| 16218 | case ALC880_MIC_EVENT: |
| 16219 | alc662_eeepc_mic_automute(codec); |
| 16220 | break; |
| 16221 | } |
| 16222 | } |
| 16223 | |
| 16224 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16225 | { |
| 16226 | alc663_g71v_front_automute(codec); |
| 16227 | alc663_g71v_hp_automute(codec); |
| 16228 | alc662_eeepc_mic_automute(codec); |
| 16229 | } |
| 16230 | |
| 16231 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16232 | unsigned int res) |
| 16233 | { |
| 16234 | switch (res >> 26) { |
| 16235 | case ALC880_HP_EVENT: |
| 16236 | alc663_m51va_speaker_automute(codec); |
| 16237 | break; |
| 16238 | case ALC880_MIC_EVENT: |
| 16239 | alc662_eeepc_mic_automute(codec); |
| 16240 | break; |
| 16241 | } |
| 16242 | } |
| 16243 | |
| 16244 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16245 | { |
| 16246 | alc663_m51va_speaker_automute(codec); |
| 16247 | alc662_eeepc_mic_automute(codec); |
| 16248 | } |
| 16249 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16250 | /* bind hp and internal speaker mute (with plug check) */ |
| 16251 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 16252 | struct snd_ctl_elem_value *ucontrol) |
| 16253 | { |
| 16254 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 16255 | long *valp = ucontrol->value.integer.value; |
| 16256 | int change; |
| 16257 | |
| 16258 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 16259 | HDA_AMP_MUTE, |
| 16260 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 16261 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 16262 | HDA_AMP_MUTE, |
| 16263 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 16264 | if (change) |
| 16265 | alc262_hippo1_automute(codec); |
| 16266 | return change; |
| 16267 | } |
| 16268 | |
| 16269 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16270 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16271 | { |
| 16272 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16273 | .name = "Master Playback Switch", |
| 16274 | .info = snd_hda_mixer_amp_switch_info, |
| 16275 | .get = snd_hda_mixer_amp_switch_get, |
| 16276 | .put = alc662_ecs_master_sw_put, |
| 16277 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16278 | }, |
| 16279 | |
| 16280 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16281 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16282 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16283 | |
| 16284 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16285 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16286 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16287 | { } /* end */ |
| 16288 | }; |
| 16289 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16290 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16291 | #define alc662_loopbacks alc880_loopbacks |
| 16292 | #endif |
| 16293 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16294 | |
| 16295 | /* pcm configuration: identiacal with ALC880 */ |
| 16296 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16297 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16298 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16299 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16300 | |
| 16301 | /* |
| 16302 | * configuration and preset |
| 16303 | */ |
| 16304 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16305 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16306 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16307 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16308 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16309 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16310 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16311 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16312 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16313 | [ALC663_ASUS_M51VA] = "m51va", |
| 16314 | [ALC663_ASUS_G71V] = "g71v", |
| 16315 | [ALC663_ASUS_H13] = "h13", |
| 16316 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16317 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16318 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16319 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16320 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16321 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16322 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16323 | [ALC662_AUTO] = "auto", |
| 16324 | }; |
| 16325 | |
| 16326 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16327 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
| 16328 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16329 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16330 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16331 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16332 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16333 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16334 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16335 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16336 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16337 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16338 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16339 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
| 16340 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16341 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16342 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16343 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
| 16344 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16345 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16346 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16347 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16348 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16349 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
| 16350 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16351 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16352 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
| 16353 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16354 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
| 16355 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16356 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16357 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16358 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16359 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
| 16360 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16361 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16362 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16363 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16364 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16365 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16366 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16367 | ALC662_3ST_6ch_DIG), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16368 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16369 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16370 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16371 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16372 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16373 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16374 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16375 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16376 | {} |
| 16377 | }; |
| 16378 | |
| 16379 | static struct alc_config_preset alc662_presets[] = { |
| 16380 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16381 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16382 | .init_verbs = { alc662_init_verbs }, |
| 16383 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16384 | .dac_nids = alc662_dac_nids, |
| 16385 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16386 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16387 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16388 | .channel_mode = alc662_3ST_2ch_modes, |
| 16389 | .input_mux = &alc662_capture_source, |
| 16390 | }, |
| 16391 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16392 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16393 | .init_verbs = { alc662_init_verbs }, |
| 16394 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16395 | .dac_nids = alc662_dac_nids, |
| 16396 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16397 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16398 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16399 | .channel_mode = alc662_3ST_6ch_modes, |
| 16400 | .need_dac_fix = 1, |
| 16401 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16402 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16403 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16404 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16405 | .init_verbs = { alc662_init_verbs }, |
| 16406 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16407 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16408 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16409 | .channel_mode = alc662_3ST_6ch_modes, |
| 16410 | .need_dac_fix = 1, |
| 16411 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16412 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16413 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16414 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16415 | .init_verbs = { alc662_init_verbs }, |
| 16416 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16417 | .dac_nids = alc662_dac_nids, |
| 16418 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16419 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16420 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16421 | .channel_mode = alc662_5stack_modes, |
| 16422 | .input_mux = &alc662_capture_source, |
| 16423 | }, |
| 16424 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16425 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16426 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16427 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16428 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16429 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16430 | .channel_mode = alc662_3ST_2ch_modes, |
| 16431 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16432 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16433 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16434 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16435 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16436 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16437 | .init_verbs = { alc662_init_verbs, |
| 16438 | alc662_eeepc_sue_init_verbs }, |
| 16439 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16440 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16441 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16442 | .channel_mode = alc662_3ST_2ch_modes, |
| 16443 | .input_mux = &alc662_eeepc_capture_source, |
| 16444 | .unsol_event = alc662_eeepc_unsol_event, |
| 16445 | .init_hook = alc662_eeepc_inithook, |
| 16446 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16447 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16448 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16449 | alc662_chmode_mixer }, |
| 16450 | .init_verbs = { alc662_init_verbs, |
| 16451 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16452 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16453 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16454 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16455 | .channel_mode = alc662_3ST_6ch_modes, |
| 16456 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16457 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 16458 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16459 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16460 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16461 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16462 | .init_verbs = { alc662_init_verbs, |
| 16463 | alc662_ecs_init_verbs }, |
| 16464 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16465 | .dac_nids = alc662_dac_nids, |
| 16466 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16467 | .channel_mode = alc662_3ST_2ch_modes, |
| 16468 | .input_mux = &alc662_eeepc_capture_source, |
| 16469 | .unsol_event = alc662_eeepc_unsol_event, |
| 16470 | .init_hook = alc662_eeepc_inithook, |
| 16471 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16472 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16473 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16474 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16475 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16476 | .dac_nids = alc662_dac_nids, |
| 16477 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16478 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16479 | .channel_mode = alc662_3ST_2ch_modes, |
| 16480 | .input_mux = &alc663_m51va_capture_source, |
| 16481 | .unsol_event = alc663_m51va_unsol_event, |
| 16482 | .init_hook = alc663_m51va_inithook, |
| 16483 | }, |
| 16484 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16485 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16486 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16487 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16488 | .dac_nids = alc662_dac_nids, |
| 16489 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16490 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16491 | .channel_mode = alc662_3ST_2ch_modes, |
| 16492 | .input_mux = &alc662_eeepc_capture_source, |
| 16493 | .unsol_event = alc663_g71v_unsol_event, |
| 16494 | .init_hook = alc663_g71v_inithook, |
| 16495 | }, |
| 16496 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16497 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16498 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16499 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16500 | .dac_nids = alc662_dac_nids, |
| 16501 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16502 | .channel_mode = alc662_3ST_2ch_modes, |
| 16503 | .input_mux = &alc663_m51va_capture_source, |
| 16504 | .unsol_event = alc663_m51va_unsol_event, |
| 16505 | .init_hook = alc663_m51va_inithook, |
| 16506 | }, |
| 16507 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16508 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16509 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16510 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16511 | .dac_nids = alc662_dac_nids, |
| 16512 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16513 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16514 | .channel_mode = alc662_3ST_6ch_modes, |
| 16515 | .input_mux = &alc663_capture_source, |
| 16516 | .unsol_event = alc663_g50v_unsol_event, |
| 16517 | .init_hook = alc663_g50v_inithook, |
| 16518 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16519 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16520 | .mixers = { alc663_m51va_mixer }, |
| 16521 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16522 | .init_verbs = { alc662_init_verbs, |
| 16523 | alc663_21jd_amic_init_verbs }, |
| 16524 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16525 | .hp_nid = 0x03, |
| 16526 | .dac_nids = alc662_dac_nids, |
| 16527 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16528 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16529 | .channel_mode = alc662_3ST_2ch_modes, |
| 16530 | .input_mux = &alc662_eeepc_capture_source, |
| 16531 | .unsol_event = alc663_mode1_unsol_event, |
| 16532 | .init_hook = alc663_mode1_inithook, |
| 16533 | }, |
| 16534 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16535 | .mixers = { alc662_1bjd_mixer }, |
| 16536 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16537 | .init_verbs = { alc662_init_verbs, |
| 16538 | alc662_1bjd_amic_init_verbs }, |
| 16539 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16540 | .dac_nids = alc662_dac_nids, |
| 16541 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16542 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16543 | .channel_mode = alc662_3ST_2ch_modes, |
| 16544 | .input_mux = &alc662_eeepc_capture_source, |
| 16545 | .unsol_event = alc662_mode2_unsol_event, |
| 16546 | .init_hook = alc662_mode2_inithook, |
| 16547 | }, |
| 16548 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16549 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16550 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16551 | .init_verbs = { alc662_init_verbs, |
| 16552 | alc663_two_hp_amic_m1_init_verbs }, |
| 16553 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16554 | .hp_nid = 0x03, |
| 16555 | .dac_nids = alc662_dac_nids, |
| 16556 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16557 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16558 | .channel_mode = alc662_3ST_2ch_modes, |
| 16559 | .input_mux = &alc662_eeepc_capture_source, |
| 16560 | .unsol_event = alc663_mode3_unsol_event, |
| 16561 | .init_hook = alc663_mode3_inithook, |
| 16562 | }, |
| 16563 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16564 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16565 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16566 | .init_verbs = { alc662_init_verbs, |
| 16567 | alc663_21jd_amic_init_verbs}, |
| 16568 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16569 | .hp_nid = 0x03, |
| 16570 | .dac_nids = alc662_dac_nids, |
| 16571 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16572 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16573 | .channel_mode = alc662_3ST_2ch_modes, |
| 16574 | .input_mux = &alc662_eeepc_capture_source, |
| 16575 | .unsol_event = alc663_mode4_unsol_event, |
| 16576 | .init_hook = alc663_mode4_inithook, |
| 16577 | }, |
| 16578 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16579 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16580 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16581 | .init_verbs = { alc662_init_verbs, |
| 16582 | alc663_15jd_amic_init_verbs }, |
| 16583 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16584 | .hp_nid = 0x03, |
| 16585 | .dac_nids = alc662_dac_nids, |
| 16586 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16587 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16588 | .channel_mode = alc662_3ST_2ch_modes, |
| 16589 | .input_mux = &alc662_eeepc_capture_source, |
| 16590 | .unsol_event = alc663_mode5_unsol_event, |
| 16591 | .init_hook = alc663_mode5_inithook, |
| 16592 | }, |
| 16593 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16594 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16595 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16596 | .init_verbs = { alc662_init_verbs, |
| 16597 | alc663_two_hp_amic_m2_init_verbs }, |
| 16598 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16599 | .hp_nid = 0x03, |
| 16600 | .dac_nids = alc662_dac_nids, |
| 16601 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16602 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16603 | .channel_mode = alc662_3ST_2ch_modes, |
| 16604 | .input_mux = &alc662_eeepc_capture_source, |
| 16605 | .unsol_event = alc663_mode6_unsol_event, |
| 16606 | .init_hook = alc663_mode6_inithook, |
| 16607 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16608 | }; |
| 16609 | |
| 16610 | |
| 16611 | /* |
| 16612 | * BIOS auto configuration |
| 16613 | */ |
| 16614 | |
| 16615 | /* add playback controls from the parsed DAC table */ |
| 16616 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16617 | const struct auto_pin_cfg *cfg) |
| 16618 | { |
| 16619 | char name[32]; |
| 16620 | static const char *chname[4] = { |
| 16621 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16622 | }; |
| 16623 | hda_nid_t nid; |
| 16624 | int i, err; |
| 16625 | |
| 16626 | for (i = 0; i < cfg->line_outs; i++) { |
| 16627 | if (!spec->multiout.dac_nids[i]) |
| 16628 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16629 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16630 | if (i == 2) { |
| 16631 | /* Center/LFE */ |
| 16632 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16633 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16634 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16635 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16636 | if (err < 0) |
| 16637 | return err; |
| 16638 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16639 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16640 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16641 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16642 | if (err < 0) |
| 16643 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16644 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16645 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16646 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16647 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16648 | if (err < 0) |
| 16649 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16650 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16651 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16652 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16653 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16654 | if (err < 0) |
| 16655 | return err; |
| 16656 | } else { |
| 16657 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16658 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16659 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16660 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16661 | if (err < 0) |
| 16662 | return err; |
| 16663 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16664 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16665 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16666 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16667 | if (err < 0) |
| 16668 | return err; |
| 16669 | } |
| 16670 | } |
| 16671 | return 0; |
| 16672 | } |
| 16673 | |
| 16674 | /* add playback controls for speaker and HP outputs */ |
| 16675 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16676 | const char *pfx) |
| 16677 | { |
| 16678 | hda_nid_t nid; |
| 16679 | int err; |
| 16680 | char name[32]; |
| 16681 | |
| 16682 | if (!pin) |
| 16683 | return 0; |
| 16684 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16685 | if (pin == 0x17) { |
| 16686 | /* ALC663 has a mono output pin on 0x17 */ |
| 16687 | sprintf(name, "%s Playback Switch", pfx); |
| 16688 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16689 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16690 | return err; |
| 16691 | } |
| 16692 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16693 | if (alc880_is_fixed_pin(pin)) { |
| 16694 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 16695 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16696 | /* specify the DAC as the extra output */ |
| 16697 | if (!spec->multiout.hp_nid) |
| 16698 | spec->multiout.hp_nid = nid; |
| 16699 | else |
| 16700 | spec->multiout.extra_out_nid[0] = nid; |
| 16701 | /* control HP volume/switch on the output mixer amp */ |
| 16702 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16703 | sprintf(name, "%s Playback Volume", pfx); |
| 16704 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16705 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16706 | if (err < 0) |
| 16707 | return err; |
| 16708 | sprintf(name, "%s Playback Switch", pfx); |
| 16709 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16710 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16711 | if (err < 0) |
| 16712 | return err; |
| 16713 | } else if (alc880_is_multi_pin(pin)) { |
| 16714 | /* set manual connection */ |
| 16715 | /* we have only a switch on HP-out PIN */ |
| 16716 | sprintf(name, "%s Playback Switch", pfx); |
| 16717 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16718 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16719 | if (err < 0) |
| 16720 | return err; |
| 16721 | } |
| 16722 | return 0; |
| 16723 | } |
| 16724 | |
| 16725 | /* create playback/capture controls for input pins */ |
| 16726 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 16727 | const struct auto_pin_cfg *cfg) |
| 16728 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16729 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16730 | int i, err, idx; |
| 16731 | |
| 16732 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16733 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 16734 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 16735 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16736 | auto_pin_cfg_labels[i], |
| 16737 | idx, 0x0b); |
| 16738 | if (err < 0) |
| 16739 | return err; |
| 16740 | imux->items[imux->num_items].label = |
| 16741 | auto_pin_cfg_labels[i]; |
| 16742 | imux->items[imux->num_items].index = |
| 16743 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 16744 | imux->num_items++; |
| 16745 | } |
| 16746 | } |
| 16747 | return 0; |
| 16748 | } |
| 16749 | |
| 16750 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16751 | hda_nid_t nid, int pin_type, |
| 16752 | int dac_idx) |
| 16753 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16754 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16755 | /* need the manual connection? */ |
| 16756 | if (alc880_is_multi_pin(nid)) { |
| 16757 | struct alc_spec *spec = codec->spec; |
| 16758 | int idx = alc880_multi_pin_idx(nid); |
| 16759 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16760 | AC_VERB_SET_CONNECT_SEL, |
| 16761 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16762 | } |
| 16763 | } |
| 16764 | |
| 16765 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16766 | { |
| 16767 | struct alc_spec *spec = codec->spec; |
| 16768 | int i; |
| 16769 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16770 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16771 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16772 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16773 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16774 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16775 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16776 | i); |
| 16777 | } |
| 16778 | } |
| 16779 | |
| 16780 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16781 | { |
| 16782 | struct alc_spec *spec = codec->spec; |
| 16783 | hda_nid_t pin; |
| 16784 | |
| 16785 | pin = spec->autocfg.hp_pins[0]; |
| 16786 | if (pin) /* connect to front */ |
| 16787 | /* use dac 0 */ |
| 16788 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16789 | pin = spec->autocfg.speaker_pins[0]; |
| 16790 | if (pin) |
| 16791 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16792 | } |
| 16793 | |
| 16794 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 16795 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16796 | |
| 16797 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16798 | { |
| 16799 | struct alc_spec *spec = codec->spec; |
| 16800 | int i; |
| 16801 | |
| 16802 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16803 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 16804 | if (alc662_is_input_pin(nid)) { |
| 16805 | snd_hda_codec_write(codec, nid, 0, |
| 16806 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16807 | (i <= AUTO_PIN_FRONT_MIC ? |
| 16808 | PIN_VREF80 : PIN_IN)); |
| 16809 | if (nid != ALC662_PIN_CD_NID) |
| 16810 | snd_hda_codec_write(codec, nid, 0, |
| 16811 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16812 | AMP_OUT_MUTE); |
| 16813 | } |
| 16814 | } |
| 16815 | } |
| 16816 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16817 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16818 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16819 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16820 | { |
| 16821 | struct alc_spec *spec = codec->spec; |
| 16822 | int err; |
| 16823 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16824 | |
| 16825 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16826 | alc662_ignore); |
| 16827 | if (err < 0) |
| 16828 | return err; |
| 16829 | if (!spec->autocfg.line_outs) |
| 16830 | return 0; /* can't find valid BIOS pin config */ |
| 16831 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16832 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16833 | if (err < 0) |
| 16834 | return err; |
| 16835 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16836 | if (err < 0) |
| 16837 | return err; |
| 16838 | err = alc662_auto_create_extra_out(spec, |
| 16839 | spec->autocfg.speaker_pins[0], |
| 16840 | "Speaker"); |
| 16841 | if (err < 0) |
| 16842 | return err; |
| 16843 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16844 | "Headphone"); |
| 16845 | if (err < 0) |
| 16846 | return err; |
| 16847 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 16848 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16849 | return err; |
| 16850 | |
| 16851 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16852 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16853 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16854 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16855 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16856 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16857 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16858 | |
| 16859 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16860 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16861 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16862 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16863 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16864 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16865 | |
| 16866 | err = alc_auto_add_mic_boost(codec); |
| 16867 | if (err < 0) |
| 16868 | return err; |
| 16869 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 16870 | store_pin_configs(codec); |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16871 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16872 | } |
| 16873 | |
| 16874 | /* additional initialization for auto-configuration model */ |
| 16875 | static void alc662_auto_init(struct hda_codec *codec) |
| 16876 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16877 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16878 | alc662_auto_init_multi_out(codec); |
| 16879 | alc662_auto_init_hp_out(codec); |
| 16880 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16881 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16882 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16883 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16884 | } |
| 16885 | |
| 16886 | static int patch_alc662(struct hda_codec *codec) |
| 16887 | { |
| 16888 | struct alc_spec *spec; |
| 16889 | int err, board_config; |
| 16890 | |
| 16891 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16892 | if (!spec) |
| 16893 | return -ENOMEM; |
| 16894 | |
| 16895 | codec->spec = spec; |
| 16896 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16897 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16898 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16899 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16900 | alc662_models, |
| 16901 | alc662_cfg_tbl); |
| 16902 | if (board_config < 0) { |
| 16903 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16904 | "trying auto-probe from BIOS...\n"); |
| 16905 | board_config = ALC662_AUTO; |
| 16906 | } |
| 16907 | |
| 16908 | if (board_config == ALC662_AUTO) { |
| 16909 | /* automatic parse from the BIOS config */ |
| 16910 | err = alc662_parse_auto_config(codec); |
| 16911 | if (err < 0) { |
| 16912 | alc_free(codec); |
| 16913 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16914 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16915 | printk(KERN_INFO |
| 16916 | "hda_codec: Cannot set up configuration " |
| 16917 | "from BIOS. Using base mode...\n"); |
| 16918 | board_config = ALC662_3ST_2ch_DIG; |
| 16919 | } |
| 16920 | } |
| 16921 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16922 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 16923 | if (err < 0) { |
| 16924 | alc_free(codec); |
| 16925 | return err; |
| 16926 | } |
| 16927 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16928 | if (board_config != ALC662_AUTO) |
| 16929 | setup_preset(spec, &alc662_presets[board_config]); |
| 16930 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16931 | if (codec->vendor_id == 0x10ec0663) { |
| 16932 | spec->stream_name_analog = "ALC663 Analog"; |
| 16933 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16934 | } else if (codec->vendor_id == 0x10ec0272) { |
| 16935 | spec->stream_name_analog = "ALC272 Analog"; |
| 16936 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16937 | } else { |
| 16938 | spec->stream_name_analog = "ALC662 Analog"; |
| 16939 | spec->stream_name_digital = "ALC662 Digital"; |
| 16940 | } |
| 16941 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16942 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16943 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16944 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16945 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16946 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16947 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16948 | spec->adc_nids = alc662_adc_nids; |
| 16949 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16950 | spec->capsrc_nids = alc662_capsrc_nids; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16951 | spec->capture_style = CAPT_MIX; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16952 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16953 | if (!spec->cap_mixer) |
| 16954 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16955 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16956 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16957 | spec->vmaster_nid = 0x02; |
| 16958 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16959 | codec->patch_ops = alc_patch_ops; |
| 16960 | if (board_config == ALC662_AUTO) |
| 16961 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16962 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16963 | if (!spec->loopback.amplist) |
| 16964 | spec->loopback.amplist = alc662_loopbacks; |
| 16965 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 16966 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16967 | |
| 16968 | return 0; |
| 16969 | } |
| 16970 | |
| 16971 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16972 | * patch entries |
| 16973 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 16974 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16975 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16976 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16977 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 16978 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16979 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16980 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16981 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16982 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16983 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 16984 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 16985 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16986 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 16987 | .patch = patch_alc883 }, |
| 16988 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 16989 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16990 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16991 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16992 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16993 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 16994 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 16995 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 16996 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 16997 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16998 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 16999 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17000 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 17001 | .patch = patch_alc883 }, |
Wu Fengguang | 3fea2cb | 2008-12-26 12:20:43 +0800 | [diff] [blame] | 17002 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17003 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17004 | {} /* terminator */ |
| 17005 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17006 | |
| 17007 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17008 | |
| 17009 | MODULE_LICENSE("GPL"); |
| 17010 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17011 | |
| 17012 | static struct hda_codec_preset_list realtek_list = { |
| 17013 | .preset = snd_hda_preset_realtek, |
| 17014 | .owner = THIS_MODULE, |
| 17015 | }; |
| 17016 | |
| 17017 | static int __init patch_realtek_init(void) |
| 17018 | { |
| 17019 | return snd_hda_add_codec_preset(&realtek_list); |
| 17020 | } |
| 17021 | |
| 17022 | static void __exit patch_realtek_exit(void) |
| 17023 | { |
| 17024 | snd_hda_delete_codec_preset(&realtek_list); |
| 17025 | } |
| 17026 | |
| 17027 | module_init(patch_realtek_init) |
| 17028 | module_exit(patch_realtek_exit) |